Пример #1
0
        public static void SelectListView(string name, Form form, int value)
        {
            var lv = new ListViewTester(name, form);

            //lv.Select(value);
            lv.Properties.SetSelectedItem(value);
        }
Пример #2
0
        public void NewWord_DictionaryContainsWordEmpty_ContainsBlankAndEmpty()
        {
            // The string "(Empty)" used to be retured as the lexical form for an empty entry.
            // A result of this was that by preventing the Add New Word button from creating
            // multiple empty entries, if you actually had a word "(Empty)", a new word
            // would not be created.  This test ensures that this bad behavior does not happen.

            Application.DoEvents();
            StartWithEmpty();
            ClickAddWord();
            Application.DoEvents();
            var form = "(Empty)";

            TypeInLexicalForm(form);
            Application.DoEvents();
            ClickAddWord();
            Application.DoEvents();
            Assert.AreEqual(2, _lexEntryRepository.CountAllItems());
            LexicalFormMustMatch(string.Empty);
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            // select other entry
            l.Select((l.Properties.SelectedIndices[0] + 1) % 2);
            LexicalFormMustMatch(form);
        }
Пример #3
0
        private void VerifySelectedWordIs(string word)
        {
            ListViewTester l = new ListViewTester("_recordsListBox", this._window);

            string label = GetSelectedLabel((WeSayListView)l.Properties);

            Assert.AreEqual(word, label);
        }
Пример #4
0
        public void SelectingUpdatesPageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("Updates");
            CheckBoxTester checkboxTester = new CheckBoxTester("chkCheckForUpdatesOnStartup", _optionsForm);

            Assert.That(checkboxTester.Text, Does.Match("Check for updates"));
        }
Пример #5
0
        public void SelectingSQLPageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("SQL Server");
            CheckBoxTester checkboxTester = new CheckBoxTester("chkUseSQLServer", _optionsForm);

            Assert.That(checkboxTester.Text, Does.Match("Use SQL"));
        }
Пример #6
0
        public void SelectingStartupExitPageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("Startup/Exit");
            CheckBoxTester checkboxTester = new CheckBoxTester("chkSaveConsOnExit", _optionsForm);

            Assert.That(checkboxTester.Text, Does.Match("Save connections"));
        }
        public void SelectingTabsPanelPageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("Tabs & Panels");
            CheckBoxTester checkboxTester = new CheckBoxTester("chkAlwaysShowPanelTabs", _optionsForm);

            Assert.That(checkboxTester.Text, Does.Match("Always show panel tabs"));
        }
Пример #8
0
        public void SelectingAdvancedPageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("Advanced");
            CheckBoxTester checkboxTester = new CheckBoxTester("chkWriteLogFile", _optionsForm);

            Assert.That(checkboxTester.Text, Does.Match("Write log file"));
        }
        public void SelectingThemePageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("Theme");
            ButtonTester buttonTester = new ButtonTester("btnThemeNew", _optionsForm);

            Assert.That(buttonTester.Text, Does.Match("New"));
        }
Пример #10
0
        public void SelectingAppearancePageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("Appearance");
            CheckBoxTester checkboxTester = new CheckBoxTester("chkShowSystemTrayIcon", _optionsForm);

            Assert.That(checkboxTester.Text, Does.Match("show notification area icon"));
        }
        public void SelectingConnectionsPageLoadsSettings()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            listViewTester.Select("Connections");
            CheckBoxTester checkboxTester = new CheckBoxTester("chkSingleClickOnConnectionOpensIt", _optionsForm);

            Assert.That(checkboxTester.Text, Does.Match("Single click on connection"));
        }
Пример #12
0
        public void EmptyDictionary_AddWordsTwice_OneWordExists()
        {
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            StartWithEmpty();
            ClickAddWord();
            Assert.AreEqual(1, l.Properties.Items.Count);
            ClickAddWord();
            Assert.AreEqual(1, l.Properties.Items.Count);
        }
Пример #13
0
        public void DeletingLastWordSelectsPreviousWordInList()
        {
            AddInitialEntries();
            ListViewTester t = new ListViewTester("_recordsListBox", _window);

            ((WeSayListView)t.Properties).SelectedIndex = 2;
            Assert.AreEqual("Tertiary", LexemeFormOfSelectedEntry);
            DeleteWord();
            Assert.AreEqual("Secondary", LexemeFormOfSelectedEntry);
        }
Пример #14
0
        public void EmptyDictionary_AddWords_NewWordSelectedInListBox()
        {
            StartWithEmpty();
            ClickAddWord();
            ListViewTester t = new ListViewTester("_recordsListBox", _window);

            Assert.AreEqual(0, ((WeSayListView)t.Properties).SelectedIndex);
            string label = GetSelectedLabel((WeSayListView)t.Properties);

            Assert.AreEqual("(Empty)", label);
        }
Пример #15
0
        private void GoToLexicalEntryUseFind(string lexemeForm)
        {
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter(lexemeForm);
            t.FireEvent("KeyDown", new KeyEventArgs(Keys.Enter));
            ListViewTester l     = new ListViewTester("_recordsListBox", _window);
            string         label = GetSelectedLabel((WeSayListView)l.Properties);

            Assert.AreEqual(lexemeForm, label);
        }
Пример #16
0
        public void EmptyDictionary_EnterText_PressFindButton_NoCrash()
        {
            StartWithEmpty();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("blah");
            ButtonTester b = new ButtonTester("_findButton", _window);

            b.Click();
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            Assert.AreEqual(-1, ((WeSayListView)l.Properties).SelectedIndex);
        }
Пример #17
0
        public void FindText_Enter_Finds()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("Secondary");
            t.FireEvent("KeyDown", new KeyEventArgs(Keys.Enter));
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            string label = GetSelectedLabel((WeSayListView)l.Properties);

            Assert.AreEqual("Secondary", label);
        }
Пример #18
0
        [Platform(Exclude = "Unix")]         // MouseController uses Win32.GetCursorPos so not portable
        public void ClickOnWhiteSpaceUnderEntries_EntrySelectionDoesNotchange()
        {
            AddInitialEntries();
            var l = new ListViewTester("_recordsListBox", _window);

            using (var mc = new MouseController(l))
            {
                Rectangle r = l.Properties.GetItemRect(2);
                mc.Click(r.Right + 1, r.Bottom + 1);
                // move enough to not count as a double-click
                mc.Click(r.Right + SystemInformation.DoubleClickSize.Width + 2, r.Bottom + 1);
            }
            Assert.IsTrue(l.Properties.SelectedIndices[0] == 0);
        }
Пример #19
0
        [Platform(Exclude = "Unix")]       // MouseController uses Win32.GetCursorPos so not portable
        public void DoubleClickOnWhiteSpaceToRightOfEntry_EntryAlreadySelected_EntryStaysSelected()
        {
            ListViewTester l = new ListViewTester("_listView", _window);

            using (MouseController mc = new MouseController(l))
            {
                Rectangle r = l.Properties.GetItemRect(0);
                mc.Click(r.Right + 1, r.Top + 1);
                // move enough to not confuse click with double-click
                mc.DoubleClick(r.Right + SystemInformation.DoubleClickSize.Width + 2, r.Top + 1);
            }
            Assert.AreEqual(1, l.Properties.SelectedIndices.Count);
            Assert.AreEqual(0, l.Properties.SelectedIndices[0]);
        }
Пример #20
0
        private void AssertExistenceOfEntryInList(string form, bool shouldExist)
        {
            ListViewTester l     = new ListViewTester("_recordsListBox", _window);
            bool           found = false;

            for (int i = 0; i < l.Properties.Items.Count; ++i)
            {
                if (l.Properties.Items[i].ToString() == form)
                {
                    found = true;
                    break;
                }
            }
            Assert.AreEqual(shouldExist, found);
        }
Пример #21
0
        public void FindText_EnterTextThenPressFindButton_Finds()
        {
            AddInitialEntries();
            TextBoxTester t = new TextBoxTester("_textToSearchForBox", _window);

            t.Enter("Secondary");
            ClickFindButton();
            ListViewTester l = new ListViewTester("_recordsListBox", _window);

            string label = GetSelectedLabel((WeSayListView)l.Properties);

            Assert.AreEqual("Secondary", label);
//            RichTextBoxTester r = new RichTextBoxTester("_lexicalEntryPreview", _window);
//            Assert.IsTrue(r.Text.Contains("secondarymeaning"));
        }
Пример #22
0
        [Platform(Exclude = "Unix")]       // MouseController uses Win32.GetCursorPos so not portable
        public void ClickOnWhiteSpaceToRightOfEntry_EntryAlreadySelected_DeleteButtonStaysEnabled()
        {
            AddInitialEntries();
            ListViewTester l = new ListViewTester("_recordsListBox", _window);
            ButtonTester   b = new ButtonTester("_btnDeleteWord", _window);

            using (MouseController mc = new MouseController(l))
            {
                Rectangle r = l.Properties.GetItemRect(0);
                mc.Click(r.Right + 1, r.Top + 1);
                // move enough to not count as a double-click
                mc.Click(r.Right + SystemInformation.DoubleClickSize.Width + 2, r.Top + 1);
            }
            Assert.IsTrue(b.Properties.Enabled);
        }
Пример #23
0
        [Platform(Exclude = "Unix")]       // MouseController uses Win32.GetCursorPos so not portable
        public void ClickOnWhiteSpaceToRightOfEntry_ThenKeyboardNavigate_CorrectEntrySelected()
        {
            ListViewTester l = new ListViewTester("_listView", _window);

            using (MouseController mc = new MouseController(l))
            {
                using (KeyboardController kc = new KeyboardController(l))
                {
                    l.Select(0);
                    Rectangle r = l.Properties.GetItemRect(1);
                    mc.Click(r.Right + 1, r.Top + 1);
                    kc.Press("{DOWN}");
                    kc.Release("{DOWN}");
                }
            }
            Assert.AreEqual(2, l.Properties.SelectedIndices[0]);
        }
Пример #24
0
        public static void LocationEditDlg_Handler(LocationEditDlg dlg)
        {
            SelectTab("tabsData", dlg, 0);

            EnterText("txtName", dlg, "Moscow");

            var listGeoCoords = new ListViewTester("ListGeoCoords", dlg);

            listGeoCoords.FireEvent("Click", new EventArgs());

            ClickButton("btnSearch", dlg);
            ClickButton("btnSelect", dlg);
            ClickButton("btnSelectName", dlg);
            ClickButton("btnShowOnMap", dlg);

            ClickButton("btnAccept", dlg);
        }
Пример #25
0
        private void PutCursorInMeaningFieldOfSecondEntry()
        {
            //skip to second word (first has extra stuff in the sense)
            ListViewTester t = new ListViewTester("_recordsListBox", _window);

            t.Properties.Focus();
            ((WeSayListView)t.Properties).SelectedIndex = 1;
            Assert.AreEqual("Secondary", LexemeFormOfSelectedEntry);
            Assert.AreEqual(1,
                            GetCurrentEntry().Senses.Count,
                            "this test assumes an entry with 1 sense");
            Assert.AreEqual(0,
                            GetCurrentEntry().Senses[0].ExampleSentences.Count,
                            "this test assumes a sense w/ no example");
            MultiTextControl editControl = GetEditControl("Definition");             // edit control is associated with minor label of Meaning 1

            editControl.TextBoxes[0].Focus();
        }
        public void ListViewContainsOptionsPages()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            Assert.That(listViewTester.Items.Count, Is.EqualTo(8));
        }
        public void ThemePageLinkExistsInListView()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            Assert.That(listViewTester.Items[6].Text, Does.Match("Theme"));
        }
Пример #28
0
 public override void Setup()
 {
     base.Setup();
     listViewForm = new ListViewTestForm();
     listViewDetails = new ListViewTester("listViewDetails", listViewForm);
 }
Пример #29
0
        public void AppearancePageLinkExistsInListView()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            Assert.That(listViewTester.Items[1].Text, Does.Match("Appearance"));
        }
        public void ConnectionsIconShownInListView()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            Assert.That(listViewTester.Items[3].ImageList, Is.Not.Null);
        }
        public void ConnectionsPageLinkExistsInListView()
        {
            ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);

            Assert.That(listViewTester.Items[3].Text, Does.Match("Connections"));
        }