Merge round3a-integration (c305861a4) into the import review fixes

This commit is contained in:
aiongg
2026-10-24 06:03:26 +00:00
2 changed files with 23 additions and 9 deletions
+10 -4
View File
@@ -874,15 +874,23 @@ fn photos_dropped_on_the_launch_list_go_into_the_library_chosen() {
#[test]
fn a_failed_lookup_doesnt_mark_a_recent_library_missing() {
use std::os::unix::fs::PermissionsExt;
/// Gives the folder its permissions back and removes the test's folder, also when an assertion
/// fails (a folder left at mode 000 can't be removed).
struct Cleanup(std::path::PathBuf, std::path::PathBuf);
impl Drop for Cleanup {
fn drop(&mut self) {
let _ = std::fs::set_permissions(&self.1, std::fs::Permissions::from_mode(0o755));
let _ = std::fs::remove_dir_all(&self.0);
}
}
let dir = temp("lookup");
let locked = dir.join("Locked");
let _cleanup = Cleanup(dir.clone(), locked.clone());
let inside = make_library(&locked.join("Inside"));
let gone = dir.join("Gone").to_string_lossy().into_owned();
std::fs::set_permissions(&locked, std::fs::Permissions::from_mode(0o000)).unwrap();
if std::fs::read_dir(&locked).is_ok() {
// running as root (some CI containers): the mode bits don't stop it, so no lookup fails
std::fs::set_permissions(&locked, std::fs::Permissions::from_mode(0o755)).unwrap();
let _ = std::fs::remove_dir_all(&dir);
lightcraft_testkit::skip!(System, "a folder with no permissions can still be read (running as root)");
return;
}
@@ -890,7 +898,6 @@ fn a_failed_lookup_doesnt_mark_a_recent_library_missing() {
app.ui.settings.recent_libraries = vec![inside.clone(), gone.clone()];
let mut h = Headless::new(app, [900.0, 600.0], 1.0);
let answered = h.step_until(T, |h| h.app.recent_checks.is_known(&inside) && h.app.recent_checks.is_known(&gone));
std::fs::set_permissions(&locked, std::fs::Permissions::from_mode(0o755)).unwrap();
assert!(answered);
assert_eq!(h.app.recent_checks.exists(&gone), Some(false), "a library that isn't there is missing");
assert_eq!(h.app.recent_checks.exists(&inside), None, "one that couldn't be looked at isn't");
@@ -901,7 +908,6 @@ fn a_failed_lookup_doesnt_mark_a_recent_library_missing() {
assert!(!Unavailable::Unreadable("denied".into()).is_missing() && !Unavailable::LookupFailed("timed out".into()).is_missing());
assert!(Unavailable::NotFound.is_missing());
drop(h);
let _ = std::fs::remove_dir_all(&dir);
}
/// A library found is asked about again when the window comes back to the front, not on a timer: a
+13 -5
View File
@@ -241,8 +241,8 @@ fn playback_settings_drive_the_slideshow_and_bad_ones_are_refused() {
reveal(&mut h, "check:settings.slideshowRandom");
let r = h.request("ui.clickWidget", json!({"id": "check:settings.slideshowRandom"}), T);
assert_eq!(r["ok"], true, "{r}");
h.step();
assert!(h.app.session.slideshow.random_order, "the checkbox goes through slideshow.playback");
// (waits for it: one frame isn't always enough on a loaded machine)
assert!(h.step_until(T, |h| h.app.session.slideshow.random_order), "the checkbox goes through slideshow.playback");
h.settle(SETTLE);
}
@@ -394,9 +394,17 @@ fn settings_shows_the_slide_layout_and_a_live_preview() {
h.step();
// (the preview is pinned above the page: in view already)
reveal(&mut h, "slideshow:preview");
let rect = h.app.widgets.iter().find(|(id, _)| id == "slideshow:preview").map(|(_, r)| *r).unwrap();
let img = h.paint();
let c = painted(&img, (rect.left() + 3.0) as usize, (rect.center().y) as usize);
// (painted once the new preview is on screen: one frame isn't always enough on a loaded machine)
let t0 = std::time::Instant::now();
let c = loop {
let rect = h.app.widgets.iter().find(|(id, _)| id == "slideshow:preview").map(|(_, r)| *r).unwrap();
let img = h.paint();
let c = painted(&img, (rect.left() + 3.0) as usize, (rect.center().y) as usize);
if (c[1] > 200 && c[0] < 60) || t0.elapsed() > T {
break c;
}
h.step();
};
assert!(c[1] > 200 && c[0] < 60, "the green backdrop in the preview margin: {c:?}");
h.settle(SETTLE);
}