Add tests for exotic 12-bit sample images

These images should correctly report their color depths, but fail to
decode as they are unsupported.
This commit is contained in:
Andrew Champion committed 2019-12-16 18:53:44 +00:00
1 parent e5d2e7862c
commit c72a8d364d
3 files changed
+24

No files matched your search

+24
View File
@@ -44,6 +44,18 @@ fn test_rgb_u8() {
}
}
#[test]
fn test_gray_u12() {
let img_file =
File::open("./tests/images/12bit.cropped.tiff").expect("Cannot find test image!");
let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
assert_eq!(decoder.colortype().unwrap(), ColorType::Gray(12));
assert!(match decoder.read_image() {
Err(tiff::TiffError::UnsupportedError(tiff::TiffUnsupportedError::UnsupportedColorType(_))) => true,
_ => false,
});
}
#[test]
fn test_gray_u16() {
let img_file =
@@ -104,6 +116,18 @@ fn test_gray_u64() {
}
}
#[test]
fn test_rgb_u12() {
let img_file =
File::open("./tests/images/12bit.cropped.rgb.tiff").expect("Cannot find test image!");
let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
assert_eq!(decoder.colortype().unwrap(), ColorType::RGB(12));
assert!(match decoder.read_image() {
Err(tiff::TiffError::UnsupportedError(tiff::TiffUnsupportedError::UnsupportedColorType(_))) => true,
_ => false,
});
}
#[test]
fn test_rgb_u16() {
let img_file = File::open("./tests/images/rgb-3c-16b.tiff").expect("Cannot find test image!");
Binary file not shown.
Binary file not shown.