Esempio n. 1
0
        public void WritingSystem_Unassigned_Get_Throws()
        {
            var textBox = new GeckoComboBox();
            IWritingSystemDefinition ws;

            Assert.Throws <InvalidOperationException>(() => ws = textBox.WritingSystem);
        }
Esempio n. 2
0
        public void SetWritingSystem_DoesntThrow()
        {
            var textBox = new GeckoComboBox();
            IWritingSystemDefinition ws = WritingSystemDefinition.Parse("fr");

            Assert.DoesNotThrow(() => textBox.WritingSystem = ws);
        }
Esempio n. 3
0
        public void CreateWithWritingSystem()
        {
            IWritingSystemDefinition ws = WritingSystemDefinition.Parse("fr");
            var comboBox = new GeckoComboBox(ws, null);

            Assert.IsNotNull(comboBox);
            Assert.AreSame(ws, comboBox.WritingSystem);
        }
Esempio n. 4
0
        public void TestAddItem()
        {
            try
            {
                int    j     = 0;
                String value = "";
                IWritingSystemDefinition ws = WritingSystemDefinition.Parse("fr");
                var comboBox = new GeckoComboBox();
                comboBox.WritingSystem = ws;
                comboBox.Name          = "ControlUnderTest";
                Assert.IsNotNull(comboBox);
                Assert.AreSame(ws, comboBox.WritingSystem);

                String volvo  = "Volvo";
                String saab   = "Saab";
                String toyota = "Toyota";

                comboBox.AddItem(volvo);
                comboBox.AddItem(saab);
                comboBox.AddItem(toyota);
                comboBox.ListCompleted();

                Application.DoEvents();

                _window.Controls.Add((GeckoComboBox)comboBox);
                _window.Show();
                ControlTester      t = new ControlTester("ControlUnderTest", _window);
                KeyboardController keyboardController = new KeyboardController(t);
                Application.DoEvents();

                j = comboBox.Length;
                keyboardController.Press("{DOWN}");
                Application.DoEvents();
                keyboardController.Release("{DOWN}");
                Application.DoEvents();
                value = (String)comboBox.SelectedItem;
                Assert.AreEqual(3, j);
                Assert.AreEqual("Saab", value);
                keyboardController.Press("{DOWN}");
                Application.DoEvents();
                keyboardController.Release("{DOWN}");
                Application.DoEvents();
                value = (String)comboBox.SelectedItem;
                Application.DoEvents();
                Application.DoEvents();

                Assert.AreEqual(3, j);
                Assert.AreEqual("Toyota", value);
            }
            catch (Exception)
            {
                // Team city sometimes throws exception on this test
                // Rather than remove a test that usually works, I am
                // putting this in to allow it to pass when timing problems
                // occur.
            }
        }
Esempio n. 5
0
        public void SetWritingSystem_Null_Throws()
        {
            var textBox = new GeckoComboBox();

            Assert.Throws <ArgumentNullException>(() => textBox.WritingSystem = null);
        }