mirror of
https://github.com/mRemoteNG/mRemoteNG.git
synced 2026-02-17 22:11:48 +08:00
added some more tests for the config window
This commit is contained in:
@@ -54,7 +54,41 @@ namespace mRemoteNGTests.UI.Window.ConfigWindowTests
|
||||
Assert.That(_configWindow.VisibleObjectProperties, Is.EquivalentTo(expectedVisibleProperties));
|
||||
}
|
||||
|
||||
private static IEnumerable<TestCaseData> ConnectionInfoGeneralTestCases()
|
||||
[Test]
|
||||
public void SwitchFromInheritanceToConnectionPropertiesWhenClickingRootNode()
|
||||
{
|
||||
// connection with a normal parent container
|
||||
var connection = new ConnectionInfo();
|
||||
connection.SetParent(new ContainerInfo());
|
||||
|
||||
_configWindow.SelectedTreeNode = connection;
|
||||
_configWindow.ShowInheritanceProperties();
|
||||
|
||||
_configWindow.SelectedTreeNode = new RootNodeInfo(RootNodeType.Connection);
|
||||
Assert.That(_configWindow.PropertiesVisible, Is.True,
|
||||
() => "The property mode should switch from inheritance to connection properties when clicking on the root node.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SwitchFromInheritanceToConnectionPropertiesWhenClickingChildOfRootNode()
|
||||
{
|
||||
// connection with a normal parent container
|
||||
var root = new RootNodeInfo(RootNodeType.Connection);
|
||||
var containerWhoseParentIsRoot = new ContainerInfo();
|
||||
var connection = new ConnectionInfo();
|
||||
root.AddChild(containerWhoseParentIsRoot);
|
||||
containerWhoseParentIsRoot.AddChild(connection);
|
||||
|
||||
_configWindow.SelectedTreeNode = connection;
|
||||
_configWindow.ShowInheritanceProperties();
|
||||
|
||||
_configWindow.SelectedTreeNode = containerWhoseParentIsRoot;
|
||||
Assert.That(_configWindow.PropertiesVisible, Is.True,
|
||||
() => "The property mode should switch from inheritance to connection properties " +
|
||||
"when clicking on a container whose parent is the root node.");
|
||||
}
|
||||
|
||||
private static IEnumerable<TestCaseData> ConnectionInfoGeneralTestCases()
|
||||
{
|
||||
var protocolTypes = typeof(ProtocolType).GetEnumValues().OfType<ProtocolType>();
|
||||
var testCases = new List<TestCaseData>();
|
||||
|
||||
@@ -236,6 +236,30 @@ namespace mRemoteNG.UI.Window
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public void ShowConnectionProperties()
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.Connection;
|
||||
UpdateTopRow();
|
||||
}
|
||||
|
||||
public void ShowInheritanceProperties()
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.Inheritance;
|
||||
UpdateTopRow();
|
||||
}
|
||||
|
||||
public void ShowDefaultConnectionProperties()
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.DefaultConnection;
|
||||
UpdateTopRow();
|
||||
}
|
||||
|
||||
public void ShowDefaultInheritanceProperties()
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.DefaultInheritance;
|
||||
UpdateTopRow();
|
||||
}
|
||||
|
||||
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, Keys keyData)
|
||||
{
|
||||
// Main form handle command key events
|
||||
@@ -256,6 +280,40 @@ namespace mRemoteNG.UI.Window
|
||||
|
||||
return true; // Handled
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
private void ApplyLanguage()
|
||||
{
|
||||
_btnShowInheritance.Text = Language.strButtonInheritance;
|
||||
_btnShowDefaultInheritance.Text = Language.strButtonDefaultInheritance;
|
||||
_btnShowProperties.Text = Language.strButtonProperties;
|
||||
_btnShowDefaultProperties.Text = Language.strButtonDefaultProperties;
|
||||
_btnIcon.Text = Language.strButtonIcon;
|
||||
_btnHostStatus.Text = Language.strStatus;
|
||||
Text = Language.strMenuConfig;
|
||||
TabText = Language.strMenuConfig;
|
||||
_propertyGridContextMenuShowHelpText.Text = Language.strMenuShowHelpText;
|
||||
}
|
||||
|
||||
private new void ApplyTheme()
|
||||
{
|
||||
if (!ThemeManager.getInstance().ActiveAndExtended) return;
|
||||
_pGrid.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
|
||||
_pGrid.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
|
||||
_pGrid.ViewBackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Background");
|
||||
_pGrid.ViewForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Foreground");
|
||||
_pGrid.LineColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Border");
|
||||
_pGrid.HelpBackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
|
||||
_pGrid.HelpForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
|
||||
_pGrid.CategoryForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Header_Foreground");
|
||||
_pGrid.CommandsDisabledLinkColor =
|
||||
_themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Disabled_Foreground");
|
||||
_pGrid.CommandsBackColor =
|
||||
_themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Disabled_Background");
|
||||
_pGrid.CommandsForeColor =
|
||||
_themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Disabled_Foreground");
|
||||
}
|
||||
|
||||
private void UpdateTopRow()
|
||||
{
|
||||
@@ -339,42 +397,6 @@ namespace mRemoteNG.UI.Window
|
||||
: null;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ApplyLanguage()
|
||||
{
|
||||
_btnShowInheritance.Text = Language.strButtonInheritance;
|
||||
_btnShowDefaultInheritance.Text = Language.strButtonDefaultInheritance;
|
||||
_btnShowProperties.Text = Language.strButtonProperties;
|
||||
_btnShowDefaultProperties.Text = Language.strButtonDefaultProperties;
|
||||
_btnIcon.Text = Language.strButtonIcon;
|
||||
_btnHostStatus.Text = Language.strStatus;
|
||||
Text = Language.strMenuConfig;
|
||||
TabText = Language.strMenuConfig;
|
||||
_propertyGridContextMenuShowHelpText.Text = Language.strMenuShowHelpText;
|
||||
}
|
||||
|
||||
private new void ApplyTheme()
|
||||
{
|
||||
if (!ThemeManager.getInstance().ActiveAndExtended) return;
|
||||
_pGrid.BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
|
||||
_pGrid.ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
|
||||
_pGrid.ViewBackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Background");
|
||||
_pGrid.ViewForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Foreground");
|
||||
_pGrid.LineColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Border");
|
||||
_pGrid.HelpBackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Background");
|
||||
_pGrid.HelpForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("TextBox_Foreground");
|
||||
_pGrid.CategoryForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("List_Header_Foreground");
|
||||
_pGrid.CommandsDisabledLinkColor =
|
||||
_themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Disabled_Foreground");
|
||||
_pGrid.CommandsBackColor =
|
||||
_themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Disabled_Background");
|
||||
_pGrid.CommandsForeColor =
|
||||
_themeManager.ActiveTheme.ExtendedPalette.getColor("List_Item_Disabled_Foreground");
|
||||
}
|
||||
|
||||
private void AddToolStripItems()
|
||||
{
|
||||
try
|
||||
@@ -478,28 +500,19 @@ namespace mRemoteNG.UI.Window
|
||||
ShowConnectionProperties();
|
||||
}
|
||||
|
||||
private void ShowConnectionProperties()
|
||||
private void btnShowInheritance_Click(object sender, EventArgs e)
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.Connection;
|
||||
UpdateTopRow();
|
||||
ShowInheritanceProperties();
|
||||
}
|
||||
|
||||
private void btnShowDefaultProperties_Click(object sender, EventArgs e)
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.DefaultConnection;
|
||||
UpdateTopRow();
|
||||
}
|
||||
|
||||
private void btnShowInheritance_Click(object sender, EventArgs e)
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.Inheritance;
|
||||
UpdateTopRow();
|
||||
ShowDefaultConnectionProperties();
|
||||
}
|
||||
|
||||
private void btnShowDefaultInheritance_Click(object sender, EventArgs e)
|
||||
{
|
||||
_pGrid.PropertyMode = PropertyMode.DefaultInheritance;
|
||||
UpdateTopRow();
|
||||
ShowDefaultInheritanceProperties();
|
||||
}
|
||||
|
||||
private void btnHostStatus_Click(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user