Queue top table floats and let text flow around them

This commit is contained in:
gloamxun committed 2026-10-19 14:42:06 +08:00
1 parent 7ad3c327ec
commit 6658a155fc
6 files changed
+210 -70

No files matched your search

+40
View File
@@ -805,6 +805,46 @@ Body text.
}
}
#[test]
fn top_table_moves_to_the_next_page_and_text_flows() {
let source = r#"\documentclass{article}
\begin{document}
Before table.
\begin{table}[t]
\caption{Top table}
\begin{tabular}{ll}
Alpha & Beta \\
Gamma & Delta \\
\end{tabular}
\end{table}
After table.
\end{document}
"#;
let value = fresh_preview(source, "table-float.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
assert_eq!(pages(&value).len(), 2, "top table should start a new page");
assert!(
!page_svg(&value, 0).contains("Top"),
"table caption should not stay on page 1: {}",
page_svg(&value, 0)
);
assert!(
page_svg(&value, 0).contains("After"),
"text after the table should fill page 1"
);
let second = page_svg(&value, 1);
assert!(
second.contains(">op</text>"),
"table caption missing from page 2: {second}"
);
assert!(
second.contains(">Alpha</text>"),
"table body missing from page 2: {second}"
);
}
#[test]
fn table_of_contents_lists_numbered_sections_and_pages() {
let source = r"\documentclass{article}