Procházet zdrojové kódy

Add Draw_Vertical_TopBottom_LeftRight test (3 test cases)

Co-authored-by: tig <[email protected]>
copilot-swe-agent[bot] před 1 měsícem
rodič
revize
d6a1bf4557

+ 0 - 53
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]
 

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