|
@@ -14,7 +14,7 @@ public class ScenarioTests : TestsAllViews
|
|
|
#endif
|
|
|
_output = output;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
public static IEnumerable<object []> AllScenarioTypes =>
|
|
|
typeof (Scenario).Assembly
|
|
|
.GetTypes ()
|
|
@@ -129,9 +129,9 @@ public class ScenarioTests : TestsAllViews
|
|
|
|
|
|
var top = new Toplevel ();
|
|
|
|
|
|
- _viewClasses = TestHelpers.GetAllViewClasses ().ToDictionary(t => t.Name);
|
|
|
+ _viewClasses = TestHelpers.GetAllViewClasses ().ToDictionary (t => t.Name);
|
|
|
|
|
|
- _leftPane = new()
|
|
|
+ _leftPane = new ()
|
|
|
{
|
|
|
Title = "Classes",
|
|
|
X = 0,
|
|
@@ -142,7 +142,7 @@ public class ScenarioTests : TestsAllViews
|
|
|
ColorScheme = Colors.ColorSchemes ["TopLevel"]
|
|
|
};
|
|
|
|
|
|
- _classListView = new()
|
|
|
+ _classListView = new ()
|
|
|
{
|
|
|
X = 0,
|
|
|
Y = 0,
|
|
@@ -154,7 +154,7 @@ public class ScenarioTests : TestsAllViews
|
|
|
};
|
|
|
_leftPane.Add (_classListView);
|
|
|
|
|
|
- _settingsPane = new()
|
|
|
+ _settingsPane = new ()
|
|
|
{
|
|
|
X = Pos.Right (_leftPane),
|
|
|
Y = 0, // for menu
|
|
@@ -164,12 +164,12 @@ public class ScenarioTests : TestsAllViews
|
|
|
ColorScheme = Colors.ColorSchemes ["TopLevel"],
|
|
|
Title = "Settings"
|
|
|
};
|
|
|
- _computedCheckBox = new() { X = 0, Y = 0, Text = "Computed Layout", Checked = true };
|
|
|
+ _computedCheckBox = new () { X = 0, Y = 0, Text = "Computed Layout", Checked = true };
|
|
|
_settingsPane.Add (_computedCheckBox);
|
|
|
|
|
|
var radioItems = new [] { "Percent(x)", "AnchorEnd(x)", "Center", "At(x)" };
|
|
|
|
|
|
- _locationFrame = new()
|
|
|
+ _locationFrame = new ()
|
|
|
{
|
|
|
X = Pos.Left (_computedCheckBox),
|
|
|
Y = Pos.Bottom (_computedCheckBox),
|
|
@@ -181,21 +181,21 @@ public class ScenarioTests : TestsAllViews
|
|
|
|
|
|
var label = new Label { X = 0, Y = 0, Text = "x:" };
|
|
|
_locationFrame.Add (label);
|
|
|
- _xRadioGroup = new() { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
- _xText = new() { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_xVal}" };
|
|
|
+ _xRadioGroup = new () { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
+ _xText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_xVal}" };
|
|
|
_locationFrame.Add (_xText);
|
|
|
|
|
|
_locationFrame.Add (_xRadioGroup);
|
|
|
|
|
|
radioItems = new [] { "Percent(y)", "AnchorEnd(y)", "Center", "At(y)" };
|
|
|
- label = new() { X = Pos.Right (_xRadioGroup) + 1, Y = 0, Text = "y:" };
|
|
|
+ label = new () { X = Pos.Right (_xRadioGroup) + 1, Y = 0, Text = "y:" };
|
|
|
_locationFrame.Add (label);
|
|
|
- _yText = new() { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_yVal}" };
|
|
|
+ _yText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_yVal}" };
|
|
|
_locationFrame.Add (_yText);
|
|
|
- _yRadioGroup = new() { X = Pos.X (label), Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
+ _yRadioGroup = new () { X = Pos.X (label), Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
_locationFrame.Add (_yRadioGroup);
|
|
|
|
|
|
- _sizeFrame = new()
|
|
|
+ _sizeFrame = new ()
|
|
|
{
|
|
|
X = Pos.Right (_locationFrame),
|
|
|
Y = Pos.Y (_locationFrame),
|
|
@@ -205,25 +205,25 @@ public class ScenarioTests : TestsAllViews
|
|
|
};
|
|
|
|
|
|
radioItems = new [] { "Auto()", "Percent(width)", "Fill(width)", "Sized(width)" };
|
|
|
- label = new() { X = 0, Y = 0, Text = "width:" };
|
|
|
+ label = new () { X = 0, Y = 0, Text = "width:" };
|
|
|
_sizeFrame.Add (label);
|
|
|
- _wRadioGroup = new() { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
- _wText = new() { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_wVal}" };
|
|
|
+ _wRadioGroup = new () { X = 0, Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
+ _wText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_wVal}" };
|
|
|
_sizeFrame.Add (_wText);
|
|
|
_sizeFrame.Add (_wRadioGroup);
|
|
|
|
|
|
radioItems = new [] { "Auto()", "Percent(height)", "Fill(height)", "Sized(height)" };
|
|
|
- label = new() { X = Pos.Right (_wRadioGroup) + 1, Y = 0, Text = "height:" };
|
|
|
+ label = new () { X = Pos.Right (_wRadioGroup) + 1, Y = 0, Text = "height:" };
|
|
|
_sizeFrame.Add (label);
|
|
|
- _hText = new() { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_hVal}" };
|
|
|
+ _hText = new () { X = Pos.Right (label) + 1, Y = 0, Width = 4, Text = $"{_hVal}" };
|
|
|
_sizeFrame.Add (_hText);
|
|
|
|
|
|
- _hRadioGroup = new() { X = Pos.X (label), Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
+ _hRadioGroup = new () { X = Pos.X (label), Y = Pos.Bottom (label), RadioLabels = radioItems };
|
|
|
_sizeFrame.Add (_hRadioGroup);
|
|
|
|
|
|
_settingsPane.Add (_sizeFrame);
|
|
|
|
|
|
- _hostPane = new()
|
|
|
+ _hostPane = new ()
|
|
|
{
|
|
|
X = Pos.Right (_leftPane),
|
|
|
Y = Pos.Bottom (_settingsPane),
|
|
@@ -477,20 +477,24 @@ public class ScenarioTests : TestsAllViews
|
|
|
// Instantiate view
|
|
|
var view = (View)Activator.CreateInstance (type);
|
|
|
|
|
|
- //_curView.X = Pos.Center ();
|
|
|
- //_curView.Y = Pos.Center ();
|
|
|
- if (!view.AutoSize)
|
|
|
+ if (view is null)
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (view.Width is not Dim.DimAuto)
|
|
|
{
|
|
|
view.Width = Dim.Percent (75);
|
|
|
- view.Height = Dim.Percent (75);
|
|
|
}
|
|
|
|
|
|
- // Set the colorscheme to make it stand out if is null by default
|
|
|
- if (view.ColorScheme == null)
|
|
|
+ if (view.Height is not Dim.DimAuto)
|
|
|
{
|
|
|
- view.ColorScheme = Colors.ColorSchemes ["Base"];
|
|
|
+ view.Height = Dim.Percent (75);
|
|
|
}
|
|
|
|
|
|
+ // Set the colorscheme to make it stand out if is null by default
|
|
|
+ view.ColorScheme ??= Colors.ColorSchemes ["Base"];
|
|
|
+
|
|
|
// If the view supports a Text property, set it so we have something to look at
|
|
|
if (view.GetType ().GetProperty ("Text") != null)
|
|
|
{
|