|
@@ -4,21 +4,20 @@ namespace Terminal.Gui.ViewTests;
|
|
|
|
|
|
public class MouseTests (ITestOutputHelper output)
|
|
public class MouseTests (ITestOutputHelper output)
|
|
{
|
|
{
|
|
-
|
|
|
|
[Theory]
|
|
[Theory]
|
|
- [InlineData(false, false, false)]
|
|
|
|
|
|
+ [InlineData (false, false, false)]
|
|
[InlineData (true, false, true)]
|
|
[InlineData (true, false, true)]
|
|
[InlineData (true, true, true)]
|
|
[InlineData (true, true, true)]
|
|
public void MouseClick_SetsFocus_If_CanFocus (bool canFocus, bool setFocus, bool expectedHasFocus)
|
|
public void MouseClick_SetsFocus_If_CanFocus (bool canFocus, bool setFocus, bool expectedHasFocus)
|
|
{
|
|
{
|
|
- var superView = new View () { CanFocus = true, Height = 1, Width = 15 };
|
|
|
|
- var focusedView = new View () { CanFocus = true, Width = 1, Height = 1 };
|
|
|
|
- var testView = new View () { CanFocus = canFocus, X = 4, Width = 4, Height = 1 };
|
|
|
|
|
|
+ var superView = new View { CanFocus = true, Height = 1, Width = 15 };
|
|
|
|
+ var focusedView = new View { CanFocus = true, Width = 1, Height = 1 };
|
|
|
|
+ var testView = new View { CanFocus = canFocus, X = 4, Width = 4, Height = 1 };
|
|
superView.Add (focusedView, testView);
|
|
superView.Add (focusedView, testView);
|
|
superView.BeginInit ();
|
|
superView.BeginInit ();
|
|
- superView.EndInit ();
|
|
|
|
-
|
|
|
|
- focusedView.SetFocus();
|
|
|
|
|
|
+ superView.EndInit ();
|
|
|
|
+
|
|
|
|
+ focusedView.SetFocus ();
|
|
|
|
|
|
Assert.True (superView.HasFocus);
|
|
Assert.True (superView.HasFocus);
|
|
Assert.True (focusedView.HasFocus);
|
|
Assert.True (focusedView.HasFocus);
|
|
@@ -29,8 +28,10 @@ public class MouseTests (ITestOutputHelper output)
|
|
testView.SetFocus ();
|
|
testView.SetFocus ();
|
|
}
|
|
}
|
|
|
|
|
|
- testView.OnMouseEvent (new MouseEvent () { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked });
|
|
|
|
|
|
+ testView.OnMouseEvent (new() { X = 0, Y = 0, Flags = MouseFlags.Button1Clicked });
|
|
Assert.True (superView.HasFocus);
|
|
Assert.True (superView.HasFocus);
|
|
- Assert.Equal(expectedHasFocus, testView.HasFocus);
|
|
|
|
|
|
+ Assert.Equal (expectedHasFocus, testView.HasFocus);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ // TODO: Add more tests that ensure the above test works with positive adornments
|
|
}
|
|
}
|