diff --git a/tests/Investigations/TwoMenuBarsInvestigation.cs b/tests/Investigations/TwoMenuBarsInvestigation.cs index 8504a13b..f01cb177 100644 --- a/tests/Investigations/TwoMenuBarsInvestigation.cs +++ b/tests/Investigations/TwoMenuBarsInvestigation.cs @@ -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().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))); + } + } }