Ship float-heavy pages without body material
This commit is contained in:
1 parent
594a57e414
commit
66dfb10b60
4 files changed
+82
-4
No files matched your search
@@ -1965,6 +1965,7 @@ impl Engine {
|
||||
top_number: usize::from(document.top_number),
|
||||
bottom_number: usize::from(document.bottom_number),
|
||||
total_number: usize::from(document.total_number),
|
||||
float_page_fraction_percent: document.float_page_fraction_percent,
|
||||
ragged_bottom: document.ragged_bottom,
|
||||
}
|
||||
}
|
||||
@@ -5798,6 +5799,28 @@ mod tests {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paged_layout_honours_float_page_fraction() {
|
||||
let mut document = Document::new(
|
||||
100,
|
||||
vec![
|
||||
Unit::float(1, FloatPlacement::Top, 100, 60),
|
||||
Unit::rule(2, 100, 10),
|
||||
],
|
||||
);
|
||||
document.text_fraction_percent = 0;
|
||||
document.float_page_fraction_percent = 50;
|
||||
let layout = Engine::layout_paged(&document).expect("float page builds");
|
||||
assert_eq!(layout.pages().len(), 2);
|
||||
assert!(layout.pages()[0].items.is_empty());
|
||||
assert_eq!(layout.pages()[0].floats.len(), 1);
|
||||
|
||||
document.float_page_fraction_percent = 90;
|
||||
let layout = Engine::layout_paged(&document).expect("shared page builds");
|
||||
assert_eq!(layout.pages().len(), 1);
|
||||
assert_eq!(layout.pages()[0].items.len(), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn paged_float_reserves_text_float_sep_in_the_display_list() {
|
||||
let mut document = Document::new(
|
||||
|
||||
Reference in new issue
Block a user