mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2025-12-26 15:57:56 +01:00
* Fixed MouseGrabView bug. Added extensive test coverage for `Keyboard`, `Mouse`, `Timeout`, and `Popover` functionalities, including edge cases and concurrent access. Introduced parameterized and data-driven tests to reduce redundancy and improve clarity. Refactored codebase for modularity and maintainability, introducing new namespaces and reorganizing classes. Enhanced `MouseImpl`, `KeyboardImpl`, and `Runnable` implementations with improved event handling, thread safety, and support for the Terminal.Gui Cancellable Work Pattern (CWP). Removed deprecated code and legacy tests, such as `LogarithmicTimeout` and `SmoothAcceleratingTimeout`. Fixed bugs related to mouse grabbing during drag operations and unbalanced `ApplicationImpl.Begin/End` calls. Improved documentation and code readability with modern C# features. * Code cleanup. * Update Tests/UnitTestsParallelizable/Application/Runnable/RunnableIntegrationTests.cs Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Improve null handling and simplify test setup In `MouseImpl.cs`, added an early `return` after the `UngrabMouse()` call within the `if (view is null)` block to prevent further execution when `view` is `null`, improving null reference handling. In `RunnableIntegrationTests.cs`, removed the initialization of the `IApplication` object (`app`) from the `MultipleRunnables_IndependentResults` test method, simplifying the test setup and focusing on runnable behavior. * Code cleanup * API doc link cleanup --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -49,8 +49,10 @@ public class MouseTests : TestsAllViews
|
||||
|
||||
Application.RaiseMouseEvent (new () { ScreenPosition = new (xy + 1, xy + 1), Flags = MouseFlags.Button1Pressed | MouseFlags.ReportMousePosition });
|
||||
AutoInitShutdownAttribute.RunIteration ();
|
||||
|
||||
Assert.Equal (expectedMoved, new Point (5, 5) == testView.Frame.Location);
|
||||
// The above grabbed the mouse. Need to ungrab.
|
||||
Application.Mouse.UngrabMouse ();
|
||||
|
||||
top.Dispose ();
|
||||
}
|
||||
|
||||
|
||||
@@ -152,6 +152,9 @@ public class ViewCommandTests
|
||||
Assert.Equal (1, btnAcceptedCount);
|
||||
Assert.Equal (0, wAcceptedCount);
|
||||
|
||||
// The above grabbed the mouse. Need to ungrab.
|
||||
Application.Mouse.UngrabMouse ();
|
||||
|
||||
w.Dispose ();
|
||||
Application.ResetState (true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user