private void SimulateFewSteps() { for (var i = 0; i < 3; i++) { inputActionHandler.Update(); } }
public void Test() { actionHandler.Update(); Assert.AreEqual(0, actionHandler.ActiveInputActions.Count); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action1)); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action2)); inputs.PushKey(KeyboardKey.KEY_A); actionHandler.Update(); Assert.IsTrue(actionHandler.AreAllKeysPressedForAction(TestAction.Action1)); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action2)); Assert.AreEqual(1, actionHandler.ActiveInputActions.Count); inputs.ReleaseKey(KeyboardKey.KEY_A); actionHandler.Update(); Assert.AreEqual(0, actionHandler.ActiveInputActions.Count); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action1)); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action2)); inputs.PushKey(KeyboardKey.KEY_LEFT_CONTROL); actionHandler.Update(); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action1)); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action2)); Assert.AreEqual(0, actionHandler.ActiveInputActions.Count); inputs.PushKey(KeyboardKey.KEY_S); actionHandler.Update(); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action1)); Assert.IsTrue(actionHandler.AreAllKeysPressedForAction(TestAction.Action2)); Assert.AreEqual(1, actionHandler.ActiveInputActions.Count); inputs.ReleaseKey(KeyboardKey.KEY_LEFT_CONTROL); actionHandler.Update(); Assert.AreEqual(0, actionHandler.ActiveInputActions.Count); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action1)); Assert.IsFalse(actionHandler.AreAllKeysPressedForAction(TestAction.Action2)); }