Skip to content

Commit

Permalink
Add simpler test that does not repro
Browse files Browse the repository at this point in the history
  • Loading branch information
tznind committed Jan 7, 2024
1 parent 164f626 commit 6f758bf
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions tests/Investigations/TwoMenuBarsInvestigation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,5 +112,66 @@ protected override void MakeAssertions(Design rootDesign)
Assert.That(menuBars[0].Width, Is.EqualTo(Dim.Fill(0)));
Assert.That(menuBars[1].Width, Is.EqualTo(Dim.Fill(0)));
}

[Test]
public void SimplerTest()
{
MenuBar menuBar;
MenuBar menuBar2;

var w = new Window();
menuBar2 = new Terminal.Gui.MenuBar();
menuBar = new Terminal.Gui.MenuBar();
w.Width = Dim.Fill(0);
w.Height = Dim.Fill(0);
w.X = 0;
w.Y = 0;
w.Visible = true;
w.Modal = false;
w.Title = "";
menuBar.Width = Dim.Fill(0);
menuBar.Height = 1;
menuBar.X = 0;
menuBar.Y = 0;
menuBar.Visible = true;
menuBar.Data = "menuBar";
menuBar.TextAlignment = Terminal.Gui.TextAlignment.Left;
var fileF9Menu = new Terminal.Gui.MenuBarItem();
fileF9Menu.Title = "_File(F9)";
var editMeMenuItem = new Terminal.Gui.MenuItem();
editMeMenuItem.Title = "Edit Me";
editMeMenuItem.Data = "editMeMenuItem";
fileF9Menu.Children = new Terminal.Gui.MenuItem[] {
editMeMenuItem};
menuBar.Menus = new Terminal.Gui.MenuBarItem[] {
fileF9Menu};

w.Add(menuBar);
menuBar2.Width = Dim.Fill(0);
menuBar2.Height = 1;
menuBar2.X = 0;
menuBar2.Y = 4;
menuBar2.Visible = true;
menuBar2.Data = "menuBar2";
menuBar2.TextAlignment = Terminal.Gui.TextAlignment.Left;
var fileF9Menu2 = new Terminal.Gui.MenuBarItem();
fileF9Menu2.Title = "_File(F9)";
var editMeMenuItem2 = new Terminal.Gui.MenuItem();
editMeMenuItem2.Title = "Edit Me";
editMeMenuItem2.Data = "editMeMenuItem2";
fileF9Menu2.Children = new Terminal.Gui.MenuItem[] {
editMeMenuItem2};
menuBar2.Menus = new Terminal.Gui.MenuBarItem[] {
fileF9Menu2};
w.Add(menuBar2);


var menuBars = w.Subviews.OfType<MenuBar>().ToArray();
Assert.That(menuBars, Has.Length.EqualTo(2));

Assert.That(menuBars[0].Width, Is.EqualTo(Dim.Fill(0)));
Assert.That(menuBars[1].Width, Is.EqualTo(Dim.Fill(0)));
}

}
}

0 comments on commit 6f758bf

Please sign in to comment.