Browse Source

Test against Rectangles, not strings

Brandon Thetford 1 year ago
parent
commit
e670960ee0
1 changed files with 13 additions and 17 deletions
  1. 13 17
      UnitTests/View/DrawTests.cs

+ 13 - 17
UnitTests/View/DrawTests.cs

@@ -1,4 +1,4 @@
-using System.Text;
+using System.Text;
 using Xunit.Abstractions;
 using Xunit.Abstractions;
 
 
 namespace Terminal.Gui.ViewsTests;
 namespace Terminal.Gui.ViewsTests;
@@ -176,8 +176,8 @@ t     ",
         view.EndInit ();
         view.EndInit ();
         view.SetRelativeLayout (Application.Driver.Bounds);
         view.SetRelativeLayout (Application.Driver.Bounds);
 
 
-        Assert.Equal ("(0,0,2,2)", view.Frame.ToString ());
-        Assert.Equal ("(0,0,0,0)", view.Bounds.ToString ());
+        Assert.Equal (new (0,0,2,2), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Bounds);
 
 
         view.Draw ();
         view.Draw ();
 
 
@@ -199,16 +199,12 @@ t     ",
         view.EndInit ();
         view.EndInit ();
         view.SetRelativeLayout (Application.Driver.Bounds);
         view.SetRelativeLayout (Application.Driver.Bounds);
 
 
-        Assert.Equal ("(0,0,2,1)", view.Frame.ToString ());
-        Assert.Equal ("(0,0,0,0)", view.Bounds.ToString ());
+        Assert.Equal (new (0,0,2,1), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Bounds);
 
 
         view.Draw ();
         view.Draw ();
 
 
-        TestHelpers.AssertDriverContentsWithFrameAre (
-                                                      @"
-",
-                                                      _output
-                                                     );
+        TestHelpers.AssertDriverContentsWithFrameAre (string.Empty, _output);
     }
     }
 
 
     [Fact]
     [Fact]
@@ -221,8 +217,8 @@ t     ",
         view.EndInit ();
         view.EndInit ();
         view.SetRelativeLayout (Application.Driver.Bounds);
         view.SetRelativeLayout (Application.Driver.Bounds);
 
 
-        Assert.Equal ("(0,0,1,2)", view.Frame.ToString ());
-        Assert.Equal ("(0,0,0,0)", view.Bounds.ToString ());
+        Assert.Equal (new (0,0,1,2), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Bounds);
 
 
         view.Draw ();
         view.Draw ();
 
 
@@ -244,8 +240,8 @@ t     ",
         view.EndInit ();
         view.EndInit ();
         view.SetRelativeLayout (Application.Driver.Bounds);
         view.SetRelativeLayout (Application.Driver.Bounds);
 
 
-        Assert.Equal ("(0,0,1,2)", view.Frame.ToString ());
-        Assert.Equal ("(0,0,0,0)", view.Bounds.ToString ());
+        Assert.Equal (new (0,0,1,2), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Bounds);
 
 
         view.Draw ();
         view.Draw ();
 
 
@@ -268,8 +264,8 @@ t     ",
         view.EndInit ();
         view.EndInit ();
         view.SetRelativeLayout (Application.Driver.Bounds);
         view.SetRelativeLayout (Application.Driver.Bounds);
 
 
-        Assert.Equal ("(0,0,2,1)", view.Frame.ToString ());
-        Assert.Equal ("(0,0,0,0)", view.Bounds.ToString ());
+        Assert.Equal (new (0,0,2,1), view.Frame);
+        Assert.Equal (Rectangle.Empty, view.Bounds);
 
 
         view.Draw ();
         view.Draw ();
 
 
@@ -393,7 +389,7 @@ t     ",
     [AutoInitShutdown]
     [AutoInitShutdown]
     public void Draw_Negative_Bounds_Horizontal_Without_New_Lines ()
     public void Draw_Negative_Bounds_Horizontal_Without_New_Lines ()
     {
     {
-        // BUGBUG: This previously assumed the default height of a View was 1. 
+        // BUGBUG: This previously assumed the default height of a View was 1.
         var subView = new View
         var subView = new View
         {
         {
             Id = "subView",
             Id = "subView",