PhotoCraft: An open-source, photo editor written by scratch in pure Rust
Integration: test stringID blend modes through .atn import (#8502)
David Mann1bfae77c16ee
diff --git a/crates/engine/src/atn_cmds/tests.rs b/crates/engine/src/atn_cmds/tests.rsindex 9954f85fe..a3ddcde02 100644--- a/crates/engine/src/atn_cmds/tests.rs+++ b/crates/engine/src/atn_cmds/tests.rs@@ -30,6 +30,32 @@ fn blend_modes_accept_photoshop_string_ids_and_export_canonical_char_ids() {}}+/// #8454: a Set and a Make layer step whose blend mode is stored as a Photoshop stringID import+/// with that mode (a Set was unsupported, a Make silently fell back to Normal).+#[test]+fn layer_steps_with_string_id_blend_modes_import_with_their_mode() {+ let set = desc("null").with("null", target_ref("Lyr ")).with("T ", D::Descriptor(desc("Lyr ").with("Md ", enm("BlnM", "softLight"))));+ let make = desc("null").with("null", class_ref("Lyr ")).with("Usng", D::Descriptor(desc("Lyr ").with("Md ", enm("BlnM", "luminosity"))));+ let file = AtnFile {+ name: UnicodeString::new_nul("Blend"),+ expanded: false,+ actions: vec![AtnAction {+ name: UnicodeString::new_nul("A"),+ items: vec![item("setd", "Set", Some(set)), item("Mk ", "Make", Some(make))],+ ..Default::default()+ }],+ warnings: vec![],+ };+ let imp = import(&atn::write(&file).unwrap()).unwrap();+ assert!(imp.unsupported.is_empty(), "{:?}", imp.unsupported.iter().map(|u| &u.event).collect::<Vec<_>>());+ let steps = &imp.actions[0].steps;+ assert_eq!(steps.len(), 2);+ assert_eq!(steps[0].0, "layer.setProps");+ assert_eq!(steps[0].1["blend"], json!("Soft Light"));+ assert_eq!(steps[1].0, "layer.new.layer");+ assert_eq!(steps[1].1["mode"], json!("Luminosity"));+}+fn item(event: &str, label: &str, d: Option<Descriptor>) -> AtnItem {let event = match event.as_bytes() {[a, b, c, dd] => AtnEvent::Code([*a, *b, *c, *dd]),