pub struct Snapshot;Expand description
Snapshot comparison utilities.
Implementations§
Source§impl Snapshot
impl Snapshot
Sourcepub fn assert_match(name: &str, actual: &Image, threshold: f64)
pub fn assert_match(name: &str, actual: &Image, threshold: f64)
Compare an actual image against a baseline snapshot.
§Panics
Panics if the difference exceeds the threshold.
Sourcepub fn diff(a: &Image, b: &Image) -> f64
pub fn diff(a: &Image, b: &Image) -> f64
Calculate difference ratio between two images (byte-level).
Sourcepub fn perceptual_diff(a: &Image, b: &Image) -> f64
pub fn perceptual_diff(a: &Image, b: &Image) -> f64
Calculate perceptual difference (color distance per pixel). Returns mean squared error normalized to 0.0-1.0.
Sourcepub fn generate_diff_image(a: &Image, b: &Image) -> Image
pub fn generate_diff_image(a: &Image, b: &Image) -> Image
Generate a difference image highlighting changed pixels.
Sourcepub fn compare(a: &Image, b: &Image) -> ComparisonResult
pub fn compare(a: &Image, b: &Image) -> ComparisonResult
Perform a comprehensive comparison between two images.
Sourcepub fn count_changed_pixels(a: &Image, b: &Image) -> u64
pub fn count_changed_pixels(a: &Image, b: &Image) -> u64
Count the number of pixels that differ between two images.
Sourcepub fn ssim(a: &Image, b: &Image) -> f64
pub fn ssim(a: &Image, b: &Image) -> f64
Calculate Structural Similarity Index (SSIM).
Simplified implementation of SSIM that considers luminance similarity. Returns 1.0 for identical images, 0.0 for completely different.
Sourcepub fn compare_region(
a: &Image,
b: &Image,
x: u32,
y: u32,
width: u32,
height: u32,
) -> ComparisonResult
pub fn compare_region( a: &Image, b: &Image, x: u32, y: u32, width: u32, height: u32, ) -> ComparisonResult
Compare a region of two images.