Tests: read the PDF/X output intent's profile with the crate's own xref reader (#1962)

This commit is contained in:
bflatastic
2026-10-16 04:44:31 +07:00
parent 32dbc4b641
commit e6b28f0e80
+2 -3
View File
@@ -59,9 +59,8 @@ fn each_standard_writes_its_header_output_intent_boxes_and_identification() {
}
// (PDF/X-3 and PDF/X-4 share the stream of the profile that tags the colours.)
let oi: u32 = t.split("/DestOutputProfile ").nth(1).unwrap().split(' ').next().unwrap().parse().unwrap();
let file = hayro_syntax::Pdf::new(std::sync::Arc::new(r.bytes.clone())).unwrap();
let profile = file.xref().get::<hayro_syntax::object::Stream<'_>>(hayro_syntax::object::ObjectIdentifier::new(oi as i32, 0)).unwrap();
assert_eq!(profile.dict().get::<i32>(b"N"), Some(4), "{standard:?}: a CMYK profile");
let (start, end) = crate::patch::Xref::read(&r.bytes).unwrap().dict(&r.bytes, oi).unwrap();
assert!(text(&r.bytes[start..end]).contains("/N 4"), "{standard:?}: a CMYK profile");
// Every page is trimmed to its artboard; the file is untrapped, titled and dated.
for want in ["/TrimBox[0 0 200 100]", "/Trapped/False", "/Title(Untitled)", "/CreationDate", "/ModDate"] {
assert!(t.contains(want), "{standard:?}: {want}");