From d7e122eaf00d205bfb5c79ec70d49af7b2a00a87 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Mon, 16 Nov 2026 20:09:15 -0800 Subject: [PATCH] Tests: update prompt tests see every repaint request from the offer The helper that waits for an offered release's prompt now observes every repaint request on its context, and ticks after each immediate one until the prompt opens. An earlier immediate request on the same context no longer hides the offer thread's request. --- crates/ui-egui/src/updates_ui.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/src/updates_ui.rs b/crates/ui-egui/src/updates_ui.rs index 3dce3e2310..eb8a4d530c 100644 --- a/crates/ui-egui/src/updates_ui.rs +++ b/crates/ui-egui/src/updates_ui.rs @@ -256,14 +256,15 @@ mod tests { /// Offers `release` and returns once its prompt is open. The updater reads the installed /// files for an offer on a thread of its own, which asks the context the updater keeps for a - /// repaint after it answers; the next tick opens the prompt. The updater must not have kept - /// another context, which its thread would ask instead. A copy the launcher manages ignores - /// the offer and fails the test. + /// repaint after it answers; the next tick opens the prompt. The observer sees every repaint + /// request, so each immediate one is followed by a tick until the prompt opens. The updater + /// must not have kept another context, which its thread would ask instead. A copy the + /// launcher manages ignores the offer and fails the test. #[cfg(not(target_arch = "wasm32"))] fn offer_and_wait(updater: &mut Updater, release: craft_update::Release) { let ctx = egui::Context::default(); let (answered, wait) = std::sync::mpsc::channel(); - ctx.set_request_repaint_callback(move |info| { + ctx.set_repaint_observer(move |info| { if info.delay.is_zero() { let _ = answered.send(()); } @@ -273,11 +274,10 @@ mod tests { updater.offer(release); // `offer` reads the launcher's choice; a managed copy starts no inspection. assert!(updater.managed().is_none(), "the launcher manages this copy, so it ignored the offer"); - if !updater.prompt_open() { + while !updater.prompt_open() { wait.recv().unwrap(); updater.tick(&ctx); } - assert!(updater.prompt_open(), "the offer opened its prompt"); } /// An app with one saved document holding a selected rectangle.