pub fn try_image_snapshot_options(
    new: &ImageBuffer<Rgba<u8>, Vec<u8>>,
    name: &str,
    options: &SnapshotOptions,
) -> Result<(), SnapshotError>
Expand description

Image snapshot test with custom options.

If you want to change the default options for your whole project, it’s recommended to create a new my_image_snapshot function in your project that calls this function with the desired options. You could additionally use the disallowed_methods lint to disable use of the image_snapshot to prevent accidentally using the wrong defaults.

The snapshot files will be saved under SnapshotOptions::output_path. The snapshot will be saved under {output_path}/{name}.png. The new image from the most recent test run will be saved under {output_path}/{name}.new.png. If the new image didn’t match the snapshot, a diff image will be saved under {output_path}/{name}.diff.png.

If the env-var UPDATE_SNAPSHOTS is set, then the old image will backed up under {output_path}/{name}.old.png. and then new image will be written to {output_path}/{name}.png

§Errors

Returns a SnapshotError if the image does not match the snapshot or if there was an error reading or writing the snapshot.