mirror of
https://github.com/storytold/photocraft.git
synced 2026-12-03 06:31:42 +01:00
Merge #18012 into the merge queue batch
test(ui): fix two timing-dependent tests that redden main (#18011)
This commit is contained in:
commit
3c2d97d516
2 files changed
+6
-2
No files matched your search
@@ -314,9 +314,9 @@ fn a_background_fill_remembers_its_settings_only_when_its_job_is_applied() {
|
||||
assert_eq!(saved(&app), Some(remembered), "nothing is remembered while the fill runs");
|
||||
assert_eq!(app.jobs.caf_settings.len(), 1, "the fill runs as a background job");
|
||||
let ctx = ctx(&app);
|
||||
let deadline = std::time::Instant::now() + std::time::Duration::from_secs(30);
|
||||
// No deadline of its own: a loaded runner can take over a minute for the fill, and the test runner's
|
||||
// timeout catches a job that never ends.
|
||||
while app.session.has_jobs() {
|
||||
assert!(std::time::Instant::now() < deadline, "the fill job did not end");
|
||||
crate::jobs_ui::tick(&mut app, &ctx);
|
||||
std::thread::sleep(std::time::Duration::from_millis(1));
|
||||
}
|
||||
|
||||
@@ -559,6 +559,10 @@ mod tests {
|
||||
assert_ne!(before, revision_of(&app, &path_string), "invalidation must change the real source's revision");
|
||||
// Check invalidation with unchanged metadata first, then make stale and fresh decoder pixels distinct.
|
||||
std::fs::write(&path_string, flat_png([20, 100, 60, 255])).unwrap();
|
||||
// The revision read above statted the old file. Let that stat expire and read the new file now, so no
|
||||
// stat between the passes below changes the revision under the replacement decoder (#18011).
|
||||
std::thread::sleep(RECHECK_INTERVAL);
|
||||
revision_of(&app, &path_string);
|
||||
|
||||
// The former picture may be a stand-in, but it cannot satisfy the invalidated revision as Ready.
|
||||
assert!(
|
||||
|
||||
Reference in new issue
Block a user