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 the actual image is written next to the golden as <name>.actual.png for inspection.

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.