Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

Merge PhotoCraft 0.8.2 and stabilize background-job tests

skylar taylor-barrick7b0317ff41f3
diff --cc Cargo.lock
index a9205248c,ec1ddff11..a0499ca1c
--- a/Cargo.lock
+++ b/Cargo.lock
@@@ -4355,10 -4347,9 +4355,10 @@@ dependencies =
[[package]]
name = "photocraft-engine"
- version = "0.8.1"
+ version = "0.8.2"
dependencies = [
"blake3",
+ "craft-print",
"exr",
"flate2",
"photocraft-affinity",
diff --cc crates/ui-egui/src/jobs_ui_tests.rs
index 3a5215466,9d5c15506..bc2906451
--- a/crates/ui-egui/src/jobs_ui_tests.rs
+++ b/crates/ui-egui/src/jobs_ui_tests.rs
@@@ -66,9 -66,9 +66,16 @@@ fn slow_job(app: &mut PhotocraftApp, ga
/// Step frames for `ms` of wall time; returns (frames, slowest frame in ms).
fn frames_for(h: &mut Harness<'_, PhotocraftApp>, ms: u64) -> (u64, f64) {
++ frames_for_at_least(h, ms, 0)
++}
++
++/// Prove the frame loop advances while a gated worker stays blocked, without assuming a
++/// minimum frame rate on software-rendered CI machines. Also wait for the progress modal.
++fn frames_for_at_least(h: &mut Harness<'_, PhotocraftApp>, ms: u64, min_frames: u64) -> (u64, f64) {
let t = Instant::now();
let (mut n, mut worst) = (0, 0.0f64);
-- while t.elapsed() < Duration::from_millis(ms) {
++ while t.elapsed() < Duration::from_millis(ms) || n < min_frames {
++ assert!(t.elapsed() < Duration::from_secs(30), "frame observation timed out after {n} frames");
let f = Instant::now();
h.step();
worst = worst.max(f.elapsed().as_secs_f64() * 1000.0);
@@@ -84,7 -84,7 +91,7 @@@ fn the_frame_loop_keeps_running_during_
let doc_before = h.state().session.active().unwrap().doc.clone();
let job = slow_job(h.state_mut(), &gate);
let frame0 = h.state().frame;
-- let (n, worst) = frames_for(&mut h, 400);
++ let (n, worst) = frames_for_at_least(&mut h, 400, 10);
assert!(h.state().frame - frame0 >= 10, "the UI kept rendering ({n} frames)");
eprintln!("{n} frames during the job, slowest {worst:.1} ms");
// The status bar shows the job, and after the delay the modal progress dialog.
@@@ -418,7 -418,7 +425,7 @@@ fn saves_run_in_the_background_and_are_
assert!(h.state().saving());
// The window keeps drawing; the document stays unsaved and can't be edited meanwhile.
-- let (frames, _) = frames_for(&mut h, 400);
++ let (frames, _) = frames_for_at_least(&mut h, 400, 4);
assert!(frames >= 4, "only {frames} frames while saving");
let st = h.state().session.active().unwrap();
assert!(st.is_dirty() && st.path.is_none());