Add ruler cursor behavior tests#174
Merged
Merged
Conversation
Enable UI tests to observe cursor changes and ensure mouse events propagate correctly. - AppDelegate: read FREE_RULER_UI_TEST_CURSOR_STATE_NAME env var, add writeUITestCursorState(), and initialize cursor state to "none" during UI tests. - RulerCursorController: add accessibilityValue for cursor styles and write the current cursor state to the test file whenever cursor changes. - RuleView: forward mouseEntered/mouseExited/mouseDown/mouseUp/mouseMoved to nextResponder and accept first mouse to ensure expected behavior during UI interactions. - RulerWindow: forward mouseDown/mouseUp to nextResponder and call super. - FreeRulerUITests: create per-run temp cursor state file, set env var, add multiple tests and helpers to hover/press elements and assert cursor sequences by reading the state file; clean up after tests. These changes make cursor-related assertions in UI tests deterministic by communicating cursor state via a temporary file and ensure UI elements receive mouse events as expected.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds both unit-level and UI-level coverage for the ruler cursor state machine by (a) expanding RulerCursorController behavior assertions and (b) instrumenting the app/UI to forward mouse events and expose cursor state to UI tests.
Changes:
- Add a focused unit test that steps through mouse enter/down/exit-drag/up-outside/re-enter/up-inside/exit and asserts
currentCursor+ cursor application. - Add new UI tests that perform hover/press/mouseout sequences on grouped and ungrouped rulers and assert cursor transitions via a cursor-state file.
- Forward mouse events from
RuleView/RulerWindowinto the responder chain soRulerControllercan drive cursor updates.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| FreeRulerUITests/FreeRulerUITests.swift | Adds cursor-sequence UI tests + file-based cursor assertions and related helpers. |
| FreeRulerTests/RulerCoreTests.swift | Adds a detailed cursor-controller state-machine unit test with step-by-step assertions. |
| Free Ruler/RuleView.swift | Forwards mouse events (entered/exited/moved/down/up) to the next responder; accepts first mouse. |
| Free Ruler/RulerWindow.swift | Forwards mouse down/up to the next responder before calling super. |
| Free Ruler/RulerCursorController.swift | Adds a string representation for cursor styles and writes cursor state for UI tests on cursor changes. |
| Free Ruler/AppDelegate.swift | Adds env-controlled cursor-state file writing for UI tests and initializes cursor state during UI-test startup. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Adds focused behavior coverage for the ruler cursor state machine before the resize-handle branch continues iterating on hover and cursor regressions.
Changes
RulerCursorController.currentCursorafter each action, and verify cursor application when a cursor change is expected.Validation
Not run per request.