Bladeren bron

Code cleanup and refactor

Tig 9 maanden geleden
bovenliggende
commit
563d58a380

+ 1 - 1
CommunityToolkitExample/LoginView.cs

@@ -59,7 +59,7 @@ internal partial class LoginView : IRecipient<Message<LoginActions>>
                 }
         }
         SetText();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
     }
 
     private void SetText ()

+ 1 - 1
Terminal.Gui/Application/Application.Keyboard.cs

@@ -200,7 +200,7 @@ public static partial class Application // Keyboard handling
                     Command.Refresh,
                     static () =>
                     {
-                        LayoutAndDrawToplevels ();
+                        LayoutAndDraw ();
 
                         return true;
                     }

+ 3 - 4
Terminal.Gui/Application/Application.Run.cs

@@ -495,13 +495,12 @@ public static partial class Application // Run (Begin, Run, End, Stop)
     /// <summary>Wakes up the running application that might be waiting on input.</summary>
     public static void Wakeup () { MainLoop?.Wakeup (); }
 
-    // TODO: Rename this to LayoutAndDrawRunnables in https://github.com/gui-cs/Terminal.Gui/issues/2491
     /// <summary>
     /// Causes any Toplevels that need layout to be laid out. Then draws any Toplevels that need dispplay. Only Views that need to be laid out (see <see cref="View.NeedsLayout"/>) will be laid out.
     /// Only Views that need to be drawn (see <see cref="View.NeedsDraw"/>) will be drawn.
     /// </summary>
     /// <param name="forceDraw">If <see langword="true"/> the entire View hierarchy will be redrawn. The default is <see langword="false"/> and should only be overriden for testing.</param>
-    public static void LayoutAndDrawToplevels (bool forceDraw = false)
+    public static void LayoutAndDraw (bool forceDraw = false)
     {
         bool neededLayout = View.Layout (TopLevels.Reverse (), Screen.Size);
 
@@ -588,7 +587,7 @@ public static partial class Application // Run (Begin, Run, End, Stop)
             return firstIteration;
         }
 
-        LayoutAndDrawToplevels ();
+        LayoutAndDraw ();
 
         if (PositionCursor ())
         {
@@ -688,6 +687,6 @@ public static partial class Application // Run (Begin, Run, End, Stop)
         runState.Toplevel = null;
         runState.Dispose ();
 
-        LayoutAndDrawToplevels ();
+        LayoutAndDraw ();
     }
 }

+ 1 - 1
Terminal.Gui/Application/Application.Screen.cs

@@ -63,7 +63,7 @@ public static partial class Application // Screen related stuff
             t.SetNeedsLayout ();
         }
 
-        LayoutAndDrawToplevels ();
+        LayoutAndDraw ();
 
         return true;
     }

+ 1 - 1
Terminal.Gui/Views/Menu/Menu.cs

@@ -609,7 +609,7 @@ internal sealed class Menu : View
         Application.UngrabMouse ();
         _host.CloseAllMenus ();
         Application.Driver!.ClearContents ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         _host.Run (action);
     }

+ 1 - 1
Terminal.Gui/Views/Menu/MenuBar.cs

@@ -1117,7 +1117,7 @@ public class MenuBar : View, IDesignable
 
         Application.UngrabMouse ();
         CloseAllMenus ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         _openedByAltKey = true;
 
         return Run (item.Action);

+ 1 - 1
UICatalog/Scenarios/GraphViewExample.cs

@@ -214,7 +214,7 @@ public class GraphViewExample : Scenario
                                ? ViewDiagnosticFlags.Thickness
                                  | ViewDiagnosticFlags.Ruler
                                : ViewDiagnosticFlags.Off;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
     }
 
     private void Margin (bool left, bool increase)

+ 1 - 1
UICatalog/Scenarios/Images.cs

@@ -288,7 +288,7 @@ public class Images : Scenario
 
         _imageView.SetImage (img);
         ApplyShowTabViewHack ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
     }
 
     private void ApplyShowTabViewHack ()

+ 1 - 1
UICatalog/Scenarios/Localization.cs

@@ -38,7 +38,7 @@ public class Localization : Scenario
 
         CurrentCulture = culture;
         Thread.CurrentThread.CurrentUICulture = culture;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
     }
 
     public override void Main ()

+ 3 - 3
UICatalog/Scenarios/RuneWidthGreaterThanOne.cs

@@ -115,7 +115,7 @@ public class RuneWidthGreaterThanOne : Scenario
         _labelV.Text = "This is a test text 你";
         _win.Title = "HACC Demo 你";
         _lastRunesUsed = "Mixed";
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
     }
 
     private void NarrowMessage (object sender, EventArgs e) { MessageBox.Query ("Say Hello", $"Hello {_text.Text}", "Ok"); }
@@ -135,7 +135,7 @@ public class RuneWidthGreaterThanOne : Scenario
         _labelV.Text = "This is a test text";
         _win.Title = "HACC Demo";
         _lastRunesUsed = "Narrow";
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
     }
 
     private void UnsetClickedEvent ()
@@ -174,6 +174,6 @@ public class RuneWidthGreaterThanOne : Scenario
         _labelV.Text = "あなたの名前を入力してください";
         _win.Title = "デモエムポンズ";
         _lastRunesUsed = "Wide";
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
     }
 }

+ 1 - 1
UICatalog/Scenarios/SingleBackgroundWorker.cs

@@ -176,7 +176,7 @@ public class SingleBackgroundWorker : Scenario
                                                             $"Worker {_startStaging}.{_startStaging:fff} was completed at {DateTime.Now}."
                                                            );
                                                   _listLog.SetNeedsDraw ();
-                                                  Application.LayoutAndDrawToplevels ();
+                                                  Application.LayoutAndDraw ();
 
                                                   var builderUI =
                                                       new StagingUIController (_startStaging, e.Result as ObservableCollection<string>);

+ 2 - 2
UICatalog/UICatalog.cs

@@ -754,7 +754,7 @@ public class UICatalogApp
                                                               {
                                                                   Application.Force16Colors = args.NewValue == CheckState.Checked;
                                                                   MiForce16Colors!.Checked = Application.Force16Colors;
-                                                                  Application.LayoutAndDrawToplevels ();
+                                                                  Application.LayoutAndDraw ();
                                                               };
 
             _statusBar.Add (
@@ -1266,7 +1266,7 @@ public class UICatalogApp
 
                                           ((CheckBox)ShForce16Colors!.CommandView!).CheckedState =
                                               Application.Force16Colors ? CheckState.Checked : CheckState.UnChecked;
-                                          Application.LayoutAndDrawToplevels ();
+                                          Application.LayoutAndDraw ();
                                       };
             menuItems.Add (MiForce16Colors);
 

+ 8 - 8
UnitTests/Dialogs/MessageBoxTests.cs

@@ -219,7 +219,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 1)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                        @"
@@ -236,7 +236,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 2)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                        @"
@@ -291,7 +291,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 1)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                        @"
@@ -311,7 +311,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 2)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                        @$"
@@ -361,7 +361,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 1)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          Assert.IsType<Dialog> (Application.Top);
                                          Assert.Equal (new (height, width), Application.Top.Frame.Size);
@@ -398,7 +398,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 1)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          Assert.IsType<Dialog> (Application.Top);
                                          Assert.Equal (new (height, width), Application.Top.Frame.Size);
@@ -431,7 +431,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 1)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          Assert.IsType<Dialog> (Application.Top);
                                          Assert.Equal (new (height, width), Application.Top.Frame.Size);
@@ -471,7 +471,7 @@ public class MessageBoxTests
                                      }
                                      else if (iterations == 1)
                                      {
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          string expectedText = """
                                                                ┌────────────────────────────────────────────────────────────────────┐

+ 4 - 4
UnitTests/View/SubviewTests.cs

@@ -145,7 +145,7 @@ public class SubviewTests
                                Assert.False (v2AddedToWin.CanFocus);
                                Assert.False (svAddedTov1.CanFocus);
 
-                               Application.LayoutAndDrawToplevels ();
+                               Application.LayoutAndDraw ();
                            };
 
         winAddedToTop.Initialized += (s, e) =>
@@ -201,7 +201,7 @@ public class SubviewTests
 
         Application.Iteration += (s, a) =>
                                  {
-                                     Application.LayoutAndDrawToplevels ();
+                                     Application.LayoutAndDraw ();
                                      top.Running = false;
                                  };
 
@@ -253,7 +253,7 @@ public class SubviewTests
                              Assert.False (v1.CanFocus);
                              Assert.False (v2.CanFocus);
 
-                             Application.LayoutAndDrawToplevels ();
+                             Application.LayoutAndDraw ();
                          };
 
         w.Initialized += (s, e) =>
@@ -297,7 +297,7 @@ public class SubviewTests
 
                                      v1.Add (sv1);
 
-                                     Application.LayoutAndDrawToplevels ();
+                                     Application.LayoutAndDraw ();
                                      t.Running = false;
                                  };
 

+ 1 - 1
UnitTests/View/ViewTests.cs

@@ -210,7 +210,7 @@ cccccccccccccccccccc",
             Assert.True (v.HasFocus);
             v.SetFocus ();
             Assert.True (v.HasFocus);
-            Application.LayoutAndDrawToplevels ();
+            Application.LayoutAndDraw ();
 
             TestHelpers.AssertDriverAttributesAre (
                                                    @"

+ 4 - 4
UnitTests/Views/CheckBoxTests.cs

@@ -359,7 +359,7 @@ public class CheckBoxTests (ITestOutputHelper output)
         Assert.Equal (new (0, 0, 30, 5), pos);
 
         checkBox.CheckedState = CheckState.Checked;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @$"
 ┌┤Test Demo 你├──────────────┐
@@ -429,7 +429,7 @@ public class CheckBoxTests (ITestOutputHelper output)
         Application.RunIteration (ref rs);
         Assert.Equal (new (1, 2, 25, 1), checkBox2.Frame);
         Assert.Equal (_size25x1, checkBox2.TextFormatter.ConstrainToSize);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @$"
 ┌┤Test Demo 你├──────────────┐
@@ -480,7 +480,7 @@ public class CheckBoxTests (ITestOutputHelper output)
         Assert.Equal (new (0, 0, 30, 5), pos);
 
         checkBox.CheckedState = CheckState.Checked;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @$"
 ┌┤Test Demo 你├──────────────┐
@@ -531,7 +531,7 @@ public class CheckBoxTests (ITestOutputHelper output)
         Assert.Equal (new (0, 0, 30, 5), pos);
 
         checkBox.CheckedState = CheckState.Checked;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @$"
 ┌┤Test Demo 你├──────────────┐

+ 4 - 4
UnitTests/Views/FrameViewTests.cs

@@ -50,7 +50,7 @@ public class FrameViewTests (ITestOutputHelper output)
         fv.Height = 5;
         fv.Width = 5;
         Assert.Equal (new (0, 0, 5, 5), fv.Frame);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -65,7 +65,7 @@ public class FrameViewTests (ITestOutputHelper output)
         fv.X = 1;
         fv.Y = 2;
         Assert.Equal (new (1, 2, 5, 5), fv.Frame);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -80,7 +80,7 @@ public class FrameViewTests (ITestOutputHelper output)
         fv.X = -1;
         fv.Y = -2;
         Assert.Equal (new (-1, -2, 5, 5), fv.Frame);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -93,7 +93,7 @@ public class FrameViewTests (ITestOutputHelper output)
         fv.X = 7;
         fv.Y = 8;
         Assert.Equal (new (7, 8, 5, 5), fv.Frame);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"

+ 9 - 9
UnitTests/Views/LabelTests.cs

@@ -111,7 +111,7 @@ public class LabelTests (ITestOutputHelper output)
 
         label.Text = "Say Hello 你 changed";
 
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
 ┌────────────────────────────┐
@@ -151,7 +151,7 @@ public class LabelTests (ITestOutputHelper output)
 
         label.Text = "Say Hello 你 changed";
 
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
 ┌────────────────────────────┐
@@ -244,7 +244,7 @@ This TextFormatter (tf2) is rewritten.                                 ",
         var top = new Toplevel ();
         top.Add (label);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (new (0, 0, 16, 1), label.Frame);
 
@@ -265,7 +265,7 @@ Demo Simple Rune
         var top = new Toplevel ();
         top.Add (label);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.NotNull (label.Width);
         Assert.NotNull (label.Height);
 
@@ -301,7 +301,7 @@ e
         var top = new Toplevel ();
         top.Add (label);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         var expected = @"
@@ -472,7 +472,7 @@ e
         var top = new Toplevel ();
         top.Add (label);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (new (0, 0, 6, 3), label.Frame);
         Assert.Equal (new (0, 0, 4, 1), label.Viewport);
@@ -496,7 +496,7 @@ e
         var top = new Toplevel ();
         top.Add (label);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (new (0, 0, 6, 2), label.Frame);
         Assert.Equal (new (0, 0, 4, 1), label.Viewport);
         Application.Begin (top);
@@ -1224,7 +1224,7 @@ e
         Assert.Equal (10, text.Length);
 
         //label.Width = Dim.Fill () - text.Length;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (new (0, 0, 5, 1), label.Frame);
         Assert.Equal (new (5, 1), label.TextFormatter.ConstrainToSize);
@@ -1283,7 +1283,7 @@ e
         Assert.Equal (10, text.Length);
 
         //label.Width = Dim.Fill () - text.Length;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (new (0, 0, 5, 1), label.Frame);
         Assert.Equal (new (5, 1), label.TextFormatter.ConstrainToSize);

+ 7 - 7
UnitTests/Views/ListViewTests.cs

@@ -56,7 +56,7 @@ public class ListViewTests (ITestOutputHelper output)
         top.Add (win);
         RunState rs = Application.Begin (top);
         ((FakeDriver)Application.Driver!).SetBufferSize (12, 12);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (-1, lv.SelectedItem);
 
@@ -304,7 +304,7 @@ public class ListViewTests (ITestOutputHelper output)
         var top = new Toplevel ();
         top.Add (lv);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -318,7 +318,7 @@ Item 4",
 
         // EnsureSelectedItemVisible is auto enabled on the OnSelectedChanged
         lv.SelectedItem = 6;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -342,7 +342,7 @@ Item 6",
         var top = new Toplevel ();
         top.Add (lv);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal ("Second ", GetContents (0));
         Assert.Equal (new (' ', 7), GetContents (1));
@@ -724,7 +724,7 @@ Item 6",
         var top = new Toplevel ();
         top.Add (lv);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (new (1), lv.Border.Thickness);
         Assert.Equal (-1, lv.SelectedItem);
@@ -798,7 +798,7 @@ Item 6",
         var top = new Toplevel ();
         top.Add (lv);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -811,7 +811,7 @@ Item 6",
 
         lv.LeftItem = 1;
         lv.TopItem = 1;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"

+ 17 - 17
UnitTests/Views/MenuBarTests.cs

@@ -100,7 +100,7 @@ public class MenuBarTests (ITestOutputHelper output)
                                          new () { Position = new (0, 0), Flags = MouseFlags.Button1Pressed, View = menu }
                                         )
                     );
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @$"
@@ -880,7 +880,7 @@ public class MenuBarTests (ITestOutputHelper output)
         Toplevel top = new ();
         Application.Begin (top);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         var expected = @"
 ──────┐
@@ -895,7 +895,7 @@ public class MenuBarTests (ITestOutputHelper output)
         menu.CloseAllMenus ();
         menu.Frame = new (-1, -2, menu.Frame.Width, menu.Frame.Height);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
  One  │
@@ -910,7 +910,7 @@ public class MenuBarTests (ITestOutputHelper output)
         menu.Frame = new (0, 0, menu.Frame.Width, menu.Frame.Height);
         ((FakeDriver)Application.Driver!).SetBufferSize (7, 5);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
 ┌──────
@@ -926,7 +926,7 @@ public class MenuBarTests (ITestOutputHelper output)
         menu.Frame = new (0, 0, menu.Frame.Width, menu.Frame.Height);
         ((FakeDriver)Application.Driver!).SetBufferSize (7, 3);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
 ┌──────
@@ -960,7 +960,7 @@ public class MenuBarTests (ITestOutputHelper output)
         Toplevel top = new ();
         Application.Begin (top);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         var expected = @"
 ne
@@ -972,7 +972,7 @@ wo
         menu.CloseAllMenus ();
         menu.Frame = new (-2, -2, menu.Frame.Width, menu.Frame.Height);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
 wo
@@ -984,7 +984,7 @@ wo
         menu.Frame = new (0, 0, menu.Frame.Width, menu.Frame.Height);
         ((FakeDriver)Application.Driver!).SetBufferSize (3, 2);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
  On
@@ -997,7 +997,7 @@ wo
         menu.Frame = new (0, 0, menu.Frame.Width, menu.Frame.Height);
         ((FakeDriver)Application.Driver!).SetBufferSize (3, 1);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expected = @"
  On
@@ -1024,7 +1024,7 @@ wo
         Toplevel top = new ();
         Application.Begin (top);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         var expected = @"
 ┌──────┐
@@ -1056,7 +1056,7 @@ wo
         Toplevel top = new ();
         Application.Begin (top);
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         var expected = @"
  One
@@ -1479,7 +1479,7 @@ wo
         Application.Begin (top);
 
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -1527,7 +1527,7 @@ wo
         Application.Begin (top);
 
         menu.OpenMenu ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -1661,7 +1661,7 @@ wo
                                                      );
 
         Assert.True (menu.NewKeyDownEvent (Key.CursorRight));
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -1773,7 +1773,7 @@ wo
                                                                                   );
 
                                      Assert.True (menu.NewKeyDownEvent (Key.CursorRight));
-                                     Application.LayoutAndDrawToplevels ();
+                                     Application.LayoutAndDraw ();
 
                                      TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                    @"
@@ -1945,7 +1945,7 @@ wo
         Application.Iteration += (s, a) =>
                                  {
                                      Toplevel top = Application.Top;
-                                     Application.LayoutAndDrawToplevels();
+                                     Application.LayoutAndDraw();
 
                                      TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                    @"
@@ -1977,7 +1977,7 @@ wo
                                                                                   );
 
                                      Assert.True (top.Subviews [0].NewKeyDownEvent (Key.CursorRight));
-                                     Application.LayoutAndDrawToplevels ();
+                                     Application.LayoutAndDraw ();
 
                                      TestHelpers.AssertDriverContentsWithFrameAre (
                                                                                    @"

+ 2 - 2
UnitTests/Views/RadioGroupTests.cs

@@ -549,7 +549,7 @@ public class RadioGroupTests (ITestOutputHelper output)
         Assert.Equal (new (0, 0, 30, 5), pos);
 
         rg.Orientation = Orientation.Horizontal;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (Orientation.Horizontal, rg.Orientation);
         Assert.Equal (2, rg.HorizontalSpace);
@@ -570,7 +570,7 @@ public class RadioGroupTests (ITestOutputHelper output)
         Assert.Equal (new (0, 0, 30, 5), pos);
 
         rg.HorizontalSpace = 4;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (Orientation.Horizontal, rg.Orientation);
         Assert.Equal (4, rg.HorizontalSpace);

+ 23 - 23
UnitTests/Views/TextViewTests.cs

@@ -6742,7 +6742,7 @@ This is the second line.
         Assert.True (_textView.Multiline);
         _textView.NewKeyDownEvent (Key.Tab);
         Assert.Equal ("\tTAB to jump between text fields.", _textView.Text);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -6751,7 +6751,7 @@ TAB to jump between text field",
                                                      );
 
         _textView.TabWidth = 4;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -6762,7 +6762,7 @@ TAB to jump between text field",
         _textView.NewKeyDownEvent (Key.Tab.WithShift);
         Assert.Equal ("TAB to jump between text fields.", _textView.Text);
         Assert.True (_textView.NeedsDraw);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -6828,7 +6828,7 @@ TAB to jump between text field",
         top.Add (win);
         Application.Begin (top);
         ((FakeDriver)Application.Driver!).SetBufferSize (15, 15);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         //this passes
         Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (
@@ -6857,7 +6857,7 @@ TAB to jump between text field",
         tv.Used = false;
         tv.CursorPosition = Point.Empty;
         tv.InsertText ("\r\naaa\r\nbbb");
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -6906,7 +6906,7 @@ TAB to jump between text field",
         top.Add (win);
         Application.Begin (top);
         ((FakeDriver)Application.Driver!).SetBufferSize (15, 15);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         //this passes
         Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (
@@ -6935,7 +6935,7 @@ TAB to jump between text field",
         tv.Used = false;
         tv.CursorPosition = Point.Empty;
         tv.InsertText ("\naaa\nbbb");
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -7004,7 +7004,7 @@ TAB to jump between text field",
         var top = new Toplevel ();
         top.Add (tv);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.False (tv.WordWrap);
         Assert.Equal (Point.Empty, tv.CursorPosition);
@@ -8177,7 +8177,7 @@ line.
         var top = new Toplevel ();
         top.Add (tv);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.Equal (Point.Empty, tv.CursorPosition);
         Assert.Equal (0, tv.LeftColumn);
@@ -8191,7 +8191,7 @@ aaaa
 
         tv.CursorPosition = new Point (5, 0);
         Assert.True (tv.NewKeyDownEvent (Key.Backspace));
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (0, tv.LeftColumn);
 
         TestHelpers.AssertDriverContentsAre (
@@ -8202,7 +8202,7 @@ aaa
                                             );
 
         Assert.True (tv.NewKeyDownEvent (Key.Backspace));
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (0, tv.LeftColumn);
 
         TestHelpers.AssertDriverContentsAre (
@@ -8213,7 +8213,7 @@ aa
                                             );
 
         Assert.True (tv.NewKeyDownEvent (Key.Backspace));
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (0, tv.LeftColumn);
 
         TestHelpers.AssertDriverContentsAre (
@@ -8224,7 +8224,7 @@ a
                                             );
 
         Assert.True (tv.NewKeyDownEvent (Key.Backspace));
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (0, tv.LeftColumn);
 
         TestHelpers.AssertDriverContentsAre (
@@ -8235,7 +8235,7 @@ a
                                             );
 
         Assert.True (tv.NewKeyDownEvent (Key.Backspace));
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (0, tv.LeftColumn);
 
         TestHelpers.AssertDriverContentsAre (
@@ -8257,7 +8257,7 @@ a
         _textView.Text = "Line 1.\nLine 2.";
         _textView.WordWrap = true;
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.True (_textView.WordWrap);
 
@@ -8272,12 +8272,12 @@ Line 2.",
         Assert.Equal ("Line 1.", _textView.SelectedText);
 
         Assert.True (_textView.NewKeyDownEvent (new Key (del)));
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         TestHelpers.AssertDriverContentsWithFrameAre ("Line 2.", _output);
 
         Assert.True (_textView.NewKeyDownEvent (Key.H.WithShift));
         Assert.NotEqual (Rectangle.Empty, _textView._needsDrawRect);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -8915,7 +8915,7 @@ line.
         var top = new Toplevel ();
         top.Add (tv);
         Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -8927,7 +8927,7 @@ This is the second line.",
         tv.Width = 10;
         tv.Height = 25;
         tv.WordWrap = true;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         TestHelpers.AssertDriverContentsWithFrameAre (
                                                       @"
@@ -8969,7 +8969,7 @@ line.  ",
         var top = new Toplevel ();
         top.Add (tv);
         RunState rs = Application.Begin (top);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Assert.True (tv.InheritsPreviousAttribute);
 
@@ -9011,7 +9011,7 @@ Error   ";
         TestHelpers.AssertDriverAttributesAre (expectedColor, _output, Application.Driver, attributes);
 
         tv.WordWrap = true;
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         TestHelpers.AssertDriverContentsWithFrameAre (expectedText, _output);
         TestHelpers.AssertDriverAttributesAre (expectedColor, _output, Application.Driver, attributes);
 
@@ -9023,7 +9023,7 @@ Error   ";
         tv.IsSelecting = false;
         tv.CursorPosition = new (2, 4);
         tv.Paste ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expectedText = @"
 TopLevel  
@@ -9058,7 +9058,7 @@ Dialogror ";
         tv.IsSelecting = false;
         tv.CursorPosition = new (2, 4);
         tv.Paste ();
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         expectedText = @"
 TopLevel  

+ 11 - 11
UnitTests/Views/ToplevelTests.cs

@@ -456,7 +456,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
                                                                        ScreenPosition = new (2, 2), Flags = MouseFlags.Button1Pressed
                                                                                                       | MouseFlags.ReportMousePosition
                                                                    });
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          Assert.Equal (Application.Top.Border, Application.MouseGrabView);
                                          Assert.Equal (new (1, 2, 10, 3), Application.Top.Frame);
@@ -478,7 +478,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
                                                                    {
                                                                        ScreenPosition = new (2, 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition
                                                                    });
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          Assert.Equal (Application.Top!.Border, Application.MouseGrabView);
                                          Assert.Equal (new (1, 1, 10, 3), Application.Top.Frame);
@@ -497,7 +497,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
 
                                          // Ungrab the mouse
                                          Application.RaiseMouseEvent (new () { ScreenPosition = new (2, 1), Flags = MouseFlags.Button1Released });
-                                         Application.LayoutAndDrawToplevels ();
+                                         Application.LayoutAndDraw ();
 
                                          Assert.Null (Application.MouseGrabView);
                                      }
@@ -752,7 +752,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
         top.SetNeedsLayout ();
         top.LayoutSubviews ();
         Assert.Equal (new (6, 6, 191, 91), win.Frame);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Application.RaiseMouseEvent (
                                   new ()
@@ -763,7 +763,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
         top.SetNeedsLayout ();
         top.LayoutSubviews ();
         Assert.Equal (new (2, 2, 195, 95), win.Frame);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
 
         Application.RaiseMouseEvent (new () { ScreenPosition = new (5, 5), Flags = MouseFlags.Button1Released });
 
@@ -784,7 +784,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
         RunState rsTop = Application.Begin (top);
         ((FakeDriver)Application.Driver!).SetBufferSize (40, 10);
         RunState rsWindow = Application.Begin (window);
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (new (0, 0, 40, 10), top.Frame);
         Assert.Equal (new (0, 0, 20, 3), window.Frame);
 
@@ -800,7 +800,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
                                       ScreenPosition = new (-11, -4), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition
                                   });
 
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (new (0, 0, 40, 10), top.Frame);
         Assert.Equal (new (-11, -4, 20, 3), window.Frame);
 
@@ -813,7 +813,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
                                       ScreenPosition = new (-1, -1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition
                                   });
 
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (new (0, 0, 20, 3), top.Frame);
         Assert.Equal (new (-1, -1, 20, 3), window.Frame);
 
@@ -826,7 +826,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
                                       ScreenPosition = new (-1, -1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition
                                   });
 
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (new (0, 0, 19, 2), top.Frame);
         Assert.Equal (new (-1, -1, 20, 3), window.Frame);
 
@@ -836,7 +836,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
                                       ScreenPosition = new (18, 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition
                                   });
 
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (new (0, 0, 19, 2), top.Frame);
         Assert.Equal (new (18, 1, 20, 3), window.Frame);
 
@@ -847,7 +847,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
                                       ScreenPosition = new (19, 2), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition
                                   });
 
-        Application.LayoutAndDrawToplevels ();
+        Application.LayoutAndDraw ();
         Assert.Equal (new (0, 0, 19, 2), top.Frame);
         Assert.Equal (new (19, 2, 20, 3), window.Frame);
         //TestHelpers.AssertDriverContentsWithFrameAre (@"", output);

+ 1 - 1
UnitTests/Views/ViewDisposalTest.cs

@@ -60,7 +60,7 @@ public class ViewDisposalTest (ITestOutputHelper output)
         // make sure the application is doing to the views whatever its supposed to do to the views
         for (var i = 0; i < 100; i++)
         {
-            Application.LayoutAndDrawToplevels ();
+            Application.LayoutAndDraw ();
         }
 
         top.Remove (container);