mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
Tons of Layout refactoring. LayoutSubviews is now internal.
This commit is contained in:
@@ -7,6 +7,139 @@ namespace Terminal.Gui.ViewTests;
|
||||
[Trait ("Category", "Output")]
|
||||
public class DrawTests (ITestOutputHelper _output)
|
||||
{
|
||||
[Fact]
|
||||
public void NeedsDisplay_True_After_Constructor ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
Assert.True (view.NeedsDisplay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NeedsDisplay_False_After_BeginInit ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.BeginInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.NeedsDisplay = false;
|
||||
|
||||
view.BeginInit ();
|
||||
Assert.False (view.NeedsDisplay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NeedsDisplay_False_After_EndInit ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.BeginInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.EndInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
view.BeginInit ();
|
||||
view.NeedsDisplay = false;
|
||||
view.EndInit ();
|
||||
Assert.False (view.NeedsDisplay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NeedsDisplay_False_After_SetRelativeLayout ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2 };
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.BeginInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.EndInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.SetRelativeLayout (Application.Screen.Size);
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.NeedsDisplay = false;
|
||||
view.SetRelativeLayout (new (10, 10));
|
||||
Assert.False (view.NeedsDisplay);
|
||||
|
||||
view = new View { Width = Dim.Percent(50), Height = Dim.Percent(50) };
|
||||
View superView = new ()
|
||||
{
|
||||
Id = "superView",
|
||||
Width = Dim.Fill(),
|
||||
Height = Dim.Fill()
|
||||
};
|
||||
superView.Add (view);
|
||||
|
||||
superView.BeginInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
Assert.True (superView.NeedsDisplay);
|
||||
|
||||
superView.EndInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
Assert.True (superView.NeedsDisplay);
|
||||
|
||||
superView.SetRelativeLayout (Application.Screen.Size);
|
||||
Assert.True (view.NeedsDisplay);
|
||||
Assert.True (superView.NeedsDisplay);
|
||||
|
||||
superView.NeedsDisplay = false;
|
||||
superView.SetRelativeLayout (new (10, 10));
|
||||
Assert.False (superView.NeedsDisplay);
|
||||
Assert.False (view.NeedsDisplay);
|
||||
|
||||
view.SetRelativeLayout (new (11, 11));
|
||||
Assert.True (superView.NeedsDisplay);
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NeedsDisplay_True_After_LayoutSubviews ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.BeginInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.EndInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.SetRelativeLayout (Application.Screen.Size);
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.LayoutSubviews ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NeedsDisplay_False_After_Draw ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.BeginInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.EndInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.SetRelativeLayout (Application.Screen.Size);
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.LayoutSubviews ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.Draw ();
|
||||
Assert.False (view.NeedsDisplay);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[SetupFakeDriver]
|
||||
public void Move_Is_Constrained_To_Viewport ()
|
||||
@@ -17,18 +150,18 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
Y = 1,
|
||||
Width = 3, Height = 3
|
||||
};
|
||||
view.Margin.Thickness = new Thickness (1);
|
||||
view.Margin.Thickness = new (1);
|
||||
|
||||
// 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 (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 (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 (2, 2), new Point (Application.Driver!.Col, Application.Driver!.Row));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -41,7 +174,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
Y = 1,
|
||||
Width = 3, Height = 3
|
||||
};
|
||||
view.Margin.Thickness = new Thickness (1);
|
||||
view.Margin.Thickness = new (1);
|
||||
View.Diagnostics = ViewDiagnosticFlags.Padding;
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
@@ -84,6 +217,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
superView.LayoutSubviews ();
|
||||
|
||||
superView.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -93,6 +227,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
Rectangle toFill = new (x, y, width, height);
|
||||
view.FillRect (toFill);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -103,6 +238,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
// Now try to clear beyond Viewport (invalid; clipping should prevent)
|
||||
superView.SetNeedsDisplay ();
|
||||
superView.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -111,6 +247,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
_output);
|
||||
toFill = new (-width, -height, width, height);
|
||||
view.FillRect (toFill);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -121,6 +258,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
// Now try to clear beyond Viewport (valid)
|
||||
superView.SetNeedsDisplay ();
|
||||
superView.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -129,6 +267,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
_output);
|
||||
toFill = new (-1, -1, width + 1, height + 1);
|
||||
view.FillRect (toFill);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -139,6 +278,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
// Now clear too much size
|
||||
superView.SetNeedsDisplay ();
|
||||
superView.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -147,6 +287,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
_output);
|
||||
toFill = new (0, 0, width * 2, height * 2);
|
||||
view.FillRect (toFill);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -174,6 +315,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
superView.LayoutSubviews ();
|
||||
|
||||
superView.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -182,6 +324,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
_output);
|
||||
|
||||
view.Clear ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -210,6 +353,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
superView.LayoutSubviews ();
|
||||
|
||||
superView.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -218,6 +362,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
_output);
|
||||
|
||||
view.Clear ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@"
|
||||
┌─┐
|
||||
@@ -226,7 +371,6 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
_output);
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
[AutoInitShutdown]
|
||||
[Trait ("Category", "Unicode")]
|
||||
@@ -243,7 +387,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
Assert.Equal (2, r.GetColumns ());
|
||||
|
||||
var win = new Window { Title = us };
|
||||
var view = new View { Text = r.ToString (), Height = Dim.Fill (), Width = Dim.Fill ()};
|
||||
var view = new View { Text = r.ToString (), Height = Dim.Fill (), Width = Dim.Fill () };
|
||||
var tf = new TextField { Text = us, Y = 1, Width = 3 };
|
||||
win.Add (view, tf);
|
||||
Toplevel top = new ();
|
||||
@@ -317,7 +461,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
""";
|
||||
|
||||
Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, _output);
|
||||
Assert.Equal (new Rectangle (0, 0, 30, 10), pos);
|
||||
Assert.Equal (new (0, 0, 30, 10), pos);
|
||||
|
||||
Application.End (rsDiag);
|
||||
dg.Dispose ();
|
||||
@@ -352,12 +496,13 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
Toplevel top = new ();
|
||||
top.Add (viewRight, viewBottom);
|
||||
|
||||
Application.Begin (top);
|
||||
var rs = Application.Begin (top);
|
||||
((FakeDriver)Application.Driver!).SetBufferSize (7, 7);
|
||||
Application.RunIteration (ref rs);
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
Test
|
||||
|
||||
|
||||
@@ -391,13 +536,25 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 2, BorderStyle = LineStyle.Single };
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.BeginInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.EndInit ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.SetRelativeLayout (Application.Screen.Size);
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.LayoutSubviews ();
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
Assert.Equal (new (0, 0, 2, 2), view.Frame);
|
||||
Assert.Equal (Rectangle.Empty, view.Viewport);
|
||||
|
||||
Assert.True (view.NeedsDisplay);
|
||||
|
||||
view.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
@@ -415,7 +572,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Bottom ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
||||
view.Border.Thickness = new Thickness (1, 1, 1, 0);
|
||||
view.Border.Thickness = new (1, 1, 1, 0);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Screen.Size);
|
||||
@@ -433,7 +590,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Left ()
|
||||
{
|
||||
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
||||
view.Border.Thickness = new Thickness (0, 1, 1, 1);
|
||||
view.Border.Thickness = new (0, 1, 1, 1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Screen.Size);
|
||||
@@ -458,7 +615,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Right ()
|
||||
{
|
||||
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
||||
view.Border.Thickness = new Thickness (1, 1, 0, 1);
|
||||
view.Border.Thickness = new (1, 1, 0, 1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
view.SetRelativeLayout (Application.Screen.Size);
|
||||
@@ -483,7 +640,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Top ()
|
||||
{
|
||||
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
||||
view.Border.Thickness = new Thickness (1, 0, 1, 1);
|
||||
view.Border.Thickness = new (1, 0, 1, 1);
|
||||
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
@@ -494,7 +651,8 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
view.Draw ();
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre ("││",
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"││",
|
||||
_output
|
||||
);
|
||||
}
|
||||
@@ -510,40 +668,40 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
Width = 1,
|
||||
Height = 7,
|
||||
Text = """
|
||||
s
|
||||
u
|
||||
b
|
||||
V
|
||||
i
|
||||
e
|
||||
w
|
||||
"""
|
||||
s
|
||||
u
|
||||
b
|
||||
V
|
||||
i
|
||||
e
|
||||
w
|
||||
"""
|
||||
};
|
||||
|
||||
var view = new View
|
||||
{
|
||||
Id = "view", Width = 2, Height = 20, Text = """
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
"""
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
0
|
||||
1
|
||||
2
|
||||
3
|
||||
4
|
||||
5
|
||||
6
|
||||
7
|
||||
8
|
||||
9
|
||||
"""
|
||||
};
|
||||
view.Add (subView);
|
||||
var content = new View { Id = "content", Width = 20, Height = 20 };
|
||||
@@ -560,12 +718,12 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
container.Add (content);
|
||||
Toplevel top = new ();
|
||||
top.Add (container);
|
||||
Application.Driver!.Clip = container.Frame;
|
||||
Application.Begin (top);
|
||||
var rs = Application.Begin (top);
|
||||
|
||||
top.Draw ();
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
0s
|
||||
1u
|
||||
2b
|
||||
@@ -580,7 +738,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
s
|
||||
u
|
||||
b
|
||||
@@ -600,7 +758,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
1u
|
||||
2b
|
||||
3V
|
||||
@@ -615,7 +773,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
6w
|
||||
7
|
||||
8
|
||||
@@ -630,7 +788,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
9
|
||||
""",
|
||||
_output
|
||||
@@ -682,9 +840,10 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
top.LayoutComplete += Top_LayoutComplete;
|
||||
Application.Begin (top);
|
||||
|
||||
Application.Refresh ();
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
01234
|
||||
subVi
|
||||
""",
|
||||
@@ -696,7 +855,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
12345
|
||||
ubVie
|
||||
""",
|
||||
@@ -708,7 +867,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
ubVie
|
||||
""",
|
||||
_output
|
||||
@@ -766,12 +925,12 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
container.Add (content);
|
||||
Toplevel top = new ();
|
||||
top.Add (container);
|
||||
Application.Driver!.Clip = container.Frame;
|
||||
Application.Begin (top);
|
||||
|
||||
Application.Refresh ();
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
0s
|
||||
1u
|
||||
2b
|
||||
@@ -786,7 +945,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
s
|
||||
u
|
||||
b
|
||||
@@ -806,7 +965,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
1u
|
||||
2b
|
||||
3V
|
||||
@@ -821,7 +980,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
6w
|
||||
7
|
||||
8
|
||||
@@ -836,7 +995,7 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (
|
||||
"""
|
||||
|
||||
|
||||
9
|
||||
""",
|
||||
_output
|
||||
@@ -892,15 +1051,16 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
|
||||
var expected = """
|
||||
|
||||
┌┤𝔹├─────┐
|
||||
│𝔹 │
|
||||
│𝔹 │
|
||||
└────────┘
|
||||
""";
|
||||
┌┤𝔹├─────┐
|
||||
│𝔹 │
|
||||
│𝔹 │
|
||||
└────────┘
|
||||
""";
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
|
||||
|
||||
TestHelpers.AssertDriverContentsAre (expected, _output);
|
||||
top.Dispose ();
|
||||
|
||||
// This test has nothing to do with color - removing as it is not relevant and fragile
|
||||
}
|
||||
|
||||
@@ -916,15 +1076,16 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
// Visible content is (1, 1, 10, 10)
|
||||
// Expected clip is (1, 1, 10, 10) - same as visible content
|
||||
Rectangle expectedClip = new (1, 1, 10, 10);
|
||||
|
||||
// Arrange
|
||||
var view = new View ()
|
||||
var view = new View
|
||||
{
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill (),
|
||||
ViewportSettings = ViewportSettings.ClipContentOnly
|
||||
};
|
||||
view.SetContentSize (new Size (10, 10));
|
||||
view.Border.Thickness = new Thickness (1);
|
||||
view.Border.Thickness = new (1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
Assert.Equal (view.Frame, Application.Driver?.Clip);
|
||||
@@ -949,14 +1110,15 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
// Visible content is (1, 1, 10, 10)
|
||||
// Expected clip is (1, 1, 23, 23) - same as Viewport
|
||||
Rectangle expectedClip = new (1, 1, 23, 23);
|
||||
|
||||
// Arrange
|
||||
var view = new View ()
|
||||
var view = new View
|
||||
{
|
||||
Width = Dim.Fill (),
|
||||
Height = Dim.Fill (),
|
||||
Height = Dim.Fill ()
|
||||
};
|
||||
view.SetContentSize (new Size (10, 10));
|
||||
view.Border.Thickness = new Thickness (1);
|
||||
view.Border.Thickness = new (1);
|
||||
view.BeginInit ();
|
||||
view.EndInit ();
|
||||
Assert.Equal (view.Frame, Application.Driver?.Clip);
|
||||
@@ -970,7 +1132,6 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
view.Dispose ();
|
||||
}
|
||||
|
||||
|
||||
[Fact]
|
||||
[TestRespondersDisposed]
|
||||
public void Draw_Throws_IndexOutOfRangeException_With_Negative_Bounds ()
|
||||
@@ -983,11 +1144,11 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
top.Add (view);
|
||||
|
||||
Application.Iteration += (s, a) =>
|
||||
{
|
||||
Assert.Equal (-2, view.X);
|
||||
{
|
||||
Assert.Equal (-2, view.X);
|
||||
|
||||
Application.RequestStop ();
|
||||
};
|
||||
Application.RequestStop ();
|
||||
};
|
||||
|
||||
try
|
||||
{
|
||||
@@ -1000,8 +1161,8 @@ public class DrawTests (ITestOutputHelper _output)
|
||||
}
|
||||
|
||||
top.Dispose ();
|
||||
|
||||
// Shutdown must be called to safely clean up Application if Init has been called
|
||||
Application.Shutdown ();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user