From c3f63eb2ac68ebb3ca805fce04d0aea0bcbdfc0a Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Mon, 3 Mar 2025 15:46:16 +0100 Subject: [PATCH 1/7] Reenabled WhenAnticipating_ValueChangesImmediately test --- .../Tests/Runtime/NetworkTransformAnticipationTests.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs index 5b11e84a48..0b4dcf8b09 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs @@ -115,7 +115,6 @@ public AnticipatedNetworkTransform GetOtherClientComponent() } [Test] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android })] // Tracked in MTT-11361 public void WhenAnticipating_ValueChangesImmediately() { var testComponent = GetTestComponent(); @@ -131,7 +130,6 @@ public void WhenAnticipating_ValueChangesImmediately() Assert.AreEqual(new Vector3(0, 1, 2), testComponent.AnticipatedState.Position); Assert.AreEqual(new Vector3(1, 2, 3), testComponent.AnticipatedState.Scale); Assert.AreEqual(Quaternion.LookRotation(new Vector3(2, 3, 4)), testComponent.AnticipatedState.Rotation); - } [Test] From f98965b98ffd0825f5c300ae2700b302f5b82d4f Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Mon, 3 Mar 2025 17:06:47 +0100 Subject: [PATCH 2/7] Reenabled NetworkVariableTests --- .../Tests/Runtime/NetworkVariableTests.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs index f9995caba4..909278b3fa 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs @@ -1844,7 +1844,6 @@ public void WhenSerializingAndDeserializingValueTypeNetworkVariables_ValuesAreSe } [Test] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. The job is failing on mobile devices on 2021 editor specifically public void WhenSerializingAndDeserializingValueTypeNativeArrayNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -2180,7 +2179,6 @@ public string ArrayStr(NativeArray arr) where T : unmanaged } [Test] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeValueTypeNativeArrayNetworkVariables_ValuesAreSerializedCorrectly( @@ -2646,7 +2644,6 @@ public string DictionaryStr(Dictionary list) } [Test] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesAreSerializedCorrectly( @@ -2833,7 +2830,6 @@ public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesA } [Test] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_ValuesAreSerializedCorrectly( @@ -2989,7 +2985,6 @@ public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_Valu } [Test] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeDictionaryNetworkVariables_ValuesAreSerializedCorrectly( From 718728dcd16b2042bf2058e652310dca357de0b0 Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Mon, 3 Mar 2025 17:10:39 +0100 Subject: [PATCH 3/7] Reenabled RpcTypeSerializationTests and TimeInitializationTests --- .../Tests/Runtime/RpcTypeSerializationTests.cs | 1 - .../Tests/Runtime/Timing/TimeInitializationTest.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs index 4758a23b6d..777b1d0569 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs @@ -1504,7 +1504,6 @@ public void WhenSendingAnArrayOfValueTypesOverAnRpc_ValuesAreSerializedCorrectly } [Test] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. The job is failing on mobile devices on 2021 editor specifically public void WhenSendingANativeArrayOfValueTypesOverAnRpc_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs index 507fbafac4..cbd7b99d9d 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs @@ -16,7 +16,6 @@ public class TimeInitializationTest private NetworkManager m_Client; [UnityTest] - [UnityPlatform(exclude = new[] { RuntimePlatform.Android })] // Tracked in MTT-11356. public IEnumerator TestClientTimeInitializationOnConnect([Values(0, 1f)] float serverStartDelay, [Values(0, 1f)] float clientStartDelay, [Values(true, false)] bool isHost) { // Create multiple NetworkManager instances From 50e470274e8b8f81280a126c6f4cd30498bccff5 Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Wed, 12 Mar 2025 13:58:55 +0100 Subject: [PATCH 4/7] Revert "Reenabled NetworkVariableTests" This reverts commit f98965b98ffd0825f5c300ae2700b302f5b82d4f. --- .../Tests/Runtime/NetworkVariableTests.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs index 909278b3fa..f9995caba4 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkVariableTests.cs @@ -1844,6 +1844,7 @@ public void WhenSerializingAndDeserializingValueTypeNetworkVariables_ValuesAreSe } [Test] + [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. The job is failing on mobile devices on 2021 editor specifically public void WhenSerializingAndDeserializingValueTypeNativeArrayNetworkVariables_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), @@ -2179,6 +2180,7 @@ public string ArrayStr(NativeArray arr) where T : unmanaged } [Test] + [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeValueTypeNativeArrayNetworkVariables_ValuesAreSerializedCorrectly( @@ -2644,6 +2646,7 @@ public string DictionaryStr(Dictionary list) } [Test] + [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesAreSerializedCorrectly( @@ -2830,6 +2833,7 @@ public void WhenSerializingAndDeserializingVeryLargeListNetworkVariables_ValuesA } [Test] + [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_ValuesAreSerializedCorrectly( @@ -2985,6 +2989,7 @@ public void WhenSerializingAndDeserializingVeryLargeHashSetNetworkVariables_Valu } [Test] + [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. [Repeat(5)] public void WhenSerializingAndDeserializingVeryLargeDictionaryNetworkVariables_ValuesAreSerializedCorrectly( From f84ae99703dba8506b24bc3557c218903891f242 Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Wed, 12 Mar 2025 13:58:58 +0100 Subject: [PATCH 5/7] Revert "Reenabled RpcTypeSerializationTests and TimeInitializationTests" This reverts commit 718728dcd16b2042bf2058e652310dca357de0b0. --- .../Tests/Runtime/RpcTypeSerializationTests.cs | 1 + .../Tests/Runtime/Timing/TimeInitializationTest.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs index 777b1d0569..4758a23b6d 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/RpcTypeSerializationTests.cs @@ -1504,6 +1504,7 @@ public void WhenSendingAnArrayOfValueTypesOverAnRpc_ValuesAreSerializedCorrectly } [Test] + [UnityPlatform(exclude = new[] { RuntimePlatform.Android, RuntimePlatform.IPhonePlayer })] // Tracked in MTT-11356. The job is failing on mobile devices on 2021 editor specifically public void WhenSendingANativeArrayOfValueTypesOverAnRpc_ValuesAreSerializedCorrectly( [Values(typeof(byte), typeof(sbyte), typeof(short), typeof(ushort), typeof(int), typeof(uint), diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs b/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs index cbd7b99d9d..507fbafac4 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/Timing/TimeInitializationTest.cs @@ -16,6 +16,7 @@ public class TimeInitializationTest private NetworkManager m_Client; [UnityTest] + [UnityPlatform(exclude = new[] { RuntimePlatform.Android })] // Tracked in MTT-11356. public IEnumerator TestClientTimeInitializationOnConnect([Values(0, 1f)] float serverStartDelay, [Values(0, 1f)] float clientStartDelay, [Values(true, false)] bool isHost) { // Create multiple NetworkManager instances From 7c1e0921c7d7adb5beee8ba97150b481a5cf28ca Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Wed, 12 Mar 2025 15:11:47 +0100 Subject: [PATCH 6/7] Modified WhenAnticipating_ValueChangesImmediately test --- .../Tests/Runtime/NetworkTransformAnticipationTests.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs index 0b4dcf8b09..86ad97f2a0 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs @@ -118,6 +118,7 @@ public AnticipatedNetworkTransform GetOtherClientComponent() public void WhenAnticipating_ValueChangesImmediately() { var testComponent = GetTestComponent(); + var quaternionComparer = new QuaternionEqualityComparer(0.000001f); testComponent.AnticipateMove(new Vector3(0, 1, 2)); testComponent.AnticipateScale(new Vector3(1, 2, 3)); @@ -125,11 +126,11 @@ public void WhenAnticipating_ValueChangesImmediately() Assert.AreEqual(new Vector3(0, 1, 2), testComponent.transform.position); Assert.AreEqual(new Vector3(1, 2, 3), testComponent.transform.localScale); - Assert.AreEqual(Quaternion.LookRotation(new Vector3(2, 3, 4)), testComponent.transform.rotation); + 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. Assert.AreEqual(new Vector3(0, 1, 2), testComponent.AnticipatedState.Position); Assert.AreEqual(new Vector3(1, 2, 3), testComponent.AnticipatedState.Scale); - Assert.AreEqual(Quaternion.LookRotation(new Vector3(2, 3, 4)), testComponent.AnticipatedState.Rotation); + 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. } [Test] From a62099d7e075bce4ffaaa98eac16e05aa80a7af4 Mon Sep 17 00:00:00 2001 From: michalChrobot Date: Wed, 12 Mar 2025 15:21:06 +0100 Subject: [PATCH 7/7] Corrected library --- .../Tests/Runtime/NetworkTransformAnticipationTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs index 86ad97f2a0..70bb7d4197 100644 --- a/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs +++ b/com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransformAnticipationTests.cs @@ -5,7 +5,7 @@ using Unity.Netcode.Components; using Unity.Netcode.TestHelpers.Runtime; using UnityEngine; -using UnityEngine.TestTools; +using UnityEngine.TestTools.Utils; using Object = UnityEngine.Object; namespace Unity.Netcode.RuntimeTests