Skip to content

Add ruler cursor behavior tests#174

Merged
pascalpp merged 4 commits into
mainfrom
codex/173-behavior-tests
Jun 11, 2026
Merged

Add ruler cursor behavior tests#174
pascalpp merged 4 commits into
mainfrom
codex/173-behavior-tests

Conversation

@pascalpp

@pascalpp pascalpp commented Jun 11, 2026

Copy link
Copy Markdown
Owner

Summary

Adds focused behavior coverage for the ruler cursor state machine before the resize-handle branch continues iterating on hover and cursor regressions.

Changes

  • Add a cursor-sequence test that exercises mouse over, mouse down, mouse out while dragging, mouse up outside, re-enter, mouse up inside, and mouse out after release.
  • Assert RulerCursorController.currentCursor after each action, and verify cursor application when a cursor change is expected.

Validation

Not run per request.

@pascalpp pascalpp changed the title Add ruler cursor and mouse tick behavior tests Add ruler cursor behavior tests Jun 11, 2026
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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/RulerWindow into the responder chain so RulerController can 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.

Comment thread Free Ruler/RulerCursorController.swift Outdated
Comment thread Free Ruler/RulerCursorController.swift
Comment thread FreeRulerUITests/FreeRulerUITests.swift
Comment thread Free Ruler/AppDelegate.swift
@pascalpp pascalpp merged commit 9259ceb into main Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants