Test link annotations in route-D PDFs
This commit is contained in:
1 parent
91a75820a4
commit
11cfa44c2b
3 files changed
+28
-2
No files matched your search
@@ -48,7 +48,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`,
|
||||
`\bottomnumber`, `\totalnumber`), insertion classes (`\skip`, fraction and
|
||||
absolute limits, splitting), marks, Rust output hook, multi-page PDF, and the
|
||||
route-D service endpoints (`/api/route-d/preview|pdf|edit`, project preview and
|
||||
PDF opt-in with `?engine=route-d`). 686 workspace tests are green and no oracle
|
||||
PDF opt-in with `?engine=route-d`). 687 workspace tests are green and no oracle
|
||||
fixture is ignored.
|
||||
|
||||
Status after G1 (P0-P2): the paragraph model reproduces TeX's passes,
|
||||
|
||||
+1
-1
@@ -367,7 +367,7 @@ Math coverage includes fractions/roots, scripts, `\left...\right` with body-scal
|
||||
|
||||
Paragraph units carry a `ParagraphFont`; `Unit::paragraph_with_face` and `Unit::paragraph_with_style_and_face` select Roman, bold, italic, mono, or sans. The corresponding Computer Modern TFM (`cmr10`, `cmbx10`, `cmti10`, `cmbxti10`, `cmtt10`, `cmss10`, `cmssbx10`, `cmssi10`, `cmcsc10`) supplies advances, kerns, ligatures, and italic correction for layout, the display list selects the matching face, and the PDF writes Computer Modern Type1 outlines for each built-in face (`cmr10`/`cmbx10`/`cmti10`/`cmbxti10`/`cmtt10`/`cmss10`/`cmssbx10`/`cmssi10`/`cmcsc10`, plus `cmmi10` for mathematical italic letters, `cmsy10` for math symbols and `cmex10` for big operators), falling back to Liberation subsets only for characters the Type1 encodings cannot address. `Engine::edit` preserves the face when reflowing an edited paragraph.
|
||||
|
||||
The crate currently has 405 unit tests plus eight route-D integration tests and thirty-five oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 686 tests (405 route-D unit, 121 engine binary unit, 8 route-D integration, 35 oracle, 71 v1 integration, 41 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
The crate currently has 405 unit tests plus eight route-D integration tests and thirty-five oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 687 tests (405 route-D unit, 121 engine binary unit, 8 route-D integration, 35 oracle, 71 v1 integration, 42 server, 4 engine unit, 1 core unit), with none ignored. v1 remains the live server path.
|
||||
|
||||
### M0 incremental demo
|
||||
|
||||
|
||||
@@ -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")]);
|
||||
|
||||
Reference in new issue
Block a user