From d6a1bf45578ab3204cdd4b11c85c7274f29e34b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:28:08 +0000 Subject: [PATCH] Add Draw_Vertical_TopBottom_LeftRight test (3 test cases) Co-authored-by: tig <585482+tig@users.noreply.github.com> --- Tests/UnitTests/Text/TextFormatterTests.cs | 53 ------------------- .../Text/TextFormatterTests.cs | 29 ++++++++++ 2 files changed, 29 insertions(+), 53 deletions(-) diff --git a/Tests/UnitTests/Text/TextFormatterTests.cs b/Tests/UnitTests/Text/TextFormatterTests.cs index 9f142b5cd..be309c484 100644 --- a/Tests/UnitTests/Text/TextFormatterTests.cs +++ b/Tests/UnitTests/Text/TextFormatterTests.cs @@ -3510,59 +3510,6 @@ public class TextFormatterTests Application.Shutdown (); } - [SetupFakeDriver] - [Theory] - [InlineData ("A", 5, 5, "A")] - [InlineData ( - "AB12", - 5, - 5, - @" -A -B -1 -2")] - [InlineData ( - "AB\n12", - 5, - 5, - @" -A1 -B2")] - [InlineData ("", 5, 1, "")] - [InlineData ( - "Hello Worlds", - 1, - 12, - @" -H -e -l -l -o - -W -o -r -l -d -s")] - [InlineData ("Hello Worlds", 12, 1, @"HelloWorlds")] - public void Draw_Vertical_TopBottom_LeftRight (string text, int width, int height, string expectedText) - { - TextFormatter tf = new () - { - Text = text, - Direction = TextDirection.TopBottom_LeftRight - }; - - tf.ConstrainToWidth = width; - tf.ConstrainToHeight = height; - tf.Draw (new (0, 0, 20, 20), Attribute.Default, Attribute.Default); - - DriverAssert.AssertDriverContentsWithFrameAre (expectedText, _output); - } - [SetupFakeDriver] [Theory] diff --git a/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs b/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs index c5fae4c41..a5ebd012f 100644 --- a/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs +++ b/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs @@ -3255,5 +3255,34 @@ public class TextFormatterTests Assert.Equal (expectedText, actualText); } + [Theory] + [InlineData ("", 5, 1, "")] + [InlineData ( + "Hello Worlds", + 1, + 12, + "H\ne\nl\nl\no\n\nW\no\nr\nl\nd\ns")] + [InlineData ("Hello Worlds", 12, 1, @"HelloWorlds")] + public void Draw_Vertical_TopBottom_LeftRight (string text, int width, int height, string expectedText) + { + // Create a local driver instance for this test + var factory = new FakeDriverFactory (); + var driver = factory.Create (); + driver.SetBufferSize (Math.Max (25, 20), Math.Max (25, 20)); + + TextFormatter tf = new () + { + Text = text, + Direction = TextDirection.TopBottom_LeftRight + }; + + tf.ConstrainToWidth = width; + tf.ConstrainToHeight = height; + tf.Draw (new Rectangle (0, 0, 20, 20), Attribute.Default, Attribute.Default, driver: driver); + + string actualText = GetDriverContents (driver, width, height); + Assert.Equal (expectedText, actualText); + } + #endregion }