From bdf2e6cb31e8d5c49e8d8bb01bbc3465f2cc5289 Mon Sep 17 00:00:00 2001 From: fjamesprice Date: Sat, 17 Oct 2026 16:23:14 -0400 Subject: [PATCH] test(camera-raw): wait for the proxy worker before recording a revision The dialog's own controls develop the preview on a worker (#5964), so after the scope tone drags its last frame could land after the test recorded previewRevision and bump it during the hover check that must not re-render. A settle() helper waits until previewPending is false; the fixture and the drag test call it before taking a baseline. With a 20 ms delay added to the worker, the old test failed 9 of 10 runs with the reviewer's assertion; with settle() all 21 tests passed 10 of 10. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/tests/camera_raw_scope.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/crates/ui-egui/tests/camera_raw_scope.rs b/crates/ui-egui/tests/camera_raw_scope.rs index 7d9957ce3f..7ff1236077 100644 --- a/crates/ui-egui/tests/camera_raw_scope.rs +++ b/crates/ui-egui/tests/camera_raw_scope.rs @@ -39,8 +39,21 @@ fn fixture_render(theme: ThemeKind, gpu: bool) -> Harness<'static, PhotocraftApp h.state_mut().set_theme(&ctx, theme); h.run_steps(3); assert_eq!(h.state().ui.theme, theme); + settle(&mut h); h } +/// Waits for the proxy develop that the dialog's own controls start on a worker (#5964), so its +/// frame can't land, and bump `previewRevision`, after a test has recorded the revision. +fn settle(h: &mut Harness<'_, PhotocraftApp>) { + let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30); + while inspect(h)["previewPending"] == true { + assert!(std::time::Instant::now() < deadline, "the Camera Raw preview worker never finished"); + std::thread::sleep(std::time::Duration::from_millis(2)); + h.run_steps(1); + } + // The frame that picked up the result also rebuilt the scope; let it go quiet. + h.run_steps(2); +} fn press(h: &mut Harness<'_, PhotocraftApp>, p: Pos2, pressed: bool, modifiers: Modifiers) { h.event(Event::ModifiersChanged(modifiers)); h.event(Event::PointerMoved(p)); @@ -218,6 +231,8 @@ fn real_drag_hover_warnings_sampler_motion_and_floating_scope_across_themes() { let ctx = h.ctx.clone(); menu(h.state_mut(), &ctx, json!({"ui":{"scope":{"samplerTool":true,"vectorscope":true,"shadows":true,"highlights":true}}})).unwrap(); h.run_steps(3); + // The tone drags above developed on the worker; the last frame may still be on its way. + settle(&mut h); let revision = inspect(&h)["previewRevision"].clone(); let scope_revision = inspect(&h)["scopeRevision"].clone(); let preview = rect(&h, "previewRect");