Browse Source

These should be testing against the Rectangles, not the strings

Brandon Thetford 1 year ago
parent
commit
8252203c75

+ 5 - 3
UnitTests/View/Text/AutoSizeFalseTests.cs

@@ -142,9 +142,10 @@ public class AutoSizeFalseTests
 
 
         view.Text = "New text";
         view.Text = "New text";
         super.LayoutSubviews ();
         super.LayoutSubviews ();
+        Rectangle expectedViewBounds = new (0, 0, 0, 0);
 
 
         Assert.False (view.AutoSize);
         Assert.False (view.AutoSize);
-        Assert.Equal ("(0,0,0,0)", view.Bounds.ToString ());
+        Assert.Equal (expectedViewBounds, view.Bounds);
         super.Dispose ();
         super.Dispose ();
     }
     }
 
 
@@ -158,9 +159,10 @@ public class AutoSizeFalseTests
 
 
         view.Text = "New text\nNew line";
         view.Text = "New text\nNew line";
         super.LayoutSubviews ();
         super.LayoutSubviews ();
+        Rectangle expectedViewBounds = new (0, 0, 30, 80);
 
 
         Assert.False (view.AutoSize);
         Assert.False (view.AutoSize);
-        Assert.Equal ("(0,0,30,80)", view.Bounds.ToString ());
+        Assert.Equal (expectedViewBounds, view.Bounds);
         Assert.False (view.IsInitialized);
         Assert.False (view.IsInitialized);
 
 
         super.BeginInit ();
         super.BeginInit ();
@@ -168,7 +170,7 @@ public class AutoSizeFalseTests
 
 
         Assert.True (view.IsInitialized);
         Assert.True (view.IsInitialized);
         Assert.False (view.AutoSize);
         Assert.False (view.AutoSize);
-        Assert.Equal ("(0,0,30,80)", view.Bounds.ToString ());
+        Assert.Equal (expectedViewBounds, view.Bounds);
     }
     }
 
 
     [Fact]
     [Fact]

+ 13 - 7
UnitTests/View/Text/AutoSizeTrueTests.cs

@@ -868,14 +868,16 @@ public class AutoSizeTrueTests
         win.EndInit ();
         win.EndInit ();
 
 
         Assert.True (label.AutoSize);
         Assert.True (label.AutoSize);
-        Assert.Equal ("(0,0,0,0)", label.Bounds.ToString ());
+        Rectangle expectedLabelBounds = Rectangle.Empty;
+        Assert.Equal (expectedLabelBounds, label.Bounds);
         Assert.True (label.AutoSize);
         Assert.True (label.AutoSize);
 
 
         label.Text = "First line\nSecond line";
         label.Text = "First line\nSecond line";
         win.LayoutSubviews ();
         win.LayoutSubviews ();
 
 
+        expectedLabelBounds = new (0, 0, 11, 2);
         Assert.True (label.AutoSize);
         Assert.True (label.AutoSize);
-        Assert.Equal ("(0,0,11,2)", label.Bounds.ToString ());
+        Assert.Equal (expectedLabelBounds, label.Bounds);
 
 
         label.AutoSize = false;
         label.AutoSize = false;
         label.Width = Dim.Fill ();
         label.Width = Dim.Fill ();
@@ -885,17 +887,19 @@ public class AutoSizeTrueTests
         // Here the SetMinWidthHeight ensuring the minimum height
         // Here the SetMinWidthHeight ensuring the minimum height
         // #3127: After: (0,0,28,2) because turning off AutoSize leaves
         // #3127: After: (0,0,28,2) because turning off AutoSize leaves
         // Height set to 2.
         // Height set to 2.
+        expectedLabelBounds = new (0, 0, 28, 2);
         Assert.False (label.AutoSize);
         Assert.False (label.AutoSize);
-        Assert.Equal ("(0,0,28,2)", label.Bounds.ToString ());
+        Assert.Equal (expectedLabelBounds, label.Bounds);
 
 
         label.Text = "First changed line\nSecond changed line\nNew line";
         label.Text = "First changed line\nSecond changed line\nNew line";
         win.LayoutSubviews ();
         win.LayoutSubviews ();
 
 
         // Here the AutoSize is false and the width 28 (Dim.Fill) and
         // Here the AutoSize is false and the width 28 (Dim.Fill) and
         // #3127: Before: height 1 because it wasn't set and SetMinWidthHeight ensuring the minimum height
         // #3127: Before: height 1 because it wasn't set and SetMinWidthHeight ensuring the minimum height
-        // #3127: After: (0,0,28,2) because setting Text leaves Height set to 2..
+        // #3127: After: (0,0,28,2) because setting Text leaves Height set to 2.
+        expectedLabelBounds = new (0, 0, 28, 2);
         Assert.False (label.AutoSize);
         Assert.False (label.AutoSize);
-        Assert.Equal ("(0,0,28,2)", label.Bounds.ToString ());
+        Assert.Equal (expectedLabelBounds, label.Bounds);
 
 
         label.AutoSize = true;
         label.AutoSize = true;
 
 
@@ -903,8 +907,9 @@ public class AutoSizeTrueTests
 
 
         // Here the AutoSize ensuring the right size with width 19 (width of longest line)
         // Here the AutoSize ensuring the right size with width 19 (width of longest line)
         // and height 3 because the text has 3 lines
         // and height 3 because the text has 3 lines
+        expectedLabelBounds = new (0, 0, 19, 3);
         Assert.True (label.AutoSize);
         Assert.True (label.AutoSize);
-        Assert.Equal ("(0,0,19,3)", label.Bounds.ToString ());
+        Assert.Equal (expectedLabelBounds, label.Bounds);
     }
     }
 
 
     [Fact]
     [Fact]
@@ -1486,7 +1491,8 @@ public class AutoSizeTrueTests
         super.LayoutSubviews ();
         super.LayoutSubviews ();
 
 
         Assert.True (label.AutoSize);
         Assert.True (label.AutoSize);
-        Assert.Equal ("(0,0,8,1)", label.Bounds.ToString ());
+        Rectangle expectedLabelBounds = new (0, 0, 8, 1);
+        Assert.Equal (expectedLabelBounds, label.Bounds);
         super.Dispose ();
         super.Dispose ();
     }
     }