Stack insertion classes from the page bottom
This commit is contained in:
1 parent
060405fca6
commit
6a7e79fa03
3 files changed
+69
-14
No files matched your search
@@ -1799,6 +1799,50 @@ mod tests {
|
||||
assert!(y > 690 * 65_536);
|
||||
assert!(y < 700 * 65_536);
|
||||
}
|
||||
#[test]
|
||||
fn insertion_classes_stack_from_the_page_bottom() {
|
||||
let page = Page {
|
||||
items: vec![
|
||||
VerticalItem::Insertion(Insertion {
|
||||
class: 1,
|
||||
height: 10 * 65_536,
|
||||
items: vec![VerticalItem::Rule {
|
||||
width: 10 * 65_536,
|
||||
height: 10 * 65_536,
|
||||
}],
|
||||
}),
|
||||
VerticalItem::Insertion(Insertion {
|
||||
class: 0,
|
||||
height: 10 * 65_536,
|
||||
items: vec![VerticalItem::Rule {
|
||||
width: 10 * 65_536,
|
||||
height: 10 * 65_536,
|
||||
}],
|
||||
}),
|
||||
],
|
||||
insertions: Vec::new(),
|
||||
marks: Vec::new(),
|
||||
floats: Vec::new(),
|
||||
sources: Vec::new(),
|
||||
hash: 0,
|
||||
};
|
||||
let list = page.display_list_with_goal(100 * 65_536);
|
||||
let mut rules: Vec<i64> = list
|
||||
.items
|
||||
.iter()
|
||||
.filter_map(|item| match item {
|
||||
crate::render::DisplayItem::Rule { y, width, .. } if *width == 10 * 65_536 => {
|
||||
Some(*y)
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
.collect();
|
||||
rules.sort_unstable();
|
||||
assert_eq!(rules.len(), 2);
|
||||
assert_eq!(rules[0], 78 * 65_536);
|
||||
assert_eq!(rules[1], 90 * 65_536);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn insertion_material_sits_at_the_page_bottom() {
|
||||
let page = Page {
|
||||
|
||||
Reference in new issue
Block a user