Draw paged top floats with their text float separation
This commit is contained in:
1 parent
aa081e3dc6
commit
c5b3493998
3 files changed
+31
-9
No files matched your search
@@ -5181,6 +5181,26 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paged_float_reserves_text_float_sep_in_the_display_list() {
|
||||
let mut document = Document::new(
|
||||
100,
|
||||
vec![
|
||||
Unit::float(1, FloatPlacement::Top, 100, 20),
|
||||
Unit::rule(2, 100, 10),
|
||||
],
|
||||
);
|
||||
document.text_float_sep = 10;
|
||||
let engine = Engine::layout_paged(&document).expect("paged floats build");
|
||||
let list =
|
||||
engine.pages()[0].display_list_with_layout(document.page_goal, document.text_float_sep);
|
||||
let body = list.items.iter().find_map(|item| match item {
|
||||
crate::render::DisplayItem::Rule { y, height, .. } if *height == 10 => Some(*y),
|
||||
_ => None,
|
||||
});
|
||||
assert_eq!(body, Some(30));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paged_layout_defers_a_late_top_float() {
|
||||
let mut document = Document::new(
|
||||
|
||||
Reference in new issue
Block a user