mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
add base OnSetHostVisibility test (#1749)
* add base OnSetHostVisibility test * fix code smells
This commit is contained in:
parent
2d006fe730
commit
3cf686f3b8
@ -136,6 +136,18 @@ public override void OnSetHostVisibility(bool visible)
|
||||
|
||||
}
|
||||
|
||||
class SetHostVisibilityNetworkBehaviour : NetworkVisibility
|
||||
{
|
||||
public int called;
|
||||
public override void OnRebuildObservers(HashSet<NetworkConnection> observers, bool initialize) { }
|
||||
public override bool OnCheckObserver(NetworkConnection conn) { return true; }
|
||||
public override void OnSetHostVisibility(bool visible)
|
||||
{
|
||||
++called;
|
||||
base.OnSetHostVisibility(visible);
|
||||
}
|
||||
}
|
||||
|
||||
class CheckObserverExceptionNetworkBehaviour : NetworkVisibility
|
||||
{
|
||||
public int called;
|
||||
@ -1780,5 +1792,17 @@ public void GetDirtyComponentsMaskShouldReturnZeroWhenNoDirtyComponents()
|
||||
Assert.That(mask, Is.EqualTo(0UL));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OnSetHostVisibilityBaseTest()
|
||||
{
|
||||
SpriteRenderer renderer;
|
||||
|
||||
renderer = gameObject.AddComponent<SpriteRenderer>();
|
||||
SetHostVisibilityNetworkBehaviour comp = gameObject.AddComponent<SetHostVisibilityNetworkBehaviour>();
|
||||
comp.OnSetHostVisibility(false);
|
||||
|
||||
Assert.That(comp.called, Is.EqualTo(1));
|
||||
Assert.That(renderer.enabled, Is.False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user