Attempting to figure out unit test fails and why tests are now slow. 2

This commit is contained in:
Tig
2024-09-23 11:04:39 -06:00
parent 21abe095a6
commit 8e4ddfab82
8 changed files with 52 additions and 88 deletions

View File

@@ -138,7 +138,7 @@ public class ApplicationMouseTests
/// Tests that the mouse coordinates passed to the focused view are correct when the mouse is clicked. With
/// Frames; Frame != Viewport
/// </summary>
[AutoInitShutdown]
//[AutoInitShutdown]
[Theory]
// click on border
@@ -200,12 +200,12 @@ public class ApplicationMouseTests
var clicked = false;
var top = new Toplevel ();
top.X = 0;
top.Y = 0;
top.Width = size.Width * 2;
top.Height = size.Height * 2;
top.BorderStyle = LineStyle.None;
Application.Top = new Toplevel ();
Application.Top.X = 0;
Application.Top.Y = 0;
Application.Top.Width = size.Width * 2;
Application.Top.Height = size.Height * 2;
Application.Top.BorderStyle = LineStyle.None;
var view = new View { X = pos.X, Y = pos.Y, Width = size.Width, Height = size.Height };
@@ -213,8 +213,8 @@ public class ApplicationMouseTests
view.BorderStyle = LineStyle.Single;
view.CanFocus = true;
top.Add (view);
Application.Begin (top);
Application.Top.Add (view);
var mouseEvent = new MouseEvent { Position = new (clickX, clickY), Flags = MouseFlags.Button1Clicked };
view.MouseClick += (s, e) =>
@@ -226,7 +226,8 @@ public class ApplicationMouseTests
Application.OnMouseEvent (mouseEvent);
Assert.Equal (expectedClicked, clicked);
top.Dispose ();
Application.Top.Dispose ();
Application.ResetState (ignoreDisposed: true);
}
#endregion mouse coordinate tests