Ship pages conditionally on parity in the output routine

This commit is contained in:
gloamxun committed 2026-10-23 03:08:19 +08:00
1 parent a2a2eafab5
commit 7964765605
5 files changed
+66 -9

No files matched your search

+13
View File
@@ -4896,6 +4896,19 @@ mod tests {
assert_eq!(engine.pages().len(), 1);
}
#[test]
fn interpreted_output_can_ship_only_odd_pages() {
let mut document = Document::new(100, Vec::new());
document.output_routine = Some(r"\ifodd\pageno\shipout\box255\fi".to_owned());
document.units = vec![
Unit::rule(0, 10, 40),
Unit::penalty(1, -10_000),
Unit::rule(2, 10, 40),
];
let engine = Engine::layout_paged(&document).expect("paged layout");
assert_eq!(engine.pages().len(), 1);
}
#[test]
fn paged_layout_expands_vertical_units() {
let document = Document::new(