1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00
Files
egui/crates
Emil Ernerfeldt c676d939ca Report failing pixels by threshold when a kittest snapshot fails (#8360)
When an image snapshot fails, you get the number of pixels differing by
more than the `threshold` you happened to configure — which doesn't tell
you what threshold *would* have passed. So picking
`SnapshotOptions::threshold` / `failed_pixel_count_threshold` is trial
and error, one CI round-trip per guess.

This measures the failing pixel count at a sweep of thresholds (new
public `THRESHOLD_SWEEP`) and includes it in `SnapshotError::Diff`:

```
'sweep_demo' Image did not match snapshot. Diff: 293, …/sweep_demo.diff.png.
  Failing pixels by threshold: 0.0: 1522, 0.1: 1522, 0.2: 293, 0.4: 293, 0.6: 293, 1.0: 293, …
  Run `UPDATE_SNAPSHOTS=1 cargo test --all-features` to update the snapshots.
```

The sweep only runs for snapshots that already failed, so passing tests
are unaffected.

Breaking: `SnapshotError::Diff` gained a `failing_pixels_by_threshold`
field.

* [x] I have followed the instructions in the PR template

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 10:08:09 +02:00
..
2026-08-03 06:38:37 +00:00