Skip to content

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

Document presets: check a rejected blank profile leaves preferences unchanged

Higgs325846dbc8956ada3
diff --git a/crates/engine/src/document_preset_cmds.rs b/crates/engine/src/document_preset_cmds.rs
index 52c637fdc..e65856951 100644
--- a/crates/engine/src/document_preset_cmds.rs
+++ b/crates/engine/src/document_preset_cmds.rs
@@ -388,8 +388,6 @@ mod tests {
let plain = saved(&mut s, "Plain", settings());
assert!(plain["settings"].get("profile").is_none());
assert!(s.presets.documents[1].settings.command_params().get("profile").is_none());
- config["profile"] = json!(" ");
- assert!(s.execute("document.presets.save", json!({"name":"Blank","settings":config})).is_err());
}
#[test]
@@ -529,6 +527,9 @@ mod tests {
("backgroundColor", json!([2, 0, 0])),
("unit", json!("yards")),
("resolutionUnit", json!("px")),
+ ("profile", json!("")),
+ ("profile", json!(" \t")),
+ ("profile", json!(12)),
] {
let mut config = settings();
config[key] = bad;