Add Draw_Vertical_TopBottom_LeftRight_Top test (8 test cases)

Co-authored-by: tig <585482+tig@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-10-16 16:55:05 +00:00
parent d6a1bf4557
commit d4fd965eba
2 changed files with 48 additions and 59 deletions

View File

@@ -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")]

View File

@@ -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
}