Test link annotations in route-D PDFs

This commit is contained in:
gloamxun committed 2026-10-24 23:05:05 +08:00
1 parent 91a75820a4
commit 11cfa44c2b
3 files changed
+28 -2

No files matched your search

+26
View File
@@ -283,6 +283,32 @@ fn project_preview_expands_included_files() {
assert!(svg.contains(">B</text>"), "{svg}");
}
#[test]
fn project_pdf_annotates_href_links() {
let server = TestServer::start("route-d-link-pdf");
let main = "\\documentclass{article}\n\\begin{document}\nVisit \\href{https://example.com/link}{Example}.\n\\end{document}\n";
let put = server.request(
"PUT",
"/api/projects/hello/file?path=hello.tex",
main.as_bytes(),
"text/plain; charset=utf-8",
);
assert_eq!(put.status, 200, "{}", put.text());
let pdf = server.request(
"POST",
"/api/projects/hello/pdf?engine=route-d",
&[],
"application/pdf",
);
assert_eq!(pdf.status, 200);
let text = String::from_utf8_lossy(&pdf.body);
assert!(text.contains("/Subtype /Link"), "missing link annotation");
assert!(
text.contains("/URI (https://example.com/link)"),
"missing link target"
);
}
#[test]
fn project_preview_uses_the_engine_default() {
let server = TestServer::start_with_env("route-d-default", &[("TEXRRA_ENGINE", "route-d")]);