Skip to main content

Module testing

Module testing 

Source
Expand description

PNG golden testing: tolerance-based image comparison with an update mode, used by every visual test in the workspace.

Comparison passes when every channel delta is at most 3/255 and fewer than 0.2 percent of pixels exceed that. FENESTRA_UPDATE_SNAPSHOTS=1 regenerates goldens. On failure three artifacts land next to the golden: <name>.actual.png (what rendered), <name>.diff.png (the offending pixels in red over the dimmed golden), and <name>.side.png (golden | actual | diff side by side) — read the diff first; it shows where, not just how much.

Goldens are rendered on macOS/Metal; a software rasterizer (CI’s lavapipe) antialiases slightly differently, so the pixel budget can be widened there with FENESTRA_SNAPSHOT_BUDGET (e.g. 0.006) without loosening the reference platform.

Constants§

BUDGET_ENV
Env var overriding the differing-pixel budget (a fraction, e.g. 0.006), for runners whose rasterizer differs from the goldens’.
UPDATE_ENV
Env var that regenerates goldens instead of comparing.

Functions§

assert_png_snapshot
Compares actual against the golden dir/name.png.