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.
Enums§
- Filmstrip
Error - What can go wrong composing a filmstrip via
filmstrip_image: never a panic, always one of these.
Constants§
- BUDGET_
ENV - Env var overriding the differing-pixel budget (a fraction, e.g.
0.006), for runners whose rasterizer differs from the goldens’. - MAX_
STRIP_ SCALE - See
MIN_STRIP_SCALE. - MIN_
STRIP_ SCALE - Per-cell scale bounds (
clamp_strip_scale): below the floor a frame is unreadably small; above 1.0 there is nothing to upscale — a filmstrip never carries more detail than the frames it tiles. - UPDATE_
ENV - Env var that regenerates goldens instead of comparing.
Functions§
- assert_
filmstrip_ snapshot - Composes frames captured by
crate::Harness::filminto one horizontal filmstrip and compares it against the PNG goldendir/name.pngexactly likeassert_png_snapshot(same env vars, same.actual/.diff/.sidefailure artifacts). Seefilmstrip_imagefor how the strip is composed. - assert_
filmstrip_ snapshot_ scaled - Like
assert_filmstrip_snapshot, with an explicit per-cellscale(clamped to0.05..=1.0) so a strip of many, or large, frames still makes a small, reviewable golden. - assert_
png_ snapshot - Compares
actualagainst the goldendir/name.png. - clamp_
strip_ scale - Clamps a filmstrip’s per-cell
scaleinto the composable range (0.05..=1.0, seeMIN_STRIP_SCALE/MAX_STRIP_SCALE); non-finite input clamps to the default (no shrink), same as aNaNor infinite input would from any other caller-supplied dimension in this crate. - filmstrip_
image - Composes frames captured by
crate::Harness::filminto one horizontal filmstrip: each frame side by side, left to right, captioned with its index and elapsed time (index * interval_ms, matching theinterval_mspassed tofilm).scale(per-cell, clamped viaclamp_strip_scale) shrinks each thumbnail so a strip of many, or large, frames still composes to a reviewable size.