Paint route-D float placeholders at page edges

This commit is contained in:
gloamxun committed 2026-10-20 18:20:32 +08:00
1 parent 6e1ee13d68
commit af50f1afa1
3 files changed
+86 -1

No files matched your search

+36
View File
@@ -1372,6 +1372,42 @@ mod tests {
)));
}
#[test]
fn float_placeholders_are_painted_at_page_edges() {
let page = Page {
items: vec![VerticalItem::Box(VerticalBox {
width: 100 * 65_536,
height: 20 * 65_536,
})],
insertions: Vec::new(),
marks: Vec::new(),
floats: vec![
Float {
placement: FloatPlacement::Top,
width: 50 * 65_536,
height: 15 * 65_536,
},
Float {
placement: FloatPlacement::Bottom,
width: 60 * 65_536,
height: 10 * 65_536,
},
],
sources: Vec::new(),
hash: 0,
};
let list = page.display_list_with_goal(700 * 65_536);
assert!(list.items.iter().any(|item| matches!(
item,
crate::render::DisplayItem::Rule { y, width, height, .. }
if *y == 0 && *width == 50 * 65_536 && *height == 15 * 65_536
)));
assert!(list.items.iter().any(|item| matches!(
item,
crate::render::DisplayItem::Rule { y, width, height, .. }
if *y == 690 * 65_536 && *width == 60 * 65_536 && *height == 10 * 65_536
)));
}
#[test]
fn footnote_separator_sits_above_the_insertion_area() {
let page = Page {