summaryrefslogtreecommitdiff
path: root/vendor/tiff/tests/decode_bigtiff_images.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
committerValentin Popov <valentin@popov.link>2024-01-08 00:21:28 +0300
commit1b6a04ca5504955c571d1c97504fb45ea0befee4 (patch)
tree7579f518b23313e8a9748a88ab6173d5e030b227 /vendor/tiff/tests/decode_bigtiff_images.rs
parent5ecd8cf2cba827454317368b68571df0d13d7842 (diff)
downloadfparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.tar.xz
fparkan-1b6a04ca5504955c571d1c97504fb45ea0befee4.zip
Initial vendor packages
Signed-off-by: Valentin Popov <valentin@popov.link>
Diffstat (limited to 'vendor/tiff/tests/decode_bigtiff_images.rs')
-rw-r--r--vendor/tiff/tests/decode_bigtiff_images.rs46
1 files changed, 46 insertions, 0 deletions
diff --git a/vendor/tiff/tests/decode_bigtiff_images.rs b/vendor/tiff/tests/decode_bigtiff_images.rs
new file mode 100644
index 0000000..9113f42
--- /dev/null
+++ b/vendor/tiff/tests/decode_bigtiff_images.rs
@@ -0,0 +1,46 @@
+extern crate tiff;
+
+use tiff::decoder::Decoder;
+use tiff::tags::Tag;
+use tiff::ColorType;
+
+use std::fs::File;
+use std::path::PathBuf;
+
+const TEST_IMAGE_DIR: &str = "./tests/images/bigtiff";
+
+#[test]
+fn test_big_tiff() {
+ let filenames = ["BigTIFF.tif", "BigTIFFMotorola.tif", "BigTIFFLong.tif"];
+ for filename in filenames.iter() {
+ let path = PathBuf::from(TEST_IMAGE_DIR).join(filename);
+ let img_file = File::open(path).expect("Cannot find test image!");
+ let mut decoder = Decoder::new(img_file).expect("Cannot create decoder");
+ assert_eq!(
+ decoder.dimensions().expect("Cannot get dimensions"),
+ (64, 64)
+ );
+ assert_eq!(
+ decoder.colortype().expect("Cannot get colortype"),
+ ColorType::RGB(8)
+ );
+ assert_eq!(
+ decoder
+ .get_tag_u64(Tag::StripOffsets)
+ .expect("Cannot get StripOffsets"),
+ 16
+ );
+ assert_eq!(
+ decoder
+ .get_tag_u64(Tag::RowsPerStrip)
+ .expect("Cannot get RowsPerStrip"),
+ 64
+ );
+ assert_eq!(
+ decoder
+ .get_tag_u64(Tag::StripByteCounts)
+ .expect("Cannot get StripByteCounts"),
+ 12288
+ )
+ }
+}