Documentation
¶
Overview ¶
Command fidelity scores Sweef's layout and rendering against Chromium.
go run ./tools/fidelity # all fixtures, provider "engine" go run ./tools/fidelity -only flex -v # one fixture, show worst elements go run ./tools/fidelity -provider render # layout engine directly (boxes only until a painter is registered) go run ./tools/fidelity -refresh # re-capture Chromium references
For every fixture page in testdata/fidelity/*.html the tool captures, from Chromium via the agent-browser CLI, the border box of every element in document order and a screenshot, and caches them under testdata/fidelity/.ref so later runs need no browser. A provider (the full engine, or the render package alone) produces the same data for Sweef and the tool prints per-page and overall scores:
- IoU of every element's border box (mean), and the share of elements within 1 px / 4 px on all four edges of Chromium's box;
- screenshot agreement: share of pixels equal within a tolerance, and the same after a 3x3 blur (which forgives anti-aliasing differences).
Providers register themselves with Register (see providers.go and any provider_*.go files added by feature work).