From 0b230f3f17c64f2e980419d37bc26d9654deb299 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 11 Nov 2026 21:05:53 -0800 Subject: [PATCH] Tests: cached-frame scale test no longer fails when a parallel test places a file cached_frames_keep_their_scale_during_resize_rotation_and_dpi_changes delivered the worker's frame with a 1 ms render time. The canvas key carries the process-wide placed-document generation, so when another test in the same run made a placed bitmap between the delivery and the next frame, the key no longer matched. With a 1 ms last frame, the next frame rendered on the UI thread over the delivered one, and the "the worker's frame arrived" assertion failed. The delivered frame now reports 50 ms, as the frames before it do, so a moved generation queues the next frame on the controlled worker and the delivered frame stays shown. --- crates/ui-egui/src/canvas/tests.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/canvas/tests.rs b/crates/ui-egui/src/canvas/tests.rs index 4f962fdb5..9067bdb29 100644 --- a/crates/ui-egui/src/canvas/tests.rs +++ b/crates/ui-egui/src/canvas/tests.rs @@ -2850,10 +2850,13 @@ fn cached_frames_keep_their_scale_during_resize_rotation_and_dpi_changes() { "{old_rot}° -> {new_rot}°, DPI {old_ppp} -> {new_ppp}, pixel={pixel}: {vertex:?}" ); } - // Deliver the actual replacement and verify that it replaces the cached key. + // Deliver the actual replacement and verify that it replaces the cached key. The frame + // reports a slow render: when a parallel test makes a placed document's bitmap, the key's + // process-wide `placed` generation moves, and the next frame goes to the controlled worker + // instead of rendering over the delivered frame on this thread. let img = app.canvas.renderer.render(&job.doc, job.w, job.h, job.view, &job.opts); let expected = job.key.clone(); - completed.send(crate::render_worker::Done { key: job.key, doc: job.doc, opts: job.opts, img, ms: 1.0, moved: 0, reused: false }).unwrap(); + completed.send(crate::render_worker::Done { key: job.key, doc: job.doc, opts: job.opts, img, ms: 50.0, moved: 0, reused: false }).unwrap(); frame(&mut app, size, new_ppp); assert_eq!(app.canvas.key.as_ref(), Some(&expected), "the worker's frame arrived"); }