Skip to content

Slider snap test draws its slider before pressing it - #210

Open
FitFocusMedia wants to merge 1 commit into
robbietilton:mainfrom
FitFocusMedia:slider-snap-test-draws-first
Open

FitFocusMedia wants to merge 1 commit into
robbietilton:mainfrom
FitFocusMedia:slider-snap-test-draws-first

Conversation

@FitFocusMedia

Copy link
Copy Markdown

Built with Xcode 27 (macOS 27 SDK), SliderSnapTests.clickingTheTrackSnapsBeforeNativeTrackingBegins fails every run:

Expectation failed: abs(slider.doubleValue - 0.94) < 0.02
value should snap under the click before tracking: 1.0

It passes in CI (Xcode 26.6), and the app's slider snapping is unaffected. Only the test's setup changed meaning.

Cause

A slider cell learns its track's rectangle only when it draws. Linked against the macOS 27 SDK, makeKeyAndOrderFront no longer draws the window right away, so the test presses a slider that has never drawn. Tracing the hook during the failing test showed:

knob (-10.0, -8.0, 20.0, 16.0)  track (0.0, 0.0, 20.0, 16.0)
after snap 0.1  →  after original 1.0

The track is no wider than the knob, so snapValue sees no travel and returns without setting a value. Native tracking then jumps to the end (1.0). The hook itself is installed and called as intended.

Fix

The test calls window.displayIfNeeded() before pressing, as a person always sees a slider before clicking it. The app code is unchanged.

Verification

On macOS 26.6.2, Apple silicon, Xcode 27.0 (27A266a):

  • FloatingPanelTests + SliderSnapTests run serially: 7/7 pass, three runs in a row (failed every time before).
  • The rest of CompositorTests in parallel: 510/510 pass.

I haven't run it under Xcode 26.6 locally. Drawing an already ordered-front window should be harmless there, and this PR's CI covers it.

🤖 Generated with Claude Code

A slider cell learns its track's rectangle only when it draws. Built
against the macOS 27 SDK (Xcode 27), ordering a window front no longer
draws it, so the test pressed a slider that had never drawn: the snap
saw a track no wider than the knob, left the value alone, and native
tracking jumped it to 1.0. Drawing the window first, as a person always
sees a slider before clicking it, lets the test check the snap again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

1 participant