Cover bottom float content painting
This commit is contained in:
1 parent
34c4f0d84b
commit
b004cd2efb
1 file changed
+35
@@ -1861,6 +1861,41 @@ mod tests {
|
||||
let svg = list.to_svg();
|
||||
assert!(svg.contains(">x</text>"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn bottom_float_content_is_painted_at_the_page_bottom() {
|
||||
let mut document = Document::new(100, Vec::new());
|
||||
document.top_skip = 0;
|
||||
document.text_fraction_percent = 0;
|
||||
document.units.push(Unit::vertical(
|
||||
1,
|
||||
vec![VerticalItem::Box(VerticalBox {
|
||||
width: 10,
|
||||
height: 10,
|
||||
})],
|
||||
));
|
||||
document.units.push(Unit::float_with_content(
|
||||
2,
|
||||
FloatPlacement::Bottom,
|
||||
30,
|
||||
20,
|
||||
vec![VerticalItem::Rule {
|
||||
width: 30,
|
||||
height: 2,
|
||||
}],
|
||||
));
|
||||
let engine = Engine::layout(&document);
|
||||
let list = engine.pages()[0].display_list_with_goal(100);
|
||||
assert!(list.items.iter().any(|item| matches!(
|
||||
item,
|
||||
DisplayItem::Rule {
|
||||
y: 80,
|
||||
width: 30,
|
||||
height: 2,
|
||||
..
|
||||
}
|
||||
)));
|
||||
}
|
||||
#[test]
|
||||
fn float_content_is_painted_at_the_top_of_the_page() {
|
||||
let mut document = Document::new(1000, Vec::new());
|
||||
|
||||
Reference in new issue
Block a user