Fixes #1812. AutoSize stays true with empty text. (#1824)

* Fixes #1812. AutoSize stays true with empty text.

* Added some more features and bug fixes.

* Reformat files.
This commit is contained in:
BDisp
2022-07-06 02:04:24 +01:00
committed by GitHub
parent b93b8c1a3b
commit bcc3034db7

View File

@@ -277,6 +277,42 @@ namespace Terminal.Gui.Views {
Assert.Equal (new Rect (0, 0, 30, 5), pos);
}
[Fact, AutoInitShutdown]
public void AutoSize_Stays_True_With_EmptyText ()
{
var btn = new Button () {
X = Pos.Center (),
Y = Pos.Center (),
AutoSize = true
};
var win = new Window () {
Width = Dim.Fill (),
Height = Dim.Fill (),
Title = "Test Demo 你"
};
win.Add (btn);
Application.Top.Add (win);
Assert.True (btn.AutoSize);
btn.Text = "Say Hello 你";
Assert.True (btn.AutoSize);
Application.Begin (Application.Top);
((FakeDriver)Application.Driver).SetBufferSize (30, 5);
var expected = @"
┌ Test Demo 你 ──────────────┐
│ │
│ [ Say Hello 你 ] │
│ │
└────────────────────────────┘
";
GraphViewTests.AssertDriverContentsWithFrameAre (expected, output);
}
[Fact, AutoInitShutdown]
public void AutoSize_Stays_True_Center ()
{