Test Times table column metrics

This commit is contained in:
gloamxun committed 2026-10-28 13:51:32 +08:00
1 parent 049365d595
commit 4ae362e4dd
6 files changed
+34 -8

No files matched your search

+26
View File
@@ -15364,6 +15364,32 @@ mod tests {
);
}
#[test]
fn times_tabular_uses_times_metrics() {
let source = "\\renewcommand{\\rmdefault}{ptm}\n\\begin{tabular}{ll}\nDendrite & Input terminal \\\\\nAxon & Output terminal\n\\end{tabular}";
let (body, geometry) = geometry_and_body(source);
let blocks = paragraphs(&body).expect("paragraphs");
let document = build_document(&blocks, &geometry);
let halign = document
.units
.iter()
.flat_map(|unit| &unit.items)
.find_map(|item| match item {
VerticalItem::Halign(halign) => Some(halign),
_ => None,
})
.expect("tabular halign");
assert_eq!(
halign.font,
Some(texrra_tex_core::paragraph::ParagraphFont::TimesRoman)
);
assert!(
halign.column_widths[0] < 36 * SCALE,
"Times Dendrite column is wider than expected: {}",
halign.column_widths[0]
);
}
#[test]
fn tabcolsep_sets_tabular_column_glue() {
let source = "\\tabcolsep=20pt\n\n\\begin{tabular}{ll}\nA & B \\\\\nC & D\n\\end{tabular}";