mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Fixes #1812. AutoSize stays true with empty text. * Added some more features and bug fixes. * Reformat files.
This commit is contained in:
@@ -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 ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user