Add minipage and vbox block boxes

This commit is contained in:
gloamxun committed 2026-10-19 13:05:43 +08:00
1 parent 2552008d4b
commit 5fa301fdcd
7 files changed
+116 -20

No files matched your search

+35
View File
@@ -426,3 +426,38 @@ A\fbox{B}C
"text around fbox missing"
);
}
#[test]
fn minipage_wraps_to_requested_width_and_vbox_wraps() {
let source = r#"\documentclass{article}
\begin{document}
\begin{minipage}[t]{50mm}
This is a minipage with enough text to wrap across several lines and demonstrate that it is block-wide.
\end{minipage}
\vbox{A vbox wraps at text width with \textbf{bold} content.}
\end{document}
"#;
let value = fresh_preview(source, "minipage.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
let svg = page_svg(&value, 0);
assert!(svg.contains(">minipage</text>"), "minipage content missing");
assert!(
svg.contains(">block-wide.</text>"),
"wrapped minipage tail missing"
);
let first = text_y(&svg, "This");
let wrapped = text_y(&svg, "text");
assert!(
wrapped > first + 3.0,
"minipage did not wrap: {first} -> {wrapped}"
);
for word in ["This", "text", "block-wide."] {
assert!(
text_x(&svg, word) < 50.0,
"minipage content escaped its 50mm width: {word}"
);
}
assert!(svg.contains(">vbox</text>"), "vbox content missing");
assert!(svg.contains(">bold</text>"), "vbox styled content missing");
}