public void ChangeTextKey() { MockInputSimulator inputSimulator = new MockInputSimulator(); TestabelKeyboard keyboard = CreateKeyboard(inputSimulator); MockButton btn = keyboard.Children[4] as MockButton; btn.ClickButton(); Assert.AreEqual("Hello World!", inputSimulator.GetTextInput()); inputSimulator.ClearState(); Keyboard.SetOutputText(btn, "Goodbye"); btn.ClickButton(); Assert.AreEqual("Goodbye", inputSimulator.GetTextInput()); }
public void ChangeKeyAtoZ() { MockInputSimulator inputSimulator = new MockInputSimulator(); TestabelKeyboard keyboard = CreateKeyboard(inputSimulator); MockButton btn = keyboard.Children[3] as MockButton; btn.ClickButton(); Assert.AreEqual(1, inputSimulator.KeyActions.Count); Assert.AreEqual(WindowsInput.Native.VirtualKeyCode.VK_A, inputSimulator.KeyActions[0].KeyCode); inputSimulator.ClearState(); Keyboard.SetKeyCode(btn, VirtualKeyCode.VkZ); btn.ClickButton(); Assert.AreEqual(1, inputSimulator.KeyActions.Count); Assert.AreEqual(WindowsInput.Native.VirtualKeyCode.VK_Z, inputSimulator.KeyActions[0].KeyCode); }
public void ChangeKeyBehaviour() { MockInputSimulator inputSimulator = new MockInputSimulator(); TestabelKeyboard keyboard = CreateKeyboard(inputSimulator); MockButton btn = keyboard.Children[3] as MockButton; btn.ClickButton(); Assert.AreEqual(1, inputSimulator.KeyActions.Count); Assert.AreEqual(WindowsInput.Native.VirtualKeyCode.VK_A, inputSimulator.KeyActions[0].KeyCode); Assert.AreEqual(string.Empty, inputSimulator.GetTextInput()); inputSimulator.ClearState(); Keyboard.SetKeyBehaviour(btn, KeyBehaviour.Text); btn.ClickButton(); Assert.AreEqual(0, inputSimulator.KeyActions.Count); Assert.AreEqual("Virtual Key", inputSimulator.GetTextInput()); }