fn compare_to_truth_image_with_tolerance<P>(
    actual: &ImageBuffer<P, Vec<u8>>,
    truth_file_name: &str,
    tol: u8,
) where
    P: Pixel<Subpixel = u8> + 'static,
    ImageBuffer<P, Vec<u8>>: FromDynamic,
{
    if should_regenerate() {
        actual
            .save(Path::new(TRUTH_DIR).join(truth_file_name))
            .unwrap();
    } else {
        let truth = ImageBuffer::<P, Vec<u8>>::from_dynamic(&load_image_or_panic(
            Path::new(TRUTH_DIR).join(truth_file_name),
        ));
        assert_pixels_eq_within!(*actual, truth, tol);
    }
}
/// Checks that an image matches a 'truth' image to within a given per-pixel tolerance.
Checks that an image matches a 'truth' image to within a given per-pixel tolerance.
Checks that an image matches a ' truth ' image to within a given per - pixel tolerance .
fn compare_to_truth_image_with_tolerance<P>(
    actual: &ImageBuffer<P, Vec<u8>>,
    truth_file_name: &str,
    tol: u8,
) where
    P: Pixel<Subpixel = u8> + 'static,
    ImageBuffer<P, Vec<u8>>: FromDynamic,
{
    if should_regenerate() {
        actual
            .save(Path::new(TRUTH_DIR).join(truth_file_name))
            .unwrap();
    } else {
        let truth = ImageBuffer::<P, Vec<u8>>::from_dynamic(&load_image_or_panic(
            Path::new(TRUTH_DIR).join(truth_file_name),
        ));
        assert_pixels_eq_within!(*actual, truth, tol);
    }
}
fn compare_to_truth_image_with_tolerance < P > ( actual : & ImageBuffer < P , Vec < u8 > > , truth_file_name : & str , tol : u8 , ) where P : Pixel < Subpixel = u8 > + ' static , ImageBuffer < P , Vec < u8 > > : FromDynamic , { if should_regenerate ( ) { actual . save ( Path :: new ( TRUTH_DIR ) . join ( truth_file_name ) ) . unwrap ( ) ; } else { let truth = ImageBuffer :: < P , Vec < u8 > > :: from_dynamic ( & load_image_or_panic ( Path :: new ( TRUTH_DIR ) . join ( truth_file_name ) , ) ) ; assert_pixels_eq_within ! ( actual truth tol ) ; } }
Checks that an image matches a 'truth' image to within a given per-pixel tolerance.
Checks that an image matches a ' truth ' image to within a given per - pixel tolerance .
actual
&ImageBuffer<P, Vec<u8>>
truth_file_name
&str
tol
u8
actual
&ImageBuffer<P, Vec<u8>>
truth_file_name
&str
tol
u8