extra tests for other unsupported png scenarios

This commit is contained in:
Gered 2023-03-20 12:06:10 -04:00
parent 76d0289a0f
commit d02b81b1fb

View file

@ -638,6 +638,38 @@ pub mod tests {
Err(PngError::BadFile(..))
);
assert_matches!(
IndexedBitmap::load_png_file(path_to_file(Path::new("unsupported_alpha_8bit.png")).as_path()),
Err(PngError::BadFile(..))
);
assert_matches!(
IndexedBitmap::load_png_file(path_to_file(Path::new("unsupported_greyscale_8bit.png")).as_path()),
Err(PngError::BadFile(..))
);
assert_matches!(
IndexedBitmap::load_png_file(path_to_file(Path::new("unsupported_indexed_16col.png")).as_path()),
Err(PngError::BadFile(..))
);
assert_matches!(
IndexedBitmap::load_png_file(path_to_file(Path::new("unsupported_rgb_16bit.png")).as_path()),
Err(PngError::BadFile(..))
);
assert_matches!(
IndexedBitmap::load_png_file(path_to_file(Path::new("unsupported_rgba_16bit.png")).as_path()),
Err(PngError::BadFile(..))
);
// also test the extra formats that IndexedBitmap does not support which RgbaBitmap does
// (anything not 256-color indexed basically ...)
assert_matches!(
IndexedBitmap::load_png_file(path_to_file(Path::new("rgb.png")).as_path()),
Err(PngError::BadFile(..))
);
assert_matches!(
IndexedBitmap::load_png_file(path_to_file(Path::new("rgba.png")).as_path()),
Err(PngError::BadFile(..))
);
Ok(())
}
}