1# llimphi-test
2
3Headless, deterministic golden-image harness.
4
5The problem it closes: in `PLAN-NUCLEO-RETENIDO.md` and `PARIDAD-FLUTTER.md`
6every block used to end with "still to verify on metal / PNG diff pending", and
7CLAUDE.md §8 forbids routine render-and-look because of its token cost. This
8crate turns that expensive, subjective verification into `assert_golden!(...)`:
9cheap, objective, in CI, certified by **text** (`DiffStats`).
10
11## Determinism
12
13The `Harness` asks for a `Hal` through the **software** adapter
14(`llimphi_hal::Hal::new_headless(true)`): the llvmpipe/lavapipe rasterizer
15(deviceType CPU) produces the **same pixel** on any host and in CI, not tied to
16the GPU of whoever generated the golden. If the machine has no fallback adapter
17it falls back to the normal one, and `GoldenConfig`'s perceptual tolerance
18absorbs the vendor difference.
19
20## Typical use (inside another crate's test)
21
22```ignore
23use llimphi_test::assert_golden;
24#[test]
25fn card_with_shadow() {
26 let v = my_widget::card(...);
27 assert_golden!("card_with_shadow", v, 400, 240); // tests/goldens/card_with_shadow.png
28}
29```
30
31Regenerate the goldens with `LLIMPHI_GOLDEN_UPDATE=1 cargo test`.
32
33---
34
35Part of **llimphi** — see [llimphi](../README.md).
README.md
llimphi-test
Headless, deterministic golden-image harness.
The problem it closes: in PLAN-NUCLEO-RETENIDO.md and PARIDAD-FLUTTER.md
every block used to end with "still to verify on metal / PNG diff pending", and
CLAUDE.md §8 forbids routine render-and-look because of its token cost. This
crate turns that expensive, subjective verification into assert_golden!(...):
cheap, objective, in CI, certified by text (DiffStats).
Determinism
The Harness asks for a Hal through the software adapter
(llimphi_hal::Hal::new_headless(true)): the llvmpipe/lavapipe rasterizer
(deviceType CPU) produces the same pixel on any host and in CI, not tied to
the GPU of whoever generated the golden. If the machine has no fallback adapter
it falls back to the normal one, and GoldenConfig's perceptual tolerance
absorbs the vendor difference.
Typical use (inside another crate's test)
use llimphi_test::assert_golden;
#[test]
fn card_with_shadow() {
let v = my_widget::card(...);
assert_golden!("card_with_shadow", v, 400, 240); // tests/goldens/card_with_shadow.png
}
Regenerate the goldens with LLIMPHI_GOLDEN_UPDATE=1 cargo test.
Part of llimphi — see llimphi.