Browse Source

Revamped Scenario

Tig 1 year ago
parent
commit
469b3572d5
2 changed files with 52 additions and 66 deletions
  1. 49 64
      UICatalog/Scenarios/ViewExperiments.cs
  2. 3 2
      UnitTests/View/NavigationTests.cs

+ 49 - 64
UICatalog/Scenarios/ViewExperiments.cs

@@ -19,49 +19,66 @@ public class ViewExperiments : Scenario
             TabStop = TabBehavior.TabGroup
         };
 
+        var editor = new AdornmentsEditor
+        {
+            X = 0,
+            Y = 0,
+            AutoSelectViewToEdit = true,
+            TabStop = TabBehavior.NoStop
+        };
+        app.Add (editor);
 
-        var view = new View
+        FrameView testFrame = new ()
         {
-            X = 2,
-            Y = 2,
-            Height = Dim.Auto (),
-            Width = Dim.Auto (),
-            Title = "View1",
-            ColorScheme = Colors.ColorSchemes ["Base"],
-            Id = "View1",
-            ShadowStyle = ShadowStyle.Transparent,
-            BorderStyle = LineStyle.Double,
-            CanFocus = true, // Can't drag without this? BUGBUG
-            TabStop = TabBehavior.TabGroup,
-            Arrangement = ViewArrangement.Movable | ViewArrangement.Overlapped
+            Title = "Test Frame",
+            X = Pos.Right (editor),
+            Width = Dim.Fill (),
+            Height = Dim.Fill (),
         };
 
+        app.Add (testFrame);
+
         Button button = new ()
         {
-            Title = "Button_1",
+            X = 0,
+            Y = 0,
+            Title = "TopButton_1",
         };
-        view.Add (button);
+
+        testFrame.Add (button);
+
+        var overlappedView1 = CreateOverlappedView (3, 2, 2);
+        var overlappedView2 = CreateOverlappedView (4, 34, 4);
+
+
+        testFrame.Add (overlappedView1);
+        testFrame.Add (overlappedView2);
 
         button = new ()
         {
-            Y = Pos.Bottom (button),
-            Title = "Button_2",
+            X = Pos.AnchorEnd (),
+            Y = Pos.AnchorEnd (),
+            Title = "TopButton_2",
         };
-        view.Add (button);
 
-        //app.Add (view);
+        testFrame.Add (button);
 
-        view.BorderStyle = LineStyle.Double;
+        Application.Run (app);
+        app.Dispose ();
+        Application.Shutdown ();
+    }
 
-        var view2 = new View
+    private View CreateOverlappedView (int id, int x, int y)
+    {
+        View overlapped = new View
         {
-            X = Pos.Right (view),
-            Y = Pos.Bottom (view),
+            X = x,
+            Y = y,
             Height = Dim.Auto (),
             Width = Dim.Auto (),
-            Title = "View2",
-            ColorScheme = Colors.ColorSchemes ["Base"],
-            Id = "View2",
+            Title = $"Overlapped_{id}",
+            ColorScheme = Colors.ColorSchemes ["Toplevel"],
+            Id = $"Overlapped{id}",
             ShadowStyle = ShadowStyle.Transparent,
             BorderStyle = LineStyle.Double,
             CanFocus = true, // Can't drag without this? BUGBUG
@@ -69,51 +86,19 @@ public class ViewExperiments : Scenario
             Arrangement = ViewArrangement.Movable | ViewArrangement.Overlapped
         };
 
-
-        button = new ()
+        Button button = new ()
         {
-            Title = "Button_3",
+            Title = $"Button{id} _{id * 2}"
         };
-        view2.Add (button);
+        overlapped.Add (button);
 
         button = new ()
         {
             Y = Pos.Bottom (button),
-            Title = "Button_4",
-        };
-        view2.Add (button);
-
-        var editor = new AdornmentsEditor
-        {
-            X = 0,
-            Y = 0,
-            AutoSelectViewToEdit = true
-        };
-        app.Add (editor);
-
-        button = new ()
-        {
-            Y = 0,
-            X = Pos.X (view),
-            Title = "Button_0",
+            Title = $"Button{id} _{id * 2 + 1}"
         };
-        app.Add (button);
+        overlapped.Add (button);
 
-        button = new ()
-        {
-            X = Pos.AnchorEnd (),
-            Y = Pos.AnchorEnd (),
-            Title = "Button_5",
-        };
-
-        view.X = 34;
-        view.Y = 4;
-        app.Add (view);
-        app.Add (view2);
-        app.Add (button);
-
-        Application.Run (app);
-        app.Dispose ();
-        Application.Shutdown ();
+        return overlapped;
     }
 }

+ 3 - 2
UnitTests/View/NavigationTests.cs

@@ -1417,8 +1417,9 @@ public class NavigationTests (ITestOutputHelper _output) : TestsAllViews
         r.Dispose ();
     }
 
-    [Theory, CombinatorialData]
-    public void TabStop_All_True_And_Changing_CanFocus_Later ([CombinatorialValues (TabBehavior.NoStop, TabBehavior.TabStop, TabBehavior.TabGroup)] TabBehavior behavior)
+    [Theory]
+    [CombinatorialData]
+    public void TabStop_Change_CanFocus_Works ([CombinatorialValues (TabBehavior.NoStop, TabBehavior.TabStop, TabBehavior.TabGroup)] TabBehavior behavior)
     {
         var r = new View ();
         var v1 = new View ();