Expose the page box height and depth to the output routine

This commit is contained in:
gloamxun committed 2026-10-23 13:24:14 +08:00
1 parent 70b360e50e
commit be23fe9686
4 files changed
+49 -4

No files matched your search

+17
View File
@@ -5905,6 +5905,23 @@ mod tests {
assert_eq!(page_prev_graf(&empty), 0);
}
#[test]
fn output_routine_reads_the_page_box_height() {
let pt = 65_536;
let mut document = Document::new(
100 * pt,
vec![
Unit::rule(1, 10 * pt, 40 * pt),
Unit::penalty(2, -10_000),
Unit::rule(3, 10 * pt, 70 * pt),
],
);
document.output_routine = Some(r"\ifdim\ht255>50pt\shipout\box255\else\relax\fi".into());
let engine = Engine::layout_paged(&document).expect("paged layout");
assert_eq!(engine.pages().len(), 1);
assert_eq!(item_height(&engine.pages()[0].items[0]), 70 * pt);
}
#[test]
fn output_register_assignments_persist_across_pages() {
let mut document = Document::new(