diff --git a/crates/ui-egui/src/file_dialog/tests.rs b/crates/ui-egui/src/file_dialog/tests.rs index 9ce0a76d120..c7527e3ab23 100644 --- a/crates/ui-egui/src/file_dialog/tests.rs +++ b/crates/ui-egui/src/file_dialog/tests.rs @@ -50,11 +50,11 @@ fn chose(path: &str) -> Picked { Picked::Paths(vec![PathBuf::from(path)]) } -/// The file a Save request suggests: its folder and name together. +/// The file a Save request suggests: its folder and name together (see [`joined`]). fn suggested(request: &PickRequest) -> String { let name = request.file_name.clone().unwrap_or_default(); match &request.directory { - Some(dir) => dir.join(name).to_string_lossy().into_owned(), + Some(dir) => joined(&dir.to_string_lossy(), &name), None => name, } } @@ -589,10 +589,10 @@ fn save_and_export_dialogs_start_beside_the_document() { } } -/// The path `pick_save` suggests for `name` in `dir` on this platform: it joins with `Path::join`, -/// which uses `\` on Windows, so the expected values must be built the same way (#2745). +/// `name` in the folder `dir`, joined with `/` as the tests' paths are written. A Save request +/// carries its folder and name apart, and `Path::join` would put `\` between them on Windows. fn joined(dir: &str, name: &str) -> String { - Path::new(dir).join(name).to_string_lossy().into_owned() + format!("{}/{name}", dir.trim_end_matches('/')) } /// #1826: after the user navigates a save or export dialog elsewhere, the document's next dialog @@ -1428,7 +1428,7 @@ fn a_scripted_quality_survives_the_changed_on_disk_prompt() { fn save_a_copy_appends_copy_unless_the_preference_says_not_to() { let ctx = egui::Context::default(); for (off, name) in [(false, "My image copy.psd"), (true, "My image.psd")] { - let want = Path::new("/pics").join(name).to_string_lossy().into_owned(); + let want = joined("/pics", name); let (mut app, files, _) = jpeg_app(Some("/pics/My image.JPEG"), false); app.run("prefs.set", json!({"path": "fileHandling.doNotAppendCopy", "value": off})).unwrap(); menus::invoke(&mut app, &ctx, "file.saveACopy", json!({})).unwrap(); diff --git a/crates/ui-egui/src/panels/histogram_panel/tests.rs b/crates/ui-egui/src/panels/histogram_panel/tests.rs index 6ff01ad2c62..6d1a8f26538 100644 --- a/crates/ui-egui/src/panels/histogram_panel/tests.rs +++ b/crates/ui-egui/src/panels/histogram_panel/tests.rs @@ -276,8 +276,10 @@ fn cache_levels_one_still_throttles_recounts_and_an_uncached_refresh_does_not() let mut app = app_with(json!({"width": 64, "height": 48})); app.run("prefs.set", json!({"path": "performance.cacheLevels", "value": 1})).unwrap(); settle(&mut app); - // The count just landed, so the next edit falls inside the throttle. - app.doc_hist.as_mut().unwrap().at = 0.0; + // The count just landed, so the next edit falls inside the throttle. Each pass without an input + // time moves the context's clock on by one frame, so "just now" is the context's time, not 0. + let now = app.ctx().input(|i| i.time) * 1000.0; + app.doc_hist.as_mut().unwrap().at = now; app.run("edit.fill", json!({"color": "#000000"})).unwrap(); frame(&mut app); assert!(app.hist_job.is_none(), "an edit within 250 ms of the last count waits");