From cdc355d4367dd431a738f33e80822e25d3502b1d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 1 Dec 2026 02:27:45 -0800 Subject: [PATCH] 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. --- crates/eps/src/import/tests_composite.rs | 2 ++ crates/svg/tests/it/mesh_export.rs | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/crates/eps/src/import/tests_composite.rs b/crates/eps/src/import/tests_composite.rs index 6e3a63373d..4caf968271 100644 --- a/crates/eps/src/import/tests_composite.rs +++ b/crates/eps/src/import/tests_composite.rs @@ -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:?}"); } diff --git a/crates/svg/tests/it/mesh_export.rs b/crates/svg/tests/it/mesh_export.rs index c46b943734..281d3b1571 100644 --- a/crates/svg/tests/it/mesh_export.rs +++ b/crates/svg/tests/it/mesh_export.rs @@ -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); }