Fixed TextFormatterTests

This commit is contained in:
Tig
2024-04-18 17:52:21 -06:00
parent 6c117e0f0a
commit 69cb2719b5
2 changed files with 57 additions and 9 deletions

View File

@@ -3408,9 +3408,10 @@ ssb
{
Size = new Size (width, 1),
Text = text,
Alignment = TextAlignment.Centered
Alignment = TextAlignment.Centered,
AutoSize = true
};
tf.Draw (new Rectangle (0, 0, width, 1), Attribute.Default, Attribute.Default);
tf.Draw (new (Point.Empty, tf.Size), Attribute.Default, Attribute.Default);
TestHelpers.AssertDriverContentsWithFrameAre (expectedText, _output);
}

View File

@@ -2854,15 +2854,30 @@ Y
Assert.Equal (new (0, 0, width + 2, 6), frame.Frame);
var expected = @"
string expected ;
if (autoSize)
{
expected = @"
┌────────────────────┐
│Hello World │
│Hello World │
│Hello World │
│Hello World │
└────────────────────┘
";
}
else
{
expected = @"
┌────────────────────┐
│Hello World │
│ Hello World │
│ Hello World│
│Hello World│
└────────────────────┘
"
;
";
}
Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
Assert.Equal (new (0, 0, width + 2, 6), pos);
@@ -2940,7 +2955,7 @@ Y
Assert.Equal (new (1, 11), lblLeft.TextFormatter.Size);
Assert.Equal (new (1, 11), lblCenter.TextFormatter.Size);
Assert.Equal (new (1, 11), lblRight.TextFormatter.Size);
Assert.Equal (new (1, height), lblJust.TextFormatter.Size);
Assert.Equal (new (1, 11), lblJust.TextFormatter.Size);
Assert.Equal (new (0, 0, 9, height + 2), frame.Frame);
}
else
@@ -2952,7 +2967,39 @@ Y
Assert.Equal (new (0, 0, 9, height + 2), frame.Frame);
}
var expected = @"
string expected;
if (autoSize)
{
expected = @"
┌───────┐
│H H H H│
│e e e e│
│l l l l│
│l l l l│
│o o o o│
│ │
│W W W W│
│o o o o│
│r r r r│
│l l l l│
│d d d d│
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
│ │
└───────┘
";
}
else
{
expected = @"
┌───────┐
│H H│
│e e│
@@ -2975,8 +3022,8 @@ Y
│ l l│
│ d d│
└───────┘
"
;
";
}
Rectangle pos = TestHelpers.AssertDriverContentsWithFrameAre (expected, _output);
Assert.Equal (new (0, 0, 9, height + 2), pos);