From 6d5754c22faca47be289e2ca651aae8a8d40a0bb Mon Sep 17 00:00:00 2001 From: BDisp Date: Mon, 4 Dec 2023 12:10:36 +0000 Subject: [PATCH] Adds more unit tests for minimum full border without Left and Right thickness. --- Terminal.Gui/View/Frame.cs | 2 +- UnitTests/View/DrawTests.cs | 32 +++++++++++++++++++++++++++++--- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/View/Frame.cs b/Terminal.Gui/View/Frame.cs index 8f41cb30b..5f846579f 100644 --- a/Terminal.Gui/View/Frame.cs +++ b/Terminal.Gui/View/Frame.cs @@ -217,7 +217,7 @@ namespace Terminal.Gui { var drawTop = Thickness.Top > 0 && Frame.Width > 1 && Frame.Height > 0; var drawLeft = Thickness.Left > 0 && (Frame.Height > 1 || Thickness.Top == 0); var drawBottom = Thickness.Bottom > 0 && Frame.Width > 1 && Frame.Height > 1; - var drawRight = Thickness.Right > 0 && ((Frame.Width > 1 && Frame.Height > 1) || Thickness.Top == 0); + var drawRight = Thickness.Right > 0 && ((Frame.Width > 0 && Frame.Height > 1) || Thickness.Top == 0); var prevAttr = Driver.GetAttribute (); if (ColorScheme != null) { diff --git a/UnitTests/View/DrawTests.cs b/UnitTests/View/DrawTests.cs index 024fa7e7a..3829bb864 100644 --- a/UnitTests/View/DrawTests.cs +++ b/UnitTests/View/DrawTests.cs @@ -347,6 +347,18 @@ t ", output); └┘", output); } + [Fact, AutoInitShutdown] + public void Draw_Minimum_Full_Border_Width_One_Height_One_Without_Top () + { + var label = new Label () { Width = 1, Height = 1, BorderStyle = LineStyle.Single }; + label.Border.Thickness = new Thickness (1, 0, 1, 1); + Application.Top.Add (label); + Application.Begin (Application.Top); + + TestHelpers.AssertDriverContentsWithFrameAre (@" +││", output); + } + [Fact, AutoInitShutdown] public void Draw_Minimum_Full_Border_Width_One_Height_One_Without_Bottom () { @@ -360,15 +372,29 @@ t ", output); } [Fact, AutoInitShutdown] - public void Draw_Minimum_Full_Border_Width_One_Height_One_Without_Top () + public void Draw_Minimum_Full_Border_Width_One_Height_One_Without_Left () { var label = new Label () { Width = 1, Height = 1, BorderStyle = LineStyle.Single }; - label.Border.Thickness = new Thickness (1, 0, 1, 1); + label.Border.Thickness = new Thickness (0, 1, 1, 1); Application.Top.Add (label); Application.Begin (Application.Top); TestHelpers.AssertDriverContentsWithFrameAre (@" -││", output); +│ +│", output); + } + + [Fact, AutoInitShutdown] + public void Draw_Minimum_Full_Border_Width_One_Height_One_Without_Right () + { + var label = new Label () { Width = 1, Height = 1, BorderStyle = LineStyle.Single }; + label.Border.Thickness = new Thickness (1, 1, 0, 1); + Application.Top.Add (label); + Application.Begin (Application.Top); + + TestHelpers.AssertDriverContentsWithFrameAre (@" +│ +│", output); } [Fact, AutoInitShutdown]