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.
This commit is contained in:
dotCooCoo
2026-11-11 21:05:53 -08:00
parent aa4657e1ce
commit 0b230f3f17
+5 -2
View File
@@ -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");
}