public void Basic_Null()
		{
			using (var dialog = new NavPaneOptionsDlg(null))
			{
				dialog.Show();
				Assert.IsNotNull(dialog);
			}
		}
 public void Basic_Null()
 {
     using (var dialog = new NavPaneOptionsDlg(null))
     {
         dialog.Show();
         Assert.IsNotNull(dialog);
     }
 }
 public void CannotMoveTabBeyondLimit_Down()
 {
     using (var dialog = new NavPaneOptionsDlg(_tabs))
     {
         dialog.Show();
         dialog.tabListBox.SetSelected(2, true);                 // select bottom-most tab
         Assert.False(dialog.btn_Down.Enabled, "Down button should be disabled");
     }
 }
Example #4
0
 /// <summary></summary>
 private void NavigationPaneOptions(object sender, System.EventArgs e)
 {
     m_rightClickedButton = null;
     m_hoveringButton     = null;
     Invalidate();
     using (NavPaneOptionsDlg frm = new NavPaneOptionsDlg(Buttons))
         frm.ShowDialog();
     Invalidate();
 }
 public void LoadingDialogDoesNotStartWithUpDownButtonsEnabled()
 {
     using (var dialog = new NavPaneOptionsDlg(_tabs))
     {
         dialog.Show();
         Assert.IsNull(dialog.tabListBox.SelectedItem, "This test doesn't make sense if a tab is selected");
         Assert.False(dialog.btn_Down.Enabled, "Down button should be disabled when no tab is selected");
         Assert.False(dialog.btn_Up.Enabled, "Up button should be disabled when no tab is selected");
     }
 }
        public void HideATabHasNoEffectIfCancel()
        {
            Assert.IsTrue(_tab1.Visible, "tab1 should be visible before hiding");

            using (var dialog = new NavPaneOptionsDlg(_tabs))
            {
                dialog.Show();
                dialog.tabListBox.SetItemChecked(0, false);
                dialog.btn_Cancel.PerformClick();

                Assert.IsTrue(_tab1.Visible, "tab1 should still be visible since we clicked Cancel");
            }
        }
        public void CanHideATab()
        {
            Assert.IsTrue(_tab1.Visible, "tab1 should be visible before hiding");

            using (var dialog = new NavPaneOptionsDlg(_tabs))
            {
                dialog.Show();
                dialog.tabListBox.SetItemChecked(0, false);
                dialog.btn_OK.PerformClick();

                Assert.IsFalse(_tab1.Visible, "tab1 should have been hidden");
            }
        }
		public void JustCancelingDoesNotChangeTabs()
		{
			var tabsBeforeDialog = new object[10];
			var tabsAfterDialog = new object[10];
			(_tabs as ICollection).CopyTo(tabsBeforeDialog, 0);
			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				dialog.btn_Cancel.PerformClick();
				(_tabs as ICollection).CopyTo(tabsAfterDialog, 0);
				Assert.AreEqual(tabsBeforeDialog, tabsAfterDialog, "Opening and Canceling dialog should not have changed the tabs");
			}
		}
        public void JustCancelingDoesNotChangeTabs()
        {
            var tabsBeforeDialog = new object[10];
            var tabsAfterDialog  = new object[10];

            (_tabs as ICollection).CopyTo(tabsBeforeDialog, 0);
            using (var dialog = new NavPaneOptionsDlg(_tabs))
            {
                dialog.Show();
                dialog.btn_Cancel.PerformClick();
                (_tabs as ICollection).CopyTo(tabsAfterDialog, 0);
                Assert.AreEqual(tabsBeforeDialog, tabsAfterDialog, "Opening and Canceling dialog should not have changed the tabs");
            }
        }
 public void ResetButton_disablesUpDownButtons()
 {
     using (var dialog = new NavPaneOptionsDlg(_tabs))
     {
         dialog.Show();
         // Select a tab that enables Up and Down buttons
         dialog.tabListBox.SetSelected(1, true);
         // Click Reset
         dialog.btn_Reset.PerformClick();
         Assert.IsNull(dialog.tabListBox.SelectedItem, "This test doesn't make sense if a tab is selected");
         Assert.False(dialog.btn_Down.Enabled, "Down button should be disabled when no tab is selected");
         Assert.False(dialog.btn_Up.Enabled, "Up button should be disabled when no tab is selected");
     }
 }
        public void CanReorderTabs_Up()
        {
            var tabsBeforeDialog = new object[3];
            var tabsAfterDialog  = new object[3];

            (_tabs as ICollection).CopyTo(tabsBeforeDialog, 0);
            var tabsAfterDialog_expected = new object[3] {
                _tab1, _tab3, _tab2
            };

            using (var dialog = new NavPaneOptionsDlg(_tabs))
            {
                dialog.Show();
                dialog.tabListBox.SetSelected(2, true);
                dialog.btn_Up.PerformClick();

                (_tabs as ICollection).CopyTo(tabsAfterDialog, 0);
                Assert.AreEqual(tabsAfterDialog_expected, tabsAfterDialog, "Reordering a tab up did not work");
            }
        }
        public void ResetButton()
        {
            var tabsBeforeDialog = new object[10];
            var tabsAfterDialog  = new object[10];

            (_tabs as ICollection).CopyTo(tabsBeforeDialog, 0);

            using (var dialog = new NavPaneOptionsDlg(_tabs))
            {
                dialog.Show();
                // Uncheck a tab
                dialog.tabListBox.SetItemChecked(2, false);
                // Move a tab down
                dialog.tabListBox.SetSelected(0, true);
                dialog.btn_Down.PerformClick();
                dialog.btn_Reset.PerformClick();                 // Reset should restore things

                Assert.IsTrue(dialog.tabListBox.GetItemChecked(2), "tab should be checked again after Reset");
                (_tabs as ICollection).CopyTo(tabsAfterDialog, 0);
                Assert.AreEqual(tabsBeforeDialog, tabsAfterDialog, "tab order should be restored by Reset");
            }
        }
        public void ReorderingShouldNotCheck()
        {
            using (var dialog = new NavPaneOptionsDlg(_tabs))
            {
                dialog.Show();

                // Uncheck all tabs
                for (int i = 0; i < _tabs.Count; i++)
                {
                    dialog.tabListBox.SetItemChecked(i, false);
                }

                // Move a tab down
                dialog.tabListBox.SetSelected(0, true);
                dialog.btn_Down.PerformClick();

                for (int i = 0; i < _tabs.Count; i++)
                {
                    Assert.IsFalse(dialog.tabListBox.GetItemChecked(i),
                                   "tab at index {0} should have remained unchecked when tabs are reordered", i);
                }
            }
        }
		public void HideATabHasNoEffectIfCancel()
		{
			Assert.IsTrue(_tab1.Visible, "tab1 should be visible before hiding");

			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				dialog.tabListBox.SetItemChecked(0, false);
				dialog.btn_Cancel.PerformClick();

				Assert.IsTrue(_tab1.Visible, "tab1 should still be visible since we clicked Cancel");
			}
		}
		public void CannotMoveTabBeyondLimit_Down()
		{
			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				dialog.tabListBox.SetSelected(2, true); // select bottom-most tab
				Assert.False(dialog.btn_Down.Enabled, "Down button should be disabled");
			}
		}
		public void LoadingDialogDoesNotStartWithUpDownButtonsEnabled()
		{
			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				Assert.IsNull(dialog.tabListBox.SelectedItem, "This test doesn't make sense if a tab is selected");
				Assert.False(dialog.btn_Down.Enabled, "Down button should be disabled when no tab is selected");
				Assert.False(dialog.btn_Up.Enabled, "Up button should be disabled when no tab is selected");
			}
		}
		public void ResetButton()
		{
			var tabsBeforeDialog = new object[10];
			var tabsAfterDialog = new object[10];
			(_tabs as ICollection).CopyTo(tabsBeforeDialog, 0);

			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				// Uncheck a tab
				dialog.tabListBox.SetItemChecked(2, false);
				// Move a tab down
				dialog.tabListBox.SetSelected(0, true);
				dialog.btn_Down.PerformClick();
				dialog.btn_Reset.PerformClick(); // Reset should restore things

				Assert.IsTrue(dialog.tabListBox.GetItemChecked(2), "tab should be checked again after Reset");
				(_tabs as ICollection).CopyTo(tabsAfterDialog, 0);
				Assert.AreEqual(tabsBeforeDialog, tabsAfterDialog, "tab order should be restored by Reset");
			}
		}
		public void CanReorderTabs_Up()
		{
			var tabsBeforeDialog = new object[3];
			var tabsAfterDialog = new object[3];
			(_tabs as ICollection).CopyTo(tabsBeforeDialog, 0);
			var tabsAfterDialog_expected = new object[3] { _tab1, _tab3, _tab2 };

			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				dialog.tabListBox.SetSelected(2, true);
				dialog.btn_Up.PerformClick();

				(_tabs as ICollection).CopyTo(tabsAfterDialog, 0);
				Assert.AreEqual(tabsAfterDialog_expected, tabsAfterDialog, "Reordering a tab up did not work");
			}
		}
		public void CanHideATab()
		{
			Assert.IsTrue(_tab1.Visible, "tab1 should be visible before hiding");

			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				dialog.tabListBox.SetItemChecked(0, false);
				dialog.btn_OK.PerformClick();

				Assert.IsFalse(_tab1.Visible, "tab1 should have been hidden");
			}
		}
		public void ResetButton_disablesUpDownButtons()
		{
			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();
				// Select a tab that enables Up and Down buttons
				dialog.tabListBox.SetSelected(1, true);
				// Click Reset
				dialog.btn_Reset.PerformClick();
				Assert.IsNull(dialog.tabListBox.SelectedItem, "This test doesn't make sense if a tab is selected");
				Assert.False(dialog.btn_Down.Enabled, "Down button should be disabled when no tab is selected");
				Assert.False(dialog.btn_Up.Enabled, "Up button should be disabled when no tab is selected");
			}
		}
		public void ReorderingShouldNotCheck()
		{
			using (var dialog = new NavPaneOptionsDlg(_tabs))
			{
				dialog.Show();

				// Uncheck all tabs
				for (int i = 0; i < _tabs.Count; i++)
					dialog.tabListBox.SetItemChecked(i, false);

				// Move a tab down
				dialog.tabListBox.SetSelected(0, true);
				dialog.btn_Down.PerformClick();

				for (int i = 0; i < _tabs.Count; i++)
					Assert.IsFalse(dialog.tabListBox.GetItemChecked(i),
						"tab at index {0} should have remained unchecked when tabs are reordered", i);
			}
		}