5
5
using NUnit . Framework ;
6
6
using Unity . Collections ;
7
7
8
-
9
8
namespace Unity . Netcode . RuntimeTests
10
9
{
11
10
public struct FixedString32Struct : INetworkSerializable
@@ -43,13 +42,9 @@ public void NetworkSerialize(NetworkSerializer serializer)
43
42
serializer . Serialize ( ref SomeBool ) ;
44
43
}
45
44
}
45
+
46
46
public class NetworkVariableTest : NetworkBehaviour
47
47
{
48
- public readonly ClientNetworkVariable < int > ClientVar = new ClientNetworkVariable < int > ( ) ;
49
-
50
- public readonly ClientNetworkVariable < int > ClientVarPrivate =
51
- new ClientNetworkVariable < int > ( NetworkVariableReadPermission . OwnerOnly ) ;
52
-
53
48
public readonly NetworkVariable < int > TheScalar = new NetworkVariable < int > ( ) ;
54
49
public readonly NetworkList < int > TheList = new NetworkList < int > ( ) ;
55
50
public readonly NetworkSet < int > TheSet = new NetworkSet < int > ( ) ;
@@ -232,38 +227,6 @@ public void ClientWritePermissionTest([Values(true, false)] bool useHost)
232
227
Assert . Throws < InvalidOperationException > ( ( ) => m_Player1OnClient1 . TheScalar . Value = k_TestVal1 ) ;
233
228
}
234
229
235
- [ Test ]
236
- public void ServerWritePermissionTest ( [ Values ( true , false ) ] bool useHost )
237
- {
238
- m_TestWithHost = useHost ;
239
-
240
- // server must not be allowed to write to a client auth variable
241
- Assert . Throws < InvalidOperationException > ( ( ) => m_Player1OnServer . ClientVar . Value = k_TestVal1 ) ;
242
- }
243
-
244
- [ UnityTest ]
245
- public IEnumerator ClientTest ( [ Values ( true , false ) ] bool useHost )
246
- {
247
- m_TestWithHost = useHost ;
248
-
249
- yield return MultiInstanceHelpers . RunAndWaitForCondition (
250
- ( ) =>
251
- {
252
- m_Player1OnClient1 . ClientVar . Value = k_TestVal2 ;
253
- m_Player2OnClient2 . ClientVar . Value = k_TestVal3 ;
254
- } ,
255
- ( ) =>
256
- {
257
- // the client's values should win on the objects it owns
258
- return
259
- m_Player1OnServer . ClientVar . Value == k_TestVal2 &&
260
- m_Player2OnServer . ClientVar . Value == k_TestVal3 &&
261
- m_Player1OnClient1 . ClientVar . Value == k_TestVal2 &&
262
- m_Player2OnClient2 . ClientVar . Value == k_TestVal3 ;
263
- }
264
- ) ;
265
- }
266
-
267
230
[ UnityTest ]
268
231
public IEnumerator FixedString32StructTest ( [ Values ( true , false ) ] bool useHost )
269
232
{
@@ -289,33 +252,6 @@ public IEnumerator FixedString32StructTest([Values(true, false)] bool useHost)
289
252
) ;
290
253
}
291
254
292
- [ UnityTest ]
293
- public IEnumerator PrivateClientTest ( [ Values ( true , false ) ] bool useHost )
294
- {
295
- m_TestWithHost = useHost ;
296
-
297
- yield return MultiInstanceHelpers . RunAndWaitForCondition (
298
- ( ) =>
299
- {
300
- // we are writing to the private and public variables on player 1's object...
301
- m_Player1OnClient1 . ClientVarPrivate . Value = k_TestVal1 ;
302
- m_Player1OnClient1 . ClientVar . Value = k_TestVal2 ;
303
- } ,
304
- ( ) =>
305
- {
306
- // ...and we should see the writes to the private var only on the server & the owner,
307
- // but the public variable everywhere
308
- return
309
- m_Player1OnClient2 . ClientVarPrivate . Value != k_TestVal1 &&
310
- m_Player1OnClient1 . ClientVarPrivate . Value == k_TestVal1 &&
311
- m_Player1OnClient2 . ClientVar . Value != k_TestVal2 &&
312
- m_Player1OnClient1 . ClientVar . Value == k_TestVal2 &&
313
- m_Player1OnServer . ClientVarPrivate . Value == k_TestVal1 &&
314
- m_Player1OnServer . ClientVar . Value == k_TestVal2 ;
315
- }
316
- ) ;
317
- }
318
-
319
255
[ UnityTest ]
320
256
public IEnumerator NetworkListAdd ( [ Values ( true , false ) ] bool useHost )
321
257
{
0 commit comments