Skip to content

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

Tests: build save-dialog expectations with Path::join so they pass on Windows (#2745) (#2853)

mroxsod9e6cee90853
diff --git a/crates/ui-egui/src/file_dialog/tests.rs b/crates/ui-egui/src/file_dialog/tests.rs
index 56eb45b6f..d490e8b10 100644
--- a/crates/ui-egui/src/file_dialog/tests.rs
+++ b/crates/ui-egui/src/file_dialog/tests.rs
@@ -292,6 +292,12 @@ 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).
+fn joined(dir: &str, name: &str) -> String {
+ std::path::Path::new(dir).join(name).to_string_lossy().into_owned()
+}
+
/// #1826: after the user navigates a save or export dialog elsewhere, the document's next dialog
/// starts there. Save As of a saved document still suggests its own path; other documents and
/// closed documents are unaffected.