Partially Fixes #2975 - Upgrades UICatalog to Menuv2 (#4011)

This commit is contained in:
Tig
2025-04-02 06:27:24 -06:00
committed by GitHub
parent 4cc44091f2
commit 7ba9e539ed
31 changed files with 6467 additions and 5216 deletions

View File

@@ -462,7 +462,7 @@ public class MessageBoxTests
{
MessageBox.Query (
"",
UICatalogApp.GetAboutBoxMessage (),
UICatalog.UICatalogTopLevel.GetAboutBoxMessage (),
wrapMessage: false,
buttons: "_Ok"
);

View File

@@ -4146,7 +4146,7 @@ Nice Work")]
{
TextFormatter tf = new ()
{
Text = UICatalogApp.GetAboutBoxMessage (),
Text = UICatalog.UICatalogTopLevel.GetAboutBoxMessage (),
Alignment = Alignment.Center,
VerticalAlignment = Alignment.Start,
WordWrap = false,

View File

@@ -129,6 +129,28 @@ public class KeyBindingsTests ()
top.Dispose ();
}
[Fact]
[AutoInitShutdown]
public void HotKey_Enabled_False_Does_Not_Invoke ()
{
var view = new ScopedKeyBindingView ();
var keyWasHandled = false;
view.KeyDownNotHandled += (s, e) => keyWasHandled = true;
var top = new Toplevel ();
top.Add (view);
Application.Begin (top);
Application.RaiseKeyDownEvent (Key.Z);
Assert.False (keyWasHandled);
Assert.False (view.HotKeyCommand);
keyWasHandled = false;
view.Enabled = false;
Application.RaiseKeyDownEvent (Key.F);
Assert.False (view.HotKeyCommand);
top.Dispose ();
}
// tests that test KeyBindingScope.Focus and KeyBindingScope.HotKey (tests for KeyBindingScope.Application are in Application/KeyboardTests.cs)
public class ScopedKeyBindingView : View

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -4,10 +4,10 @@
namespace Terminal.Gui.ViewsTests;
public class MenuTests
public class Menuv1Tests
{
private readonly ITestOutputHelper _output;
public MenuTests (ITestOutputHelper output) { _output = output; }
public Menuv1Tests (ITestOutputHelper output) { _output = output; }
// TODO: Create more low-level unit tests for Menu and MenuItem