From 18f8a1bdcf5d94f8586f52943c2ab7c3bbec4d1d Mon Sep 17 00:00:00 2001 From: bflatastic Date: Fri, 16 Oct 2026 02:50:27 +0700 Subject: [PATCH] PDF import: a damaged array is refused as damaged, not as functions built on one another --- crates/pdf/src/tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/pdf/src/tests.rs b/crates/pdf/src/tests.rs index 71c88ec79..bccdc720d 100644 --- a/crates/pdf/src/tests.rs +++ b/crates/pdf/src/tests.rs @@ -813,7 +813,9 @@ fn functions_and_colour_spaces_built_on_themselves_are_refused() { ] { let objects: Vec<&str> = objects.iter().map(String::as_str).collect(); let e = import(&pdf_with(std::slice::from_ref(page), &objects, None)).err().map(|e| e.to_string()); - assert!(e.as_deref().is_some_and(|e| e.contains("built on one another without end")), "{what}: {e:?}"); + // A damaged array is refused as damaged: what it holds can't be looked at whole. + let refused = |e: &str| e.contains("built on one another without end") || e.contains("is damaged and can't be read"); + assert!(e.as_deref().is_some_and(refused), "{what}: {e:?}"); } for (what, page, objects) in [ ("a function stitching one", &shaded, vec![stitch(&next), ramp.to_string()]),