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 InputTextKeyHello() { MockInputSimulator inputSimulator = new MockInputSimulator(); TestabelKeyboard keyboard = CreateKeyboard(inputSimulator); MockButton btn = keyboard.Children[4] as MockButton; btn.ClickButton(); Assert.AreEqual("Hello World!", inputSimulator.GetTextInput()); }
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()); }