From 263fa36fb57f4743b72ca2822baf21813ba00b86 Mon Sep 17 00:00:00 2001 From: GloamXun Date: Tue, 27 Oct 2026 04:09:26 +0800 Subject: [PATCH] Activate dormant tests and clear route-D warnings Three test functions in texrra-tex-core (PDF metadata, Type1 outline embedding and \noalign row glue) were missing their #[test] attribute and only produced dead-code warnings. With the attributes added they pass and raise the core suite from 439 to 442 tests. The unused `mut` on the PDF entry point geometry is gone too, leaving no route-D/PDF/lib compiler warnings in `cargo check --workspace --all-targets`. --- crates/texrra-tex-core/src/lib.rs | 1 + crates/texrra-tex-core/src/pdf.rs | 2 ++ docs/ROUTE_D_PLAN.md | 2 +- docs/ROUTE_D_STATUS.md | 4 ++-- docs/TEX_CORE.md | 4 ++-- src/route_d.rs | 2 +- 6 files changed, 9 insertions(+), 6 deletions(-) diff --git a/crates/texrra-tex-core/src/lib.rs b/crates/texrra-tex-core/src/lib.rs index 6d6dac2..eef5e64 100644 --- a/crates/texrra-tex-core/src/lib.rs +++ b/crates/texrra-tex-core/src/lib.rs @@ -8497,6 +8497,7 @@ b & 2 \\ assert_eq!(halign.row_gaps, vec![327_680]); } + #[test] fn noalign_vertical_glue_spaces_rows() { let source = "a & b \\\\\n\\noalign{\\vskip 6pt}\nc & d \\\\\n"; let unit = Unit::halign_from_source_with_template(1, "ll", source, 0); diff --git a/crates/texrra-tex-core/src/pdf.rs b/crates/texrra-tex-core/src/pdf.rs index 580cff5..4051aba 100755 --- a/crates/texrra-tex-core/src/pdf.rs +++ b/crates/texrra-tex-core/src/pdf.rs @@ -1370,6 +1370,7 @@ mod type1_pdf_tests { assert!(pdf.contains("/Outlines")); } + #[test] fn metadata_writes_the_pdf_info_dictionary() { let pages = vec![DisplayList { width: 612 * 65536, @@ -1463,6 +1464,7 @@ mod type1_pdf_tests { assert!(pdf.contains("/Last")); } + #[test] fn type1_backend_embeds_computer_modern_outlines() { let pdf = write(&[hello_list()]); let text = String::from_utf8_lossy(&pdf); diff --git a/docs/ROUTE_D_PLAN.md b/docs/ROUTE_D_PLAN.md index 34c6ead..5e580a8 100644 --- a/docs/ROUTE_D_PLAN.md +++ b/docs/ROUTE_D_PLAN.md @@ -51,7 +51,7 @@ floats (`\floatsep`, `\textfloatsep`, `\intextsep`, `\topfraction`, 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`; flat `/preview` and project previews now -prefer route-D with a v1 fallback). 1058 workspace tests are green and no oracle +prefer route-D with a v1 fallback). 1061 workspace tests are green and no oracle fixture is ignored. Preview JSON also carries a `warnings` array naming environments route-D cannot lay out and control words that survived layout, so unsupported source is reported instead of being silently typeset. diff --git a/docs/ROUTE_D_STATUS.md b/docs/ROUTE_D_STATUS.md index 55c8ac6..dba7a93 100755 --- a/docs/ROUTE_D_STATUS.md +++ b/docs/ROUTE_D_STATUS.md @@ -16,11 +16,11 @@ cargo test --workspace --offline or run `./scripts/verify-route-d.sh`, which executes both. -The workspace currently passes **1058 tests**: +The workspace currently passes **1061 tests**: | Suite | Tests | | --- | --- | -| route-D unit (engine) | 439 | +| route-D unit (engine) | 442 | | engine binary unit | 428 | | server integration | 63 | | v1 integration | 71 | diff --git a/docs/TEX_CORE.md b/docs/TEX_CORE.md index 005fe7c..31d04c1 100755 --- a/docs/TEX_CORE.md +++ b/docs/TEX_CORE.md @@ -370,7 +370,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; those fallback glyphs keep their Unicode text under PDF extraction, so accented and Greek words round-trip; Type1 faces carry a ToUnicode CMap built from the requested characters, so glyphs whose names are ambiguous in the Adobe Glyph List (capital Omega, which would otherwise extract as U+2126) keep their intended code points. `Engine::edit` preserves the face when reflowing an edited paragraph. -The crate currently has 437 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 1058 tests (439 route-D unit, 428 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 63 server, 4 engine unit, 1 core unit), with none ignored. The flat `/preview` endpoint and the project preview/PDF endpoints now try route-D first and fall back to v1 on error (`?engine=v1` or `TEXRRA_ENGINE=v1` forces v1; the flat response carries `X-Preview-Engine`, naming the engine used). A geometry-less project now defaults to Letter, matching pdfLaTeX, where the old v1 path used A4. +The crate currently has 437 unit tests plus ten route-D integration tests and forty-two oracle fixtures. Workspace verification: `cargo fmt --all -- --check`; `cargo test --workspace --offline` runs 1061 tests (442 route-D unit, 428 engine binary unit, 10 route-D integration, 42 oracle, 71 v1 integration, 63 server, 4 engine unit, 1 core unit), with none ignored. The flat `/preview` endpoint and the project preview/PDF endpoints now try route-D first and fall back to v1 on error (`?engine=v1` or `TEXRRA_ENGINE=v1` forces v1; the flat response carries `X-Preview-Engine`, naming the engine used). A geometry-less project now defaults to Letter, matching pdfLaTeX, where the old v1 path used A4. ### M0 incremental demo @@ -524,7 +524,7 @@ deliberately open rather than approximated: ## Limits and remaining gaps -The suite currently stands at 1058 passing tests, with the workspace clean. +The suite currently stands at 1061 passing tests, with the workspace clean. Route-D serves both flat `/preview` and project preview/PDF requests by default (automatic v1 fallback; `?engine=v1` or `TEXRRA_ENGINE=v1` opts out). The objective's areas are implemented to the limits below; complex-script shaping is diff --git a/src/route_d.rs b/src/route_d.rs index 6c62ffb..e01a687 100755 --- a/src/route_d.rs +++ b/src/route_d.rs @@ -61,7 +61,7 @@ pub fn project_preview_json_with_images( source: &str, images: &HashMap, ) -> Result { - let (body, mut geometry) = geometry_and_body_with_images(source, images); + let (body, geometry) = geometry_and_body_with_images(source, images); let body = resolve_page_references(body, &geometry); let paragraphs = paragraphs_with_geometry( &body,