basic tests for a wider variety of files
This commit is contained in:
51
tests/player/WeaponSystemUnitTest.cs
Normal file
51
tests/player/WeaponSystemUnitTest.cs
Normal file
@@ -0,0 +1,51 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user