瀏覽代碼

Messing with border

Tig 8 月之前
父節點
當前提交
69a2c4de53

+ 1 - 1
Terminal.Gui/View/View.Drawing.cs

@@ -92,7 +92,7 @@ public partial class View // Drawing APIs
 
             // Re-draw the border and padding subviews
             // HACK: This is a hack to ensure that the border and padding subviews are drawn after the line canvas.
-            DoDrawBorderAndPaddingSubViews ();
+            //DoDrawBorderAndPaddingSubViews ();
 
             // Advance the diagnostics draw indicator
             Border?.AdvanceDrawIndicator ();

+ 13 - 8
UICatalog/Scenarios/AllViewsTester.cs

@@ -59,7 +59,8 @@ public class AllViewsTester : Scenario
             ColorScheme = Colors.ColorSchemes ["TopLevel"],
             SelectedItem = 0,
             Source = new ListWrapper<string> (new (_viewClasses.Keys.ToList ())),
-            BorderStyle = LineStyle.Rounded
+            BorderStyle = LineStyle.Rounded,
+            SuperViewRendersLineCanvas = true
         };
 
         _classListView.SelectedItemChanged += (s, args) =>
@@ -87,28 +88,30 @@ public class AllViewsTester : Scenario
         _adornmentsEditor = new ()
         {
             Title = "Adornments [_2]",
-            X = Pos.Right (_classListView),
+            X = Pos.Right (_classListView) - 1,
             Y = 0,
             Width = Dim.Auto (),
             Height = Dim.Auto (),
             ColorScheme = Colors.ColorSchemes ["TopLevel"],
             BorderStyle = LineStyle.Rounded,
             AutoSelectViewToEdit = false,
-            AutoSelectAdornments = false
+            AutoSelectAdornments = false,
+            SuperViewRendersLineCanvas = true
         };
         _adornmentsEditor.ExpanderButton.Orientation = Orientation.Vertical;
 
         _arrangementEditor = new ()
         {
             Title = "Arrangement [_3]",
-            X = Pos.Right (_classListView),
-            Y = Pos.Bottom (_adornmentsEditor),
+            X = Pos.Right (_classListView) - 1,
+            Y = Pos.Bottom (_adornmentsEditor) -1,
             Width = Dim.Width (_adornmentsEditor),
             Height = Dim.Fill (),
             ColorScheme = Colors.ColorSchemes ["TopLevel"],
             BorderStyle = LineStyle.Rounded,
             AutoSelectViewToEdit = false,
-            AutoSelectAdornments = false
+            AutoSelectAdornments = false,
+            SuperViewRendersLineCanvas = true
         };
         _arrangementEditor.ExpanderButton.Orientation = Orientation.Vertical;
 
@@ -124,7 +127,8 @@ public class AllViewsTester : Scenario
             ColorScheme = Colors.ColorSchemes ["TopLevel"],
             BorderStyle = LineStyle.Rounded,
             AutoSelectViewToEdit = false,
-            AutoSelectAdornments = false
+            AutoSelectAdornments = false,
+            SuperViewRendersLineCanvas = true
         };
 
         _settingsPane = new ()
@@ -136,7 +140,8 @@ public class AllViewsTester : Scenario
             Height = Dim.Auto (),
             CanFocus = true,
             ColorScheme = Colors.ColorSchemes ["TopLevel"],
-            BorderStyle = LineStyle.Rounded
+            BorderStyle = LineStyle.Rounded,
+            SuperViewRendersLineCanvas = true
         };
 
         Label label = new () { X = 0, Y = 0, Text = "_Orientation:" };

+ 1 - 1
UICatalog/Scenarios/LineCanvasExperiment.cs

@@ -131,7 +131,7 @@ public class LineCanvasExperiment : Scenario
             //ColorScheme = Colors.ColorSchemes ["Error"],
             SuperViewRendersLineCanvas = true
         };
-        marginWindow.Margin.ColorScheme = Colors.ColorSchemes ["Dialog"];
+        marginWindow.Margin.ColorScheme = Colors.ColorSchemes ["Error"];
         marginWindow.Margin.Thickness = new (1);
         marginWindow.Border.Thickness = new (1, 2, 1, 1);
 

+ 64 - 1
UnitTests/View/Adornment/BorderTests.cs

@@ -836,7 +836,7 @@ public class BorderTests (ITestOutputHelper output)
 │ ┊ ┊
 └─└┄┘")]
     [SetupFakeDriver]
-    public void SuperViewRendersLineCanvas_AutoJoinsLines (bool superViewRendersLineCanvas, string expected)
+    public void SuperViewRendersLineCanvas_No_Subviews_AutoJoinsLines (bool superViewRendersLineCanvas, string expected)
     {
         View superView = new View ()
         {
@@ -876,4 +876,67 @@ public class BorderTests (ITestOutputHelper output)
 
         TestHelpers.AssertDriverContentsAre (expected, output);
     }
+
+
+    [Theory]
+    [InlineData (false, @"
+┌┤A├──────┐
+│    ║    │
+│    ║    │
+│════┌┤C├┄│
+│    ┊    │
+│    ┊    │
+└─────────┘")]
+    [InlineData (true, @"
+╔╡A╞═╗────┐
+║    ║    │
+║    ║    │
+╚════╬┤C├┄┐
+│    ┊    ┊
+│    ┊    ┊
+└────└┄┄┄┄┘")]
+    [SetupFakeDriver]
+    public void SuperViewRendersLineCanvas_Title_AutoJoinsLines (bool superViewRendersLineCanvas, string expected)
+    {
+        View superView = new View ()
+        {
+            Id = "superView",
+            Title = "A",
+            Width = 11,
+            Height = 7,
+            BorderStyle = LineStyle.Single
+        };
+
+        View view1 = new View ()
+        {
+            Id = "view1",
+            Title = "B",
+            Width = 6,
+            Height = 4,
+            X = -1,
+            Y = -1,
+            BorderStyle = LineStyle.Double,
+            SuperViewRendersLineCanvas = superViewRendersLineCanvas
+        };
+
+        View view2 = new View ()
+        {
+            Id = "view2",
+            Title = "C",
+            Width = 6,
+            Height = 4,
+            X = 4,
+            Y = 2,
+            BorderStyle = LineStyle.Dotted,
+            SuperViewRendersLineCanvas = superViewRendersLineCanvas
+        };
+
+        superView.Add (view1, view2);
+
+        superView.BeginInit ();
+        superView.EndInit ();
+        superView.Draw ();
+
+        TestHelpers.AssertDriverContentsAre (expected, output);
+    }
 }