Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ public IEnumerator Test_AccessibilityLabel()
AccessibilityNode axObject = ButtonAXObject();
UnityEngine.Assertions.Assert.AreEqual(axObject.AccessibilityLabel, "Button");

bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult(axObject.gameObject.GetInstanceID(), "accessibilityLabel", "Button");
#if UNITY_6000_4_OR_NEWER
bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult(EntityId.ToULong(axObject.gameObject.GetEntityId()), "accessibilityLabel", "Button");
#else
bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult((ulong)axObject.gameObject.GetInstanceID(), "accessibilityLabel", "Button");
#endif
UnityEngine.Assertions.Assert.IsTrue(succeeded);

yield return null;
Expand All @@ -75,7 +79,11 @@ public IEnumerator Test_AccessibilityValue()
AccessibilityNode axObject = ButtonAXObject();
UnityEngine.Assertions.Assert.AreEqual(axObject.AccessibilityValue, "ButtonValue");

bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult(axObject.gameObject.GetInstanceID(), "accessibilityValue", "ButtonValue");
#if UNITY_6000_4_OR_NEWER
bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult(EntityId.ToULong(axObject.gameObject.GetEntityId()), "accessibilityValue", "ButtonValue");
#else
bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult((ulong)axObject.gameObject.GetInstanceID(), "accessibilityValue", "ButtonValue");
#endif
UnityEngine.Assertions.Assert.IsTrue(succeeded);

yield return null;
Expand All @@ -92,7 +100,11 @@ public IEnumerator Test_AccessibilityHint()
AccessibilityNode axObject = ButtonAXObject();
UnityEngine.Assertions.Assert.AreEqual(axObject.AccessibilityHint, "ButtonHint");

bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult(axObject.gameObject.GetInstanceID(), "accessibilityHint", "ButtonHint");
#if UNITY_6000_4_OR_NEWER
bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult(EntityId.ToULong(axObject.gameObject.GetEntityId()), "accessibilityHint", "ButtonHint");
#else
bool succeeded = AccessibilityTests.RuniOSSideUnitTestWithKeyPathExpectingStringResult((ulong)axObject.gameObject.GetInstanceID(), "accessibilityHint", "ButtonHint");
#endif
UnityEngine.Assertions.Assert.IsTrue(succeeded);

yield return null;
Expand Down Expand Up @@ -135,7 +147,11 @@ public IEnumerator Test_PerformMagicTap()
return true;
};

bool tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap(axObject.gameObject.GetInstanceID());
#if UNITY_6000_4_OR_NEWER
bool tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap(EntityId.ToULong(axObject.gameObject.GetEntityId()));
#else
bool tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap((ulong)axObject.gameObject.GetInstanceID());
#endif
expectedMagicTapCount += 1;
UnityEngine.Assertions.Assert.AreEqual(magicTapCount, expectedMagicTapCount);
UnityEngine.Assertions.Assert.IsTrue(tapSucceeded);
Expand All @@ -156,7 +172,11 @@ public IEnumerator Test_PerformMagicTap()
return false;
};

tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap(axObject.gameObject.GetInstanceID());
#if UNITY_6000_4_OR_NEWER
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap(EntityId.ToULong(axObject.gameObject.GetEntityId()));
#else
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap((ulong)axObject.gameObject.GetInstanceID());
#endif
expectedMagicTapCount += 1;
UnityEngine.Assertions.Assert.AreEqual(magicTapCount, expectedMagicTapCount);
UnityEngine.Assertions.Assert.IsFalse(tapSucceeded);
Expand All @@ -171,7 +191,11 @@ public IEnumerator Test_PerformMagicTap()
//Unimplemented tap
axObject.onAccessibilityPerformMagicTap = null;

tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap(axObject.gameObject.GetInstanceID());
#if UNITY_6000_4_OR_NEWER
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap(EntityId.ToULong(axObject.gameObject.GetEntityId()));
#else
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformMagicTap((ulong)axObject.gameObject.GetInstanceID());
#endif
UnityEngine.Assertions.Assert.AreEqual(magicTapCount, expectedMagicTapCount);
UnityEngine.Assertions.Assert.IsFalse(tapSucceeded);
#if UNITY_IOS && !UNITY_EDITOR
Expand Down Expand Up @@ -205,7 +229,11 @@ public IEnumerator Test_PerformEscape()
return true;
};

bool tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape(axObject.gameObject.GetInstanceID());
#if UNITY_6000_4_OR_NEWER
bool tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape(EntityId.ToULong(axObject.gameObject.GetEntityId()));
#else
bool tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape((ulong)axObject.gameObject.GetInstanceID());
#endif
expectedEscapeCount += 1;
UnityEngine.Assertions.Assert.AreEqual(EscapeCount, expectedEscapeCount);
UnityEngine.Assertions.Assert.IsTrue(tapSucceeded);
Expand All @@ -226,7 +254,11 @@ public IEnumerator Test_PerformEscape()
return false;
};

tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape(axObject.gameObject.GetInstanceID());
#if UNITY_6000_4_OR_NEWER
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape(EntityId.ToULong(axObject.gameObject.GetEntityId()));
#else
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape((ulong)axObject.gameObject.GetInstanceID());
#endif
expectedEscapeCount += 1;
UnityEngine.Assertions.Assert.AreEqual(EscapeCount, expectedEscapeCount);
UnityEngine.Assertions.Assert.IsFalse(tapSucceeded);
Expand All @@ -241,7 +273,11 @@ public IEnumerator Test_PerformEscape()
//Unimplemented tap
axObject.onAccessibilityPerformEscape = null;

tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape(axObject.gameObject.GetInstanceID());
#if UNITY_6000_4_OR_NEWER
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape(EntityId.ToULong(axObject.gameObject.GetEntityId()));
#else
tapSucceeded = AccessibilityRuntime._UnityAX_AccessibilityPerformEscape((ulong)axObject.gameObject.GetInstanceID());
#endif
UnityEngine.Assertions.Assert.AreEqual(EscapeCount, expectedEscapeCount);
UnityEngine.Assertions.Assert.IsFalse(tapSucceeded);
#if UNITY_IOS && !UNITY_EDITOR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ public class AccessibilityTests : MonoBehaviour
private static extern bool _UnityAX_RuniOSSideUnitTestWithName(string name);

[DllImport("__Internal")]
private static extern bool _UnityAX_RuniOSSideUnitTestWithKeyPathExpectingStringResult(int identifier, string keyPath, string expected);

private static extern bool _UnityAX_RuniOSSideUnitTestWithKeyPathExpectingStringResult(ulong identifier, string keyPath, string expected);

public static bool RuniOSUnitTestWithName(string name)
{
Expand All @@ -19,17 +18,17 @@ public static bool RuniOSUnitTestWithName(string name)
#else
return true;
#endif
}
}

public static bool RuniOSSideUnitTestWithKeyPathExpectingStringResult(int identifier, string keyPath, string expected)
public static bool RuniOSSideUnitTestWithKeyPathExpectingStringResult(ulong identifier, string keyPath, string expected)
{
#if (UNITY_IOS || UNITY_TVOS) && !UNITY_EDITOR
return _UnityAX_RuniOSSideUnitTestWithKeyPathExpectingStringResult( identifier, keyPath, expected);
return _UnityAX_RuniOSSideUnitTestWithKeyPathExpectingStringResult(identifier, keyPath, expected);
#else
return true;
#endif
}

[DllImport("__Internal")]
private static extern void _UnityAX_PostFeatureEnabledNotification(string name, bool enabled);

Expand Down
Loading