mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
Improving Application.Navigation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Xunit.Abstractions;
|
||||
using System.Reflection.Emit;
|
||||
using Xunit.Abstractions;
|
||||
using Color = Terminal.Gui.Color;
|
||||
|
||||
namespace Terminal.Gui.ViewsTests;
|
||||
@@ -692,6 +693,10 @@ public class ColorPickerTests
|
||||
public void ColorPicker_TabCompleteColorName ()
|
||||
{
|
||||
var cp = GetColorPicker (ColorModel.RGB, true, true);
|
||||
Application.Navigation = new ();
|
||||
Application.Current = new ();
|
||||
Application.Current.Add (cp);
|
||||
|
||||
cp.Draw ();
|
||||
|
||||
var r = GetColorBar (cp, ColorPickerPart.Bar1);
|
||||
@@ -728,6 +733,7 @@ public class ColorPickerTests
|
||||
Assert.Equal ("#7FFFD4", hex.Text);
|
||||
|
||||
Application.Current?.Dispose ();
|
||||
Application.ResetState ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -735,6 +741,10 @@ public class ColorPickerTests
|
||||
public void ColorPicker_EnterHexFor_ColorName ()
|
||||
{
|
||||
var cp = GetColorPicker (ColorModel.RGB, true, true);
|
||||
Application.Navigation = new ();
|
||||
Application.Current = new ();
|
||||
Application.Current.Add (cp);
|
||||
|
||||
cp.Draw ();
|
||||
|
||||
var name = GetTextField (cp, ColorPickerPart.ColorName);
|
||||
@@ -777,6 +787,7 @@ public class ColorPickerTests
|
||||
Assert.Equal ("Aquamarine", name.Text);
|
||||
|
||||
Application.Current?.Dispose ();
|
||||
Application.ResetState ();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -1321,6 +1321,7 @@ e
|
||||
{
|
||||
Label label = new () { Text = "label" };
|
||||
View view = new () { Text = "view", CanFocus = true };
|
||||
Application.Navigation = new ();
|
||||
Application.Current = new ();
|
||||
Application.Current.Add (label, view);
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ Causes the focus to advance (forward or backwards) to the next View in the appli
|
||||
The implementation is simple:
|
||||
|
||||
```cs
|
||||
return Application.GetFocused()?.AdvanceFocus (direction, behavior) ?? false;
|
||||
return Application.Current?.AdvanceFocus (direction, behavior);
|
||||
```
|
||||
|
||||
This method is called from the `Command` handlers bound to the application-scoped keybindings created during `Application.Init`. It is `public` as a convenience.
|
||||
|
||||
Reference in New Issue
Block a user