Fix key release repeat flag and add event contract tests#10
Merged
Conversation
…t-coverage # Conflicts: # Lessons.md
There was a problem hiding this comment.
Pull request overview
This PR tightens and documents input/lifecycle event contracts across the overlay window and retained UI, and fixes keyboard repeat semantics so key-release events don’t incorrectly report repeats due to Win32 WasDown.
Changes:
- Fix
OverlayKeyboardEventArgs.IsRepeatso repeat is only true for key-down dispatch (not key-up). - Add/strengthen integration + UI tests asserting event payloads (bounds/visibility/target tracking, pointer/keyboard/text routing, EventArgs.Empty-style events).
- Document the Win32 key-up repeat lesson in
Lessons.md.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| tests/ModernOverlay.Tests/TargetTrackingTests.cs | Adds assertions for BoundsChanged / TargetChanged / loss+reacquire event payloads. |
| tests/ModernOverlay.Tests/OverlayWindowThreadingTests.cs | Adds event-contract tests for dispose, pointer move/release, and keyboard/text payload copying. |
| tests/ModernOverlay.Tests/OverlayUiRangeNumericTests.cs | Asserts ValueChanged event count during slider interaction. |
| tests/ModernOverlay.Tests/OverlayUiInputRoutingTests.cs | Adds stronger routed pointer/wheel/click assertions (source/original source/phase/payload). |
| tests/ModernOverlay.Tests/OverlayUiFocusKeyboardTests.cs | Adds routed text input assertions for focused elements + handled behavior. |
| tests/ModernOverlay.Tests/OverlayUiElementModelTests.cs | Asserts lifecycle event args use EventArgs.Empty and sender correctness. |
| tests/ModernOverlay.Tests/OverlayUiCommandTests.cs | Asserts CanExecuteChanged sender/args contract and that raise triggers exactly once. |
| tests/ModernOverlay.Tests/OverlayUiButtonControlTests.cs | Adds CheckStateChanged event-count assertion for toggle behavior. |
| src/ModernOverlay/OverlayWindow.cs | Computes isRepeat for keyboard args only on key-down dispatch. |
| src/ModernOverlay/Events.cs | Stores IsRepeat in args; adds internal ctor to allow correct repeat semantics per event kind. |
| Lessons.md | Records the Win32 WasDown / key-up repeat contract lesson. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
559
to
566
| OverlayPointerEventArgs pointer = await pointerWheel.Task.WaitAsync(TimeSpan.FromSeconds(5)); | ||
| Assert.AreEqual(OverlayPointerEventKind.Wheel, pointer.Kind); | ||
| Assert.AreEqual(OverlayPointerButton.None, pointer.Button); | ||
| Assert.AreEqual(14, pointer.PixelX); | ||
| Assert.AreEqual(28, pointer.PixelY); | ||
| Assert.AreEqual(14f, pointer.Position.X); | ||
| Assert.AreEqual(28f, pointer.Position.Y); | ||
| Assert.AreEqual(wheelDelta, pointer.WheelDelta); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OverlayKeyboardEventArgs.IsRepeatfor key release events soWasDownonly contributes to repeat on key-down dispatch.Lessons.md.Validation
dotnet test tests\ModernOverlay.Tests\ModernOverlay.Tests.csproj --configuration Debug --filter "FullyQualifiedName~OverlayWindowThreadingTests|FullyQualifiedName~TargetTrackingTests|FullyQualifiedName~OverlayUiInputRoutingTests|FullyQualifiedName~OverlayUiFocusKeyboardTests|FullyQualifiedName~OverlayUiElementModelTests|FullyQualifiedName~OverlayUiButtonControlTests|FullyQualifiedName~OverlayUiRangeNumericTests|FullyQualifiedName~OverlayUiCommandTests" --logger trxdotnet test tests\ModernOverlay.Tests\ModernOverlay.Tests.csproj --configuration Debug --logger trxdotnet test tests\ModernOverlay.Tests\ModernOverlay.Tests.csproj --configuration Release --filter "FullyQualifiedName~OverlayWindowThreadingTests|FullyQualifiedName~TargetTrackingTests|FullyQualifiedName~OverlayUiInputRoutingTests|FullyQualifiedName~OverlayUiFocusKeyboardTests|FullyQualifiedName~OverlayUiElementModelTests|FullyQualifiedName~OverlayUiButtonControlTests|FullyQualifiedName~OverlayUiRangeNumericTests|FullyQualifiedName~OverlayUiCommandTests" --logger trxgit diff --check