From d4fd965eba4e939dd3784e40892271bf9d8fc46b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 16:55:05 +0000 Subject: [PATCH] Add Draw_Vertical_TopBottom_LeftRight_Top test (8 test cases) Co-authored-by: tig <585482+tig@users.noreply.github.com> --- Tests/UnitTests/Text/TextFormatterTests.cs | 59 ------------------- .../Text/TextFormatterTests.cs | 48 +++++++++++++++ 2 files changed, 48 insertions(+), 59 deletions(-) diff --git a/Tests/UnitTests/Text/TextFormatterTests.cs b/Tests/UnitTests/Text/TextFormatterTests.cs index be309c484..cd4e33799 100644 --- a/Tests/UnitTests/Text/TextFormatterTests.cs +++ b/Tests/UnitTests/Text/TextFormatterTests.cs @@ -3560,65 +3560,6 @@ public class TextFormatterTests Assert.Equal (expectedY, rect.Y); } - [SetupFakeDriver] - [Theory] - [InlineData ("A", 5, "A")] - [InlineData ( - "AB12", - 5, - @" -A -B -1 -2")] - [InlineData ( - "AB\n12", - 5, - @" -A1 -B2")] - [InlineData ("", 1, "")] - [InlineData ( - "AB1 2", - 2, - @" -A12 -B ")] - [InlineData ( - "こんにちは", - 1, - @" -こん")] - [InlineData ( - "こんにちは", - 2, - @" -こに -んち")] - [InlineData ( - "こんにちは", - 5, - @" -こ -ん -に -ち -は")] - public void Draw_Vertical_TopBottom_LeftRight_Top (string text, int height, string expectedText) - { - TextFormatter tf = new () - { - Text = text, - Direction = TextDirection.TopBottom_LeftRight - }; - - tf.ConstrainToWidth = 5; - tf.ConstrainToHeight = height; - tf.Draw (new (0, 0, 5, height), Attribute.Default, Attribute.Default); - - DriverAssert.AssertDriverContentsWithFrameAre (expectedText, _output); - } - [Theory] [InlineData (14, 1, TextDirection.LeftRight_TopBottom, "Les Misęrables")] [InlineData (1, 14, TextDirection.TopBottom_LeftRight, "L\ne\ns\n \nM\ni\ns\nę\nr\na\nb\nl\ne\ns")] diff --git a/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs b/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs index a5ebd012f..32f9e3634 100644 --- a/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs +++ b/Tests/UnitTestsParallelizable/Text/TextFormatterTests.cs @@ -3284,5 +3284,53 @@ public class TextFormatterTests Assert.Equal (expectedText, actualText); } + [Theory] + [InlineData ("A", 5, "A")] + [InlineData ( + "AB12", + 5, + "A\nB\n1\n2")] + [InlineData ( + "AB\n12", + 5, + "A1\nB2")] + [InlineData ("", 1, "")] + [InlineData ( + "AB1 2", + 2, + "A12\nB")] + [InlineData ( + "こんにちは", + 1, + "こん")] + [InlineData ( + "こんにちは", + 2, + "こに\nんち")] + [InlineData ( + "こんにちは", + 5, + "こ\nん\nに\nち\nは")] + public void Draw_Vertical_TopBottom_LeftRight_Top (string text, 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, 5), Math.Max (25, height)); + + TextFormatter tf = new () + { + Text = text, + Direction = TextDirection.TopBottom_LeftRight + }; + + tf.ConstrainToWidth = 5; + tf.ConstrainToHeight = height; + tf.Draw (new Rectangle (0, 0, 5, height), Attribute.Default, Attribute.Default, driver: driver); + + string actualText = GetDriverContents (driver, 5, height); + Assert.Equal (expectedText, actualText); + } + #endregion }