예제 #1
0
        //[Ignore("FLAKY - sometimes fails in tc continuous build.")]
        public void GeckoBox_KeyboardInputAfterInitialValueTest()
        {
            IWritingSystemDefinition ws      = WritingSystemDefinition.Parse("fr");
            IWeSayTextBox            textBox = new GeckoBox(ws, "ControlUnderTest");

            Assert.IsNotNull(textBox);
            Assert.AreSame(ws, textBox.WritingSystem);
            _window.Controls.Add((GeckoBox)textBox);
            _window.Show();
            ControlTester t = new ControlTester("ControlUnderTest", _window);

            textBox.Text = "Test";
            KeyboardController keyboardController = new KeyboardController(t);

            Application.DoEvents();
            keyboardController.Press(Key.HOME);
            Application.DoEvents();
            keyboardController.Press("V");
            keyboardController.Press("a");
            keyboardController.Press("l");
            keyboardController.Press("u");
            keyboardController.Press("e");
            keyboardController.Press(" ");
            Application.DoEvents();
            Assert.AreEqual("Value Test", textBox.Text);
            keyboardController.Dispose();
        }
예제 #2
0
        public void GeckoBox_WritingSystem_Unassigned_Get_Throws()
        {
            IWeSayTextBox            textBox = new GeckoBox();
            IWritingSystemDefinition ws;

            Assert.Throws <InvalidOperationException>(() => ws = textBox.WritingSystem);
        }
예제 #3
0
        public void GeckoBox_KeyboardInputWhenReadOnlyTest()
        {
            IWritingSystemDefinition ws      = WritingSystemDefinition.Parse("fr");
            IWeSayTextBox            textBox = new GeckoBox(ws, "ControlUnderTest");

            textBox.ReadOnly = true;
            Assert.IsNotNull(textBox);
            Assert.AreSame(ws, textBox.WritingSystem);
            _window.Controls.Add((GeckoBox)textBox);
            _window.Show();
            ControlTester t = new ControlTester("ControlUnderTest", _window);

            textBox.Text = "Value";
            KeyboardController keyboardController = new KeyboardController(t);

            Application.DoEvents();
            keyboardController.Press(Key.END);
            Application.DoEvents();
            keyboardController.Press(" ");
            keyboardController.Press("T");
            keyboardController.Press("e");
            keyboardController.Press("s");
            keyboardController.Press("t");
            Application.DoEvents();
            Assert.AreEqual("Value", textBox.Text);
            keyboardController.Dispose();
        }
예제 #4
0
        public void GeckoBox_CreateWithWritingSystem()
        {
            IWritingSystemDefinition ws      = WritingSystemDefinition.Parse("fr");
            IWeSayTextBox            textBox = new GeckoBox(ws, null);

            Assert.IsNotNull(textBox);
            Assert.AreSame(ws, textBox.WritingSystem);
        }
예제 #5
0
        private void SetupEntryPreview()
        {
            _geckoOption = WeSayWordsProject.GeckoOption;

            if (_geckoOption)
            {
                _entryPreview = new GeckoBox(WeSayWordsProject.Project.DefaultViewTemplate.HeadwordWritingSystem, null);
                ((GeckoBox)_entryPreview).ReadOnly    = true;
                ((GeckoBox)_entryPreview).BorderStyle = System.Windows.Forms.BorderStyle.None;
            }
            else
            {
                _entryPreview = new System.Windows.Forms.RichTextBox();
                ((RichTextBox)_entryPreview).BorderStyle = System.Windows.Forms.BorderStyle.None;
                ((RichTextBox)_entryPreview).ReadOnly    = true;
                _entryPreview.FontChanged += OnEntryView_FontChanged;
            }
        }
예제 #6
0
        public void GeckoBox_WritingSystem_Unassigned_Unfocused_Throws()
        {
            IWeSayTextBox textBox = new GeckoBox();

            Assert.Throws <InvalidOperationException>(() => textBox.ClearKeyboard());
        }
예제 #7
0
        public void GeckoBox_SetWritingSystem_Null_Throws()
        {
            IWeSayTextBox textBox = new GeckoBox();

            Assert.Throws <ArgumentNullException>(() => textBox.WritingSystem = null);
        }
예제 #8
0
        public void WritingSystem_Unassigned_Focused_Throws()
        {
            IWeSayTextBox textBox = new GeckoBox();

            Assert.Throws <InvalidOperationException>(() => textBox.AssignKeyboardFromWritingSystem());
        }