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); }
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); }
public void TestPovs(int pov) { var gamePad = new MockedGamePad(); gamePad.PovCount = pov + 1; gamePad.MovePov(pov, 12345); gamePad.Update(); Assert.AreEqual(12345, gamePad.GetExtendedState().GetPov(pov)); }
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)); }
public void TestRightTrigger() { var gamePad = new MockedGamePad(); gamePad.PushRightTrigger(0.2468f); gamePad.Update(); GamePadState state = gamePad.GetState(); Assert.AreEqual(0.2468f, state.Triggers.Right); }
public void TestLeftTrigger() { var gamePad = new MockedGamePad(); gamePad.PushLeftTrigger(0.1357f); gamePad.Update(); GamePadState state = gamePad.GetState(); Assert.AreEqual(0.1357f, state.Triggers.Left); }
public void TestSliderMovement() { var gamePad = new MockedGamePad(); foreach (ExtendedSliders slider in Enum.GetValues(typeof(ExtendedSliders))) { gamePad.AvailableSliders = slider; gamePad.MoveSlider(slider, 0.1234f); gamePad.Update(); Assert.AreEqual(0.1234f, gamePad.GetExtendedState().GetSlider(slider)); } }
public void TestAxisMovement() { var gamePad = new MockedGamePad(); foreach (ExtendedAxes axis in Enum.GetValues(typeof(ExtendedAxes))) { gamePad.AvailableAxes = axis; gamePad.MoveAxis(axis, 0.1234f); gamePad.Update(); Assert.AreEqual(0.1234f, gamePad.GetExtendedState().GetAxis(axis)); } }
public void TestExtendedButtons() { var gamePad = new MockedGamePad(); gamePad.ButtonCount = 128; for (int index = 0; index < 128; ++index) { ExtendedGamePadState state = gamePad.GetExtendedState(); Assert.IsFalse(state.IsButtonDown(index)); gamePad.Press(index); gamePad.Update(); state = gamePad.GetExtendedState(); Assert.IsTrue(state.IsButtonDown(index)); gamePad.Release(index); gamePad.Update(); state = gamePad.GetExtendedState(); Assert.IsFalse(state.IsButtonDown(index)); } }
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; } } }
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; } } }