Skip to content

feat(vrt): per-test render-mode gating for Canvas2D visual regression#125

Merged
chiefcll merged 1 commit into
mainfrom
feat/canvas-visual-regression-gating
Jul 2, 2026
Merged

feat(vrt): per-test render-mode gating for Canvas2D visual regression#125
chiefcll merged 1 commit into
mainfrom
feat/canvas-visual-regression-gating

Conversation

@chiefcll

@chiefcll chiefcll commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

First step toward running the visual regression suite against both backends (the runner already supports --renderMode canvas|all; what was missing is test-level compatibility). This PR makes the full example suite run clean under the Canvas2D backend: 151 snapshots, zero throws, zero page errors.

Gating mechanism

  • Test modules can export renderModes: ('webgl' | 'canvas')[] (default: all modes). runAutomation skips non-matching tests and logs the skip so excluded coverage is visible in runner output.
  • ExampleSettings gains a renderMode field so tests can branch per backend.

WebGL-only marks (3 tests)

  • rtt-dimension, rtt-spritemaprenderToTexture is a documented noop on CanvasRenderer; the tests render blank.
  • text-ssdf — SSDF atlas fonts exist only for the SDF/WebGL text renderer (confirmed blank under canvas).

Made mode-aware (17 tests)

The text/stress tests that deliberately render sdf and canvas text-renderer variants side by side threw under the canvas backend (No compatible text renderer found — the SDF engine is not registered there). They now skip the sdf variants when renderMode === 'canvas' and keep both under webgl. Notable cases:

  • text-offscreen-move had a subheader hardcoded to 'sdf' even on its canvas pages.
  • stress-animation / stress-tv use SDF text as HUD/content rather than as a comparison variant — they substitute the canvas text renderer wholesale under canvas.
  • render-settings used the SDF-only Ubuntu-ssdf font family for every label, leaving all text as blank/placeholder boxes under canvas; it now falls back to the canvas-loaded Ubuntu face.

Verification

  • WebGL output is unchanged: full visual regression compare run against pre-existing local baselines passes for every edited test. (5 unrelated failures are stale local baselines: 3 tests newer than the local capture, 2 gradient tests whose shaders changed in refactor(shaders): make all WebGL fragment shaders branchless for Mali 400 #118 after that capture.)
  • Canvas suite runs clean: pnpm test:visual --capture --renderMode canvas completes 151 snapshots with no page errors and no automation throws, including spot-review of shader, clipping, scaling, and text output against webgl counterparts.

Next steps (separate PRs)

  1. Capture and certify chromium-ci-canvas baselines via the Docker flow (capture twice + pixel-diff to guard against a texture-placeholder timing flake observed once during triage).
  2. Flip the runner's default renderMode to all and split the CI visual job into a webgl/canvas matrix.

🤖 Generated with Claude Code

Groundwork for running the visual regression suite against the Canvas2D
backend (runner support for --renderMode canvas already exists):

- Test modules can export `renderModes: ('webgl' | 'canvas')[]`;
  runAutomation skips non-matching tests and logs the skip.
  ExampleSettings gains `renderMode` so tests can branch per backend.

- Marked webgl-only (canvas can't produce meaningful output):
  rtt-dimension, rtt-spritemap (renderToTexture is a canvas noop),
  text-ssdf (SSDF atlas fonts are SDF-renderer-only).

- Made 17 tests mode-aware: the text/stress tests that render sdf and
  canvas text-renderer variants side by side now skip the sdf variants
  under the canvas backend (the SDF engine is not registered there and
  createTextNode throws); render-settings swaps its SDF-only
  Ubuntu-ssdf font for the canvas-loaded Ubuntu face.

Under webgl every test produces byte-identical output to before,
verified by a full visual regression compare run. Under canvas the
full suite now runs clean: 151 snapshots, zero throws, zero page
errors.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@chiefcll chiefcll merged commit 5aece74 into main Jul 2, 2026
1 check passed
@chiefcll chiefcll deleted the feat/canvas-visual-regression-gating branch July 2, 2026 22:12
chiefcll added a commit that referenced this pull request Jul 2, 2026
Completes the canvas visual-regression rollout started in #125:

- Certify chromium-ci-canvas baselines (151 snapshots), captured in the
  Docker CI environment. Captured twice and pixel-diffed: both runs
  byte-identical, guarding against the texture-placeholder timing flake
  seen once during triage.

- Flip the runner's default renderMode from 'webgl' to 'all', as the
  option's comment anticipated — local runs and CI now cover both
  backends by default.

- Split the CI workflow: unit tests in their own job, visual regression
  as a webgl/canvas matrix (fail-fast off, per-mode failed-results
  artifacts) so a red X names the backend that regressed.

- Document the dual-backend workflow in visual-regression/README.md and
  CLAUDE.md, including the per-test renderModes opt-out.

Validated with a CI-style Docker compare run over both backends:
webgl 180/180 and canvas 151/151 snapshots pass.

Co-authored-by: Claude Fable 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