Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize settings to use common code but separate prefixes #396

Merged
merged 10 commits into from
Sep 14, 2019
2 changes: 1 addition & 1 deletion src/Experimental/experimental-gui/AppEntry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public static void Run(string[] args)
var traceLevel = (InternalTraceLevel)Enum.Parse(typeof(InternalTraceLevel), options.InternalTraceLevel ?? "Off");
testEngine.InternalTraceLevel = traceLevel;

var model = new TestModel(testEngine);
var model = new TestModel(testEngine, "Experimental.");
model.PackageSettings.Add(EnginePackageSettings.InternalTraceLevel, traceLevel.ToString());

if (options.ProcessModel != null)
Expand Down
8 changes: 1 addition & 7 deletions src/Experimental/experimental-gui/Experimental.Gui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@
<Compile Include="Presenters\DurationGrouping.cs" />
<Compile Include="Presenters\OutcomeGrouping.cs" />
<Compile Include="Presenters\TextOutputPresenter.cs" />
<Compile Include="Settings\EngineSettings.cs" />
<Compile Include="Settings\GuiSettings.cs" />
<Compile Include="Settings\SettingsGroup.cs" />
<Compile Include="Settings\SettingsModel.cs" />
<Compile Include="Settings\TestTreeSettings.cs" />
<Compile Include="Presenters\TestGroup.cs" />
<Compile Include="Presenters\FixtureListDisplayStrategy.cs" />
<Compile Include="Presenters\NUnitTreeDisplayStrategy.cs" />
Expand All @@ -67,8 +62,7 @@
<Compile Include="Presenters\StatusBarPresenter.cs" />
<Compile Include="Presenters\DisplayStrategy.cs" />
<Compile Include="Presenters\XmlPresenter.cs" />
<Compile Include="Settings\TextOutputSettings.cs" />
<Compile Include="Settings\TreeDisplayStyle.cs" />
<Compile Include="Presenters\TreeDisplayStyle.cs" />
<Compile Include="Views\AddinPages\AddinsView.cs">
<SubType>Form</SubType>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
namespace TestCentric.Gui.Presenters
{
using Model;
using Settings;
using Model.Settings;
using Views;
using Elements;

Expand All @@ -46,7 +46,7 @@ public abstract class DisplayStrategy
{
protected ITestTreeView _view;
protected ITestModel _model;
protected SettingsModel _settings;
protected UserSettings _settings;

protected Dictionary<string, List<TreeNode>> _nodeIndex = new Dictionary<string, List<TreeNode>>();

Expand All @@ -58,7 +58,7 @@ public DisplayStrategy(ITestTreeView view, ITestModel model)
{
_view = view;
_model = model;
_settings = new SettingsModel(_model.Services.UserSettings);
_settings = _model.Services.UserSettings;

this.Tree = view.Tree;
}
Expand Down
8 changes: 4 additions & 4 deletions src/Experimental/experimental-gui/Presenters/MainPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
using System.Text;
using System.Windows.Forms;
using NUnit.Engine;
using TestCentric.Gui.Model.Settings;

namespace TestCentric.Gui.Presenters
{
using Model;
using Settings;
using Views;
using Views.AddinPages;

public class MainPresenter : System.IDisposable
{
IMainView _view;
ITestModel _model;
SettingsModel _settings;
UserSettings _settings;
CommandLineOptions _options;

private Dictionary<string, TreeNode> _nodeIndex = new Dictionary<string, TreeNode>();
Expand All @@ -50,7 +50,7 @@ public MainPresenter(IMainView view, ITestModel model, CommandLineOptions option
{
_view = view;
_model = model;
_settings = new SettingsModel(_model.Services.UserSettings);
_settings = _model.Services.UserSettings;
_options = options;

InitializeMainMenu();
Expand Down Expand Up @@ -189,7 +189,7 @@ private void MainForm_Load(object sender, System.EventArgs e)
_view.IsMaximized = true;

// Set the font to use
_view.Font = _settings.Gui.MainForm.Font;
_view.Font = _settings.Gui.Font;

var settings = _model.PackageSettings;
if (_options.InternalTraceLevel != null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
namespace TestCentric.Gui.Presenters
{
using Model;
using Settings;
using Views;

/// <summary>
Expand Down Expand Up @@ -66,7 +65,7 @@ public override void OnTestLoaded(TestNode testNode)

_view.Tree.Add(treeNode);

SetInitialExpansion(displayStyle, treeNode);
SetInitialExpansion((TreeDisplayStyle)displayStyle, treeNode);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit confusing that in testcentric.gui Gui.TestTree.InitialTreeDisplay contains a DisplayStyle and in the experimental gui is contains a TreeDisplayStyle, and these enums have the same values (with the same names).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I'll take another look.

Generally, I resisted making any changes that were "incidental" to the big change I was making, i.e. unifying the handling of settings. In this case, I kept the different definitions because I thought the experimental value might have more things added in the future and because the knowledge of the different ways of expanding the tree don't belong in the model. However, the name is rather bad, since it doesn't contain the word "expansion," which is what this setting is all about.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed both to InitialTreeExpansion

}

topNode?.EnsureVisible();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// ***********************************************************************
// ***********************************************************************
// Copyright (c) 2016 Charlie Poole
//
// Permission is hereby granted, free of charge, to any person obtaining
Expand All @@ -21,7 +21,7 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// ***********************************************************************

namespace TestCentric.Gui.Settings
namespace TestCentric.Gui.Presenters
{
/// <summary>
/// Indicates how a tree should be displayed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public TreeViewPresenter(ITestTreeView treeView, ITestModel model)
_view = treeView;
_model = model;

Settings = new Settings.TestTreeSettings(_model.Services.UserSettings);
Settings = _model.Services.UserSettings.Gui.TestTree;

_view.AlternateImageSet = (string)Settings.AlternateImageSet;

Expand Down Expand Up @@ -262,7 +262,7 @@ private void CreateDisplayStrategy(string format)
_view.DisplayFormat.SelectedItem = format;
}

private Settings.TestTreeSettings Settings { get; }
private Model.Settings.TestTreeSettings Settings { get; }

#endregion
}
Expand Down
57 changes: 0 additions & 57 deletions src/Experimental/experimental-gui/Settings/EngineSettings.cs

This file was deleted.

106 changes: 0 additions & 106 deletions src/Experimental/experimental-gui/Settings/GuiSettings.cs

This file was deleted.

85 changes: 0 additions & 85 deletions src/Experimental/experimental-gui/Settings/SettingsGroup.cs

This file was deleted.