From 29b28a0067ef8943da25809542b116d5f5886f45 Mon Sep 17 00:00:00 2001 From: giswqs Date: Tue, 27 Oct 2026 07:29:25 -0400 Subject: [PATCH] test(render): accept a blended text edge in the turned label background check On macOS the system font puts an anti-aliased glyph edge at the turned label's middle, a yellow-black blend (183, 183, 0) that is neither the background nor the text, so main's macOS test failed. Check instead that the pixel is not the grey map: the background, the text and their blend all have no blue. --- crates/render/src/lib.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index 6f049478c..08a514af1 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -6746,7 +6746,9 @@ mod tests { assert_eq!(text::background_reach(&label(Some(nothing))), [0.0; 2]); // Turned along a line, it turns with the text. let turned = drawn(&PlacedLabel { angle: Some(0.6), ..l.clone() }); - assert!(turned.pixel(60, 50).is_some_and(|p| yellow(p) || p.red() < 40), "{:?}", turned.pixel(60, 50)); + // Its middle is the background, the text or the text's edge blended over it (whose glyphs + // fall there depends on the platform's font): never the grey map. + assert!(turned.pixel(60, 50).is_some_and(|p| p.blue() < 40), "{:?}", turned.pixel(60, 50)); assert!(turned.pixels().iter().filter(|p| yellow(**p)).count() > 100); // Curved character by character: none. let glyph = LabelGlyph { text: "H".into(), dx: 0.0, dy: 0.0, angle: 0.0 };