mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-10-29 04:28:20 -06:00
organize: check the page's own MediaBox values in the walk test
The root's MediaBox and the page's own both have four numbers, so the length check passed even if the page lost its own value. Compare the values instead.
This commit is contained in:
@@ -2840,7 +2840,8 @@ fn page_walk_skips_repeated_and_cyclic_kids_without_copying_attributes() {
|
||||
assert_eq!(attrs.get(b"Rotate").and_then(Object::as_int), Some(90), "Rotate from the root");
|
||||
assert_eq!(walk.next().map(|(p, _)| p), Some(second));
|
||||
let (_, last) = walk.next().unwrap();
|
||||
assert_eq!(last.get(b"MediaBox").and_then(Object::as_array).map(Vec::len), Some(4), "own MediaBox kept");
|
||||
let media_box = last.get(b"MediaBox").and_then(Object::as_array).map(|m| m.iter().filter_map(Object::as_int).collect::<Vec<_>>());
|
||||
assert_eq!(media_box, Some(vec![0, 0, 500, 500]), "own MediaBox kept over the root's");
|
||||
assert!(walk.next().is_none());
|
||||
assert_eq!(labels(&doc), ["Page 1", "Page 2", "Page 3"]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user