Validate PDF page dependencies before reusing SVG previews
This commit is contained in:
1 parent
520e8eede2
commit
140bb19849
5 files changed
+339
-28
No files matched your search
@@ -276,6 +276,7 @@ fn embedded_pdf_preview_uses_current_form_and_retains_the_other_page() {
|
||||
fs::create_dir(&root).unwrap();
|
||||
let vector = root.join("vector.pdf");
|
||||
rotated_document(&vector);
|
||||
fs::copy(&vector, root.join("stable.pdf")).unwrap();
|
||||
fs::write(
|
||||
root.join("probe.tex"),
|
||||
r"\catcode123=1 \catcode125=2
|
||||
@@ -284,7 +285,9 @@ fn embedded_pdf_preview_uses_current_form_and_retains_the_other_page() {
|
||||
\pdfximage page 1 trimbox {vector.pdf}
|
||||
\shipout\hbox{\pdfsave\pdfsetmatrix{0.75 0 0 0.75}
|
||||
\hbox to0pt{\pdfrefximage\pdflastximage\hss}\pdfrestore}
|
||||
\shipout\vbox{\hrule width12pt height20pt depth0pt}\end
|
||||
\shipout\vbox{\hrule width12pt height20pt depth0pt}
|
||||
\pdfximage page 1 trimbox {stable.pdf}
|
||||
\shipout\hbox{\pdfrefximage\pdflastximage}\end
|
||||
",
|
||||
)
|
||||
.unwrap();
|
||||
@@ -302,7 +305,7 @@ fn embedded_pdf_preview_uses_current_form_and_retains_the_other_page() {
|
||||
let compiler = NativeCompiler::default();
|
||||
let first = compiler.compile(request.clone()).unwrap();
|
||||
let full = first.preview_since(None).unwrap();
|
||||
assert_eq!(full.page_count, 2);
|
||||
assert_eq!(full.page_count, 3);
|
||||
let art = full.pages[0].svg.to_ascii_lowercase();
|
||||
assert!(art.contains("<path"));
|
||||
assert!(art.contains("#ff0000"));
|
||||
@@ -338,6 +341,10 @@ fn embedded_pdf_preview_uses_current_form_and_retains_the_other_page() {
|
||||
&full.pages[1].svg,
|
||||
¤t_full.pages[1].svg
|
||||
));
|
||||
assert!(std::sync::Arc::ptr_eq(
|
||||
&full.pages[2].svg,
|
||||
¤t_full.pages[2].svg
|
||||
));
|
||||
let independent = NativeCompiler::default().compile(request).unwrap();
|
||||
assert_eq!(current.pdf, independent.pdf);
|
||||
assert_eq!(
|
||||
|
||||
Reference in new issue
Block a user