Fixed unit tests

This commit is contained in:
Tig
2024-08-15 06:38:07 -06:00
parent 782b090643
commit 42a9ecb151
4 changed files with 16 additions and 11 deletions

View File

@@ -239,11 +239,11 @@ public class ResponderTests
Assert.False (r.NewMouseLeaveEvent (new MouseEvent { Flags = MouseFlags.AllEvents }));
var v = new View ();
Assert.False (r.OnEnter (v));
//Assert.False (r.OnEnter (v));
v.Dispose ();
v = new View ();
Assert.False (r.OnLeave (v));
//Assert.False (r.OnLeave (v));
v.Dispose ();
r.Dispose ();

View File

@@ -1498,16 +1498,20 @@ public class NavigationTests (ITestOutputHelper _output) : TestsAllViews
}
[Fact]
public void SetFocus_View_With_Null_Superview_Does_Not_Throw_Exception ()
public void SetFocus_With_Null_Superview_Does_Not_Throw_Exception ()
{
var top = new Toplevel ();
Assert.True (top.CanFocus);
Assert.False (top.HasFocus);
var view = new View ()
{
CanFocus = true
};
Assert.True (view.CanFocus);
Assert.False (view.HasFocus);
Exception exception = Record.Exception (top.SetFocus);
Exception exception = Record.Exception (() => view.SetFocus());
Assert.Null (exception);
Assert.True (top.CanFocus);
Assert.True (top.HasFocus);
Assert.True (view.CanFocus);
Assert.True (view.HasFocus);
}
[Fact]

View File

@@ -612,7 +612,7 @@ Item 6",
var lv = new ListView ();
var top = new View ();
top.Add (lv);
Exception exception = Record.Exception (lv.SetFocus);
Exception exception = Record.Exception (() => lv.SetFocus());
Assert.Null (exception);
}

View File

@@ -816,6 +816,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
Assert.Null (exception);
}
#if V2_NEW_FOCUS_IMPL
[Fact]
[AutoInitShutdown]
public void OnEnter_OnLeave_Triggered_On_Application_Begin_End ()
@@ -855,7 +856,6 @@ public partial class ToplevelTests (ITestOutputHelper output)
top.Dispose ();
}
[Fact]
[AutoInitShutdown]
public void OnEnter_OnLeave_Triggered_On_Application_Begin_End_With_Modal ()
@@ -1037,6 +1037,7 @@ public partial class ToplevelTests (ITestOutputHelper output)
Assert.Equal (4, steps [^1]);
top.Dispose ();
}
#endif
[Fact]
[AutoInitShutdown]