feat: add reusable virtual hud input
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
#if UNITY_EDITOR
|
||||
using XGame.EditorTools;
|
||||
#endif
|
||||
|
||||
public sealed class VirtualInputPrefabLayoutTests
|
||||
{
|
||||
[Test]
|
||||
public void VirtualJoystickJson_DefinesReusableJoystickPrefab()
|
||||
{
|
||||
string json = File.ReadAllText("../Doc/UIPrefabCreater/UI_VirtualJoystick.json");
|
||||
|
||||
Assert.That(json, Does.Contain("\"prefabName\": \"UI_VirtualJoystick\""));
|
||||
Assert.That(json, Does.Contain("\"prefabPath\": \"Assets/Game/Art/UI/Prefab/UI_VirtualJoystick.prefab\""));
|
||||
Assert.That(json, Does.Contain("\"name\": \"Knob\""));
|
||||
Assert.That(json, Does.Contain("\"typeName\": \"XGame.VirtualInput.VirtualJoystick\""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void VirtualActionPadJson_DefinesFiveButtonsAndCancelArea()
|
||||
{
|
||||
string json = File.ReadAllText("../Doc/UIPrefabCreater/UI_VirtualActionPad.json");
|
||||
|
||||
Assert.That(json, Does.Contain("\"prefabName\": \"UI_VirtualActionPad\""));
|
||||
Assert.That(json, Does.Contain("\"prefabPath\": \"Assets/Game/Art/UI/Prefab/UI_VirtualActionPad.prefab\""));
|
||||
Assert.That(json, Does.Contain("\"typeName\": \"XGame.VirtualInput.VirtualActionPad\""));
|
||||
Assert.That(json, Does.Contain("\"Btn_Primary\""));
|
||||
Assert.That(json, Does.Contain("\"Btn_Skill1\""));
|
||||
Assert.That(json, Does.Contain("\"Btn_Skill2\""));
|
||||
Assert.That(json, Does.Contain("\"Btn_Skill3\""));
|
||||
Assert.That(json, Does.Contain("\"Btn_Skill4\""));
|
||||
Assert.That(json, Does.Contain("\"CancelArea\""));
|
||||
Assert.That(json, Does.Contain("\"Primary_CooldownMask\""));
|
||||
Assert.That(json, Does.Contain("\"Skill1_ChargeText\""));
|
||||
}
|
||||
|
||||
#if UNITY_EDITOR
|
||||
[Test]
|
||||
public void VirtualInputJsonFiles_PassPrefabBuilderValidation()
|
||||
{
|
||||
Assert.That(JsonUIPrefabBuilder.Validate("../Doc/UIPrefabCreater/UI_VirtualJoystick.json").Ok, Is.True);
|
||||
Assert.That(JsonUIPrefabBuilder.Validate("../Doc/UIPrefabCreater/UI_VirtualActionPad.json").Ok, Is.True);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user