|
@@ -2,11 +2,8 @@
|
|
|
|
|
|
namespace Terminal.Gui.ViewsTests;
|
|
|
|
|
|
-public class FrameViewTests
|
|
|
+public class FrameViewTests (ITestOutputHelper output)
|
|
|
{
|
|
|
- private readonly ITestOutputHelper _output;
|
|
|
- public FrameViewTests (ITestOutputHelper output) { _output = output; }
|
|
|
-
|
|
|
[Fact]
|
|
|
public void Constructors_Defaults ()
|
|
|
{
|
|
@@ -15,12 +12,12 @@ public class FrameViewTests
|
|
|
Assert.Equal (string.Empty, fv.Text);
|
|
|
Assert.Equal (LineStyle.Single, fv.BorderStyle);
|
|
|
|
|
|
- fv = new FrameView { Title = "Test" };
|
|
|
+ fv = new() { Title = "Test" };
|
|
|
Assert.Equal ("Test", fv.Title);
|
|
|
Assert.Equal (string.Empty, fv.Text);
|
|
|
Assert.Equal (LineStyle.Single, fv.BorderStyle);
|
|
|
|
|
|
- fv = new FrameView
|
|
|
+ fv = new()
|
|
|
{
|
|
|
X = 1,
|
|
|
Y = 2,
|
|
@@ -33,7 +30,7 @@ public class FrameViewTests
|
|
|
fv.BeginInit ();
|
|
|
fv.EndInit ();
|
|
|
Assert.Equal (LineStyle.Single, fv.BorderStyle);
|
|
|
- Assert.Equal (new Rectangle (1, 2, 10, 20), fv.Frame);
|
|
|
+ Assert.Equal (new (1, 2, 10, 20), fv.Frame);
|
|
|
}
|
|
|
|
|
|
[Fact]
|
|
@@ -47,12 +44,12 @@ public class FrameViewTests
|
|
|
var top = new Toplevel ();
|
|
|
top.Add (fv);
|
|
|
Application.Begin (top);
|
|
|
- Assert.Equal (new Rectangle (0, 0, 0, 0), fv.Frame);
|
|
|
- TestHelpers.AssertDriverContentsWithFrameAre (@"", _output);
|
|
|
+ Assert.Equal (new (0, 0, 0, 0), fv.Frame);
|
|
|
+ TestHelpers.AssertDriverContentsWithFrameAre (@"", output);
|
|
|
|
|
|
fv.Height = 5;
|
|
|
fv.Width = 5;
|
|
|
- Assert.Equal (new Rectangle (0, 0, 5, 5), fv.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 5, 5), fv.Frame);
|
|
|
Application.Refresh ();
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@@ -62,12 +59,12 @@ public class FrameViewTests
|
|
|
│ │
|
|
|
│ │
|
|
|
└───┘",
|
|
|
- _output
|
|
|
+ output
|
|
|
);
|
|
|
|
|
|
fv.X = 1;
|
|
|
fv.Y = 2;
|
|
|
- Assert.Equal (new Rectangle (1, 2, 5, 5), fv.Frame);
|
|
|
+ Assert.Equal (new (1, 2, 5, 5), fv.Frame);
|
|
|
Application.Refresh ();
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@@ -77,12 +74,12 @@ public class FrameViewTests
|
|
|
│ │
|
|
|
│ │
|
|
|
└───┘",
|
|
|
- _output
|
|
|
+ output
|
|
|
);
|
|
|
|
|
|
fv.X = -1;
|
|
|
fv.Y = -2;
|
|
|
- Assert.Equal (new Rectangle (-1, -2, 5, 5), fv.Frame);
|
|
|
+ Assert.Equal (new (-1, -2, 5, 5), fv.Frame);
|
|
|
Application.Refresh ();
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
@@ -90,19 +87,20 @@ public class FrameViewTests
|
|
|
│
|
|
|
│
|
|
|
───┘",
|
|
|
- _output
|
|
|
+ output
|
|
|
);
|
|
|
|
|
|
fv.X = 7;
|
|
|
fv.Y = 8;
|
|
|
- Assert.Equal (new Rectangle (7, 8, 5, 5), fv.Frame);
|
|
|
+ Assert.Equal (new (7, 8, 5, 5), fv.Frame);
|
|
|
Application.Refresh ();
|
|
|
|
|
|
TestHelpers.AssertDriverContentsWithFrameAre (
|
|
|
@"
|
|
|
┌──
|
|
|
│ ",
|
|
|
- _output
|
|
|
+ output
|
|
|
);
|
|
|
+ top.Dispose ();
|
|
|
}
|
|
|
}
|