Run TeX arithmetic on output registers
This commit is contained in:
1 parent
db1cc98338
commit
bd28917f05
4 files changed
+258
-27
No files matched your search
@@ -3067,6 +3067,32 @@ mod tests {
|
||||
assert_eq!(counts, vec![3, 2, 2], "pages: {counts:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_routine_can_advance_vsize_for_later_pages() {
|
||||
let mut units = Vec::new();
|
||||
for n in 0..7 {
|
||||
units.push(Unit::rule(n * 2, 300, 300));
|
||||
if n < 6 {
|
||||
units.push(Unit::penalty(n * 2 + 1, 0));
|
||||
}
|
||||
}
|
||||
let mut document = Document::new(1000, units);
|
||||
document.top_skip = 0;
|
||||
document.output_routine = Some(r"\advance\vsize by -300 \shipout\box255".to_owned());
|
||||
let engine = Engine::layout_paged(&document).expect("paged");
|
||||
let counts = engine
|
||||
.pages()
|
||||
.iter()
|
||||
.map(|page| {
|
||||
page.items
|
||||
.iter()
|
||||
.filter(|item| matches!(item, VerticalItem::Rule { .. }))
|
||||
.count()
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
assert_eq!(counts, vec![3, 2, 1, 1], "pages: {counts:?}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_routine_sees_page_goal_after_insertion_reservation() {
|
||||
let scale = 65_536;
|
||||
|
||||
Reference in new issue
Block a user