From 956bf7d1b4f1810cdd3dfd5789dc6c3d77e71ccd Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Wed, 25 Nov 2026 02:41:12 +0100 Subject: [PATCH] nightly: give the update test its dialog host before asking it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `a_nightly_never_checks_downloads_or_installs_an_update` panicked on `dialogs().unwrap()`: the host exists only after the app's first frame, and the test never ran one (the neighbouring test in the module uses `crate::unsaved::ready_for_test`). It now runs that frame first and asserts the frame itself opens no dialog, then keeps the tick/pump/exit-hook checks. Verified with `cargo +1.100.0 test -p vectorcraft-ui-egui --lib -- updates_ui::tests::a_nightly…`: 1 passed. --- crates/ui-egui/src/updates_ui.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/updates_ui.rs b/crates/ui-egui/src/updates_ui.rs index 95f7a6211c..6a60584fae 100644 --- a/crates/ui-egui/src/updates_ui.rs +++ b/crates/ui-egui/src/updates_ui.rs @@ -309,13 +309,17 @@ mod tests { assert!(Runtime::for_identity(LaunchIdentity::Stable).updater.is_some()); let mut app = app_with_saved_object(); - let ctx = crate::testing::ui_context(); + // A nightly's runtime has no updater at all, so not even the frame that gives the app its + // dialog host may start a check (`dialogs()` is `None` before that frame runs). app.updates_rt.updater = None; + let ctx = crate::unsaved::ready_for_test(&mut app); + let opened = app.dialogs().expect("the frame gives the app its dialog host").with(|h| h.open_dialogs().len()); + assert_eq!(opened, 0, "the first frame opens no update dialog in a nightly"); // Neither a frame nor the exit hook does anything at all. tick(&mut app, &ctx); pump(&mut app, &ctx); app.start_pending_update(); - let opened = app.dialogs().unwrap().with(|h| h.open_dialogs().len()); + let opened = app.dialogs().expect("the dialog host").with(|h| h.open_dialogs().len()); assert_eq!(opened, 0, "a nightly opens no update dialog on its own"); // Asked to check, it says who manages its updates instead of asking about a release. check(&mut app).unwrap();