Debian Codegraph @

tests/subsubifds.rs

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
1 use tiff::decoder::Decoder;
2
3 // This file has the following IFD structure:
4 //
5 // ```
6 // IFD -> IFD -> IFD
7 // |-> IFD
8 // |-> IFD -> IFD
9 // | \-> IFD -> IFD
10 // \-> IFD
11 // ```
12 //
13 // where the main chain of IFD has 3 images, the second of which has several sub-IFDs and some have
14 // more nested IFDs.
15 const TEST_IMAGE_SUBIFD: &str = "./tests/subsubifds.tif";
16 use std::fs::File;
17
18 #[test]
•19 #[ignore = "skipping, missing test data"]
20 fn decode_seek_chain() {
21 let file = File::open(TEST_IMAGE_SUBIFD).expect("Cannot open test image");
22 let mut decoder = Decoder::new(file).expect("Invalid format to create decoder");
23
24 // Remember the offsets in the first iteration.
25 let offset0 = decoder.ifd_pointer().expect("First IFD pointer not found");
26 decoder.next_image().unwrap();
27 let offset1 = decoder.ifd_pointer().expect("Second IFD pointer not found");
28 decoder.next_image().unwrap();
29 let offset2 = decoder.ifd_pointer().expect("Third IFD pointer not found");
30 assert!(!decoder.more_images());
31
32 // Ensure we can seek, to do this again.
33 decoder
34 .seek_to_image(0)
35 .expect("Failed to seek to first image");
36 assert_eq!(Some(offset0), decoder.ifd_pointer());
37 decoder.next_image().unwrap();
38 assert_eq!(Some(offset1), decoder.ifd_pointer());
39 decoder.next_image().unwrap();
40 assert_eq!(Some(offset2), decoder.ifd_pointer());
41 assert!(!decoder.more_images());
42 }