mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Refactored Application into smaller files.
Made Application #nullable enable
This commit is contained in:
@@ -95,7 +95,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (width, 5);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (width, 5);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
var expected = string.Empty;
|
||||
|
||||
@@ -229,7 +229,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (width, 4);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (width, 4);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
var expected = string.Empty;
|
||||
|
||||
@@ -363,7 +363,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (width, 4);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (width, 4);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
var expected = string.Empty;
|
||||
|
||||
@@ -486,7 +486,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, height);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (20, height);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
var expected = string.Empty;
|
||||
|
||||
@@ -548,7 +548,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (width, 3);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (width, 3);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
var expected = string.Empty;
|
||||
|
||||
@@ -728,7 +728,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (top);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (5, 5);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (5, 5);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
|
||||
var expected = @"
|
||||
@@ -756,7 +756,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (top);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (10, 4);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (10, 4);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
|
||||
var expected = @"
|
||||
@@ -779,7 +779,7 @@ public class BorderTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (3, 3);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (3, 3);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
|
||||
var expected = @"
|
||||
|
||||
@@ -8,7 +8,7 @@ public class MarginTests (ITestOutputHelper output)
|
||||
[SetupFakeDriver]
|
||||
public void Margin_Uses_SuperView_ColorScheme ()
|
||||
{
|
||||
((FakeDriver)Application.Driver).SetBufferSize (5, 5);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (5, 5);
|
||||
var view = new View { Height = 3, Width = 3 };
|
||||
view.Margin.Thickness = new (1);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ public class PaddingTests (ITestOutputHelper output)
|
||||
[SetupFakeDriver]
|
||||
public void Padding_Uses_Parent_ColorScheme ()
|
||||
{
|
||||
((FakeDriver)Application.Driver).SetBufferSize (5, 5);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (5, 5);
|
||||
var view = new View { Height = 3, Width = 3 };
|
||||
view.Padding.Thickness = new (1);
|
||||
|
||||
|
||||
@@ -22,13 +22,13 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
// Only valid location w/in Viewport is 0, 0 (view) - 2, 2 (screen)
|
||||
|
||||
view.Move (0, 0);
|
||||
Assert.Equal (new Point (2, 2), new Point (Application.Driver.Col, Application.Driver.Row));
|
||||
Assert.Equal (new Point (2, 2), new Point (Application.Driver!.Col, Application.Driver!.Row));
|
||||
|
||||
view.Move (-1, -1);
|
||||
Assert.Equal (new Point (2, 2), new Point (Application.Driver.Col, Application.Driver.Row));
|
||||
Assert.Equal (new Point (2, 2), new Point (Application.Driver!.Col, Application.Driver!.Row));
|
||||
|
||||
view.Move (1, 1);
|
||||
Assert.Equal (new Point (2, 2), new Point (Application.Driver.Col, Application.Driver.Row));
|
||||
Assert.Equal (new Point (2, 2), new Point (Application.Driver!.Col, Application.Driver!.Row));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -48,16 +48,16 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
view.Draw ();
|
||||
|
||||
// Only valid location w/in Viewport is 0, 0 (view) - 2, 2 (screen)
|
||||
Assert.Equal ((Rune)' ', Application.Driver.Contents [2, 2].Rune);
|
||||
Assert.Equal ((Rune)' ', Application.Driver?.Contents [2, 2].Rune);
|
||||
|
||||
view.AddRune (0, 0, Rune.ReplacementChar);
|
||||
Assert.Equal (Rune.ReplacementChar, Application.Driver.Contents [2, 2].Rune);
|
||||
Assert.Equal (Rune.ReplacementChar, Application.Driver?.Contents [2, 2].Rune);
|
||||
|
||||
view.AddRune (-1, -1, Rune.ReplacementChar);
|
||||
Assert.Equal ((Rune)'M', Application.Driver.Contents [1, 1].Rune);
|
||||
Assert.Equal ((Rune)'M', Application.Driver?.Contents [1, 1].Rune);
|
||||
|
||||
view.AddRune (1, 1, Rune.ReplacementChar);
|
||||
Assert.Equal ((Rune)'M', Application.Driver.Contents [3, 3].Rune);
|
||||
Assert.Equal ((Rune)'M', Application.Driver?.Contents [3, 3].Rune);
|
||||
|
||||
View.Diagnostics = ViewDiagnosticFlags.Off;
|
||||
}
|
||||
@@ -250,7 +250,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
top.Add (win);
|
||||
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (10, 4);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (10, 4);
|
||||
|
||||
const string expectedOutput = """
|
||||
|
||||
@@ -301,7 +301,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
dg.Add (view);
|
||||
RunState rsTop = Application.Begin (top);
|
||||
RunState rsDiag = Application.Begin (dg);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (30, 10);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (30, 10);
|
||||
|
||||
const string expectedOutput = """
|
||||
|
||||
@@ -354,7 +354,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
top.Add (viewRight, viewBottom);
|
||||
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (7, 7);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (7, 7);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
@@ -394,7 +394,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
||||
view.SetRelativeLayout (Application.Driver!.Screen.Size);
|
||||
|
||||
Assert.Equal (new (0, 0, 2, 2), view.Frame);
|
||||
Assert.Equal (Rectangle.Empty, view.Viewport);
|
||||
@@ -419,7 +419,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
view.Border.Thickness = new Thickness (1, 1, 1, 0);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
||||
view.SetRelativeLayout (Application.Driver!.Screen.Size);
|
||||
|
||||
Assert.Equal (new (0, 0, 2, 1), view.Frame);
|
||||
Assert.Equal (Rectangle.Empty, view.Viewport);
|
||||
@@ -437,7 +437,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
view.Border.Thickness = new Thickness (0, 1, 1, 1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
||||
view.SetRelativeLayout (Application.Driver!.Screen.Size);
|
||||
|
||||
Assert.Equal (new (0, 0, 1, 2), view.Frame);
|
||||
Assert.Equal (Rectangle.Empty, view.Viewport);
|
||||
@@ -462,7 +462,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
view.Border.Thickness = new Thickness (1, 1, 0, 1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
||||
view.SetRelativeLayout (Application.Driver!.Screen.Size);
|
||||
|
||||
Assert.Equal (new (0, 0, 1, 2), view.Frame);
|
||||
Assert.Equal (Rectangle.Empty, view.Viewport);
|
||||
@@ -488,7 +488,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
||||
view.SetRelativeLayout (Application.Driver!.Screen.Size);
|
||||
|
||||
Assert.Equal (new (0, 0, 2, 1), view.Frame);
|
||||
Assert.Equal (Rectangle.Empty, view.Viewport);
|
||||
@@ -561,7 +561,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
container.Add (content);
|
||||
Toplevel top = new ();
|
||||
top.Add (container);
|
||||
Application.Driver.Clip = container.Frame;
|
||||
Application.Driver!.Clip = container.Frame;
|
||||
Application.Begin (top);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@@ -727,7 +727,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
return;
|
||||
|
||||
void Top_LayoutComplete (object? sender, LayoutEventArgs e) { Application.Driver.Clip = container.Frame; }
|
||||
void Top_LayoutComplete (object? sender, LayoutEventArgs e) { Application.Driver!.Clip = container.Frame; }
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -767,7 +767,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
container.Add (content);
|
||||
Toplevel top = new ();
|
||||
top.Add (container);
|
||||
Application.Driver.Clip = container.Frame;
|
||||
Application.Driver!.Clip = container.Frame;
|
||||
Application.Begin (top);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@@ -889,7 +889,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
top.Add (win);
|
||||
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (10, 4);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (10, 4);
|
||||
|
||||
var expected = """
|
||||
|
||||
@@ -928,13 +928,13 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
view.Border.Thickness = new Thickness (1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
Assert.Equal (view.Frame, Application.Driver.Clip);
|
||||
Assert.Equal (view.Frame, Application.Driver?.Clip);
|
||||
|
||||
// Act
|
||||
view.SetClip ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (expectedClip, Application.Driver.Clip);
|
||||
Assert.Equal (expectedClip, Application.Driver?.Clip);
|
||||
view.Dispose ();
|
||||
}
|
||||
|
||||
@@ -960,14 +960,14 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
view.Border.Thickness = new Thickness (1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
Assert.Equal (view.Frame, Application.Driver.Clip);
|
||||
Assert.Equal (view.Frame, Application.Driver?.Clip);
|
||||
view.Viewport = view.Viewport with { X = 1, Y = 1 };
|
||||
|
||||
// Act
|
||||
view.SetClip ();
|
||||
|
||||
// Assert
|
||||
Assert.Equal (expectedClip, Application.Driver.Clip);
|
||||
Assert.Equal (expectedClip, Application.Driver?.Clip);
|
||||
view.Dispose ();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class DimFillTests (ITestOutputHelper output)
|
||||
var top = new Toplevel ();
|
||||
top.Add (view);
|
||||
RunState rs = Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (32, 5);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (32, 5);
|
||||
|
||||
//view.SetNeedsLayout ();
|
||||
top.LayoutSubviews ();
|
||||
|
||||
@@ -184,7 +184,7 @@ public class PosAnchorEndTests (ITestOutputHelper output)
|
||||
[SetupFakeDriver]
|
||||
public void PosAnchorEnd_View_And_Button ()
|
||||
{
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, 5);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (20, 5);
|
||||
|
||||
var b = $"{CM.Glyphs.LeftBracket} Ok {CM.Glyphs.RightBracket}";
|
||||
|
||||
|
||||
@@ -85,7 +85,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, height);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (20, height);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
var expected = string.Empty;
|
||||
|
||||
@@ -232,7 +232,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
||||
RunState rs = Application.Begin (win);
|
||||
var firstIteration = false;
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (width, 7);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (width, 7);
|
||||
Application.RunIteration (ref rs, ref firstIteration);
|
||||
var expected = string.Empty;
|
||||
|
||||
|
||||
@@ -472,7 +472,7 @@ public class ViewportTests (ITestOutputHelper output)
|
||||
//[InlineData (5, 5, false)]
|
||||
//public void IsVisibleInSuperView_With_Driver (int x, int y, bool expected)
|
||||
//{
|
||||
// ((FakeDriver)Application.Driver).SetBufferSize (10, 10);
|
||||
// ((FakeDriver)Application.Driver!).SetBufferSize (10, 10);
|
||||
|
||||
// var view = new View { X = 1, Y = 1, Width = 5, Height = 5 };
|
||||
// var top = new Toplevel ();
|
||||
|
||||
@@ -669,7 +669,7 @@ public class NavigationTests (ITestOutputHelper output)
|
||||
// Assert.False (tfQuiting);
|
||||
// Assert.False (topQuiting);
|
||||
|
||||
// Application.Driver.SendKeys ('Q', ConsoleKey.Q, false, false, true);
|
||||
// Application.Driver?.SendKeys ('Q', ConsoleKey.Q, false, false, true);
|
||||
// Assert.False (sbQuiting);
|
||||
// Assert.True (tfQuiting);
|
||||
// Assert.False (topQuiting);
|
||||
@@ -677,7 +677,7 @@ public class NavigationTests (ITestOutputHelper output)
|
||||
//#if BROKE_WITH_2927
|
||||
// tf.KeyPressed -= Tf_KeyPress;
|
||||
// tfQuiting = false;
|
||||
// Application.Driver.SendKeys ('q', ConsoleKey.Q, false, false, true);
|
||||
// Application.Driver?.SendKeys ('q', ConsoleKey.Q, false, false, true);
|
||||
// Application.MainLoop.RunIteration ();
|
||||
// Assert.True (sbQuiting);
|
||||
// Assert.False (tfQuiting);
|
||||
@@ -685,7 +685,7 @@ public class NavigationTests (ITestOutputHelper output)
|
||||
|
||||
// sb.RemoveItem (0);
|
||||
// sbQuiting = false;
|
||||
// Application.Driver.SendKeys ('q', ConsoleKey.Q, false, false, true);
|
||||
// Application.Driver?.SendKeys ('q', ConsoleKey.Q, false, false, true);
|
||||
// Application.MainLoop.RunIteration ();
|
||||
// Assert.False (sbQuiting);
|
||||
// Assert.False (tfQuiting);
|
||||
@@ -733,13 +733,13 @@ public class NavigationTests (ITestOutputHelper output)
|
||||
// Assert.False (sbQuiting);
|
||||
// Assert.False (tfQuiting);
|
||||
|
||||
// Application.Driver.SendKeys ('Q', ConsoleKey.Q, false, false, true);
|
||||
// Application.Driver?.SendKeys ('Q', ConsoleKey.Q, false, false, true);
|
||||
// Assert.False (sbQuiting);
|
||||
// Assert.True (tfQuiting);
|
||||
|
||||
// tf.KeyDown -= Tf_KeyPressed;
|
||||
// tfQuiting = false;
|
||||
// Application.Driver.SendKeys ('Q', ConsoleKey.Q, false, false, true);
|
||||
// Application.Driver?.SendKeys ('Q', ConsoleKey.Q, false, false, true);
|
||||
// Application.MainLoop.RunIteration ();
|
||||
//#if BROKE_WITH_2927
|
||||
// Assert.True (sbQuiting);
|
||||
@@ -834,7 +834,7 @@ public class NavigationTests (ITestOutputHelper output)
|
||||
Assert.Equal (new Rectangle (0, 0, View.Driver.Cols, View.Driver.Rows), top.Frame);
|
||||
Assert.Equal (new Rectangle (0, 0, 80, 25), top.Frame);
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, 10);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (20, 10);
|
||||
Assert.Equal (new Rectangle (0, 0, View.Driver.Cols, View.Driver.Rows), top.Frame);
|
||||
Assert.Equal (new Rectangle (0, 0, 20, 10), top.Frame);
|
||||
|
||||
@@ -984,7 +984,7 @@ public class NavigationTests (ITestOutputHelper output)
|
||||
Assert.NotEqual (new Rectangle (0, 0, View.Driver.Cols, View.Driver.Rows), top.Frame);
|
||||
Assert.Equal (new Rectangle (3, 2, 20, 10), top.Frame);
|
||||
|
||||
((FakeDriver)Application.Driver).SetBufferSize (30, 20);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (30, 20);
|
||||
Assert.Equal (new Rectangle (0, 0, 30, 20), new Rectangle (0, 0, View.Driver.Cols, View.Driver.Rows));
|
||||
Assert.NotEqual (new Rectangle (0, 0, View.Driver.Cols, View.Driver.Rows), top.Frame);
|
||||
Assert.Equal (new Rectangle (3, 2, 20, 10), top.Frame);
|
||||
|
||||
@@ -148,7 +148,7 @@ Y
|
||||
top.Add (win);
|
||||
|
||||
RunState rs = Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (15, 15);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (15, 15);
|
||||
|
||||
Assert.Equal (new (0, 0, 15, 15), win.Frame);
|
||||
Assert.Equal (new (0, 0, 15, 15), win.Margin.Frame);
|
||||
@@ -416,7 +416,7 @@ Y
|
||||
var top = new Toplevel ();
|
||||
top.Add (win);
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (4, 10);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (4, 10);
|
||||
|
||||
Assert.Equal (5, text.Length);
|
||||
|
||||
@@ -489,7 +489,7 @@ Y
|
||||
var top = new Toplevel ();
|
||||
top.Add (win);
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (4, 10);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (4, 10);
|
||||
|
||||
Assert.Equal (5, text.Length);
|
||||
Assert.Equal (new (0, 0, 2, 5), view.Frame);
|
||||
@@ -584,7 +584,7 @@ Y
|
||||
var top = new Toplevel ();
|
||||
top.Add (win);
|
||||
RunState rs = Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, 20);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (20, 20);
|
||||
|
||||
Assert.Equal (new (0, 0, 11, 2), horizontalView.Frame);
|
||||
Assert.Equal (new (0, 3, 2, 11), verticalView.Frame);
|
||||
@@ -672,7 +672,7 @@ Y
|
||||
var top = new Toplevel ();
|
||||
top.Add (win);
|
||||
RunState rs = Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (22, 22);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (22, 22);
|
||||
|
||||
Assert.Equal (new (text.GetColumns (), 1), horizontalView.TextFormatter.Size);
|
||||
Assert.Equal (new (2, 8), verticalView.TextFormatter.Size);
|
||||
@@ -769,7 +769,7 @@ Y
|
||||
|
||||
for (var i = 0; i < 4; i++)
|
||||
{
|
||||
text += Application.Driver.Contents [0, i].Rune;
|
||||
text += Application.Driver?.Contents [0, i].Rune;
|
||||
}
|
||||
|
||||
return text;
|
||||
@@ -804,7 +804,7 @@ Y
|
||||
var top = new Toplevel ();
|
||||
top.Add (horizontalView, verticalView);
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (50, 50);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (50, 50);
|
||||
|
||||
Assert.Equal (new (0, 0, 12, 1), horizontalView.Frame);
|
||||
Assert.Equal (new (12, 1), horizontalView.GetSizeNeededForTextWithoutHotKey ());
|
||||
@@ -900,7 +900,7 @@ Y
|
||||
var top = new Toplevel ();
|
||||
top.Add (frame);
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (width + 2, 6);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (width + 2, 6);
|
||||
|
||||
if (autoSize)
|
||||
{
|
||||
@@ -1028,7 +1028,7 @@ Y
|
||||
var top = new Toplevel ();
|
||||
top.Add (frame);
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (9, height + 2);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (9, height + 2);
|
||||
|
||||
if (autoSize)
|
||||
{
|
||||
@@ -1272,7 +1272,7 @@ Y
|
||||
[SetupFakeDriver]
|
||||
public void Narrow_Wide_Runes ()
|
||||
{
|
||||
((FakeDriver)Application.Driver).SetBufferSize (32, 32);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (32, 32);
|
||||
var top = new View { Width = 32, Height = 32 };
|
||||
|
||||
var text = $"First line{Environment.NewLine}Second line";
|
||||
|
||||
@@ -14,26 +14,26 @@ public class ViewTests (ITestOutputHelper output)
|
||||
|
||||
view.DrawContent += (s, e) =>
|
||||
{
|
||||
Rectangle savedClip = Application.Driver.Clip;
|
||||
Application.Driver.Clip = new (1, 1, view.Viewport.Width, view.Viewport.Height);
|
||||
Rectangle savedClip = Application.Driver!.Clip;
|
||||
Application.Driver!.Clip = new (1, 1, view.Viewport.Width, view.Viewport.Height);
|
||||
|
||||
for (var row = 0; row < view.Viewport.Height; row++)
|
||||
{
|
||||
Application.Driver.Move (1, row + 1);
|
||||
Application.Driver?.Move (1, row + 1);
|
||||
|
||||
for (var col = 0; col < view.Viewport.Width; col++)
|
||||
{
|
||||
Application.Driver.AddStr ($"{col}");
|
||||
Application.Driver?.AddStr ($"{col}");
|
||||
}
|
||||
}
|
||||
|
||||
Application.Driver.Clip = savedClip;
|
||||
Application.Driver!.Clip = savedClip;
|
||||
e.Cancel = true;
|
||||
};
|
||||
var top = new Toplevel ();
|
||||
top.Add (view);
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, 10);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (20, 10);
|
||||
|
||||
var expected = @"
|
||||
┌──────────────────┐
|
||||
@@ -78,26 +78,26 @@ public class ViewTests (ITestOutputHelper output)
|
||||
|
||||
view.DrawContent += (s, e) =>
|
||||
{
|
||||
Rectangle savedClip = Application.Driver.Clip;
|
||||
Application.Driver.Clip = new (1, 1, view.Viewport.Width, view.Viewport.Height);
|
||||
Rectangle savedClip = Application.Driver!.Clip;
|
||||
Application.Driver!.Clip = new (1, 1, view.Viewport.Width, view.Viewport.Height);
|
||||
|
||||
for (var row = 0; row < view.Viewport.Height; row++)
|
||||
{
|
||||
Application.Driver.Move (1, row + 1);
|
||||
Application.Driver?.Move (1, row + 1);
|
||||
|
||||
for (var col = 0; col < view.Viewport.Width; col++)
|
||||
{
|
||||
Application.Driver.AddStr ($"{col}");
|
||||
Application.Driver?.AddStr ($"{col}");
|
||||
}
|
||||
}
|
||||
|
||||
Application.Driver.Clip = savedClip;
|
||||
Application.Driver!.Clip = savedClip;
|
||||
e.Cancel = true;
|
||||
};
|
||||
var top = new Toplevel ();
|
||||
top.Add (view);
|
||||
Application.Begin (top);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (20, 10);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (20, 10);
|
||||
|
||||
var expected = @"
|
||||
┌──────────────────┐
|
||||
@@ -1016,7 +1016,7 @@ At 0,0
|
||||
view.Height = Dim.Auto ();
|
||||
Assert.Equal ("Testing visibility.".Length, view.Frame.Width);
|
||||
Assert.True (view.Visible);
|
||||
((FakeDriver)Application.Driver).SetBufferSize (30, 5);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (30, 5);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
@@ -1107,9 +1107,9 @@ At 0,0
|
||||
Cell [,] contents = ((FakeDriver)Application.Driver).Contents;
|
||||
var runesCount = 0;
|
||||
|
||||
for (var i = 0; i < Application.Driver.Rows; i++)
|
||||
for (var i = 0; i < Application.Driver!.Rows; i++)
|
||||
{
|
||||
for (var j = 0; j < Application.Driver.Cols; j++)
|
||||
for (var j = 0; j < Application.Driver!.Cols; j++)
|
||||
{
|
||||
if (contents [i, j].Rune != (Rune)' ')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user