mirror of
https://github.com/storytold/pdfcraft.git
synced 2026-11-10 13:01:29 +00:00
fix(xfa): the embedded-copy test allows the draw budget to stop it first
With embedded values counted, the 1 MiB test budget can stop this draw before its last pass; the bound on what is copied out still holds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Pq7HyDBXygTf7jcqdsjcfn
This commit is contained in:
1 parent
962af16e08
commit
32ab43eab0
1 file changed
+6
-1
@@ -3992,7 +3992,12 @@ fn embedded_values_are_copied_out_only_as_far_as_the_budget() {
|
||||
</subform></template>"#
|
||||
);
|
||||
crate::layout::EMBED_COPIED.with(|c| c.set(0));
|
||||
layout_xml(&tpl).unwrap();
|
||||
// The draw budget counts embedded values too (1 MiB in tests), so it may stop the draw
|
||||
// before its last pass; either way no more than this is copied out.
|
||||
match layout_xml(&tpl) {
|
||||
Ok(_) | Err(XfaError::TooLarge(_)) => {}
|
||||
Err(e) => panic!("{e:?}"),
|
||||
}
|
||||
let copied = crate::layout::EMBED_COPIED.with(|c| c.get());
|
||||
// The draw is measured at most seven times before it is laid out once.
|
||||
assert!(copied <= 8 * text::MAX_EMBEDDED as u64 + 8 * 4 * 201, "{copied} bytes of embedded values copied");
|
||||
|
||||
Reference in new issue
Block a user