Exemplo n.º 1
0
        public void pressing_right_from_down_right(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns((sut.Dpad.RIGHT_BUTTON.Center.ToVector2() + new Microsoft.Xna.Framework.Vector2(0, TouchControllerRenderer.BUTTON_HEIGHT)).Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.RIGHT_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Right, sut.Direction);
        }
Exemplo n.º 2
0
        public void pressing_up_from_down(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.UP_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Up, sut.Direction);
        }
Exemplo n.º 3
0
        public void pressing_dowm_from_up_left(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns((sut.Dpad.LEFT_BUTTON.Center.ToVector2() + new Microsoft.Xna.Framework.Vector2(0, -TouchControllerRenderer.BUTTON_HEIGHT)).Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Down, sut.Direction);
        }
Exemplo n.º 4
0
        public void pressing_center_from_right(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.RIGHT_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.CENTER_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            Assert.Equal(DpadDirection.Left, sut.Direction);
        }
Exemplo n.º 5
0
        public void pressing_dowm_downRight_downRight(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_RIGHT_BUTTON.Center.ToVector2().Yield());

            sut.Update();
            sut.Update();

            Assert.Equal(DpadDirection.Right, sut.Direction);
        }
Exemplo n.º 6
0
        public void pressing_rightdown_leftup_leftup(TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.DOWN_RIGHT_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.UP_LEFT_BUTTON.Center.ToVector2().Yield());

            sut.Update();

            sut.Update();

            Assert.Equal(DpadDirection.Left, sut.Direction);
        }
Exemplo n.º 7
0
        public void pressing_right(IFixture fixture, TouchControlInputs sut)
        {
            sut.TouchInputs.GetTouchCollection()
            .Returns(sut.Dpad.RIGHT_BUTTON.Center.ToVector2().Yield());
            var aa = new TouchControlInputs(fixture.Create <TouchInputs>());

            sut.Update();

            Assert.Equal(DpadDirection.Right, sut.Direction);
        }