Support 64-bit grayscale decoding

This commit is contained in:
Andrew Champion committed 2019-12-10 20:18:53 +00:00
1 parent af010edcfd
commit f4e985e0bd
4 files changed
+78 -1

No files matched your search

+20
View File
@@ -84,6 +84,26 @@ fn test_gray_u32() {
}
}
#[test]
fn test_gray_u64() {
let img_file =
File::open("./tests/images/gradient-1c-64b.tiff").expect("Cannot find test image!");
let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
assert_eq!(decoder.colortype().unwrap(), ColorType::Gray(64));
let img_res = decoder.read_image().unwrap();
if let DecodingResult::U64(res) = img_res {
let mut res_sum: u64 = 0;
for x in res {
res_sum += x as u64;
}
assert_eq!(res_sum, 549892913787);
}
else {
panic!("Wrong bit depth")
}
}
#[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.