Pārlūkot izejas kodu

Add Draw_Vertical_TopBottom_LeftRight_Top test (8 test cases)

Co-authored-by: tig <[email protected]>
copilot-swe-agent[bot] 1 mēnesi atpakaļ
vecāks
revīzija
d4fd965eba

+ 0 - 59
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")]

+ 48 - 0
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
 }