Expand description
frus-test — the framework’s test tooling (§13 of the design notes).
Three levels, from the least integrated to the most:
- Pure
update: nothing to supply — the Elm architecture makes state testable with neither GPU nor window (assert_eq!on the struct after a message). This crate plays no part. - Scene and widget snapshots:
render_sceneandrender_widgetrender offscreen, through the same pipeline as the window, and return aSnapshotthat can be queried pixel by pixel. - Goldens:
Snapshot::assert_goldencompares against a reference PNG on disk. When it is missing, it is created — read it over, then commit it;FRUS_UPDATE_GOLDENS=1regenerates it. - A frame loop:
Stageholds the retained state and steps it the way the shell does, for the widgets whose picture is a gesture in flight — a swipe half-done, a pull past the top, a page between two pages — rather than a function of their arguments.
Goldens depend on the rasteriser, text antialiasing varying from one GPU to
another, so generate and compare them in the same environment — here,
llvmpipe under WSL, which is deterministic. With no GPU adapter the render
functions return None and the tests skip cleanly.
Structs§
- Snapshot
- A rendered frame: sRGB RGBA bytes, origin at the top left.
- Stage
- A frame-by-frame harness: the retained state the shell holds, plus a way to step it forward the way the shell’s loop does.
Functions§
- render_
scene - Renders a
Sceneoffscreen on aclearbackground.Nonewith no GPU. - render_
widget - Builds and renders a widget tree the way the shell would: layout through
taffy, then painting with the given theme, on a
theme.backgroundbackground, in a virtualwidth×heightwindow. The retained state is neutral: no hover, no focus, scroll at zero.Nonewith no GPU.