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:
1 parent
e5d2e7862c
commit
c72a8d364d
3 files changed
+24
No files matched your search
@@ -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]
|
#[test]
|
||||||
fn test_gray_u16() {
|
fn test_gray_u16() {
|
||||||
let img_file =
|
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]
|
#[test]
|
||||||
fn test_rgb_u16() {
|
fn test_rgb_u16() {
|
||||||
let img_file = File::open("./tests/images/rgb-3c-16b.tiff").expect("Cannot find test image!");
|
let img_file = File::open("./tests/images/rgb-3c-16b.tiff").expect("Cannot find test image!");
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in new issue
Block a user