From 034594b62cfc0f95e79cfd1d75e7997b0bb46621 Mon Sep 17 00:00:00 2001 From: giswqs Date: Sat, 24 Oct 2026 10:37:41 -0400 Subject: [PATCH 1/3] test(render): draw the curved-halo test's letters large enough for thin fonts At 12 px, Segoe UI's and SF's thin 'l' never reaches the darkness the test looks for, so it found no letter pixels on Windows and macOS. At 30 px every font's strokes have solid middles; the letters sit closer so a halo drawn per letter still covers its neighbour. --- crates/render/src/lib.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index 9f378a9ed..1e84acee8 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -6019,13 +6019,14 @@ mod tests { #[test] fn a_curved_labels_halos_go_under_all_its_letters() { // Two letters close together along a line, with a halo: the second one's halo does not - // cover the first one's strokes, so the letters are as dark as drawn without halos. + // cover the first one's strokes, so the letters are as dark as drawn without halos. Large + // enough that even a thin system font's strokes (Segoe UI, SF) have solid middles. let glyph = |dx: f32| LabelGlyph { text: "l".into(), dx, dy: 0.0, angle: 0.0 }; let label = |halo: Option| PlacedLabel { text: "ll".into(), - x: 20.0, - y: 20.0, - size: 12.0, + x: 30.0, + y: 40.0, + size: 30.0, color: Rgba::rgb(0, 0, 0), halo, bold: false, @@ -6037,10 +6038,10 @@ mod tests { line_align: TextAlign::Left, angle: None, collide: Default::default(), - glyphs: vec![glyph(-0.75), glyph(0.75)], + glyphs: vec![glyph(-1.0), glyph(1.0)], }; let drawn = |halo| { - let mut pm = Pixmap::new(40, 40).unwrap(); + let mut pm = Pixmap::new(60, 80).unwrap(); pm.fill(tiny_skia::Color::from_rgba8(128, 128, 128, 255)); text::draw(&mut pm, &label(halo), 1.0); pm From 62ad51c7a12d3ecf90e57656fba9d028f4776b60 Mon Sep 17 00:00:00 2001 From: giswqs Date: Sat, 24 Oct 2026 11:07:06 -0400 Subject: [PATCH 2/3] test(assistant): cancel a sign-in request without racing the clock The cancelling thread could run after the 150 ms work had finished on a loaded macOS runner, so the request came back Ok. The work now runs until the cancel is set (at most 5 s), however late that is. --- crates/assistant/src/chatgpt.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/assistant/src/chatgpt.rs b/crates/assistant/src/chatgpt.rs index f1e8851a5..b683032f1 100644 --- a/crates/assistant/src/chatgpt.rs +++ b/crates/assistant/src/chatgpt.rs @@ -1597,8 +1597,13 @@ mod native { std::thread::sleep(Duration::from_millis(30)); *cancel.lock().unwrap() = true; }); - let e = cancellable(&cancel, Instant::now() + Duration::from_secs(10), || { - std::thread::sleep(Duration::from_millis(150)); + // The work outlasts the cancel however late the cancelling thread runs. + let flag = cancel.clone(); + let e = cancellable(&cancel, Instant::now() + Duration::from_secs(10), move || { + let end = Instant::now() + Duration::from_secs(5); + while !*flag.lock().unwrap() && Instant::now() < end { + std::thread::sleep(Duration::from_millis(5)); + } Ok(()) }) .unwrap_err(); From 1aa6eae1a4d9559e55cc3d02186240633e256a48 Mon Sep 17 00:00:00 2001 From: giswqs Date: Sat, 24 Oct 2026 11:15:48 -0400 Subject: [PATCH 3/3] Address CodeRabbit review feedback - The curved-halo test now checks that both letters are drawn: the pair's dark columns outnumber a single letter's, so one missing glyph can no longer pass it. --- crates/render/src/lib.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/render/src/lib.rs b/crates/render/src/lib.rs index 1e84acee8..adb204a84 100644 --- a/crates/render/src/lib.rs +++ b/crates/render/src/lib.rs @@ -6022,7 +6022,7 @@ mod tests { // cover the first one's strokes, so the letters are as dark as drawn without halos. Large // enough that even a thin system font's strokes (Segoe UI, SF) have solid middles. let glyph = |dx: f32| LabelGlyph { text: "l".into(), dx, dy: 0.0, angle: 0.0 }; - let label = |halo: Option| PlacedLabel { + let label = |halo: Option, glyphs: Vec| PlacedLabel { text: "ll".into(), x: 30.0, y: 40.0, @@ -6038,15 +6038,20 @@ mod tests { line_align: TextAlign::Left, angle: None, collide: Default::default(), - glyphs: vec![glyph(-1.0), glyph(1.0)], + glyphs, }; - let drawn = |halo| { + let drawn = |halo, glyphs| { let mut pm = Pixmap::new(60, 80).unwrap(); pm.fill(tiny_skia::Color::from_rgba8(128, 128, 128, 255)); - text::draw(&mut pm, &label(halo), 1.0); + text::draw(&mut pm, &label(halo, glyphs), 1.0); pm }; - let (plain, haloed) = (drawn(None), drawn(Some(Rgba::rgb(255, 255, 255)))); + let pair = || vec![glyph(-1.0), glyph(1.0)]; + let (plain, haloed) = (drawn(None, pair()), drawn(Some(Rgba::rgb(255, 255, 255)), pair())); + // Both letters are drawn: the pair's ink is wider than one letter's. + let inked = |pm: &Pixmap| (0..60).filter(|&x| (0..80).any(|y| pm.pixel(x, y).is_some_and(|p| p.red() < 40))).count(); + let one = drawn(None, vec![glyph(-1.0)]); + assert!(inked(&plain) > inked(&one), "two letters, not one: {} vs {}", inked(&plain), inked(&one)); let mut letters = 0; for (a, b) in plain.pixels().iter().zip(haloed.pixels()) { if a.red() < 40 {