Browse Source

Add explicit casts to a few tests to ensure the correct type is tested.

Brandon Thetford 1 year ago
parent
commit
ac0b655b1a

+ 9 - 9
UnitTests/Dialogs/DialogTests.cs

@@ -246,7 +246,7 @@ public class DialogTests
                                                       new Button { Text = btn3Text },
                                                       new Button { Text = btn4Text }
                                                      );
-        Assert.Equal (new Size (width, 1), dlg.Frame.Size);
+        Assert.Equal (new Size (width, 1), (Size)dlg.Frame.Size);
         TestHelpers.AssertDriverContentsWithFrameAre ($"{buttonRow}", _output);
         End (runstate);
 
@@ -1114,7 +1114,7 @@ public class DialogTests
 
         // Default location is centered, so 100 / 2 - 85 / 2 = 7
         var expected = 7;
-        Assert.Equal (new Point (expected, expected), d.Frame.Location);
+        Assert.Equal (new Point (expected, expected), (Point)d.Frame.Location);
     }
 
     [Fact]
@@ -1127,7 +1127,7 @@ public class DialogTests
 
         // Default location is centered, so 100 / 2 - 85 / 2 = 7
         var expected = 1;
-        Assert.Equal (new Point (expected, expected), d.Frame.Location);
+        Assert.Equal (new Point (expected, expected), (Point)d.Frame.Location);
     }
 
     [Fact]
@@ -1140,7 +1140,7 @@ public class DialogTests
         ((FakeDriver)Driver).SetBufferSize (20, 10);
 
         // Default location is centered, so 100 / 2 - 85 / 2 = 7
-        Assert.Equal (new Point (expected, expected), d.Frame.Location);
+        Assert.Equal (new Point (expected, expected), (Point)d.Frame.Location);
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -1170,7 +1170,7 @@ public class DialogTests
                              var d = new Dialog { X = 5, Y = 5, Height = 3, Width = 5 };
                              Begin (d);
 
-                             Assert.Equal (new Point (5, 5), d.Frame.Location);
+                             Assert.Equal (new Point (5, 5), (Point)d.Frame.Location);
 
                              TestHelpers.AssertDriverContentsWithFrameAre (
                                                                            @"
@@ -1191,7 +1191,7 @@ public class DialogTests
                              Begin (d);
 
                              // This is because of PostionTopLevels and EnsureVisibleBounds
-                             Assert.Equal (new Point (3, 2), d.Frame.Location);
+                             Assert.Equal (new Point (3, 2), (Point)d.Frame.Location);
 
                              // #3127: Before					
                              //					Assert.Equal (new Size (17, 8), d.Frame.Size);
@@ -1208,7 +1208,7 @@ public class DialogTests
                              //╚══└───────────────┘", _output);
 
                              // #3127: After: Because Toplevel is now Width/Height = Dim.Filll
-                             Assert.Equal (new Size (15, 6), d.Frame.Size);
+                             Assert.Equal (new Size (15, 6), (Size)d.Frame.Size);
 
                              TestHelpers.AssertDriverContentsWithFrameAre (
                                                                            @"
@@ -1272,7 +1272,7 @@ public class DialogTests
         ((FakeDriver)Driver).SetBufferSize (100, 100);
 
         // Default size is Percent(85) 
-        Assert.Equal (new Size ((int)(100 * .85), (int)(100 * .85)), d.Frame.Size);
+        Assert.Equal (new Size ((int)(100 * .85), (int)(100 * .85)), (Size)d.Frame.Size);
     }
 
     [Fact]
@@ -1285,7 +1285,7 @@ public class DialogTests
         ((FakeDriver)Driver).SetBufferSize (100, 100);
 
         // Default size is Percent(85) 
-        Assert.Equal (new Size (50, 50), d.Frame.Size);
+        Assert.Equal (new Size (50, 50), (Size)d.Frame.Size);
     }
 
     [Fact]

+ 7 - 7
UnitTests/Dialogs/MessageBoxTests.cs

@@ -153,7 +153,7 @@ public class MessageBoxTests
                                          // Default location is centered, so
                                          // X = (100 / 2) - (60 / 2) = 20
                                          // Y = (100 / 2) - (5 / 2) = 47
-                                         Assert.Equal (new Point (20, 47), Application.Current.Frame.Location);
+                                         Assert.Equal (new Point (20, 47), (Point)Application.Current.Frame.Location);
 
                                          Application.RequestStop ();
                                      }
@@ -295,7 +295,7 @@ public class MessageBoxTests
 ╚══════════════════╝",
                                                                                        _output
                                                                                       );
-                                         Assert.Equal (new Size (20 - 2, 10 - 2), Application.Current.Frame.Size);
+                                         Assert.Equal (new Size (20 - 2, 10 - 2), (Size)Application.Current.Frame.Size);
                                          Application.RequestStop ();
 
                                          // Really long text
@@ -607,7 +607,7 @@ ffffffffffffffffffff
                                          Assert.IsType<Dialog> (Application.Current);
 
                                          // Default size is Percent(60) 
-                                         Assert.Equal (new Size ((int)(100 * .60), 5), Application.Current.Frame.Size);
+                                         Assert.Equal (new Size ((int)(100 * .60), 5), (Size)Application.Current.Frame.Size);
 
                                          Application.RequestStop ();
                                      }
@@ -801,7 +801,7 @@ ffffffffffffffffffff
                                          Application.Refresh ();
 
                                          Assert.IsType<Dialog> (Application.Current);
-                                         Assert.Equal (new Size (height, width), Application.Current.Frame.Size);
+                                         Assert.Equal (new Size (height, width), (Size)Application.Current.Frame.Size);
 
                                          Application.RequestStop ();
                                      }
@@ -839,7 +839,7 @@ ffffffffffffffffffff
                                          Application.Refresh ();
 
                                          Assert.IsType<Dialog> (Application.Current);
-                                         Assert.Equal (new Size (height, width), Application.Current.Frame.Size);
+                                         Assert.Equal (new Size (height, width), (Size)Application.Current.Frame.Size);
 
                                          Application.RequestStop ();
                                      }
@@ -873,7 +873,7 @@ ffffffffffffffffffff
                                          Application.Refresh ();
 
                                          Assert.IsType<Dialog> (Application.Current);
-                                         Assert.Equal (new Size (height, width), Application.Current.Frame.Size);
+                                         Assert.Equal (new Size (height, width), (Size)Application.Current.Frame.Size);
 
                                          Application.RequestStop ();
                                      }
@@ -901,7 +901,7 @@ ffffffffffffffffffff
                                      {
                                          Application.Refresh ();
 
-                                         Assert.Equal (new Size (7, 5), Application.Current.Frame.Size);
+                                         Assert.Equal (new Size (7, 5), (Size)Application.Current.Frame.Size);
 
                                          TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                        @$"

+ 4 - 4
UnitTests/View/Text/AutoSizeTrueTests.cs

@@ -2692,12 +2692,12 @@ Y
         Assert.True (horizontalView.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 12, 1), horizontalView.Frame);
         Assert.Equal (new Size (12, 1), horizontalView.GetSizeNeededForTextWithoutHotKey ());
-        Assert.Equal (horizontalView.Frame.Size, horizontalView.GetSizeNeededForTextWithoutHotKey ());
+        Assert.Equal ((Size)horizontalView.Frame.Size, horizontalView.GetSizeNeededForTextWithoutHotKey ());
 
         Assert.True (verticalView.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 2, 11), verticalView.Frame);
         Assert.Equal (new Size (2, 11), verticalView.GetSizeNeededForTextWithoutHotKey ());
-        Assert.Equal (verticalView.Frame.Size, verticalView.GetSizeNeededForTextWithoutHotKey ());
+        Assert.Equal ((Size)verticalView.Frame.Size, verticalView.GetSizeNeededForTextWithoutHotKey ());
 
         text = "Say He_llo 你";
         horizontalView.Text = text;
@@ -2706,12 +2706,12 @@ Y
         Assert.True (horizontalView.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 12, 1), horizontalView.Frame);
         Assert.Equal (new Size (12, 1), horizontalView.GetSizeNeededForTextWithoutHotKey ());
-        Assert.Equal (horizontalView.Frame.Size, horizontalView.GetSizeNeededForTextWithoutHotKey ());
+        Assert.Equal ((Size)horizontalView.Frame.Size, horizontalView.GetSizeNeededForTextWithoutHotKey ());
 
         Assert.True (verticalView.AutoSize);
         Assert.Equal (new Rectangle (0, 0, 2, 11), verticalView.Frame);
         Assert.Equal (new Size (2, 11), verticalView.GetSizeNeededForTextWithoutHotKey ());
-        Assert.Equal (verticalView.Frame.Size, verticalView.GetSizeNeededForTextWithoutHotKey ());
+        Assert.Equal ((Size)verticalView.Frame.Size, verticalView.GetSizeNeededForTextWithoutHotKey ());
     }
 
     [Fact]