PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Prevent "Export As" from saving webp files as "*.webp.psd" (#724)
Jamie Pates33c58b5ca04f
diff --git a/apps/photocraft/src/services.rs b/apps/photocraft/src/services.rsindex 9d62a5366..b779f643b 100644--- a/apps/photocraft/src/services.rs+++ b/apps/photocraft/src/services.rs@@ -26,6 +26,7 @@ const SAVE_FILTERS: &[(&str, &[&str])] = &[("PhotoCraft", &["pcraft"]),("PNG", &["png"]),("JPEG", &["jpg"]),+ ("WebP", &["webp"]),("TIFF", &["tif"]),("Targa", &["tga"]),("OpenEXR", &["exr"]),@@ -302,6 +303,14 @@ mod tests {use photocraft_ui_egui::{PhotocraftApp, prefs_ui};use serde_json::json;+ /// "Export As" formats must lead with their own filter, or the save panel appends the first one's extension (`photo.webp.psd`).+ #[test]+ fn save_filters_lead_with_every_export_format() {+ for ext in ["png", "jpg", "webp", "tif", "tga"] {+ assert!(save_filters(&format!("photo.{ext}"))[0].1.contains(&ext), "{ext}");+ }+ }+const RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0];const BLUE: [f32; 4] = [0.0, 0.0, 1.0, 1.0];const GREEN: [f32; 4] = [0.0, 1.0, 0.0, 1.0];