Test that tagged math uses the display measure

Assert TaggedWidth.width equals the measure, protecting the right-margin
equation tag geometry while the formula body remains approximate.

Test count is 1083.
This commit is contained in:
gloamxun committed 2026-10-28 09:03:37 +08:00
1 parent af20ce8dc9
commit 35015853b4
5 files changed
+22 -6

No files matched your search

+16
View File
@@ -3912,6 +3912,22 @@ mod tagged_equation_tests {
assert_eq!(tagged.height, plain.height.max(7 * 65_536));
assert_eq!(tagged.depth, plain.depth.max(2 * 65_536));
}
#[test]
fn tagged_width_uses_the_display_measure() {
let font = Cmr10Metrics::Math;
let body = parse_math("x");
let measure = 300 * 65_536;
let tagged = layout_math(
&MathAtom::TaggedWidth {
body: Box::new(body),
tag: "(1)".to_string(),
width: measure,
},
&font,
);
assert_eq!(tagged.width, measure);
}
#[test]
fn display_sum_limits_sit_close_to_the_operator() {
let atom = parse_math(r"\sum_{i=1}^{N}");