PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Merge storytold/photocraft main into fix/windows-reserved-names
Eddi Andree Salazar Matos686a4bb93e4c
diff --cc crates/engine/src/file_cmds/tests.rsindex 3f7633f1d,913335afe..fe4e19bb0--- a/crates/engine/src/file_cmds/tests.rs+++ b/crates/engine/src/file_cmds/tests.rs@@@ -1429,19 -1459,21 +1459,38 @@@ fn batch_naming_rejects_outputs_that_reassert_eq!(std::fs::read(&second).unwrap(), before[1]);}+#[test]+fn sanitize_keeps_windows_device_names_off_the_disk() {+ assert_eq!(sanitize("nul"), "nul_");+ assert_eq!(sanitize("CON"), "CON_");+ assert_eq!(sanitize("com1.v2"), "com1_.v2");+ assert_eq!(sanitize("lpt9 .final"), "lpt9 _.final");+ assert_eq!(sanitize("COM¹"), "COM¹_");+ assert_eq!(sanitize("LPT².txt"), "LPT²_.txt");+ for name in ["nul", "CON", "com1.v2", "lpt9 .final", "aux", "prn", "conin$", "clock$", "COM¹", "lpt³.x"] {+ assert!(!is_windows_device_name(&sanitize(name)), "{name} -> {}", sanitize(name));+ }+ // Names that only start like a device are files like any other.+ for name in ["console", "normal", "com10", "lpt0", "nullify", "con_", "com⁴", "com¹¹"] {+ assert_eq!(sanitize(name), name);+ }+}+++ #[test]+ fn exposure_text_near_one_second_is_not_one_over_one() {+ assert_eq!(exposure_text(0.996).as_deref(), Some("1 s"));+ assert_eq!(exposure_text(0.99).as_deref(), Some("0.99 s"));+ assert_eq!(exposure_text(1.0 / 250.0).as_deref(), Some("1/250 s"));+ }++ /// A folder batch picks up GIMP's gzipped `.xcf.gz`, whose last extension alone (`gz`) says nothing.+ #[cfg(not(target_arch = "wasm32"))]+ #[test]+ fn folder_listing_recognises_gzipped_xcf_by_its_double_extension() {+ assert!(super::openable_name("/scans/page 01.xcf.gz"));+ assert!(super::openable_name("C:\\scans\\PAGE.XCF.GZ"));+ assert!(super::openable_name("page.xcfgz"));+ assert!(super::openable_name("page.PNG"));+ assert!(!super::openable_name("archive.tar.gz"));+ assert!(!super::openable_name("notes.txt"));+ }