Ejemplo n.º 1
0
        public void TestGetState()
        {
            var gamePad = new MockedGamePad();

            gamePad.GetState();
            // No exception means success
        }
Ejemplo n.º 2
0
 public void TestMoveLeftThumbStick() {
   var gamePad = new MockedGamePad();
   gamePad.MoveLeftThumbStick(0.1234f, 0.5678f);
   gamePad.Update();
   
   GamePadState state = gamePad.GetState();
   Assert.AreEqual(new Vector2(0.1234f, 0.5678f), state.ThumbSticks.Left);
 }
Ejemplo n.º 3
0
        public void TestMoveRightThumbStick()
        {
            var gamePad = new MockedGamePad();

            gamePad.MoveRightThumbStick(0.8765f, 0.4321f);
            gamePad.Update();

            GamePadState state = gamePad.GetState();

            Assert.AreEqual(new Vector2(0.8765f, 0.4321f), state.ThumbSticks.Right);
        }
Ejemplo n.º 4
0
        public void TestMoveLeftThumbStick()
        {
            var gamePad = new MockedGamePad();

            gamePad.MoveLeftThumbStick(0.1234f, 0.5678f);
            gamePad.Update();

            GamePadState state = gamePad.GetState();

            Assert.AreEqual(new Vector2(0.1234f, 0.5678f), state.ThumbSticks.Left);
        }
Ejemplo n.º 5
0
        public void TestButtons(Buttons button)
        {
            var gamePad = new MockedGamePad();

            GamePadState state = gamePad.GetState();

            Assert.IsFalse(state.IsButtonDown(button));

            gamePad.Press(button);
            gamePad.Update();

            state = gamePad.GetState();
            Assert.IsTrue(state.IsButtonDown(button));

            gamePad.Release(button);
            gamePad.Update();

            state = gamePad.GetState();
            Assert.IsFalse(state.IsButtonDown(button));
        }
Ejemplo n.º 6
0
        public void TestRightTrigger()
        {
            var gamePad = new MockedGamePad();

            gamePad.PushRightTrigger(0.2468f);
            gamePad.Update();

            GamePadState state = gamePad.GetState();

            Assert.AreEqual(0.2468f, state.Triggers.Right);
        }
Ejemplo n.º 7
0
        public void TestLeftTrigger()
        {
            var gamePad = new MockedGamePad();

            gamePad.PushLeftTrigger(0.1357f);
            gamePad.Update();

            GamePadState state = gamePad.GetState();

            Assert.AreEqual(0.1357f, state.Triggers.Left);
        }
Ejemplo n.º 8
0
        public void TestDirectionalPad(Buttons button)
        {
            var gamePad = new MockedGamePad();

            gamePad.Press(button);
            gamePad.Update();

            GamePadState state = gamePad.GetState();

            switch (button)
            {
            case Buttons.DPadUp: {
                Assert.AreEqual(ButtonState.Pressed, state.DPad.Up);
                Assert.AreEqual(ButtonState.Released, state.DPad.Down);
                break;
            }

            case Buttons.DPadDown: {
                Assert.AreEqual(ButtonState.Pressed, state.DPad.Down);
                Assert.AreEqual(ButtonState.Released, state.DPad.Up);
                break;
            }

            case Buttons.DPadLeft: {
                Assert.AreEqual(ButtonState.Pressed, state.DPad.Left);
                Assert.AreEqual(ButtonState.Released, state.DPad.Right);
                break;
            }

            case Buttons.DPadRight: {
                Assert.AreEqual(ButtonState.Pressed, state.DPad.Right);
                Assert.AreEqual(ButtonState.Released, state.DPad.Left);
                break;
            }
            }
        }
Ejemplo n.º 9
0
    public void TestLeftTrigger() {
      var gamePad = new MockedGamePad();
      gamePad.PushLeftTrigger(0.1357f);
      gamePad.Update();

      GamePadState state = gamePad.GetState();
      Assert.AreEqual(0.1357f, state.Triggers.Left);
    }
Ejemplo n.º 10
0
    public void TestMoveRightThumbStick() {
      var gamePad = new MockedGamePad();
      gamePad.MoveRightThumbStick(0.8765f, 0.4321f);
      gamePad.Update();

      GamePadState state = gamePad.GetState();
      Assert.AreEqual(new Vector2(0.8765f, 0.4321f), state.ThumbSticks.Right);
    }
Ejemplo n.º 11
0
 public void TestGetState() {
   var gamePad = new MockedGamePad();
   gamePad.GetState();
   // No exception means success
 }
Ejemplo n.º 12
0
    public void TestDirectionalPad(Buttons button) {
      var gamePad = new MockedGamePad();
      gamePad.Press(button);
      gamePad.Update();

      GamePadState state = gamePad.GetState();
      switch(button) {
        case Buttons.DPadUp: {
          Assert.AreEqual(ButtonState.Pressed, state.DPad.Up);
          Assert.AreEqual(ButtonState.Released, state.DPad.Down);
          break;
        }
        case Buttons.DPadDown: {
          Assert.AreEqual(ButtonState.Pressed, state.DPad.Down);
          Assert.AreEqual(ButtonState.Released, state.DPad.Up);
          break;
        }
        case Buttons.DPadLeft: {
          Assert.AreEqual(ButtonState.Pressed, state.DPad.Left);
          Assert.AreEqual(ButtonState.Released, state.DPad.Right);
          break;
        }
        case Buttons.DPadRight: {
          Assert.AreEqual(ButtonState.Pressed, state.DPad.Right);
          Assert.AreEqual(ButtonState.Released, state.DPad.Left);
          break;
        }
      }
    }
Ejemplo n.º 13
0
    public void TestButtons(Buttons button) {
      var gamePad = new MockedGamePad();

      GamePadState state = gamePad.GetState();
      Assert.IsFalse(state.IsButtonDown(button));

      gamePad.Press(button);
      gamePad.Update();

      state = gamePad.GetState();
      Assert.IsTrue(state.IsButtonDown(button));

      gamePad.Release(button);
      gamePad.Update();

      state = gamePad.GetState();
      Assert.IsFalse(state.IsButtonDown(button));
    }
Ejemplo n.º 14
0
    public void TestRightTrigger() {
      var gamePad = new MockedGamePad();
      gamePad.PushRightTrigger(0.2468f);
      gamePad.Update();

      GamePadState state = gamePad.GetState();
      Assert.AreEqual(0.2468f, state.Triggers.Right);
    }