use image::RgbaImage;
use std::{env, iter};
pub(super) fn compare_images(image: &RgbaImage, path: &str) {
let path = env::current_dir()
.unwrap()
.join("test_resources")
.join(path)
.with_extension("png");
let truth = image::open(path).expect("Unable to open test resource");
let truth = truth.into_rgba8();
if image.len() != truth.len() {
panic!("Image sizes do not match.");
}
for pixel in iter::zip(image.pixels(), truth.pixels()) {
if pixel.0 != pixel.1 {
panic!("Images do not match.");
}
}
}