#[non_exhaustive]pub struct ScreenshotAssertOptions {
pub max_diff_pixels: Option<u64>,
pub threshold: Option<f32>,
}Expand description
Options for LocatorAssertions::to_have_screenshot.
Builder-style; constructed via ScreenshotAssertOptions::new then chained
setters. All fields are optional and default to a strict comparison
(max_diff_pixels = 0, i.e. zero tolerated differing pixels).
Only effective when the screenshot-diff cargo feature is enabled.
With the feature OFF (default), to_have_screenshot performs exact
byte comparison and these options are ignored.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.max_diff_pixels: Option<u64>Maximum number of differing pixels allowed for the assertion to pass
(default 0 — strict). Only consulted when screenshot-diff is on.
threshold: Option<f32>Per-pixel color-distance threshold in 0.0..=1.0. Two pixels whose
normalized RGBA distance exceeds this count as “different” (default
0.0 — pixels must be byte-identical to be considered equal). Only
consulted when screenshot-diff is on.
Implementations§
Source§impl ScreenshotAssertOptions
impl ScreenshotAssertOptions
Sourcepub fn with_max_diff_pixels(self, pixels: u64) -> Self
pub fn with_max_diff_pixels(self, pixels: u64) -> Self
Set the maximum number of differing pixels tolerated.
Sourcepub fn with_threshold(self, threshold: f32) -> Self
pub fn with_threshold(self, threshold: f32) -> Self
Set the per-pixel color-distance threshold (0.0..=1.0).
Trait Implementations§
Source§impl Clone for ScreenshotAssertOptions
impl Clone for ScreenshotAssertOptions
Source§fn clone(&self) -> ScreenshotAssertOptions
fn clone(&self) -> ScreenshotAssertOptions
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more