|
6 | 6 | using Unity.Netcode.TestHelpers.Runtime; |
7 | 7 | using UnityEngine; |
8 | 8 | using UnityEngine.TestTools; |
| 9 | +using UnityEngine.TestTools.Utils; |
9 | 10 | using Object = UnityEngine.Object; |
10 | 11 |
|
11 | 12 | namespace Unity.Netcode.RuntimeTests |
@@ -118,18 +119,19 @@ public AnticipatedNetworkTransform GetOtherClientComponent() |
118 | 119 | public void WhenAnticipating_ValueChangesImmediately() |
119 | 120 | { |
120 | 121 | var testComponent = GetTestComponent(); |
| 122 | + var quaternionComparer = new QuaternionEqualityComparer(0.000001f); |
121 | 123 |
|
122 | 124 | testComponent.AnticipateMove(new Vector3(0, 1, 2)); |
123 | 125 | testComponent.AnticipateScale(new Vector3(1, 2, 3)); |
124 | 126 | testComponent.AnticipateRotate(Quaternion.LookRotation(new Vector3(2, 3, 4))); |
125 | 127 |
|
126 | 128 | Assert.AreEqual(new Vector3(0, 1, 2), testComponent.transform.position); |
127 | 129 | Assert.AreEqual(new Vector3(1, 2, 3), testComponent.transform.localScale); |
128 | | - Assert.That(testComponent.transform.rotation, Is.EqualTo(Quaternion.LookRotation(new Vector3(2, 3, 4))).Using(new QuaternionEqualityComparer(0.000001f))); // Quaternion comparer added due to FP precision problems on Android devices |
| 130 | + 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. |
129 | 131 |
|
130 | 132 | Assert.AreEqual(new Vector3(0, 1, 2), testComponent.AnticipatedState.Position); |
131 | 133 | Assert.AreEqual(new Vector3(1, 2, 3), testComponent.AnticipatedState.Scale); |
132 | | - Assert.That(testComponent.AnticipatedState.Rotation, Is.EqualTo(Quaternion.LookRotation(new Vector3(2, 3, 4))).Using(new QuaternionEqualityComparer(0.000001f))); // Quaternion comparer added due to FP precision problems on Android devices |
| 134 | + 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. |
133 | 135 | } |
134 | 136 |
|
135 | 137 | [Test] |
|
0 commit comments