Skip to content

Commit 5a26533

Browse files
author
Wolff, Roald (DI FA HMI EE PRC3)
committed
Add 'Test Run Settings' UI to configure engine settings
1 parent e2105fe commit 5a26533

File tree

7 files changed

+32
-2
lines changed

7 files changed

+32
-2
lines changed

src/GuiRunner/TestCentric.Gui.Tests/Presenters/Main/WhenTestsAreLoaded.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public void SimulateTestLoad()
4949
[TestCase("ForceStopButton", false)]
5050
[TestCase("SaveResultsCommand", false)]
5151
[TestCase("TransformResultsCommand", false)]
52+
[TestCase("TestRunSettingsCommand", true)]
5253
public void CheckCommandEnabled(string propName, bool enabled)
5354
{
5455
ViewElement(propName).Received().Enabled = enabled;

src/GuiRunner/TestCentric.Gui.Tests/Presenters/Main/WhenTestsAreUnloaded.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public void SimulateTestUnload()
3838
[TestCase("RunParametersButton", false)]
3939
[TestCase("StopRunButton", false)]
4040
[TestCase("ForceStopButton", false)]
41+
[TestCase("TestRunSettingsCommand", false)]
4142
public void CheckCommandEnabled(string propName, bool enabled)
4243
{
4344
ViewElement(propName).Received().Enabled = enabled;

src/GuiRunner/TestCentric.Gui/Dialogs/SettingsDialog.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ public static void Display(TestCentricPresenter presenter, ITestModel model)
1919
TreeBasedSettingsDialog.Display(presenter, model,
2020
new GuiSettingsPage("General"),
2121
new TreeSettingsPage("Tree Display", presenter.ImageSetManager),
22-
new AdvancedLoaderSettingsPage("Assembly Load Settings"),
2322
new AssemblyReloadSettingsPage("Automatic Reload"),
2423
new ProjectEditorSettingsPage("Project Editor"));
2524
}
25+
26+
public static void DisplayTestRunSettings(TestCentricPresenter presenter, ITestModel model)
27+
{
28+
TreeBasedSettingsDialog.Display(presenter, model, new AdvancedLoaderSettingsPage("Assembly Load Settings"));
29+
}
2630
}
2731
}

src/GuiRunner/TestCentric.Gui/Presenters/TestCentricPresenter.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -494,6 +494,11 @@ void OnRunFinished(ResultNode result)
494494
SettingsDialog.Display(this, _model);
495495
};
496496

497+
_view.TestRunSettingsCommand.Execute += () =>
498+
{
499+
SettingsDialog.DisplayTestRunSettings(this, _model);
500+
};
501+
497502
_view.TestCentricHelpCommand.Execute += () =>
498503
{
499504
System.Diagnostics.Process.Start("https://test-centric.org/testcentric-gui");
@@ -776,6 +781,7 @@ private void UpdateViewCommands(bool testLoading = false)
776781
_view.RecentFilesMenu.Enabled = !testRunning && !testLoading;
777782
_view.ExitCommand.Enabled = !testLoading;
778783
_view.SaveResultsCommand.Enabled = _view.TransformResultsCommand.Enabled = !testRunning && !testLoading && hasResults;
784+
_view.TestRunSettingsCommand.Enabled = testLoaded && !testRunning;
779785
}
780786

781787
private void UpdateRunSelectedTestsTooltip()

src/GuiRunner/TestCentric.Gui/SettingsPages/AdvancedLoaderSettingsPage.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,20 +245,26 @@ private void InitializeComponent()
245245

246246
public override void LoadSettings()
247247
{
248+
// Update UI elements based on current settings in TestCentricProject
248249
int agents = PackageSettings.GetValueOrDefault(SettingDefinitions.MaxAgents);
249250
numberOfAgentsCheckBox.Checked = agents > 0;
250251
numberOfAgentsUpDown.Value = agents;
251252

252253
disableShadowCopyCheckBox.Checked = !PackageSettings.GetValueOrDefault(SettingDefinitions.ShadowCopyFiles); ;
253254

254255
string principalPolicy = PackageSettings.GetValueOrDefault(SettingDefinitions.PrincipalPolicy);
256+
if (string.IsNullOrEmpty(principalPolicy))
257+
principalPolicy = nameof(PrincipalPolicy.UnauthenticatedPrincipal);
258+
255259
principalPolicyCheckBox.Checked = principalPolicyListBox.Enabled =
256260
principalPolicy != nameof(PrincipalPolicy.UnauthenticatedPrincipal);
257261
principalPolicyListBox.SelectedItem = principalPolicy;
258262
}
259263

260264
public override void ApplySettings()
261265
{
266+
// Check if current values in UI elements differ from those in TestCentricProject
267+
// If values differ, add them to SettingsChanges list, so they can be applied later
262268
int numAgents = numberOfAgentsCheckBox.Checked
263269
? (int)numberOfAgentsUpDown.Value : 0;
264270
if (numAgents != PackageSettings.GetValueOrDefault(SettingDefinitions.MaxAgents))

src/GuiRunner/TestCentric.Gui/Views/IMainView.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ public interface IMainView
6262
ICommand OpenWorkDirectoryCommand { get; }
6363
ICommand ExtensionsCommand { get; }
6464
ICommand SettingsCommand { get; }
65+
ICommand TestRunSettingsCommand { get; }
6566

6667
// Help Menu Items
6768
ICommand TestCentricHelpCommand { get; }

src/GuiRunner/TestCentric.Gui/Views/TestCentricMainView.cs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ public class TestCentricMainView : TestCentricFormBase, IMainView
4242

4343
private System.Windows.Forms.ToolStripMenuItem toolsMenu;
4444
private System.Windows.Forms.ToolStripMenuItem settingsMenuItem;
45+
private System.Windows.Forms.ToolStripMenuItem testRunSettingsMenuItem;
4546
private System.Windows.Forms.ToolStripMenuItem saveResultsMenuItem;
4647
private System.Windows.Forms.ToolStripMenuItem transformResultsMenuItem;
4748

@@ -142,6 +143,7 @@ public TestCentricMainView() : base("TestCentric")
142143
CloseProjectCommand = new CommandMenuElement(closeMenuItem);
143144
AddTestFilesCommand = new CommandMenuElement(addTestFileMenuItem);
144145
ReloadTestsCommand = new CommandMenuElement(reloadTestsMenuItem);
146+
TestRunSettingsCommand = new CommandMenuElement(testRunSettingsMenuItem);
145147
SelectAgentMenu = new PopupMenuElement(selectAgentMenu);
146148
RunAsX86 = new CheckedMenuElement(runAsX86MenuItem);
147149
RecentFilesMenu = new PopupMenuElement(recentFilesMenu);
@@ -287,6 +289,7 @@ private void InitializeComponent()
287289
this.toolStripSeparator7 = new System.Windows.Forms.ToolStripSeparator();
288290
this.extensionsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
289291
this.settingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
292+
this.testRunSettingsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
290293
this.helpItem = new System.Windows.Forms.ToolStripMenuItem();
291294
this.testCentricHelpMenuItem = new System.Windows.Forms.ToolStripMenuItem();
292295
this.nunitHelpMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -580,8 +583,9 @@ private void InitializeComponent()
580583
this.addTestFileMenuItem,
581584
this.toolStripSeparator1,
582585
this.reloadTestsMenuItem,
583-
this.selectAgentMenu,
584586
this.toolStripSeparator2,
587+
this.testRunSettingsMenuItem,
588+
this.selectAgentMenu,
585589
this.runAsX86MenuItem,
586590
this.toolStripSeparator3,
587591
this.recentFilesMenu,
@@ -866,6 +870,12 @@ private void InitializeComponent()
866870
this.settingsMenuItem.Size = new System.Drawing.Size(194, 22);
867871
this.settingsMenuItem.Text = "&Settings...";
868872
//
873+
// testRunSettingsMenuItem
874+
//
875+
this.testRunSettingsMenuItem.Name = "testRunSettingsMenuItem";
876+
this.testRunSettingsMenuItem.Size = new System.Drawing.Size(194, 22);
877+
this.testRunSettingsMenuItem.Text = "&Test Run Settings...";
878+
//
869879
// helpItem
870880
//
871881
this.helpItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -1202,6 +1212,7 @@ public int SplitterPosition
12021212
public ICommand OpenWorkDirectoryCommand { get; }
12031213
public ICommand ExtensionsCommand { get; }
12041214
public ICommand SettingsCommand { get; }
1215+
public ICommand TestRunSettingsCommand { get; }
12051216

12061217
// Help Menu Items
12071218
public ICommand TestCentricHelpCommand { get; }

0 commit comments

Comments
 (0)