Browse Source

Made unit tests more resiliant to config changes

Tig 1 year ago
parent
commit
f5b1984db7
2 changed files with 15 additions and 0 deletions
  1. 5 0
      UnitTests/FileServices/FileDialogTests.cs
  2. 10 0
      UnitTests/Views/MenuBarTests.cs

+ 5 - 0
UnitTests/FileServices/FileDialogTests.cs

@@ -622,6 +622,11 @@ public class FileDialogTests (ITestOutputHelper output)
 
     private FileDialog GetWindowsDialog ()
     {
+        // Override CM
+        Window.DefaultBorderStyle = LineStyle.Single;
+        Dialog.DefaultButtonAlignment = Alignment.Center;
+        Dialog.DefaultBorderStyle = LineStyle.Single;
+
         // Arrange
         var fileSystem = new MockFileSystem (new Dictionary<string, MockFileData> (), @"c:\");
         fileSystem.MockTime (() => new (2010, 01, 01, 11, 12, 43));

+ 10 - 0
UnitTests/Views/MenuBarTests.cs

@@ -362,6 +362,11 @@ public class MenuBarTests (ITestOutputHelper output)
     [AutoInitShutdown]
     public void Draw_A_Menu_Over_A_Dialog ()
     {
+        // Override CM
+        Window.DefaultBorderStyle = LineStyle.Single;
+        Dialog.DefaultButtonAlignment = Alignment.Center;
+        Dialog.DefaultBorderStyle = LineStyle.Single;
+
         Toplevel top = new ();
         var win = new Window ();
         top.Add (win);
@@ -590,6 +595,11 @@ public class MenuBarTests (ITestOutputHelper output)
     [AutoInitShutdown]
     public void Draw_A_Menu_Over_A_Top_Dialog ()
     {
+        // Override CM
+        Window.DefaultBorderStyle = LineStyle.Single;
+        Dialog.DefaultButtonAlignment = Alignment.Center;
+        Dialog.DefaultBorderStyle = LineStyle.Single;
+
         ((FakeDriver)Application.Driver).SetBufferSize (40, 15);
 
         Assert.Equal (new (0, 0, 40, 15), Application.Driver.Clip);