|
5 | 5 | using Unity.Netcode.Components;
|
6 | 6 | using Unity.Netcode.TestHelpers.Runtime;
|
7 | 7 | using UnityEngine;
|
8 |
| -using UnityEngine.TestTools; |
| 8 | +using UnityEngine.TestTools.Utils; |
9 | 9 | using Object = UnityEngine.Object;
|
10 | 10 |
|
11 | 11 | namespace Unity.Netcode.RuntimeTests
|
@@ -115,23 +115,22 @@ public AnticipatedNetworkTransform GetOtherClientComponent()
|
115 | 115 | }
|
116 | 116 |
|
117 | 117 | [Test]
|
118 |
| - [UnityPlatform(exclude = new[] { RuntimePlatform.Android })] // TODO: this ignored test is tracked in MTT-11341 |
119 | 118 | public void WhenAnticipating_ValueChangesImmediately()
|
120 | 119 | {
|
121 | 120 | var testComponent = GetTestComponent();
|
| 121 | + var quaternionComparer = new QuaternionEqualityComparer(0.000001f); |
122 | 122 |
|
123 | 123 | testComponent.AnticipateMove(new Vector3(0, 1, 2));
|
124 | 124 | testComponent.AnticipateScale(new Vector3(1, 2, 3));
|
125 | 125 | testComponent.AnticipateRotate(Quaternion.LookRotation(new Vector3(2, 3, 4)));
|
126 | 126 |
|
127 | 127 | Assert.AreEqual(new Vector3(0, 1, 2), testComponent.transform.position);
|
128 | 128 | Assert.AreEqual(new Vector3(1, 2, 3), testComponent.transform.localScale);
|
129 |
| - Assert.AreEqual(Quaternion.LookRotation(new Vector3(2, 3, 4)), testComponent.transform.rotation); |
| 129 | + Assert.That(testComponent.transform.rotation, Is.EqualTo(Quaternion.LookRotation(new Vector3(2, 3, 4))).Using(quaternionComparer)); // Quaternion comparer added due to FP precision problems on Android devices. |
130 | 130 |
|
131 | 131 | Assert.AreEqual(new Vector3(0, 1, 2), testComponent.AnticipatedState.Position);
|
132 | 132 | Assert.AreEqual(new Vector3(1, 2, 3), testComponent.AnticipatedState.Scale);
|
133 |
| - Assert.AreEqual(Quaternion.LookRotation(new Vector3(2, 3, 4)), testComponent.AnticipatedState.Rotation); |
134 |
| - |
| 133 | + Assert.That(testComponent.AnticipatedState.Rotation, Is.EqualTo(Quaternion.LookRotation(new Vector3(2, 3, 4))).Using(quaternionComparer)); // Quaternion comparer added due to FP precision problems on Android devices. |
135 | 134 | }
|
136 | 135 |
|
137 | 136 | [Test]
|
|
0 commit comments