A ControlTester for testing List Views.
It includes helper methods for selecting items from the list and for clearing those selections.
Inheritance: NUnit.Extensions.Forms.ControlTester
Ejemplo n.º 1
0
 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"));
 }
 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 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"));
 }
Ejemplo n.º 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"));
 }
Ejemplo n.º 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"));
 }
 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"));
 }
 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"));
 }
 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"));
 }
Ejemplo n.º 9
0
 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]);
 }
Ejemplo n.º 10
0
 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]);
 }
Ejemplo n.º 11
0
 public void ThemeIconShownInListView()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items[6].ImageList, Is.Not.Null);
 }
Ejemplo n.º 12
0
		public void ClickOnWhiteSpaceToRightOfEntry_EntryAlreadySelected_DeleteButtonStaysEnabled()
		{
			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);
		}
 public void TabsPanelPageLinkExistsInListView()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items[2].Text, Does.Match("Tabs & Panels"));
 }
Ejemplo n.º 14
0
		private void GoToLexicalEntryUseFind(string lexemeForm)
		{
			TextBoxTester t = new TextBoxTester("_findText", _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);
		}
Ejemplo n.º 15
0
 public void SQLPageLinkExistsInListView()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items[4].Text, Does.Match("SQL Server"));
 }
Ejemplo n.º 16
0
 public void AdvancedPageLinkExistsInListView()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items[7].Text, Does.Match("Advanced"));
 }
Ejemplo n.º 17
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);
		}
Ejemplo n.º 18
0
		public void DeletingLastWordSelectsPreviousWordInList()
		{
			ListViewTester t = new ListViewTester("_recordsListBox", _window);
			((WeSayListView) t.Properties).SelectedIndex = 2;
			Assert.AreEqual("Tertiary", LexemeFormOfSelectedEntry);
			ClickDeleteWord();
			Assert.AreEqual("Secondary", LexemeFormOfSelectedEntry);
		}
Ejemplo n.º 19
0
 public void UpdatesPageLinkExistsInListView()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items[5].Text, Does.Match("Updates"));
 }
 public void ConnectionsPageLinkExistsInListView()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items[3].Text, Does.Match("Connections"));
 }
Ejemplo n.º 21
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("Meaning 1");
			editControl.TextBoxes[0].Focus();
		}
Ejemplo n.º 22
0
		public void EmptyDictionary_AddWords_NewWordSelectedInListBox()
		{
			DeleteAllEntries();
			ClickAddWord();
			ListViewTester t = new ListViewTester("_recordsListBox", _window);
			Assert.AreEqual(0, ((WeSayListView) t.Properties).SelectedIndex);
			string label = GetSelectedLabel((WeSayListView) t.Properties);
			Assert.AreEqual("(Empty)", label);
		}
Ejemplo n.º 23
0
		public void FindText_EnterTextThenPressFindButton_Finds()
		{
			TextBoxTester t = new TextBoxTester("_findText", _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"));
		}
Ejemplo n.º 24
0
		public void EmptyDictionary_EnterText_PressFindButton_NoCrash()
		{
			StartWithEmpty();
			TextBoxTester t = new TextBoxTester("_findText", _window);
			t.Enter("blah");
			ButtonTester b = new ButtonTester("_btnFind", _window);
			b.Click();
			ListViewTester l = new ListViewTester("_recordsListBox", _window);

			Assert.AreEqual(-1, ((WeSayListView) l.Properties).SelectedIndex);
		}
Ejemplo n.º 25
0
		public void NewWord_DictionaryContainsWordEmpty_ContainsBlankAndEmpty()
		{
			//review: I (jh) find this test confusing.  if "empty" is a special word, can
			//someone add a comment explaining it?  Else, why not just use, like, "hello"?

			Application.DoEvents();
			StartWithEmpty();
			ClickAddWord();
			Application.DoEvents();
			var form = "hello";// "(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);
		}
Ejemplo n.º 26
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);
		}
Ejemplo n.º 27
0
		public void FindText_Enter_Finds()
		{
			TextBoxTester t = new TextBoxTester("_findText", _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);
		}
Ejemplo n.º 28
0
 public void ListViewContainsOptionsPages()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items.Count, Is.EqualTo(8));
 }
Ejemplo n.º 29
0
 public void ThemePageLinkExistsInListView()
 {
     ListViewTester listViewTester = new ListViewTester("PageListView", _optionsForm);
     Assert.That(listViewTester.Items[6].Text, Does.Match("Theme"));
 }
Ejemplo n.º 30
0
		private void VerifySelectedWordIs(string word)
		{
			ListViewTester l = new ListViewTester("_recordsListBox", this._window);

			string label = GetSelectedLabel((WeSayListView) l.Properties);
			Assert.AreEqual(word, label);
		}