mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Merge branch 'v2_develop' of tig:gui-cs/Terminal.Gui into v2_develop
This commit is contained in:
@@ -743,6 +743,11 @@ public class MenuBar : View, IDesignable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_selected == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
OpenMenu (_selected);
|
OpenMenu (_selected);
|
||||||
|
|
||||||
SelectEnabledItem (
|
SelectEnabledItem (
|
||||||
@@ -984,6 +989,11 @@ public class MenuBar : View, IDesignable
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_selected == -1)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
OpenMenu (_selected);
|
OpenMenu (_selected);
|
||||||
|
|
||||||
if (!SelectEnabledItem (
|
if (!SelectEnabledItem (
|
||||||
|
|||||||
@@ -2105,4 +2105,34 @@ public class ContextMenuTests (ITestOutputHelper output)
|
|||||||
|
|
||||||
top.Dispose ();
|
top.Dispose ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
[AutoInitShutdown]
|
||||||
|
public void Menu_Without_SubMenu_Is_Closed_When_Pressing_Key_Right_Or_Key_Left ()
|
||||||
|
{
|
||||||
|
var cm = new ContextMenu ();
|
||||||
|
|
||||||
|
var menuItems = new MenuBarItem (
|
||||||
|
[
|
||||||
|
new ("_New", string.Empty, null),
|
||||||
|
new ("_Save", string.Empty, null)
|
||||||
|
]
|
||||||
|
);
|
||||||
|
var top = new Toplevel ();
|
||||||
|
Application.Begin (top);
|
||||||
|
|
||||||
|
cm.Show (menuItems);
|
||||||
|
Assert.True (cm.MenuBar!.IsMenuOpen);
|
||||||
|
|
||||||
|
Assert.True (Application.RaiseKeyDownEvent (Key.CursorRight));
|
||||||
|
Assert.False (cm.MenuBar!.IsMenuOpen);
|
||||||
|
|
||||||
|
cm.Show (menuItems);
|
||||||
|
Assert.True (cm.MenuBar!.IsMenuOpen);
|
||||||
|
|
||||||
|
Assert.True (Application.RaiseKeyDownEvent (Key.CursorLeft));
|
||||||
|
Assert.False (cm.MenuBar!.IsMenuOpen);
|
||||||
|
|
||||||
|
top.Dispose ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user