mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 16:59:35 +01:00
Discovered serious issues with how HasFocus, OnEnter/OnLeave, etc... work in some edge cases.
This will require re-visiting the design at a deep level and fixing some long-standing but ignored issues such as how OnEnter/OnLeave don't follow proper cancelation design. Also, there's a need for keeping track of the old focus state of a tree of subviews when that tree loses focus; FocusDireciton is a hack that causes tons of confusion.
This commit is contained in:
@@ -1,12 +1,37 @@
|
||||
using Moq;
|
||||
using Xunit.Abstractions;
|
||||
using Terminal.Gui;
|
||||
|
||||
namespace Terminal.Gui.ApplicationTests;
|
||||
namespace Terminal.Gui.ApplicationTests.NavigationTests;
|
||||
|
||||
public class ApplicationNavigationTests (ITestOutputHelper output)
|
||||
{
|
||||
private readonly ITestOutputHelper _output = output;
|
||||
|
||||
[Fact]
|
||||
public void Focused_Change_Raises_FocusedChanged ()
|
||||
{
|
||||
bool raised = false;
|
||||
|
||||
ApplicationNavigation.FocusedChanged += ApplicationNavigationOnFocusedChanged;
|
||||
|
||||
ApplicationNavigation.Focused = new View();
|
||||
|
||||
Assert.True (raised);
|
||||
|
||||
ApplicationNavigation.Focused.Dispose ();
|
||||
ApplicationNavigation.Focused = null;
|
||||
|
||||
ApplicationNavigation.FocusedChanged -= ApplicationNavigationOnFocusedChanged;
|
||||
|
||||
return;
|
||||
|
||||
void ApplicationNavigationOnFocusedChanged (object sender, EventArgs e)
|
||||
{
|
||||
raised = true;
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetDeepestFocusedSubview_ShouldReturnNull_WhenViewIsNull ()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user