Capture vertical material in vbox and vtop

This commit is contained in:
gloamxun committed 2026-10-19 14:34:22 +08:00
1 parent 5e9552d785
commit 7ad3c327ec
8 files changed
+99 -14

No files matched your search

+27
View File
@@ -1022,3 +1022,30 @@ Body text.
);
assert!(svg.contains("Body"), "body text missing: {svg}");
}
#[test]
fn vbox_captures_vertical_material() {
let source = r#"\documentclass{article}
\begin{document}
Before.
\vbox{%
\hrule width 40mm height 2pt
\vskip 4pt
\hrule width 20mm height 2pt
}
After.
\end{document}
"#;
let value = fresh_preview(source, "vbox.tex");
assert_eq!(value["status"], "ok", "{}", value["message"]);
let svg = page_svg(&value, 0);
assert_eq!(
svg.matches("fill=\"#000000\"/>").count(),
2,
"expected two rules in vbox: {svg}"
);
assert!(svg.contains("width=\"40.15"), "wide rule missing: {svg}");
assert!(svg.contains("width=\"20.07"), "narrow rule missing: {svg}");
assert!(svg.contains(">Before.</text>"), "text before vbox missing");
assert!(svg.contains(">After</text>"), "text after vbox missing");
}