mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Fixes title size not being updating on view size change.
This commit is contained in:
@@ -9,8 +9,8 @@ namespace Terminal.Gui.ViewTests;
|
||||
|
||||
public class TitleTests
|
||||
{
|
||||
private readonly ITestOutputHelper output;
|
||||
public TitleTests (ITestOutputHelper output) { this.output = output; }
|
||||
private readonly ITestOutputHelper _output;
|
||||
public TitleTests (ITestOutputHelper output) { this._output = output; }
|
||||
|
||||
[Fact]
|
||||
public void Set_Title_Fires_TitleChanged ()
|
||||
@@ -76,4 +76,31 @@ public class TitleTests
|
||||
|
||||
Assert.Equal (Key.H, view.HotKey);
|
||||
}
|
||||
|
||||
[SetupFakeDriver]
|
||||
[Fact]
|
||||
public void Change_View_Size_Update_Title_Size ()
|
||||
{
|
||||
var view = new View { Title = "_Hello World", Width = Dim.Auto (), Height = Dim.Auto (), BorderStyle = LineStyle.Single};
|
||||
var top = new Toplevel ();
|
||||
top.Add (view);
|
||||
Application.Begin (top);
|
||||
|
||||
Assert.Equal (string.Empty, view.Text);
|
||||
Assert.Equal (new (2, 2), view.Frame.Size);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
┌┐
|
||||
└┘", _output);
|
||||
|
||||
var text = "This text will increment the view size and display the title.";
|
||||
view.Text = text;
|
||||
top.Draw ();
|
||||
Assert.Equal (text, view.Text);
|
||||
// SetupFakeDriver only create a screen with 25 cols and 25 rows
|
||||
Assert.Equal (new (25, 3), view.Frame.Size);
|
||||
TestHelpers.AssertDriverContentsWithFrameAre (@"
|
||||
┌┤Hello World├──────────┐
|
||||
│This text will incremen│
|
||||
└───────────────────────┘", _output);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user