pub fn assert_image_snapshot_with_tolerance(
snapshot: Snapshot,
rgba: &[u8],
width: u32,
height: u32,
tolerance: Tolerance,
)Available on crate feature
snapshot only.Expand description
Assert that rgba matches snapshot within tolerance.
Like assert_image_snapshot, a missing snapshot is written rather than
failed on — natively, where there is somewhere to write it. A freshly
written snapshot is not judged at all, since it was just made from this
frame.
A frame that does not match is kept before the assertion fails, so a run that
fails in CI leaves it behind for the job to upload: natively it is written
under DEFAULT_MISMATCH_DIR (or MISMATCH_DIR_ENV), and on the web it is
handed to the test runner, which is the process that has a filesystem.
Keeping it is a courtesy to whoever reads the result, so a failure to do so
is reported and dropped rather than replacing the mismatch it was meant to
explain.