Make the pdfTeX raster comparison actually run

pdftoppm --version exits non-zero, so the raster test silently skipped on every host. Probe pdftoppm with -v instead, lay out the route-D paragraph at the same scaled-point geometry the server uses, and compile the pdfTeX control page as Letter (612x792bp). The ink line count and left/right/bottom edges now match exactly.
This commit is contained in:
gloamxun committed 2026-10-21 08:10:29 +08:00
1 parent 5b4eadb88f
commit aeacf53518
3 files changed
+25 -7

No files matched your search

+22 -4
View File
@@ -52,15 +52,15 @@ fn route_d_article_exports_pdf_and_reflows_only_the_edited_page() {
fn route_d_page_matches_pdftex_raster_geometry() {
use std::process::Command;
fn has(command: &str) -> bool {
fn has(command: &str, version_arg: &str) -> bool {
Command::new(command)
.arg("--version")
.arg(version_arg)
.stdout(std::process::Stdio::null())
.stderr(std::process::Stdio::null())
.status()
.is_ok_and(|status| status.success())
}
if !has("pdflatex") || !has("pdftoppm") {
if !has("pdflatex", "--version") || !has("pdftoppm", "-v") {
return;
}
@@ -124,7 +124,23 @@ fn route_d_page_matches_pdftex_raster_geometry() {
let _ = std::fs::remove_dir_all(&root);
std::fs::create_dir_all(&root).expect("create raster dir");
let document = Document::new(700 * 65536, vec![Unit::paragraph(1, "Hello route-D")]);
let style = ParagraphStyle {
line_width: 480 * 65_536,
left_skip: 0,
right_skip: 0,
centered: false,
right_aligned: false,
par_indent: 0,
line_height: 12 * 65_536,
char_width: 10 * 65_536,
space_width: 4 * 65_536,
space_stretch: 6 * 65_536,
space_shrink: 2 * 65_536,
};
let document = Document::new(
700 * 65_536,
vec![Unit::paragraph_with_style(1, "Hello route-D", style)],
);
let engine = Engine::layout(&document);
let pages: Vec<_> = engine
.pages()
@@ -143,6 +159,8 @@ fn route_d_page_matches_pdftex_raster_geometry() {
\topmargin=0pt
\headheight=0pt
\headsep=0pt
\pdfpagewidth=612bp
\pdfpageheight=792bp
\textwidth=480pt
\textheight=700pt
\topskip=10pt