Fixes #2226. StatusBar misplaced when window maximized (and occasionally on resize).

This commit is contained in:
BDisp
2022-11-17 16:59:43 +00:00
parent 9afdc4df3b
commit 9e44f0183a
3 changed files with 87 additions and 52 deletions

View File

@@ -153,5 +153,88 @@ namespace Terminal.Gui.Core {
Assert.Equal (expected, r.Title.ToString ());
r.Dispose ();
}
[Fact,AutoInitShutdown]
public void MenuBar_And_StatusBar_Inside_Window ()
{
var menu = new MenuBar (new MenuBarItem [] {
new MenuBarItem ("File", new MenuItem [] {
new MenuItem ("Open", "", null),
new MenuItem ("Quit", "", null),
}),
new MenuBarItem ("Edit", new MenuItem [] {
new MenuItem ("Copy", "", null),
})
});
var sb = new StatusBar (new StatusItem [] {
new StatusItem (Key.CtrlMask | Key.Q, "~^Q~ Quit", null),
new StatusItem (Key.CtrlMask | Key.O, "~^O~ Open", null),
new StatusItem (Key.CtrlMask | Key.C, "~^C~ Copy", null),
});
var fv = new FrameView ("Frame View") {
Y = 1,
Width = Dim.Fill(),
Height = Dim.Fill (1)
};
var win = new Window ();
win.Add (menu, sb, fv);
var top = Application.Top;
top.Add (win);
Application.Begin (top);
((FakeDriver)Application.Driver).SetBufferSize (20, 10);
TestHelpers.AssertDriverContentsWithFrameAre (@"
┌──────────────────┐
│ File Edit │
│┌ Frame View ────┐│
││ ││
││ ││
││ ││
││ ││
│└────────────────┘│
│ ^Q Quit │ ^O Open│
└──────────────────┘", output);
((FakeDriver)Application.Driver).SetBufferSize (40, 20);
TestHelpers.AssertDriverContentsWithFrameAre (@"
┌──────────────────────────────────────┐
│ File Edit │
│┌ Frame View ────────────────────────┐│
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
││ ││
│└────────────────────────────────────┘│
│ ^Q Quit │ ^O Open │ ^C Copy │
└──────────────────────────────────────┘", output);
((FakeDriver)Application.Driver).SetBufferSize (20, 10);
TestHelpers.AssertDriverContentsWithFrameAre (@"
┌──────────────────┐
│ File Edit │
│┌ Frame View ────┐│
││ ││
││ ││
││ ││
││ ││
│└────────────────┘│
│ ^Q Quit │ ^O Open│
└──────────────────┘", output);
}
}
}