52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using Godot;
|
|
using GdUnit4;
|
|
using static GdUnit4.Assertions;
|
|
using Movementtests.systems;
|
|
using Movementtests.systems.damage;
|
|
|
|
namespace Movementtests.tests;
|
|
|
|
[TestSuite, RequireGodotRuntime]
|
|
public class WeaponSystemUnitTest
|
|
{
|
|
private WeaponSystem _weapon;
|
|
|
|
[BeforeTest]
|
|
public void SetupTest()
|
|
{
|
|
_weapon = new WeaponSystem();
|
|
_weapon.RDamage = new RDamage(5.0f, EDamageTypes.Normal);
|
|
|
|
_weapon.WeaponMesh = new MeshInstance3D();
|
|
_weapon.AddChild(_weapon.WeaponMesh);
|
|
_weapon.WeaponLocationIndicator = new MeshInstance3D();
|
|
_weapon.AddChild(_weapon.WeaponLocationIndicator);
|
|
}
|
|
|
|
[AfterTest]
|
|
public void CleanupTest()
|
|
{
|
|
_weapon?.Free();
|
|
}
|
|
|
|
[TestCase]
|
|
public void TestWeaponLeftAndBackVisibility()
|
|
{
|
|
_weapon.Visible = false;
|
|
|
|
_weapon.WeaponLeft();
|
|
AssertBool(_weapon.Visible).IsTrue();
|
|
|
|
_weapon.WeaponBack();
|
|
AssertBool(_weapon.Visible).IsFalse();
|
|
}
|
|
|
|
[TestCase]
|
|
public void TestThrowWeaponOnCurveSetsUnfrozen()
|
|
{
|
|
_weapon.Freeze = true;
|
|
_weapon.ThrowWeaponOnCurve();
|
|
AssertBool(_weapon.Freeze).IsFalse();
|
|
}
|
|
}
|