Fixes #3754. UICatalog throws System.NullReferenceException on MenuBar in Linux. (#3755)

This commit is contained in:
BDisp
2024-09-24 16:11:13 +01:00
committed by GitHub
parent ee13e2ca3a
commit 85fcbdf24e
2 changed files with 25 additions and 1 deletions

View File

@@ -148,6 +148,30 @@ public class MenuBarTests (ITestOutputHelper output)
top.Dispose ();
}
[Fact]
[AutoInitShutdown]
public void CanExecute_False_Does_Not_Throws ()
{
var menu = new MenuBar
{
Menus =
[
new ("File", new MenuItem []
{
new ("New", "", null, () => false),
null,
new ("Quit", "", null)
})
]
};
var top = new Toplevel ();
top.Add (menu);
Application.Begin (top);
Assert.True (menu.NewKeyDownEvent (menu.Key));
Assert.True (menu.IsMenuOpen);
}
[Fact]
[AutoInitShutdown]
public void CanExecute_HotKey ()