Skip to content

test(visual): solid white+black window marker to remove subpixel AA drift#31

Merged
afonsojramos merged 7 commits into
mainfrom
white-box-black-square-markers
May 12, 2026
Merged

test(visual): solid white+black window marker to remove subpixel AA drift#31
afonsojramos merged 7 commits into
mainfrom
white-box-black-square-markers

Conversation

@afonsojramos
Copy link
Copy Markdown
Member

Summary

Continuous-improvement step on the visual ROI work. The remaining drift after #28 was 5/14 platforms showing ~1-2% pixel jitter, driven by anti-aliasing at the cyan→yellow boundary line inside the window and the magenta/green checker against macOS's translucent menu bar.

This PR replaces the window content with solid blocks of color:

  • Old: 200x100 split horizontally — cyan (top) / yellow (bottom). A subpixel AA seam where the colors meet jittered between runs.
  • New: 200x100 white background with a centered solid 80x40 black rectangle. No AA inside the rectangle (pure white-to-white). One sharp AA boundary at the inner square edge, but that's between two solid colors with no transparency, so it should render deterministically.

Tray icon stays as the magenta/green checker — it's the backdrop (macOS menu bar translucency) that causes its drift, which is unfixable without redesigning the icon altogether.

Detection logic moved from "global cyan+yellow pixel count" to "white+black pixel count inside the reported window.getBounds() rect", which also stops OS chrome white/black text from contributing false-positives. Thresholds: ≥5000 white + ≥500 black inside the rect (out of an expected ~16800 + ~3200 fully visible).

Test plan

  • All 14 visual jobs pass with the new detection
  • After merge: auto-refresh PR diff shrinks from 5 → 0-1 platforms (or close to it)
  • Saved screenshots show a white "frame" where the window is (the inner black square blends with the black mask background — that's fine, the frame is the visual cue)

@afonsojramos afonsojramos merged commit 87794f1 into main May 12, 2026
27 checks passed
afonsojramos added a commit that referenced this pull request May 12, 2026
## Summary
After #31 made the fixture window opaque white (to fix GNOME
bleed-through), Budgie and Cinnamon started failing: their default
panels are at the **bottom** of the screen, and our window snaps to the
bottom-right corner (because `tray.getBounds()` returns `{0,0,0,0}` on
Linux SNI, so menubar's Positioner falls back). The opaque white window
now sits right on top of the tray icon → `exactTray=0`, test fails. KDE
Plasma showed the same hang/failure pattern.

Previously the window was transparent (Electron default on Linux) so the
tray showed through.

**Fix**: explicitly `mb.window.setPosition(400, 200)` after
`showWindow()`. Mid-screen placement guarantees no overlap with any
panel (top or bottom) on any platform. On macOS/Windows the visual diff
just moves where the white box appears in the masked screenshot —
relative position doesn't matter for diffing.

## Test plan
- [ ] Budgie + Cinnamon now pass tray detection
- [ ] KDE Plasma completes in normal ~3min instead of hanging
- [ ] Other platforms unchanged
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant