Fixes #3229. TextFormatter should have a FillRemaining property. (#3245)

* Fixes #3229. TextFormatter should have a FillRemaining property.

* Remove fillRemaining parameter from the Draw method.
This commit is contained in:
BDisp
2024-02-13 00:25:09 +00:00
committed by GitHub
parent c94c0567dd
commit 7a041fcc73
7 changed files with 70 additions and 20 deletions

View File

@@ -419,7 +419,6 @@ ssb
new Attribute (ColorName.White, ColorName.Black),
new Attribute (ColorName.Blue, ColorName.Black),
default (Rect),
true,
driver
);
TestHelpers.AssertDriverContentsWithFrameAre (expected, _output, driver);
@@ -427,6 +426,61 @@ ssb
driver.End ();
}
[Fact]
[SetupFakeDriver]
public void FillRemaining_True_False ()
{
((FakeDriver)Application.Driver).SetBufferSize (22, 5);
Attribute [] attrs =
{
Attribute.Default, new Attribute (ColorName.Green, ColorName.BrightMagenta),
new Attribute (ColorName.Blue, ColorName.Cyan)
};
var tf = new TextFormatter { Size = new Size (14, 3), Text = "Test\nTest long\nTest long long\n", MultiLine = true };
tf.Draw (
new Rect (1, 1, 19, 3),
attrs [1],
attrs [2]);
Assert.False (tf.FillRemaining);
TestHelpers.AssertDriverContentsWithFrameAre (
@"
Test
Test long
Test long long",
_output);
TestHelpers.AssertDriverAttributesAre (
@"
000000000000000000000
011110000000000000000
011111111100000000000
011111111111111000000
000000000000000000000",
null,
attrs);
tf.FillRemaining = true;
tf.Draw (
new Rect (1, 1, 19, 3),
attrs [1],
attrs [2]);
TestHelpers.AssertDriverAttributesAre (
@"
000000000000000000000
011111111111111111110
011111111111111111110
011111111111111111110
000000000000000000000",
null,
attrs);
}
[Theory]
[InlineData ("_k Before", true, 0, (KeyCode)'K')] // lower case should return uppercase Hotkey
[InlineData ("a_k Second", true, 1, (KeyCode)'K')]
@@ -2010,7 +2064,6 @@ ssb
new Attribute (ColorName.White, ColorName.Black),
new Attribute (ColorName.Blue, ColorName.Black),
default (Rect),
true,
driver
);
TestHelpers.AssertDriverContentsWithFrameAre (expected, _output, driver);
@@ -2049,7 +2102,6 @@ ssb
new Attribute (ColorName.White, ColorName.Black),
new Attribute (ColorName.Blue, ColorName.Black),
default (Rect),
true,
driver
);
TestHelpers.AssertDriverContentsWithFrameAre (expected, _output, driver);
@@ -2088,7 +2140,6 @@ ssb
new Attribute (ColorName.White, ColorName.Black),
new Attribute (ColorName.Blue, ColorName.Black),
default (Rect),
true,
driver
);
TestHelpers.AssertDriverContentsWithFrameAre (expected, _output, driver);