From 258d3bed021155d2f76992d4d8e26f465b5cf97b Mon Sep 17 00:00:00 2001 From: vis2k Date: Sat, 7 Mar 2020 18:57:06 +0100 Subject: [PATCH] NetworkBehaviourTests: GetSyncVarNetworkIdentityOnClientNull --- .../Tests/Editor/NetworkBehaviourTests.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs index 403165b98..afa6eee5f 100644 --- a/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs +++ b/Assets/Mirror/Tests/Editor/NetworkBehaviourTests.cs @@ -1366,6 +1366,26 @@ public void GetSyncVarNetworkIdentityOnClient() Transport.activeTransport = null; GameObject.DestroyImmediate(go); } + + [Test] + public void GetSyncVarNetworkIdentityOnClientNull() + { + // are we on client and not on server? + identity.isClient = true; + Assert.That(identity.isServer, Is.False); + + // add test component + NetworkBehaviourGetSyncVarNetworkIdentityComponent comp = gameObject.AddComponent(); + comp.syncInterval = 0; // for isDirty check + + // get it on the client. null should be supported. + NetworkIdentity result = comp.GetSyncVarNetworkIdentityExposed(); + Assert.That(result, Is.Null); + + // clean up + NetworkServer.Shutdown(); + Transport.activeTransport = null; + } } // we need to inherit from networkbehaviour to test protected functions