public void OnGUI_WillDrawRectangleCenteredOnScreenPointAtRange() { var screenPoint = new Vector3(300, 400, 10); _interactionIndicationBehaviour.screenPoint = screenPoint; _interactionIndicationBehaviour.BoxTexture = new Texture2D(50, 50);; GuiGuySpy guiGuySpy = new GuiGuySpy(); _interactionIndicationBehaviour.guiGuy = guiGuySpy; var drawIsCalled = false; guiGuySpy.onDrawBox += (rect, texture) => { Assert.AreEqual(screenPoint.x, rect.center.x); Assert.AreEqual(screenPoint.y, rect.center.y); Assert.AreEqual(100, rect.width); Assert.AreEqual(100, rect.height); drawIsCalled = true; }; _interactionIndicationBehaviour.OnGUI(); Assert.IsTrue(drawIsCalled); }
public void OnGUI_WillDrawTextureInBoxWithCorrectColors() { var expectedBackgroundColor = new Color(1, 1, 1, 0); var expectedColor = new Color(1, 1, 1, 1); var expectedTexture = new Texture2D(50, 50); _interactionIndicationBehaviour.BoxTexture = expectedTexture; GuiGuySpy guiGuySpy = new GuiGuySpy(); _interactionIndicationBehaviour.guiGuy = guiGuySpy; var drawIsCalled = false; guiGuySpy.onDrawBox += (rect, texture) => { Assert.AreEqual(expectedBackgroundColor, guiGuySpy.BackGroundColor); Assert.AreEqual(expectedColor, guiGuySpy.Color); Assert.AreEqual(expectedTexture, texture); drawIsCalled = true; }; _interactionIndicationBehaviour.OnGUI(); Assert.IsTrue(drawIsCalled); }