|
@@ -5,7 +5,7 @@ using Xunit.Abstractions;
|
|
namespace Terminal.Gui.ViewTests;
|
|
namespace Terminal.Gui.ViewTests;
|
|
|
|
|
|
[Trait ("Category", "Output")]
|
|
[Trait ("Category", "Output")]
|
|
-public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
+public class DrawTests (ITestOutputHelper _output)
|
|
{
|
|
{
|
|
[Fact]
|
|
[Fact]
|
|
[SetupFakeDriver]
|
|
[SetupFakeDriver]
|
|
@@ -17,18 +17,18 @@ public class DrawTests (ITestOutputHelper output)
|
|
Y = 1,
|
|
Y = 1,
|
|
Width = 3, Height = 3
|
|
Width = 3, Height = 3
|
|
};
|
|
};
|
|
- view.Margin.Thickness = new (1);
|
|
|
|
|
|
+ view.Margin.Thickness = new Thickness (1);
|
|
|
|
|
|
// Only valid location w/in Viewport is 0, 0 (view) - 2, 2 (screen)
|
|
// Only valid location w/in Viewport is 0, 0 (view) - 2, 2 (screen)
|
|
|
|
|
|
view.Move (0, 0);
|
|
view.Move (0, 0);
|
|
- Assert.Equal (new (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);
|
|
view.Move (-1, -1);
|
|
- Assert.Equal (new (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);
|
|
view.Move (1, 1);
|
|
- Assert.Equal (new (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]
|
|
[Fact]
|
|
@@ -41,7 +41,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
Y = 1,
|
|
Y = 1,
|
|
Width = 3, Height = 3
|
|
Width = 3, Height = 3
|
|
};
|
|
};
|
|
- view.Margin.Thickness = new (1);
|
|
|
|
|
|
+ view.Margin.Thickness = new Thickness (1);
|
|
View.Diagnostics = ViewDiagnosticFlags.Padding;
|
|
View.Diagnostics = ViewDiagnosticFlags.Padding;
|
|
view.BeginInit ();
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.EndInit ();
|
|
@@ -84,83 +84,75 @@ public class DrawTests (ITestOutputHelper output)
|
|
superView.LayoutSubviews ();
|
|
superView.LayoutSubviews ();
|
|
|
|
|
|
superView.Draw ();
|
|
superView.Draw ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│X│
|
|
│X│
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
|
|
|
|
Rectangle toFill = new (x, y, width, height);
|
|
Rectangle toFill = new (x, y, width, height);
|
|
view.FillRect (toFill);
|
|
view.FillRect (toFill);
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│ │
|
|
│ │
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
|
|
|
|
// Now try to clear beyond Viewport (invalid; clipping should prevent)
|
|
// Now try to clear beyond Viewport (invalid; clipping should prevent)
|
|
superView.SetNeedsDisplay ();
|
|
superView.SetNeedsDisplay ();
|
|
superView.Draw ();
|
|
superView.Draw ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│X│
|
|
│X│
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
toFill = new (-width, -height, width, height);
|
|
toFill = new (-width, -height, width, height);
|
|
view.FillRect (toFill);
|
|
view.FillRect (toFill);
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│X│
|
|
│X│
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
|
|
|
|
// Now try to clear beyond Viewport (valid)
|
|
// Now try to clear beyond Viewport (valid)
|
|
superView.SetNeedsDisplay ();
|
|
superView.SetNeedsDisplay ();
|
|
superView.Draw ();
|
|
superView.Draw ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│X│
|
|
│X│
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
toFill = new (-1, -1, width + 1, height + 1);
|
|
toFill = new (-1, -1, width + 1, height + 1);
|
|
view.FillRect (toFill);
|
|
view.FillRect (toFill);
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│ │
|
|
│ │
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
|
|
|
|
// Now clear too much size
|
|
// Now clear too much size
|
|
superView.SetNeedsDisplay ();
|
|
superView.SetNeedsDisplay ();
|
|
superView.Draw ();
|
|
superView.Draw ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│X│
|
|
│X│
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
toFill = new (0, 0, width * 2, height * 2);
|
|
toFill = new (0, 0, width * 2, height * 2);
|
|
view.FillRect (toFill);
|
|
view.FillRect (toFill);
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│ │
|
|
│ │
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
}
|
|
}
|
|
|
|
|
|
[Theory]
|
|
[Theory]
|
|
@@ -185,22 +177,20 @@ public class DrawTests (ITestOutputHelper output)
|
|
superView.LayoutSubviews ();
|
|
superView.LayoutSubviews ();
|
|
|
|
|
|
superView.Draw ();
|
|
superView.Draw ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│X│
|
|
│X│
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
|
|
|
|
view.Clear ();
|
|
view.Clear ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│ │
|
|
│ │
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
}
|
|
}
|
|
|
|
|
|
[Theory]
|
|
[Theory]
|
|
@@ -226,24 +216,23 @@ public class DrawTests (ITestOutputHelper output)
|
|
superView.LayoutSubviews ();
|
|
superView.LayoutSubviews ();
|
|
|
|
|
|
superView.Draw ();
|
|
superView.Draw ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│X│
|
|
│X│
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
|
|
|
|
view.Clear ();
|
|
view.Clear ();
|
|
-
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@"
|
|
@"
|
|
┌─┐
|
|
┌─┐
|
|
│ │
|
|
│ │
|
|
└─┘",
|
|
└─┘",
|
|
- output);
|
|
|
|
|
|
+ _output);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
[Fact]
|
|
[Fact]
|
|
[AutoInitShutdown]
|
|
[AutoInitShutdown]
|
|
[Trait ("Category", "Unicode")]
|
|
[Trait ("Category", "Unicode")]
|
|
@@ -260,7 +249,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
Assert.Equal (2, r.GetColumns ());
|
|
Assert.Equal (2, r.GetColumns ());
|
|
|
|
|
|
var win = new Window { Title = us };
|
|
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 };
|
|
var tf = new TextField { Text = us, Y = 1, Width = 3 };
|
|
win.Add (view, tf);
|
|
win.Add (view, tf);
|
|
Toplevel top = new ();
|
|
Toplevel top = new ();
|
|
@@ -276,12 +265,12 @@ public class DrawTests (ITestOutputHelper output)
|
|
│豈 │
|
|
│豈 │
|
|
└────────┘
|
|
└────────┘
|
|
""";
|
|
""";
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, _output);
|
|
|
|
|
|
- TestHelpers.AssertDriverContentsAre (expectedOutput, output);
|
|
|
|
- top.Dispose ();
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsAre (expectedOutput, _output);
|
|
|
|
|
|
// This test has nothing to do with color - removing as it is not relevant and fragile
|
|
// This test has nothing to do with color - removing as it is not relevant and fragile
|
|
|
|
+ top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
// TODO: Refactor this test to not depend on TextView etc... Make it as primitive as possible
|
|
// TODO: Refactor this test to not depend on TextView etc... Make it as primitive as possible
|
|
@@ -334,10 +323,11 @@ public class DrawTests (ITestOutputHelper output)
|
|
└────────────────────────────┘
|
|
└────────────────────────────┘
|
|
""";
|
|
""";
|
|
|
|
|
|
- Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, output);
|
|
|
|
- Assert.Equal (new (0, 0, 30, 10), pos);
|
|
|
|
|
|
+ Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expectedOutput, _output);
|
|
|
|
+ Assert.Equal (new Rectangle (0, 0, 30, 10), pos);
|
|
|
|
|
|
Application.End (rsDiag);
|
|
Application.End (rsDiag);
|
|
|
|
+ dg.Dispose ();
|
|
Application.End (rsTop);
|
|
Application.End (rsTop);
|
|
top.Dispose ();
|
|
top.Dispose ();
|
|
}
|
|
}
|
|
@@ -374,16 +364,16 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
Test
|
|
Test
|
|
|
|
|
|
|
|
|
|
- T
|
|
|
|
- e
|
|
|
|
- s
|
|
|
|
- t
|
|
|
|
|
|
+ T
|
|
|
|
+ e
|
|
|
|
+ s
|
|
|
|
+ t
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
TestHelpers.AssertDriverAttributesAre (
|
|
TestHelpers.AssertDriverAttributesAre (
|
|
@@ -423,7 +413,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
┌┐
|
|
┌┐
|
|
└┘
|
|
└┘
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -432,7 +422,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Bottom ()
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Bottom ()
|
|
{
|
|
{
|
|
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
|
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
|
- view.Border.Thickness = new (1, 1, 1, 0);
|
|
|
|
|
|
+ view.Border.Thickness = new Thickness (1, 1, 1, 0);
|
|
view.BeginInit ();
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.EndInit ();
|
|
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
|
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
|
@@ -442,7 +432,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
view.Draw ();
|
|
view.Draw ();
|
|
|
|
|
|
- TestHelpers.AssertDriverContentsWithFrameAre ("──", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("──", _output);
|
|
}
|
|
}
|
|
|
|
|
|
[Fact]
|
|
[Fact]
|
|
@@ -450,7 +440,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Left ()
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Left ()
|
|
{
|
|
{
|
|
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
|
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
|
- view.Border.Thickness = new (0, 1, 1, 1);
|
|
|
|
|
|
+ view.Border.Thickness = new Thickness (0, 1, 1, 1);
|
|
view.BeginInit ();
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.EndInit ();
|
|
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
|
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
|
@@ -466,7 +456,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
│
|
|
│
|
|
│
|
|
│
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -475,7 +465,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Right ()
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Right ()
|
|
{
|
|
{
|
|
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
|
var view = new View { Width = 1, Height = 2, BorderStyle = LineStyle.Single };
|
|
- view.Border.Thickness = new (1, 1, 0, 1);
|
|
|
|
|
|
+ view.Border.Thickness = new Thickness (1, 1, 0, 1);
|
|
view.BeginInit ();
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.EndInit ();
|
|
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
|
view.SetRelativeLayout (Application.Driver.Screen.Size);
|
|
@@ -491,7 +481,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
│
|
|
│
|
|
│
|
|
│
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -500,7 +490,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Top ()
|
|
public void Draw_Minimum_Full_Border_With_Empty_Viewport_Without_Top ()
|
|
{
|
|
{
|
|
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
|
var view = new View { Width = 2, Height = 1, BorderStyle = LineStyle.Single };
|
|
- view.Border.Thickness = new (1, 0, 1, 1);
|
|
|
|
|
|
+ view.Border.Thickness = new Thickness (1, 0, 1, 1);
|
|
|
|
|
|
view.BeginInit ();
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.EndInit ();
|
|
@@ -511,9 +501,8 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
view.Draw ();
|
|
view.Draw ();
|
|
|
|
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (
|
|
|
|
- "││",
|
|
|
|
- output
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("││",
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -528,40 +517,40 @@ public class DrawTests (ITestOutputHelper output)
|
|
Width = 1,
|
|
Width = 1,
|
|
Height = 7,
|
|
Height = 7,
|
|
Text = """
|
|
Text = """
|
|
- s
|
|
|
|
- u
|
|
|
|
- b
|
|
|
|
- V
|
|
|
|
- i
|
|
|
|
- e
|
|
|
|
- w
|
|
|
|
- """
|
|
|
|
|
|
+ s
|
|
|
|
+ u
|
|
|
|
+ b
|
|
|
|
+ V
|
|
|
|
+ i
|
|
|
|
+ e
|
|
|
|
+ w
|
|
|
|
+ """
|
|
};
|
|
};
|
|
|
|
|
|
var view = new View
|
|
var view = new View
|
|
{
|
|
{
|
|
Id = "view", Width = 2, Height = 20, Text = """
|
|
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);
|
|
view.Add (subView);
|
|
var content = new View { Id = "content", Width = 20, Height = 20 };
|
|
var content = new View { Id = "content", Width = 20, Height = 20 };
|
|
@@ -583,14 +572,14 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
0s
|
|
0s
|
|
1u
|
|
1u
|
|
2b
|
|
2b
|
|
3V
|
|
3V
|
|
4i
|
|
4i
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.X = -1;
|
|
content.X = -1;
|
|
@@ -598,19 +587,19 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
s
|
|
s
|
|
u
|
|
u
|
|
b
|
|
b
|
|
V
|
|
V
|
|
i
|
|
i
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.X = -2;
|
|
content.X = -2;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (@"", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (@"", _output);
|
|
|
|
|
|
content.X = 0;
|
|
content.X = 0;
|
|
content.Y = -1;
|
|
content.Y = -1;
|
|
@@ -618,14 +607,14 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
1u
|
|
1u
|
|
2b
|
|
2b
|
|
3V
|
|
3V
|
|
4i
|
|
4i
|
|
5e
|
|
5e
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -6;
|
|
content.Y = -6;
|
|
@@ -633,14 +622,14 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
6w
|
|
6w
|
|
- 7
|
|
|
|
- 8
|
|
|
|
- 9
|
|
|
|
- 0
|
|
|
|
|
|
+ 7
|
|
|
|
+ 8
|
|
|
|
+ 9
|
|
|
|
+ 0
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -19;
|
|
content.Y = -19;
|
|
@@ -648,20 +637,20 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
9
|
|
9
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -20;
|
|
content.Y = -20;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre ("", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
|
|
|
|
|
|
content.X = -2;
|
|
content.X = -2;
|
|
content.Y = 0;
|
|
content.Y = 0;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre ("", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
|
|
top.Dispose ();
|
|
top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -704,11 +693,11 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
01234
|
|
01234
|
|
subVi
|
|
subVi
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.X = -1;
|
|
content.X = -1;
|
|
@@ -716,11 +705,11 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
12345
|
|
12345
|
|
ubVie
|
|
ubVie
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -1;
|
|
content.Y = -1;
|
|
@@ -728,20 +717,20 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
ubVie
|
|
ubVie
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -2;
|
|
content.Y = -2;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre ("", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
|
|
|
|
|
|
content.X = -20;
|
|
content.X = -20;
|
|
content.Y = 0;
|
|
content.Y = 0;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre ("", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
|
|
top.Dispose ();
|
|
top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -787,14 +776,14 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
0s
|
|
0s
|
|
1u
|
|
1u
|
|
2b
|
|
2b
|
|
3V
|
|
3V
|
|
4i
|
|
4i
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.X = -1;
|
|
content.X = -1;
|
|
@@ -802,19 +791,19 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
s
|
|
s
|
|
u
|
|
u
|
|
b
|
|
b
|
|
V
|
|
V
|
|
i
|
|
i
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.X = -2;
|
|
content.X = -2;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (@"", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (@"", _output);
|
|
|
|
|
|
content.X = 0;
|
|
content.X = 0;
|
|
content.Y = -1;
|
|
content.Y = -1;
|
|
@@ -822,14 +811,14 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
1u
|
|
1u
|
|
2b
|
|
2b
|
|
3V
|
|
3V
|
|
4i
|
|
4i
|
|
5e
|
|
5e
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -6;
|
|
content.Y = -6;
|
|
@@ -837,14 +826,14 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
6w
|
|
6w
|
|
- 7
|
|
|
|
- 8
|
|
|
|
- 9
|
|
|
|
- 0
|
|
|
|
|
|
+ 7
|
|
|
|
+ 8
|
|
|
|
+ 9
|
|
|
|
+ 0
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -19;
|
|
content.Y = -19;
|
|
@@ -852,20 +841,20 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
"""
|
|
"""
|
|
-
|
|
|
|
|
|
+
|
|
9
|
|
9
|
|
""",
|
|
""",
|
|
- output
|
|
|
|
|
|
+ _output
|
|
);
|
|
);
|
|
|
|
|
|
content.Y = -20;
|
|
content.Y = -20;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre ("", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
|
|
|
|
|
|
content.X = -2;
|
|
content.X = -2;
|
|
content.Y = 0;
|
|
content.Y = 0;
|
|
Application.Refresh ();
|
|
Application.Refresh ();
|
|
- TestHelpers.AssertDriverContentsWithFrameAre ("", output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre ("", _output);
|
|
top.Dispose ();
|
|
top.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
@@ -878,7 +867,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
var view = new View { Width = 10, Height = 1 };
|
|
var view = new View { Width = 10, Height = 1 };
|
|
view.DrawHotString (expected, Attribute.Default, Attribute.Default);
|
|
view.DrawHotString (expected, Attribute.Default, Attribute.Default);
|
|
|
|
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
|
|
}
|
|
}
|
|
|
|
|
|
// TODO: The tests below that use Label should use View instead.
|
|
// TODO: The tests below that use Label should use View instead.
|
|
@@ -908,16 +897,15 @@ public class DrawTests (ITestOutputHelper output)
|
|
|
|
|
|
var expected = """
|
|
var expected = """
|
|
|
|
|
|
- ┌┤𝔹├─────┐
|
|
|
|
- │𝔹 │
|
|
|
|
- │𝔹 │
|
|
|
|
- └────────┘
|
|
|
|
- """;
|
|
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (expected, output);
|
|
|
|
|
|
+ ┌┤𝔹├─────┐
|
|
|
|
+ │𝔹 │
|
|
|
|
+ │𝔹 │
|
|
|
|
+ └────────┘
|
|
|
|
+ """;
|
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
|
|
|
|
|
|
- TestHelpers.AssertDriverContentsAre (expected, output);
|
|
|
|
|
|
+ TestHelpers.AssertDriverContentsAre (expected, _output);
|
|
top.Dispose ();
|
|
top.Dispose ();
|
|
-
|
|
|
|
// This test has nothing to do with color - removing as it is not relevant and fragile
|
|
// This test has nothing to do with color - removing as it is not relevant and fragile
|
|
}
|
|
}
|
|
|
|
|
|
@@ -933,16 +921,15 @@ public class DrawTests (ITestOutputHelper output)
|
|
// Visible content is (1, 1, 10, 10)
|
|
// Visible content is (1, 1, 10, 10)
|
|
// Expected clip is (1, 1, 10, 10) - same as visible content
|
|
// Expected clip is (1, 1, 10, 10) - same as visible content
|
|
Rectangle expectedClip = new (1, 1, 10, 10);
|
|
Rectangle expectedClip = new (1, 1, 10, 10);
|
|
-
|
|
|
|
// Arrange
|
|
// Arrange
|
|
- var view = new View
|
|
|
|
|
|
+ var view = new View ()
|
|
{
|
|
{
|
|
Width = Dim.Fill (),
|
|
Width = Dim.Fill (),
|
|
Height = Dim.Fill (),
|
|
Height = Dim.Fill (),
|
|
ViewportSettings = ViewportSettings.ClipContentOnly
|
|
ViewportSettings = ViewportSettings.ClipContentOnly
|
|
};
|
|
};
|
|
view.SetContentSize (new Size (10, 10));
|
|
view.SetContentSize (new Size (10, 10));
|
|
- view.Border.Thickness = new (1);
|
|
|
|
|
|
+ view.Border.Thickness = new Thickness (1);
|
|
view.BeginInit ();
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.EndInit ();
|
|
Assert.Equal (view.Frame, Application.Driver.Clip);
|
|
Assert.Equal (view.Frame, Application.Driver.Clip);
|
|
@@ -967,15 +954,14 @@ public class DrawTests (ITestOutputHelper output)
|
|
// Visible content is (1, 1, 10, 10)
|
|
// Visible content is (1, 1, 10, 10)
|
|
// Expected clip is (1, 1, 23, 23) - same as Viewport
|
|
// Expected clip is (1, 1, 23, 23) - same as Viewport
|
|
Rectangle expectedClip = new (1, 1, 23, 23);
|
|
Rectangle expectedClip = new (1, 1, 23, 23);
|
|
-
|
|
|
|
// Arrange
|
|
// Arrange
|
|
- var view = new View
|
|
|
|
|
|
+ var view = new View ()
|
|
{
|
|
{
|
|
Width = Dim.Fill (),
|
|
Width = Dim.Fill (),
|
|
- Height = Dim.Fill ()
|
|
|
|
|
|
+ Height = Dim.Fill (),
|
|
};
|
|
};
|
|
view.SetContentSize (new Size (10, 10));
|
|
view.SetContentSize (new Size (10, 10));
|
|
- view.Border.Thickness = new (1);
|
|
|
|
|
|
+ view.Border.Thickness = new Thickness (1);
|
|
view.BeginInit ();
|
|
view.BeginInit ();
|
|
view.EndInit ();
|
|
view.EndInit ();
|
|
Assert.Equal (view.Frame, Application.Driver.Clip);
|
|
Assert.Equal (view.Frame, Application.Driver.Clip);
|
|
@@ -989,6 +975,7 @@ public class DrawTests (ITestOutputHelper output)
|
|
view.Dispose ();
|
|
view.Dispose ();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
[Fact]
|
|
[Fact]
|
|
[TestRespondersDisposed]
|
|
[TestRespondersDisposed]
|
|
public void Draw_Throws_IndexOutOfRangeException_With_Negative_Bounds ()
|
|
public void Draw_Throws_IndexOutOfRangeException_With_Negative_Bounds ()
|
|
@@ -1001,11 +988,11 @@ public class DrawTests (ITestOutputHelper output)
|
|
top.Add (view);
|
|
top.Add (view);
|
|
|
|
|
|
Application.Iteration += (s, a) =>
|
|
Application.Iteration += (s, a) =>
|
|
- {
|
|
|
|
- Assert.Equal (-2, view.X);
|
|
|
|
|
|
+ {
|
|
|
|
+ Assert.Equal (-2, view.X);
|
|
|
|
|
|
- Application.RequestStop ();
|
|
|
|
- };
|
|
|
|
|
|
+ Application.RequestStop ();
|
|
|
|
+ };
|
|
|
|
|
|
try
|
|
try
|
|
{
|
|
{
|
|
@@ -1018,8 +1005,8 @@ public class DrawTests (ITestOutputHelper output)
|
|
}
|
|
}
|
|
|
|
|
|
top.Dispose ();
|
|
top.Dispose ();
|
|
-
|
|
|
|
// Shutdown must be called to safely clean up Application if Init has been called
|
|
// Shutdown must be called to safely clean up Application if Init has been called
|
|
Application.Shutdown ();
|
|
Application.Shutdown ();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|