Tests: check the drawn H's vertical position and each mesh column's color

The composite import test now checks the H's top and bottom as well as its
width and height, so a shift of the drawn glyph fails it. The mesh export test
samples each patch's center, so swapped column fills fail it.
This commit is contained in:
dotCooCoo committed 2026-12-01 02:27:45 -08:00
1 parent d0cf7f09ec
commit cdc355d436
2 files changed
+7

No files matched your search

+2
View File
@@ -67,6 +67,8 @@ fn type42_descendants_draw_their_own_glyphs() {
// The bundled font's H spans (90, 0)–(562, 656) of its 1000-unit em: at 50 pt from x = 10 that
// is 14.5 to 38.1, 32.8 tall.
assert!((bh.x0 - 14.5).abs() < 0.01 && (bh.width() - 23.6).abs() < 0.01 && (bh.height() - 32.8).abs() < 0.01, "{bh:?}");
// In the y-down document the baseline at y = 20 lands at 80, and the cap height 32.8 above it at 47.2.
assert!((bh.y0 - 47.2).abs() < 0.01 && (bh.y1 - 80.0).abs() < 0.01, "{bh:?}");
assert!((bh.height() - bi.height()).abs() < 0.5, "{bh:?} {bi:?}");
assert!(bi.x0 > 10.0 + 50.0 * wh - 1.0 && bi.x1 < 10.0 + 50.0 * (wh + wi), "{bi:?}");
}
+5
View File
@@ -89,6 +89,11 @@ fn a_patch_is_cut_no_finer_than_its_colour_changes() {
fills.sort_unstable();
fills.dedup();
assert_eq!(fills, ["#656565", "#666666"], "{svg}");
// The left column's pieces take 101 and the right column's 102, in both rows.
let img = resvg_render(&svg);
for (x, y, want) in [(60, 60, 101), (60, 140, 101), (140, 60, 102), (140, 140, 102)] {
assert_eq!(&img.pixel(x, y)[..3], &[want; 3], "({x}, {y}) {svg}");
}
assert_looks_alike(&d, &svg, in_square, 2, 0.0);
}