コード例 #1
0
        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());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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());
        }