Beispiel #1
0
        public void ReceiveButtonEvent_ExecutesThroughHandler()
        {
            var firstHandler = new InputBinderTestInputHandler(EInputHandlerResult.Handled);

            _inputBinderComponent.RegisterInputHandler(firstHandler);

            _inputBinderComponent.SetInputInterface(_inputInterface);

            _inputInterface.TestActivateButtonEvent(InputBinderTestInputHandler.InputKeyToUse, false);

            Assert.IsTrue(firstHandler.ReceivedResponse);
        }
Beispiel #2
0
        public void UnregisterHandler_DoesNotReceiveResponse()
        {
            var handler = new InputBinderTestInputHandler(EInputHandlerResult.Handled);

            _inputBinderComponent.RegisterInputHandler(handler);

            _inputBinderComponent.SetInputInterface(_inputInterface);

            _inputBinderComponent.UnregisterInputHandler(handler);

            _inputInterface.TestActivateMouseEvent(InputBinderTestInputHandler.InputKeyToUse, new Vector3());

            Assert.IsFalse(handler.ReceivedResponse);
        }
Beispiel #3
0
        public void ReceiveButtonEvent_ExecutesUntilResponseHandled()
        {
            var firstHandler  = new InputBinderTestInputHandler(EInputHandlerResult.Unhandled);
            var secondHandler = new InputBinderTestInputHandler(EInputHandlerResult.Handled);
            var thirdHandler  = new InputBinderTestInputHandler(EInputHandlerResult.Unhandled);

            _inputBinderComponent.RegisterInputHandler(firstHandler);
            _inputBinderComponent.RegisterInputHandler(secondHandler);
            _inputBinderComponent.RegisterInputHandler(thirdHandler);

            _inputBinderComponent.SetInputInterface(_inputInterface);

            _inputInterface.TestActivateButtonEvent(InputBinderTestInputHandler.InputKeyToUse, false);

            Assert.IsTrue(thirdHandler.ReceivedResponse);
            Assert.IsTrue(secondHandler.ReceivedResponse);
            Assert.IsFalse(firstHandler.ReceivedResponse);
        }