Prevent "Export As" from saving webp files as "*.webp.psd" (#724)

This commit is contained in:
Jamie Pates 2026-10-07 21:34:38 +01:00 committed by GitHub
parent 9d46c8ea80
commit 33c58b5ca0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -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];