Place top floats on the page they appear on

This commit is contained in:
gloamxun committed 2026-10-23 23:15:56 +08:00
1 parent a78e0c1d0d
commit db1cc98338
6 files changed
+101 -21

No files matched your search

+6 -5
View File
@@ -6450,7 +6450,7 @@ mod tests {
}
#[test]
fn paged_layout_defers_a_late_top_float() {
fn paged_layout_puts_a_late_top_float_on_its_own_page() {
let mut document = Document::new(
100,
vec![
@@ -6461,10 +6461,11 @@ mod tests {
);
document.text_float_sep = 0;
let layout = Engine::layout_paged(&document).expect("a late float still builds");
assert_eq!(layout.pages().len(), 2);
assert!(layout.pages()[0].floats.is_empty());
assert_eq!(layout.pages()[1].floats.len(), 1);
assert_eq!(layout.pages()[1].items.len(), 1);
// TeX installs the float at the top of the page it is seen on, so the
// float and both rules share one page.
assert_eq!(layout.pages().len(), 1);
assert_eq!(layout.pages()[0].floats.len(), 1);
assert_eq!(layout.pages()[0].items.len(), 2);
}
#[test]