|
@@ -1,5 +1,4 @@
|
|
|
-using Microsoft.VisualStudio.TestPlatform.Utilities;
|
|
|
-using Xunit.Abstractions;
|
|
|
+using Xunit.Abstractions;
|
|
|
using static Terminal.Gui.Dim;
|
|
|
using static Terminal.Gui.Pos;
|
|
|
|
|
@@ -16,7 +15,6 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
Assert.NotNull (posCenter);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
[Fact]
|
|
|
public void PosCenter_Equals ()
|
|
|
{
|
|
@@ -27,7 +25,6 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
Assert.False (posCenter2.Equals (posCenter1));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
[Fact]
|
|
|
public void PosCenter_ToString ()
|
|
|
{
|
|
@@ -42,7 +39,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
{
|
|
|
var posCenter = new PosCenter ();
|
|
|
var width = 50;
|
|
|
- var expectedAnchor = width / 2;
|
|
|
+ int expectedAnchor = width / 2;
|
|
|
|
|
|
Assert.Equal (expectedAnchor, posCenter.GetAnchor (width));
|
|
|
}
|
|
@@ -50,16 +47,15 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
[Fact]
|
|
|
public void PosCenter_CreatesCorrectInstance ()
|
|
|
{
|
|
|
- var pos = Pos.Center ();
|
|
|
+ Pos pos = Center ();
|
|
|
Assert.IsType<PosCenter> (pos);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
[Fact]
|
|
|
public void PosCenter_Calculate_ReturnsExpectedValue ()
|
|
|
{
|
|
|
var posCenter = new PosCenter ();
|
|
|
- var result = posCenter.Calculate (10, new DimAbsolute (2), null, Dimension.None);
|
|
|
+ int result = posCenter.Calculate (10, new DimAbsolute (2), null, Dimension.None);
|
|
|
Assert.Equal (4, result);
|
|
|
}
|
|
|
|
|
@@ -77,11 +73,11 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
[InlineData (10)]
|
|
|
public void PosCenter_SubView_85_Percent_Height (int height)
|
|
|
{
|
|
|
- var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
|
|
|
+ var win = new Window { Width = Fill (), Height = Fill () };
|
|
|
|
|
|
var subview = new Window
|
|
|
{
|
|
|
- X = Pos.Center (), Y = Pos.Center (), Width = Dim.Percent (85), Height = Dim.Percent (85)
|
|
|
+ X = Center (), Y = Center (), Width = Dim.Percent (85), Height = Dim.Percent (85)
|
|
|
};
|
|
|
|
|
|
win.Add (subview);
|
|
@@ -200,12 +196,14 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
│ └─────────────┘ │
|
|
|
│ │
|
|
|
└──────────────────┘"
|
|
|
- ;
|
|
|
+ ;
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
_ = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
|
|
|
Application.End (rs);
|
|
|
+ win.Dispose ();
|
|
|
}
|
|
|
|
|
|
[Theory]
|
|
@@ -222,11 +220,11 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
[InlineData (10)]
|
|
|
public void PosCenter_SubView_85_Percent_Width (int width)
|
|
|
{
|
|
|
- var win = new Window { Width = Dim.Fill (), Height = Dim.Fill () };
|
|
|
+ var win = new Window { Width = Fill (), Height = Fill () };
|
|
|
|
|
|
var subview = new Window
|
|
|
{
|
|
|
- X = Pos.Center (), Y = Pos.Center (), Width = Dim.Percent (85), Height = Dim.Percent (85)
|
|
|
+ X = Center (), Y = Center (), Width = Dim.Percent (85), Height = Dim.Percent (85)
|
|
|
};
|
|
|
|
|
|
win.Add (subview);
|
|
@@ -241,7 +239,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
switch (width)
|
|
|
{
|
|
|
case 1:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 0, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 0, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
│
|
|
@@ -254,7 +252,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 2:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 0, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 0, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌┐
|
|
@@ -267,7 +265,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 3:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 0, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 0, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌─┐
|
|
@@ -280,7 +278,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 4:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 1, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 1, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌──┐
|
|
@@ -293,7 +291,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 5:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 2, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 2, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌───┐
|
|
@@ -306,7 +304,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 6:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 3, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 3, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌────┐
|
|
@@ -319,7 +317,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 7:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 4, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 4, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌─────┐
|
|
@@ -332,7 +330,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 8:
|
|
|
- Assert.Equal (new Rectangle (0, 0, 5, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (0, 0, 5, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌──────┐
|
|
@@ -345,7 +343,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 9:
|
|
|
- Assert.Equal (new Rectangle (1, 0, 5, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (1, 0, 5, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌───────┐
|
|
@@ -358,7 +356,7 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
|
|
|
break;
|
|
|
case 10:
|
|
|
- Assert.Equal (new Rectangle (1, 0, 6, 4), subview.Frame);
|
|
|
+ Assert.Equal (new (1, 0, 6, 4), subview.Frame);
|
|
|
|
|
|
expected = @"
|
|
|
┌────────┐
|
|
@@ -368,11 +366,13 @@ public class PosCenterTests (ITestOutputHelper output)
|
|
|
│ └────┘ │
|
|
|
│ │
|
|
|
└────────┘"
|
|
|
- ;
|
|
|
+ ;
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
_ = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
|
|
|
Application.End (rs);
|
|
|
+ win.Dispose ();
|
|
|
}
|
|
|
}
|