Add subsubifds test file
This commit is contained in:
1 parent
df4e42eecc
commit
a1be18b548
3 files changed
+37
No files matched your search
@@ -0,0 +1,33 @@
|
||||
use tiff::{decoder::Decoder, tags::IfdPointer};
|
||||
|
||||
// This file has the following IFD structure:
|
||||
//
|
||||
// ```
|
||||
// IFD -> IFD -> IFD
|
||||
// |-> IFD
|
||||
// |-> IFD -> IFD
|
||||
// | \-> IFD -> IFD
|
||||
// \-> IFD
|
||||
// ```
|
||||
//
|
||||
// where the main chain of IFD has 3 images, the second of which has several sub-IFDs and some have
|
||||
// more nested IFDs.
|
||||
const TEST_IMAGE_SUBIFD: &str = "./tests/subsubifds.tif";
|
||||
use std::fs::File;
|
||||
|
||||
#[test]
|
||||
fn decode_seek_chain() {
|
||||
let file = File::open(TEST_IMAGE_SUBIFD).expect("Cannot open test image");
|
||||
let mut decoder = Decoder::new(file).expect("Invalid format to create decoder");
|
||||
|
||||
decoder.next_image().unwrap();
|
||||
decoder.next_image().unwrap();
|
||||
assert!(!decoder.more_images());
|
||||
|
||||
// Ensure we can seek, to do this again.
|
||||
decoder.seek_to_image(0)
|
||||
.expect("Failed to seek to first image");
|
||||
decoder.next_image().unwrap();
|
||||
decoder.next_image().unwrap();
|
||||
assert!(!decoder.more_images());
|
||||
}
|
||||
Reference in new issue
Block a user