From 712da4f05e5cc20d6596ac7eaee61adea0b957a9 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 5 Nov 2026 12:20:09 -0500 Subject: [PATCH 1/3] Layer > Smart Objects says Reveal in Explorer, Embed Linked and Embed All Linked, in the reference order, without the Warp rows (#11401) Windows now reads "Reveal in Explorer", Convert to Embedded is "Embed Linked", and a new Embed All Linked command (layer.smartObjects.embedAllLinked) embeds every linked smart object of the document in one history step, refusing the whole step with an error that names a missing file. The three Warp rows leave the submenu; their commands stay registered for scripts and the Edit menu. The menu parity floor drops from 660 to 658 because three live catalog rows were removed and one added. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/cmd/distort_cmds.rs | 4 +- crates/engine/src/cmd/smart_cmds.rs | 53 +++++++- crates/engine/src/cmd/warp_cmds.rs | 2 +- crates/engine/src/embed_all_linked_tests.rs | 122 ++++++++++++++++++ crates/engine/src/lib.rs | 2 + crates/ui-egui/src/i18n/ar.tsv | 2 + crates/ui-egui/src/i18n/bs.tsv | 2 + crates/ui-egui/src/i18n/cs.tsv | 2 + crates/ui-egui/src/i18n/da.tsv | 2 + crates/ui-egui/src/i18n/de.tsv | 2 + crates/ui-egui/src/i18n/el.tsv | 2 + crates/ui-egui/src/i18n/es.tsv | 2 + crates/ui-egui/src/i18n/fi.tsv | 2 + crates/ui-egui/src/i18n/fr.tsv | 2 + crates/ui-egui/src/i18n/hu.tsv | 2 + crates/ui-egui/src/i18n/id.tsv | 2 + crates/ui-egui/src/i18n/it.tsv | 2 + crates/ui-egui/src/i18n/ja.tsv | 2 + crates/ui-egui/src/i18n/ko.tsv | 2 + crates/ui-egui/src/i18n/nb.tsv | 2 + crates/ui-egui/src/i18n/nl.tsv | 2 + crates/ui-egui/src/i18n/pl.tsv | 2 + crates/ui-egui/src/i18n/pt-br.tsv | 2 + crates/ui-egui/src/i18n/ru.tsv | 2 + crates/ui-egui/src/i18n/sr.tsv | 2 + crates/ui-egui/src/i18n/sv.tsv | 2 + crates/ui-egui/src/i18n/tr.tsv | 2 + crates/ui-egui/src/i18n/uk.tsv | 2 + crates/ui-egui/src/i18n/vi.tsv | 2 + crates/ui-egui/src/i18n/zh-hans.tsv | 2 + crates/ui-egui/src/i18n/zh-hant.tsv | 2 + crates/ui-egui/src/lib.rs | 2 + crates/ui-egui/src/menu_catalog.rs | 7 +- crates/ui-egui/src/menus.rs | 2 +- crates/ui-egui/src/menus/parity.rs | 2 +- crates/ui-egui/src/menus/state.rs | 2 +- .../ui-egui/src/smart_objects_menu_tests.rs | 103 +++++++++++++++ docs/parity-checklist.md | 4 +- 38 files changed, 342 insertions(+), 15 deletions(-) create mode 100644 crates/engine/src/embed_all_linked_tests.rs create mode 100644 crates/ui-egui/src/smart_objects_menu_tests.rs diff --git a/crates/engine/src/cmd/distort_cmds.rs b/crates/engine/src/cmd/distort_cmds.rs index 156095288f..7d820f0620 100644 --- a/crates/engine/src/cmd/distort_cmds.rs +++ b/crates/engine/src/cmd/distort_cmds.rs @@ -407,7 +407,7 @@ pub fn specs() -> Vec { CommandSpec { id: PUPPET_SMART, label: "Puppet Warp", - menu: &["Layer", "Smart Objects"], + menu: &[], shortcut: None, params: P, enabled: smart_layer, @@ -427,7 +427,7 @@ pub fn specs() -> Vec { CommandSpec { id: PERSPECTIVE_SMART, label: "Perspective Warp", - menu: &["Layer", "Smart Objects"], + menu: &[], shortcut: None, params: Q, enabled: smart_layer, diff --git a/crates/engine/src/cmd/smart_cmds.rs b/crates/engine/src/cmd/smart_cmds.rs index 1f7de3d281..e33c25c41e 100644 --- a/crates/engine/src/cmd/smart_cmds.rs +++ b/crates/engine/src/cmd/smart_cmds.rs @@ -101,6 +101,48 @@ fn has_linked(s: &Session) -> std::result::Result<(), String> { _ => Err("the smart object is embedded".into()), } } +fn linked_layers(doc: &Document) -> Vec { + doc.walk() + .into_iter() + .filter(|(_, _, l)| matches!(&l.content, LayerContent::Smart(sm) if matches!(sm.source, SmartSource::Linked { .. }))) + .map(|(_, _, l)| l.id) + .collect() +} +fn has_any_linked(s: &Session) -> std::result::Result<(), String> { + let d = s.active().ok_or("no document open")?; + if linked_layers(&d.doc).is_empty() { Err("the document has no linked smart object".into()) } else { Ok(()) } +} +/// Embed All Linked: reads every linked file first, so a missing one refuses the whole step. +fn embed_all_linked(s: &mut Session, _p: &Value) -> Result { + let doc = &s.active().ok_or(EngineError::NoDocument)?.doc; + let ids = linked_layers(doc); + if ids.is_empty() { + return Err(other("the document has no linked smart object")); + } + let mut sources = Vec::with_capacity(ids.len()); + for id in &ids { + let src = &smart(doc, *id)?.source; + let (file_name, bytes) = source_bytes(&doc.metadata, src).ok_or_else(|| { + let path = match src { + SmartSource::Linked { path } => path.as_str(), + SmartSource::Embedded { .. } => "", + }; + other(format!("the linked file can't be read: {path}")) + })?; + sources.push(SmartSource::Embedded { file_name, bytes }); + } + let parent = doc.id; + let contents: Vec = ids.iter().map(|id| smart(doc, *id).map(|sm| sm.contents_id)).collect::>()?; + s.edit("Embed All Linked", |doc, _| { + for (id, src) in ids.iter().zip(sources) { + smart_mut(doc, *id)?.source = src; + refresh_or_fail(doc, *id)?; + } + Ok(()) + })?; + s.smart_links.retain(|l| l.parent != parent || !contents.contains(&l.contents_id)); + Ok(json!({"embedded": ids.iter().map(|l| l.0).collect::>()})) +} fn has_doc(s: &Session) -> std::result::Result<(), String> { s.active().map(|_| ()).ok_or_else(|| "no document open".into()) } @@ -146,7 +188,6 @@ mod source; pub(crate) use contents::on_close; pub use contents::{commit_child, contents_of, replace_contents_bytes, replace_contents_from_bytes}; use contents::{edit_contents, export_contents, is_smart_child, path_param, replace_contents, set_source, update_all}; -#[cfg(test)] use filters::smart_mut; pub(crate) use filters::{add_smart_filter, filter_mask_paintable, filter_mask_surface, refresh_after_filter_mask_edit}; use filters::{blending_options, delete_filter, edit_filters, move_filter, set_filter_params, set_filter_visible, smart, transfer_filters}; @@ -244,12 +285,20 @@ pub fn specs() -> Vec { has_smart, unpack::convert_to_layers ), - spec!("layer.smartObjects.convertToEmbedded", "Convert to Embedded", SO, r##"{"layer":id?}"##, has_linked, |s, p| { + spec!("layer.smartObjects.convertToEmbedded", "Embed Linked", SO, r##"{"layer":id?}"##, has_linked, |s, p| { set_source(s, p, "Convert to Embedded", true, |meta, src| { let (file_name, bytes) = source_bytes(meta, src).ok_or_else(|| other("the linked file can't be read"))?; Ok(SmartSource::Embedded { file_name, bytes }) }) }), + spec!( + "layer.smartObjects.embedAllLinked", + "Embed All Linked", + SO, + "{} (every linked smart object of the active document becomes embedded in one history step; a linked file that can't be read refuses the whole step and the error names it) -> {embedded: [layer ids]}", + has_any_linked, + embed_all_linked + ), spec!( "layer.smartObjects.convertToLinked", "Convert to Linked…", diff --git a/crates/engine/src/cmd/warp_cmds.rs b/crates/engine/src/cmd/warp_cmds.rs index c2f434fb1e..4b94af82a9 100644 --- a/crates/engine/src/cmd/warp_cmds.rs +++ b/crates/engine/src/cmd/warp_cmds.rs @@ -664,7 +664,7 @@ pub fn specs() -> Vec { CommandSpec { id: "layer.smartObjects.warp", label: "Warp", - menu: &["Layer", "Smart Objects"], + menu: &[], shortcut: None, params: P, enabled: active_smart, diff --git a/crates/engine/src/embed_all_linked_tests.rs b/crates/engine/src/embed_all_linked_tests.rs new file mode 100644 index 0000000000..1eda310490 --- /dev/null +++ b/crates/engine/src/embed_all_linked_tests.rs @@ -0,0 +1,122 @@ +//! Layer > Smart Objects > Embed Linked and Embed All Linked (#11401). + +use photocraft_doc::{LayerContent, SmartSource}; +use serde_json::json; + +use crate::Session; +use crate::cmd::command_specs; + +fn label(id: &str) -> &'static str { + command_specs().iter().find(|c| c.id == id).map(|c| c.label).unwrap_or_else(|| panic!("{id} is not registered")) +} + +/// Adds a layer with a few painted pixels (an empty layer can't become a smart object). +fn painted_layer(s: &mut Session) { + s.execute("layer.new.layer", json!({})).unwrap(); + s.edit("setup", |doc, active| { + let surf = doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap(); + surf.fill_rect(photocraft_geom::Rect::new(2, 2, 10, 10), &[1.0, 0.0, 0.0, 1.0]); + Ok(()) + }) + .unwrap(); +} + +/// Three smart objects: the first two linked to files in `dir`, the third embedded. +fn three(dir: &std::path::Path) -> (Session, [u64; 3]) { + let mut s = Session::new(); + s.execute("file.new", json!({"width": 32, "height": 24})).unwrap(); + let mut ids = [0u64; 3]; + for (i, slot) in ids.iter_mut().enumerate() { + painted_layer(&mut s); + *slot = s.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap()["layer"].as_u64().unwrap(); + if i < 2 { + let path = dir.join(format!("linked{i}.pcraft")); + s.execute("layer.smartObjects.convertToLinked", json!({"path": path.to_str().unwrap()})).unwrap(); + } + } + (s, ids) +} + +fn is_linked(s: &Session, id: u64) -> bool { + let doc = &s.active().unwrap().doc; + let layer = doc.walk().into_iter().map(|(_, _, l)| l).find(|l| l.id.0 == id).unwrap(); + match &layer.content { + LayerContent::Smart(sm) => matches!(sm.source, SmartSource::Linked { .. }), + other => panic!("not smart: {}", other.kind_name()), + } +} + +fn temp_dir(name: &str) -> std::path::PathBuf { + let dir = std::env::temp_dir().join(format!("pc-embed-all-{name}-{}", std::process::id())); + std::fs::remove_dir_all(&dir).ok(); + std::fs::create_dir_all(&dir).unwrap(); + dir +} + +#[test] +fn embed_linked_and_embed_all_linked_are_named_in_the_engine() { + assert_eq!(label("layer.smartObjects.convertToEmbedded"), "Embed Linked"); + assert_eq!(label("layer.smartObjects.embedAllLinked"), "Embed All Linked"); + // The warp commands stay registered for scripts and the Edit menu routes. + for id in ["layer.smartObjects.warp", "layer.smartObjects.perspectiveWarp", "layer.smartObjects.puppetWarp"] { + label(id); + } +} + +#[test] +fn embed_all_linked_embeds_both_linked_objects_in_one_undoable_step() { + let dir = temp_dir("both"); + let (mut s, ids) = three(&dir); + assert!(is_linked(&s, ids[0]) && is_linked(&s, ids[1]) && !is_linked(&s, ids[2])); + assert!(s.is_enabled("layer.smartObjects.embedAllLinked")); + let before = s.active().unwrap().history.entries().len(); + + let r = s.execute("layer.smartObjects.embedAllLinked", json!({})).unwrap(); + assert_eq!(r["embedded"], json!([ids[0], ids[1]])); + assert!(ids.iter().all(|&id| !is_linked(&s, id))); + let entries = s.active().unwrap().history.entries(); + assert_eq!(entries.len(), before + 1, "one history step"); + assert_eq!(entries.last().map(String::as_str), Some("Embed All Linked")); + assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "nothing left to embed"); + + s.execute("edit.undo", json!({})).unwrap(); + assert!(is_linked(&s, ids[0]) && is_linked(&s, ids[1]) && !is_linked(&s, ids[2])); + assert_eq!(s.active().unwrap().history.entries().len(), before); + std::fs::remove_dir_all(&dir).ok(); +} + +#[test] +fn embed_all_linked_with_no_linked_object_is_an_error_not_a_panic() { + let mut s = Session::new(); + assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "no document"); + assert!(s.execute("layer.smartObjects.embedAllLinked", json!({})).is_err()); + s.execute("file.new", json!({"width": 16, "height": 16})).unwrap(); + painted_layer(&mut s); + s.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap(); + assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "only embedded objects"); + let before = s.active().unwrap().history.entries().len(); + assert!(s.execute("layer.smartObjects.embedAllLinked", json!({})).is_err()); + assert_eq!(s.active().unwrap().history.entries().len(), before); +} + +#[test] +fn embed_all_linked_refuses_the_whole_step_when_a_linked_file_is_missing() { + let dir = temp_dir("missing"); + let (mut s, ids) = three(&dir); + std::fs::remove_file(dir.join("linked1.pcraft")).unwrap(); + let before = s.active().unwrap().history.entries().len(); + let err = s.execute("layer.smartObjects.embedAllLinked", json!({})).unwrap_err().to_string(); + assert!(err.contains("linked1.pcraft"), "the error names the missing file: {err}"); + assert!(is_linked(&s, ids[0]) && is_linked(&s, ids[1]), "nothing was embedded"); + assert_eq!(s.active().unwrap().history.entries().len(), before); + std::fs::remove_dir_all(&dir).ok(); +} + +#[test] +fn embed_linked_still_embeds_one_object_under_its_old_id() { + let dir = temp_dir("one"); + let (mut s, ids) = three(&dir); + s.execute("layer.smartObjects.convertToEmbedded", json!({"layer": ids[0]})).unwrap(); + assert!(!is_linked(&s, ids[0]) && is_linked(&s, ids[1])); + std::fs::remove_dir_all(&dir).ok(); +} diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs index 9d34baa7e9..43e430d251 100644 --- a/crates/engine/src/lib.rs +++ b/crates/engine/src/lib.rs @@ -315,6 +315,8 @@ pub struct Session { pub damage_misses: usize, } +#[cfg(test)] +mod embed_all_linked_tests; #[cfg(test)] mod fill_layer_mode_tests; #[cfg(test)] diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsv index 0c67a91ec6..a124891102 100644 --- a/crates/ui-egui/src/i18n/ar.tsv +++ b/crates/ui-egui/src/i18n/ar.tsv @@ -141,6 +141,7 @@ Create Smart Object after Loading Layers إنشاء كائن ذكي بعد تحميل الطبقات Reveal in Finder إظهار في Finder Show in Explorer إظهار في Explorer + Reveal in Explorer إظهار في Explorer Show in Folder إظهار في المجلد File Info… معلومات الملف… Print… طباعة… @@ -386,6 +387,7 @@ Smart Object كائن ذكي Convert to Smart Object تحويل إلى كائن ذكي Convert to Embedded تحويل إلى مضمّن + Embed Linked تحويل إلى مضمّن Convert to Layers تحويل إلى طبقات Convert to Linked… تحويل إلى مرتبط… Edit Contents تحرير المحتويات diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index fe4dc1393b..473d1091ad 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -123,6 +123,7 @@ Create Smart Object after Loading Layers Kreiraj pametni objekat nakon učitavanja slojeva Reveal in Finder Prikaži u Finderu Show in Explorer Prikaži u Exploreru + Reveal in Explorer Prikaži u Exploreru Show in Folder Prikaži u folderu File Info… Informacije o datoteci… Print… Štampaj… @@ -355,6 +356,7 @@ Smart Object Pametni objekat Convert to Smart Object Pretvori u pametni objekat Convert to Embedded Pretvori u ugrađeno + Embed Linked Pretvori u ugrađeno Convert to Layers Pretvori u slojeve Convert to Linked… Pretvori u povezano… Edit Contents Uredi sadržaj diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index 40fc3691de..e9fd5a3c82 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -262,6 +262,7 @@ Create Smart Object after Loading Layers Po načtení vrstev vytvořit chytrý objekt Reveal in Finder Zobrazit ve Finderu Show in Explorer Zobrazit v Průzkumníkovi + Reveal in Explorer Zobrazit v Průzkumníkovi Show in Folder Zobrazit ve složce File Info… Informace o souboru… Print… Tisk… @@ -507,6 +508,7 @@ Smart Object Chytrý objekt Convert to Smart Object Převést na chytrý objekt Convert to Embedded Převést na vložený + Embed Linked Převést na vložený Convert to Layers Převést na vrstvy Convert to Linked… Převést na propojený… Edit Contents Upravit obsah diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index 46e71ed2cf..fe4d8cef34 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1742,6 +1742,7 @@ Saved Gemt Reveal in Finder Vis i Finder Show in Explorer Vis i Stifinder + Reveal in Explorer Vis i Stifinder Show in Folder Vis i mappe Before (Y) Før (Y) Save Settings… Gem indstillinger… @@ -1921,6 +1922,7 @@ Combine Shapes Kombinér former Contract… Formindsk… Convert to Embedded Konvertér til indlejret + Embed Linked Konvertér til indlejret Convert to Layers Konvertér til lag Convert to Linked… Konvertér til sammenkædet… Count Optælling diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index 280558ff25..ffef6c0596 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -233,6 +233,7 @@ Create Smart Object after Loading Layers Nach dem Laden der Ebenen Smart-Objekt erstellen Reveal in Finder Im Finder anzeigen Show in Explorer Im Explorer anzeigen + Reveal in Explorer Im Explorer anzeigen Show in Folder Im Ordner anzeigen File Info… Dateiinformationen… Print… Drucken… @@ -478,6 +479,7 @@ Smart Object Smart-Objekt Convert to Smart Object In Smart-Objekt konvertieren Convert to Embedded In eingebettetes Smart-Objekt konvertieren + Embed Linked In eingebettetes Smart-Objekt konvertieren Convert to Layers In Ebenen konvertieren Convert to Linked… In verknüpftes Smart-Objekt konvertieren… Edit Contents Inhalt bearbeiten diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index cf1acf1474..60b4418a8e 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -203,6 +203,7 @@ Create Smart Object after Loading Layers Δημιουργία έξυπνου αντικειμένου μετά τη φόρτωση επιπέδων Reveal in Finder Εμφάνιση στο Finder Show in Explorer Εμφάνιση στην Εξερεύνηση αρχείων + Reveal in Explorer Εμφάνιση στην Εξερεύνηση αρχείων Show in Folder Εμφάνιση στον φάκελο File Info… Πληροφορίες αρχείου… Print… Εκτύπωση… @@ -1951,6 +1952,7 @@ Hide Selection Απόκρυψη επιλογής From Transparency Από διαφάνεια Convert to Embedded Μετατροπή σε ενσωματωμένο + Embed Linked Μετατροπή σε ενσωματωμένο Convert to Linked… Μετατροπή σε συνδεδεμένο… Edit Contents Επεξεργασία περιεχομένου Replace Contents… Αντικατάσταση περιεχομένου… diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index 186e679e30..db9ac13b90 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -199,6 +199,7 @@ Create Smart Object after Loading Layers Crear objeto inteligente tras cargar las capas Reveal in Finder Mostrar en Finder Show in Explorer Mostrar en el Explorador + Reveal in Explorer Mostrar en el Explorador Show in Folder Mostrar en la carpeta File Info… Información del archivo… Print… Imprimir… @@ -444,6 +445,7 @@ Smart Object Objeto inteligente Convert to Smart Object Convertir en objeto inteligente Convert to Embedded Convertir en incrustado + Embed Linked Convertir en incrustado Convert to Layers Convertir en capas Convert to Linked… Convertir en vinculado… Edit Contents Editar contenido diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index b08a224b27..b850bfc416 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1743,6 +1743,7 @@ Saved Tallennettu Reveal in Finder Näytä Finderissa Show in Explorer Näytä Resurssienhallinnassa + Reveal in Explorer Näytä Resurssienhallinnassa Show in Folder Näytä kansiossa Before (Y) Ennen (Y) Save Settings… Tallenna asetukset… @@ -1922,6 +1923,7 @@ Combine Shapes Yhdistä muodot Contract… Supista… Convert to Embedded Muunna upotetuksi + Embed Linked Muunna upotetuksi Convert to Layers Muunna tasoiksi Convert to Linked… Muunna linkitetyksi… Count Laskuri diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 7eaaf6b3cf..5d54a01dc9 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -231,6 +231,7 @@ Create Smart Object after Loading Layers Créer un objet intelligent après le chargement des calques Reveal in Finder Afficher dans le Finder Show in Explorer Afficher dans l'Explorateur + Reveal in Explorer Afficher dans l'Explorateur Show in Folder Afficher dans le dossier File Info… Informations sur le fichier… Print… Imprimer… @@ -466,6 +467,7 @@ Smart Object Objet intelligent Convert to Smart Object Convertir en objet intelligent Convert to Embedded Convertir en objet incorporé + Embed Linked Convertir en objet incorporé Convert to Layers Convertir en calques Convert to Linked… Convertir en objet lié… Edit Contents Modifier le contenu diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index f830df374e..710c2d1853 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -342,6 +342,7 @@ Combine Shapes Alakzatok kombinálása Contract… Szűkítés… Convert to Embedded Átalakítás beágyazottá + Embed Linked Átalakítás beágyazottá Convert to Layers Átalakítás rétegekké Convert to Linked… Átalakítás csatolttá… Convert to Smart Object Átalakítás intelligens objektummá @@ -854,6 +855,7 @@ Show All Összes megjelenítése Show Extras Options… Segédelemek beállításai… Show in Explorer Megjelenítés az Intézőben + Reveal in Explorer Megjelenítés az Intézőben Show in Folder Megjelenítés mappában Show menu colors Menüszínek megjelenítése Show/Hide All Panels Összes panel megjelenítése/elrejtése diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index 75c3f972c9..cf6b237912 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -224,6 +224,7 @@ Create Smart Object after Loading Layers Buat Smart Object setelah Memuat Layer Reveal in Finder Tampilkan di Finder Show in Explorer Tampilkan di Explorer + Reveal in Explorer Tampilkan di Explorer Show in Folder Tampilkan di Folder File Info… Info Berkas… Print… Cetak… @@ -459,6 +460,7 @@ Smart Object Smart Object Convert to Smart Object Konversi ke Smart Object Convert to Embedded Konversi ke Tertanam + Embed Linked Konversi ke Tertanam Convert to Layers Konversi ke Layer Convert to Linked… Konversi ke Tertaut… Edit Contents Edit Isi diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 931fd6240f..07584bbb16 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -245,6 +245,7 @@ Create Smart Object after Loading Layers Crea oggetto avanzato dopo il caricamento dei livelli Reveal in Finder Mostra nel Finder Show in Explorer Mostra in Esplora file + Reveal in Explorer Mostra in Esplora file Show in Folder Mostra nella cartella File Info… Info file… Print… Stampa… @@ -490,6 +491,7 @@ Smart Object Oggetto avanzato Convert to Smart Object Converti in oggetto avanzato Convert to Embedded Converti in incorporato + Embed Linked Converti in incorporato Convert to Linked… Converti in oggetto collegato… Edit Contents Modifica contenuto Replace Contents… Sostituisci contenuto… diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 8849d49db7..38a06b9a91 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -255,6 +255,7 @@ Create Smart Object after Loading Layers レイヤーの読み込み後にスマートオブジェクトを作成 Reveal in Finder Finder で表示 Show in Explorer エクスプローラーで表示 + Reveal in Explorer エクスプローラーで表示 Show in Folder フォルダーで表示 File Info… ファイル情報… Print… プリント… @@ -499,6 +500,7 @@ Smart Object スマートオブジェクト Convert to Smart Object スマートオブジェクトに変換 Convert to Embedded 埋め込みに変換 + Embed Linked 埋め込みに変換 Convert to Layers レイヤーに変換 Convert to Linked… リンクに変換… Edit Contents コンテンツを編集 diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index 83c9790573..db4dcde109 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -226,6 +226,7 @@ Create Smart Object after Loading Layers 레이어를 불러온 후 스마트 오브젝트 만들기 Reveal in Finder Finder에서 보기 Show in Explorer 파일 탐색기에서 보기 + Reveal in Explorer 파일 탐색기에서 보기 Show in Folder 폴더에서 보기 File Info… 파일 정보… Print… 인쇄… @@ -464,6 +465,7 @@ Smart Object 스마트 오브젝트 Convert to Smart Object 스마트 오브젝트로 변환 Convert to Embedded 포함된 오브젝트로 변환 + Embed Linked 포함된 오브젝트로 변환 Convert to Layers 레이어로 변환 Convert to Linked… 연결된 오브젝트로 변환… Edit Contents 내용 편집 diff --git a/crates/ui-egui/src/i18n/nb.tsv b/crates/ui-egui/src/i18n/nb.tsv index d7232004b6..534cd67f91 100644 --- a/crates/ui-egui/src/i18n/nb.tsv +++ b/crates/ui-egui/src/i18n/nb.tsv @@ -1742,6 +1742,7 @@ Saved Lagret Reveal in Finder Vis i Finder Show in Explorer Vis i Utforsker + Reveal in Explorer Vis i Utforsker Show in Folder Vis i mappe Before (Y) Før (Y) Save Settings… Lagre innstillinger… @@ -1921,6 +1922,7 @@ Combine Shapes Kombiner former Contract… Trekk sammen… Convert to Embedded Konverter til innebygd + Embed Linked Konverter til innebygd Convert to Layers Konverter til lag Convert to Linked… Konverter til koblet… Count Telling diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 0ad0a96291..4878ad503d 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -187,6 +187,7 @@ Create Smart Object after Loading Layers Slim object maken na laden van lagen Reveal in Finder Weergeven in Finder Show in Explorer Weergeven in Verkenner + Reveal in Explorer Weergeven in Verkenner Show in Folder Weergeven in map File Info… Bestandsinformatie… Print… Afdrukken… @@ -431,6 +432,7 @@ Smart Object Slim object Convert to Smart Object Omzetten naar slim object Convert to Embedded Omzetten naar ingesloten + Embed Linked Omzetten naar ingesloten Convert to Layers Omzetten naar lagen Convert to Linked… Omzetten naar gekoppeld… Edit Contents Inhoud bewerken diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 1a86582093..527017252a 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -231,6 +231,7 @@ Create Smart Object after Loading Layers Utwórz obiekt inteligentny po wczytaniu warstw Reveal in Finder Pokaż w Finderze Show in Explorer Pokaż w Eksploratorze + Reveal in Explorer Pokaż w Eksploratorze Show in Folder Pokaż w folderze File Info… Informacje o pliku… Print… Drukuj… @@ -474,6 +475,7 @@ Smart Object Obiekt inteligentny Convert to Smart Object Konwertuj na obiekt inteligentny Convert to Embedded Konwertuj na osadzony + Embed Linked Konwertuj na osadzony Convert to Layers Konwertuj na warstwy Convert to Linked… Konwertuj na połączony… Edit Contents Edytuj zawartość diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index afe96a6cc9..722fbc1fa9 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -227,6 +227,7 @@ Create Smart Object after Loading Layers Criar objeto inteligente após carregar as camadas Reveal in Finder Mostrar no Finder Show in Explorer Mostrar no Explorador + Reveal in Explorer Mostrar no Explorador Show in Folder Mostrar na pasta File Info… Informações do arquivo… Print… Imprimir… @@ -462,6 +463,7 @@ Smart Object Objeto inteligente Convert to Smart Object Converter em objeto inteligente Convert to Embedded Converter em incorporado + Embed Linked Converter em incorporado Convert to Layers Converter em camadas Convert to Linked… Converter em vinculado… Edit Contents Editar conteúdo diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index 226b0c51d0..e96cffcad0 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -1853,6 +1853,7 @@ Saved Сохранено Reveal in Finder Показать в Finder Show in Explorer Показать в Проводнике + Reveal in Explorer Показать в Проводнике Show in Folder Показать в папке Before (Y) До (Y) Save Settings… Сохранить настройки… @@ -2018,6 +2019,7 @@ Combine Shapes Комбинировать фигуры Contract… Сжать… Convert to Embedded Преобразовать во встроенный + Embed Linked Преобразовать во встроенный Convert to Layers Преобразовать в слои Convert to Linked… Преобразовать в связанный… Count Счёт diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index 2dc6bc9020..7051756499 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -255,6 +255,7 @@ Create Smart Object after Loading Layers Napravi pametni objekat posle učitavanja slojeva Reveal in Finder Prikaži u Finderu Show in Explorer Prikaži u Exploreru + Reveal in Explorer Prikaži u Exploreru Show in Folder Prikaži u fascikli File Info… Informacije o datoteci… Print… Štampaj… @@ -487,6 +488,7 @@ Smart Object Pametni objekat Convert to Smart Object Pretvori u pametni objekat Convert to Embedded Pretvori u ugrađeni + Embed Linked Pretvori u ugrađeni Convert to Layers Pretvori u slojeve Convert to Linked… Pretvori u povezani… Edit Contents Uredi sadržaj diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index b9c3721765..5e437c096a 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -1740,6 +1740,7 @@ Saved Sparat Reveal in Finder Visa i Finder Show in Explorer Visa i Utforskaren + Reveal in Explorer Visa i Utforskaren Show in Folder Visa i mapp Before (Y) Före (Y) Save Settings… Spara inställningar… @@ -1919,6 +1920,7 @@ Combine Shapes Kombinera former Contract… Dra ihop… Convert to Embedded Konvertera till inbäddat + Embed Linked Konvertera till inbäddat Convert to Layers Konvertera till lager Convert to Linked… Konvertera till länkat… Count Antal diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index c209cee829..86f5deb061 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -154,6 +154,7 @@ Create Smart Object after Loading Layers Katmanları Yükledikten Sonra Akıllı Nesne Oluştur Reveal in Finder Finder'da Göster Show in Explorer Explorer'da Göster + Reveal in Explorer Explorer'da Göster Show in Folder Klasörde Göster File Info… Dosya Bilgileri… Print… Yazdır… @@ -397,6 +398,7 @@ Smart Object Akıllı Nesne Convert to Smart Object Akıllı Nesneye Dönüştür Convert to Embedded Gömülüye Dönüştür + Embed Linked Gömülüye Dönüştür Convert to Layers Katmanlara Dönüştür Convert to Linked… Bağlantılıya Dönüştür… Edit Contents İçeriği Düzenle diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index eaacf70553..0c1a1cc1bd 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -1822,6 +1822,7 @@ Saved Збережено Reveal in Finder Показати у Finder Show in Explorer Показати у Провіднику + Reveal in Explorer Показати у Провіднику Show in Folder Показати в теці Before (Y) До (Y) Save Settings… Зберегти налаштування… @@ -1985,6 +1986,7 @@ Combine Shapes Об'єднати фігури Contract… Стиснути… Convert to Embedded Перетворити на вбудований + Embed Linked Перетворити на вбудований Convert to Layers Перетворити на шари Convert to Linked… Перетворити на пов'язаний… Count Підрахунок diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index 863a17ede7..a0f29f1b8c 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -373,6 +373,7 @@ Color Table… Bảng màu… Combine Shapes Kết hợp hình Convert to Embedded Chuyển thành nhúng + Embed Linked Chuyển thành nhúng Convert to Layers Chuyển thành lớp Convert to Linked… Chuyển thành liên kết… Convert to Smart Object Chuyển thành đối tượng thông minh @@ -2614,6 +2615,7 @@ shape Appearance Diện mạo (coming soon) (sắp có) Add beauty precomp from the AOVs Thêm precomp beauty từ các AOV Show in Explorer Hiện trong Explorer + Reveal in Explorer Hiện trong Explorer Show in Folder Hiện trong thư mục Delete and Fill Selection Xoá và tô vùng chọn Transform Again on a Copy Biến đổi lại trên một bản sao diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 9f4388d63c..5f1b968c37 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -234,6 +234,7 @@ Create Smart Object after Loading Layers 载入图层后创建智能对象 Reveal in Finder 在 Finder 中显示 Show in Explorer 在文件资源管理器中显示 + Reveal in Explorer 在文件资源管理器中显示 Show in Folder 在文件夹中显示 File Info… 文件信息… Print… 打印… @@ -482,6 +483,7 @@ Smart Object 智能对象 Convert to Smart Object 转换为智能对象 Convert to Embedded 转换为嵌入对象 + Embed Linked 转换为嵌入对象 Convert to Layers 转换为图层 Convert to Linked… 转换为链接对象… Edit Contents 编辑内容 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 8a303bdb68..5051d416ec 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -236,6 +236,7 @@ Create Smart Object after Loading Layers 載入圖層後建立智慧型物件 Reveal in Finder 在 Finder 中顯示 Show in Explorer 在檔案總管中顯示 + Reveal in Explorer 在檔案總管中顯示 Show in Folder 在資料夾中顯示 File Info… 檔案資訊… Print… 列印… @@ -481,6 +482,7 @@ Smart Object 智慧型物件 Convert to Smart Object 轉換為智慧型物件 Convert to Embedded 轉換為嵌入 + Embed Linked 轉換為嵌入 Convert to Layers 轉換為圖層 Convert to Linked… 轉換為連結… Edit Contents 編輯內容 diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 569f40841b..a30be3981e 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -787,6 +787,8 @@ mod live_retouch_tests; #[cfg(test)] mod pencil_tests; #[cfg(test)] +mod smart_objects_menu_tests; +#[cfg(test)] mod tool_options_theme_tests; #[cfg(test)] mod tool_shortcut_tests; diff --git a/crates/ui-egui/src/menu_catalog.rs b/crates/ui-egui/src/menu_catalog.rs index 328fe24fc5..06b44eb424 100644 --- a/crates/ui-egui/src/menu_catalog.rs +++ b/crates/ui-egui/src/menu_catalog.rs @@ -350,8 +350,9 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[ (&["Layer", "Smart Objects"], "Replace Contents…", None, "layer.smartObjects.replaceContents"), (&["Layer", "Smart Objects"], "Export Contents…", None, "layer.smartObjects.exportContents"), (&["Layer", "Smart Objects"], "---", None, "---"), + (&["Layer", "Smart Objects"], "Embed Linked", None, "layer.smartObjects.convertToEmbedded"), + (&["Layer", "Smart Objects"], "Embed All Linked", None, "layer.smartObjects.embedAllLinked"), (&["Layer", "Smart Objects"], "Convert to Linked…", None, "layer.smartObjects.convertToLinked"), - (&["Layer", "Smart Objects"], "Convert to Embedded", None, "layer.smartObjects.convertToEmbedded"), (&["Layer", "Smart Objects"], "Convert to Layers", None, "layer.smartObjects.convertToLayers"), (&["Layer", "Smart Objects"], "---", None, "---"), (&["Layer", "Smart Objects", "Stack Mode"], "Entropy", None, "layer.smartObjects.stackMode.entropy"), @@ -367,10 +368,6 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[ (&["Layer", "Smart Objects", "Stack Mode"], "Variance", None, "layer.smartObjects.stackMode.variance"), (&["Layer", "Smart Objects"], "---", None, "---"), (&["Layer", "Smart Objects"], "Rasterize", None, "layer.smartObjects.rasterize"), - (&["Layer", "Smart Objects"], "---", None, "---"), - (&["Layer", "Smart Objects"], "Warp", None, "layer.smartObjects.warp"), - (&["Layer", "Smart Objects"], "Perspective Warp", None, "layer.smartObjects.perspectiveWarp"), - (&["Layer", "Smart Objects"], "Puppet Warp", None, "layer.smartObjects.puppetWarp"), (&["Layer", "Video Layers"], "New Blank Video Layer", None, "layer.videoLayers.newBlankVideoLayer"), (&["Layer", "Video Layers"], "New Video Layer from File…", None, "layer.videoLayers.newVideoLayerFromFile"), (&["Layer", "Video Layers"], "---", None, "---"), diff --git a/crates/ui-egui/src/menus.rs b/crates/ui-egui/src/menus.rs index 01195598c0..95a57d9588 100644 --- a/crates/ui-egui/src/menus.rs +++ b/crates/ui-egui/src/menus.rs @@ -203,7 +203,7 @@ mod reveal_label_tests { let expected = if cfg!(target_os = "macos") { "Reveal in Finder" } else if cfg!(windows) { - "Show in Explorer" + "Reveal in Explorer" } else { "Show in Folder" }; diff --git a/crates/ui-egui/src/menus/parity.rs b/crates/ui-egui/src/menus/parity.rs index a185b3576e..520aca1181 100644 --- a/crates/ui-egui/src/menus/parity.rs +++ b/crates/ui-egui/src/menus/parity.rs @@ -7,7 +7,7 @@ use crate::menu_catalog::CATALOG; use crate::menus::is_live; /// Minimum number of live catalog items. Raise it when parity grows; never lower it. -pub const FLOOR: usize = 660; +pub const FLOOR: usize = 658; /// One top-level menu's coverage. #[derive(Clone, Debug, serde::Serialize)] diff --git a/crates/ui-egui/src/menus/state.rs b/crates/ui-egui/src/menus/state.rs index c932ca092c..924a6ed7ee 100644 --- a/crates/ui-egui/src/menus/state.rs +++ b/crates/ui-egui/src/menus/state.rs @@ -211,7 +211,7 @@ pub(crate) fn reveal_label() -> &'static str { if cfg!(target_os = "macos") { "Reveal in Finder" } else if cfg!(windows) { - "Show in Explorer" + "Reveal in Explorer" } else { "Show in Folder" } diff --git a/crates/ui-egui/src/smart_objects_menu_tests.rs b/crates/ui-egui/src/smart_objects_menu_tests.rs new file mode 100644 index 0000000000..dd6d7947a6 --- /dev/null +++ b/crates/ui-egui/src/smart_objects_menu_tests.rs @@ -0,0 +1,103 @@ +//! Layer > Smart Objects menu rows, labels and order (#11401). + +use serde_json::json; + +use crate::PhotocraftApp; +use crate::menus::{MenuItem, menu_items}; + +fn app() -> PhotocraftApp { + PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()) +} + +fn submenu(app: &PhotocraftApp) -> Vec { + menu_items(app).into_iter().filter(|i| i.path == ["Layer", "Smart Objects"]).collect() +} + +fn reveal() -> &'static str { + if cfg!(target_os = "macos") { + "Reveal in Finder" + } else if cfg!(windows) { + "Reveal in Explorer" + } else { + "Show in Folder" + } +} + +#[test] +fn the_rows_follow_the_reference_order() { + let labels: Vec = submenu(&app()).into_iter().map(|i| i.label).collect(); + let expected = [ + "Convert to Smart Object", + "New Smart Object via Copy", + "---", + reveal(), + "---", + "Update Modified Content", + "Update All Modified Content", + "---", + "Edit Contents", + "Relink to File…", + "Replace Contents…", + "Export Contents…", + "---", + "Embed Linked", + "Embed All Linked", + "Convert to Linked…", + "Convert to Layers", + "---", + "---", + "Rasterize", + ]; + assert_eq!(labels, expected, "{labels:?}"); +} + +#[test] +fn embed_rows_use_the_new_labels_and_the_ids_stay() { + let items = submenu(&app()); + let by_id = |id: &str| items.iter().find(|i| i.id == id).unwrap_or_else(|| panic!("{id} missing")); + assert_eq!(by_id("layer.smartObjects.convertToEmbedded").label, "Embed Linked"); + assert_eq!(by_id("layer.smartObjects.embedAllLinked").label, "Embed All Linked"); + assert_eq!(by_id("layer.smartObjects.revealInFinder").label, reveal()); +} + +#[cfg(windows)] +#[test] +fn windows_says_reveal_in_explorer() { + assert_eq!(crate::menus::reveal_label(), "Reveal in Explorer"); +} + +#[test] +fn the_warp_rows_are_gone_from_the_submenu_but_the_commands_stay() { + let app = app(); + for id in ["layer.smartObjects.warp", "layer.smartObjects.perspectiveWarp", "layer.smartObjects.puppetWarp"] { + assert!(!submenu(&app).iter().any(|i| i.id == id), "{id}"); + assert!(photocraft_engine::cmd::command_specs().iter().any(|c| c.id == id), "{id} stays registered"); + } + let all = menu_items(&app); + for id in ["edit.puppetWarp", "edit.perspectiveWarp", "edit.transform.warp"] { + assert!(all.iter().any(|i| i.id == id), "{id} stays in the Edit menu"); + } +} + +#[test] +fn embed_all_linked_is_disabled_without_a_linked_smart_object_and_enabled_with_one() { + let mut app = app(); + app.run("file.new", json!({"width": 32, "height": 24})).unwrap(); + app.run("layer.new.layer", json!({})).unwrap(); + app.session + .edit("setup", |doc, active| { + doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap().fill_rect(photocraft_geom::Rect::new(2, 2, 10, 10), &[1.0, 0.0, 0.0, 1.0]); + Ok(()) + }) + .unwrap(); + app.run("layer.smartObjects.convertToSmartObject", json!({})).unwrap(); + app.sync_views(); + let enabled = |app: &PhotocraftApp, id: &str| submenu(app).iter().find(|i| i.id == id).unwrap().enabled; + assert!(!enabled(&app, "layer.smartObjects.embedAllLinked")); + let path = std::env::temp_dir().join(format!("pc-so-menu-{}.pcraft", std::process::id())); + app.run("layer.smartObjects.convertToLinked", json!({"path": path.to_str().unwrap()})).unwrap(); + app.sync_views(); + assert!(enabled(&app, "layer.smartObjects.embedAllLinked")); + assert!(enabled(&app, "layer.smartObjects.convertToEmbedded")); + std::fs::remove_file(&path).ok(); +} diff --git a/docs/parity-checklist.md b/docs/parity-checklist.md index ccc77e95bc..a8899fdc2c 100644 --- a/docs/parity-checklist.md +++ b/docs/parity-checklist.md @@ -2,14 +2,14 @@ Generated by `cargo xtask parity` from `crates/ui-egui/src/menu_catalog.rs` (Photoshop's menu tree) and the live command registry. Do not edit by hand. -**660 of 660 menu items live (100.0%).** +**658 of 658 menu items live (100.0%).** | Menu | Live | Total | % | |---|---:|---:|---:| | File | 52 | 52 | 100% | | Edit | 75 | 75 | 100% | | Image | 61 | 61 | 100% | -| Layer | 163 | 163 | 100% | +| Layer | 161 | 161 | 100% | | Type | 74 | 74 | 100% | | Select | 25 | 25 | 100% | | Filter | 75 | 75 | 100% | From c9714b36af12aa216ee75166a6e5cfed1cc56e60 Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 5 Nov 2026 12:28:08 -0500 Subject: [PATCH 2/3] Smart Objects menu: Embed Linked and Embed All Linked in every catalog (#11401) Adds an Embed All Linked row to all 27 translation catalogues and re-drafts Embed Linked where the copied Convert to Embedded text still said convert. Reveal in Explorer is unchanged. Co-Authored-By: Claude Fable 5.1 --- crates/ui-egui/src/i18n/ar.tsv | 3 ++- crates/ui-egui/src/i18n/bs.tsv | 3 ++- crates/ui-egui/src/i18n/cs.tsv | 3 ++- crates/ui-egui/src/i18n/da.tsv | 3 ++- crates/ui-egui/src/i18n/de.tsv | 3 ++- crates/ui-egui/src/i18n/el.tsv | 3 ++- crates/ui-egui/src/i18n/es.tsv | 3 ++- crates/ui-egui/src/i18n/fi.tsv | 3 ++- crates/ui-egui/src/i18n/fr.tsv | 3 ++- crates/ui-egui/src/i18n/hi.tsv | 2 ++ crates/ui-egui/src/i18n/hu.tsv | 3 ++- crates/ui-egui/src/i18n/id.tsv | 3 ++- crates/ui-egui/src/i18n/it.tsv | 3 ++- crates/ui-egui/src/i18n/ja.tsv | 3 ++- crates/ui-egui/src/i18n/ko.tsv | 3 ++- crates/ui-egui/src/i18n/nb.tsv | 3 ++- crates/ui-egui/src/i18n/nl.tsv | 3 ++- crates/ui-egui/src/i18n/pl.tsv | 3 ++- crates/ui-egui/src/i18n/pt-br.tsv | 3 ++- crates/ui-egui/src/i18n/ru.tsv | 3 ++- crates/ui-egui/src/i18n/sr.tsv | 3 ++- crates/ui-egui/src/i18n/sv.tsv | 3 ++- crates/ui-egui/src/i18n/tr.tsv | 3 ++- crates/ui-egui/src/i18n/uk.tsv | 3 ++- crates/ui-egui/src/i18n/vi.tsv | 3 ++- crates/ui-egui/src/i18n/zh-hans.tsv | 3 ++- crates/ui-egui/src/i18n/zh-hant.tsv | 3 ++- 27 files changed, 54 insertions(+), 26 deletions(-) diff --git a/crates/ui-egui/src/i18n/ar.tsv b/crates/ui-egui/src/i18n/ar.tsv index a124891102..05c5cb7a47 100644 --- a/crates/ui-egui/src/i18n/ar.tsv +++ b/crates/ui-egui/src/i18n/ar.tsv @@ -387,7 +387,8 @@ Smart Object كائن ذكي Convert to Smart Object تحويل إلى كائن ذكي Convert to Embedded تحويل إلى مضمّن - Embed Linked تحويل إلى مضمّن + Embed Linked تضمين المرتبط + Embed All Linked تضمين كل المرتبط Convert to Layers تحويل إلى طبقات Convert to Linked… تحويل إلى مرتبط… Edit Contents تحرير المحتويات diff --git a/crates/ui-egui/src/i18n/bs.tsv b/crates/ui-egui/src/i18n/bs.tsv index 473d1091ad..28d820d677 100644 --- a/crates/ui-egui/src/i18n/bs.tsv +++ b/crates/ui-egui/src/i18n/bs.tsv @@ -356,7 +356,8 @@ Smart Object Pametni objekat Convert to Smart Object Pretvori u pametni objekat Convert to Embedded Pretvori u ugrađeno - Embed Linked Pretvori u ugrađeno + Embed Linked Ugradi povezano + Embed All Linked Ugradi sve povezano Convert to Layers Pretvori u slojeve Convert to Linked… Pretvori u povezano… Edit Contents Uredi sadržaj diff --git a/crates/ui-egui/src/i18n/cs.tsv b/crates/ui-egui/src/i18n/cs.tsv index e9fd5a3c82..0088a44c09 100644 --- a/crates/ui-egui/src/i18n/cs.tsv +++ b/crates/ui-egui/src/i18n/cs.tsv @@ -508,7 +508,8 @@ Smart Object Chytrý objekt Convert to Smart Object Převést na chytrý objekt Convert to Embedded Převést na vložený - Embed Linked Převést na vložený + Embed Linked Vložit propojené + Embed All Linked Vložit všechna propojená Convert to Layers Převést na vrstvy Convert to Linked… Převést na propojený… Edit Contents Upravit obsah diff --git a/crates/ui-egui/src/i18n/da.tsv b/crates/ui-egui/src/i18n/da.tsv index fe4d8cef34..65a3f7891c 100644 --- a/crates/ui-egui/src/i18n/da.tsv +++ b/crates/ui-egui/src/i18n/da.tsv @@ -1922,7 +1922,8 @@ Combine Shapes Kombinér former Contract… Formindsk… Convert to Embedded Konvertér til indlejret - Embed Linked Konvertér til indlejret + Embed Linked Indlejr sammenkædet + Embed All Linked Indlejr alle sammenkædede Convert to Layers Konvertér til lag Convert to Linked… Konvertér til sammenkædet… Count Optælling diff --git a/crates/ui-egui/src/i18n/de.tsv b/crates/ui-egui/src/i18n/de.tsv index ffef6c0596..3d1f4d79bb 100644 --- a/crates/ui-egui/src/i18n/de.tsv +++ b/crates/ui-egui/src/i18n/de.tsv @@ -479,7 +479,8 @@ Smart Object Smart-Objekt Convert to Smart Object In Smart-Objekt konvertieren Convert to Embedded In eingebettetes Smart-Objekt konvertieren - Embed Linked In eingebettetes Smart-Objekt konvertieren + Embed Linked Verknüpftes einbetten + Embed All Linked Alle verknüpften einbetten Convert to Layers In Ebenen konvertieren Convert to Linked… In verknüpftes Smart-Objekt konvertieren… Edit Contents Inhalt bearbeiten diff --git a/crates/ui-egui/src/i18n/el.tsv b/crates/ui-egui/src/i18n/el.tsv index 60b4418a8e..a801a7900d 100644 --- a/crates/ui-egui/src/i18n/el.tsv +++ b/crates/ui-egui/src/i18n/el.tsv @@ -1952,7 +1952,8 @@ Hide Selection Απόκρυψη επιλογής From Transparency Από διαφάνεια Convert to Embedded Μετατροπή σε ενσωματωμένο - Embed Linked Μετατροπή σε ενσωματωμένο + Embed Linked Ενσωμάτωση συνδεδεμένου + Embed All Linked Ενσωμάτωση όλων των συνδεδεμένων Convert to Linked… Μετατροπή σε συνδεδεμένο… Edit Contents Επεξεργασία περιεχομένου Replace Contents… Αντικατάσταση περιεχομένου… diff --git a/crates/ui-egui/src/i18n/es.tsv b/crates/ui-egui/src/i18n/es.tsv index db9ac13b90..4f18de44ce 100644 --- a/crates/ui-egui/src/i18n/es.tsv +++ b/crates/ui-egui/src/i18n/es.tsv @@ -445,7 +445,8 @@ Smart Object Objeto inteligente Convert to Smart Object Convertir en objeto inteligente Convert to Embedded Convertir en incrustado - Embed Linked Convertir en incrustado + Embed Linked Incrustar vinculado + Embed All Linked Incrustar todos los vinculados Convert to Layers Convertir en capas Convert to Linked… Convertir en vinculado… Edit Contents Editar contenido diff --git a/crates/ui-egui/src/i18n/fi.tsv b/crates/ui-egui/src/i18n/fi.tsv index b850bfc416..7978d02b4d 100644 --- a/crates/ui-egui/src/i18n/fi.tsv +++ b/crates/ui-egui/src/i18n/fi.tsv @@ -1923,7 +1923,8 @@ Combine Shapes Yhdistä muodot Contract… Supista… Convert to Embedded Muunna upotetuksi - Embed Linked Muunna upotetuksi + Embed Linked Upota linkitetty + Embed All Linked Upota kaikki linkitetyt Convert to Layers Muunna tasoiksi Convert to Linked… Muunna linkitetyksi… Count Laskuri diff --git a/crates/ui-egui/src/i18n/fr.tsv b/crates/ui-egui/src/i18n/fr.tsv index 5d54a01dc9..e7815bd3e7 100644 --- a/crates/ui-egui/src/i18n/fr.tsv +++ b/crates/ui-egui/src/i18n/fr.tsv @@ -467,7 +467,8 @@ Smart Object Objet intelligent Convert to Smart Object Convertir en objet intelligent Convert to Embedded Convertir en objet incorporé - Embed Linked Convertir en objet incorporé + Embed Linked Incorporer le lié + Embed All Linked Incorporer tous les liés Convert to Layers Convertir en calques Convert to Linked… Convertir en objet lié… Edit Contents Modifier le contenu diff --git a/crates/ui-egui/src/i18n/hi.tsv b/crates/ui-egui/src/i18n/hi.tsv index 6274ae7272..b00bb191b1 100644 --- a/crates/ui-egui/src/i18n/hi.tsv +++ b/crates/ui-egui/src/i18n/hi.tsv @@ -628,3 +628,5 @@ cameraRaw Yellow पीला @plural {n} action file loaded|{n} action files loaded {n} एक्शन फ़ाइल लोड हुई|{n} एक्शन फ़ाइलें लोड हुईं {set} from {file} replaced the one from {earlier} {file} के सेट {set} ने {earlier} वाले सेट की जगह ले ली @plural {n} file could not be loaded: {errors}|{n} files could not be loaded: {errors} {n} फ़ाइल लोड नहीं हो सकी: {errors}|{n} फ़ाइलें लोड नहीं हो सकीं: {errors} + Embed Linked लिंक किए गए को एम्बेड करें + Embed All Linked सभी लिंक किए गए को एम्बेड करें diff --git a/crates/ui-egui/src/i18n/hu.tsv b/crates/ui-egui/src/i18n/hu.tsv index 710c2d1853..b7b78c013e 100644 --- a/crates/ui-egui/src/i18n/hu.tsv +++ b/crates/ui-egui/src/i18n/hu.tsv @@ -342,7 +342,8 @@ Combine Shapes Alakzatok kombinálása Contract… Szűkítés… Convert to Embedded Átalakítás beágyazottá - Embed Linked Átalakítás beágyazottá + Embed Linked Csatolt beágyazása + Embed All Linked Összes csatolt beágyazása Convert to Layers Átalakítás rétegekké Convert to Linked… Átalakítás csatolttá… Convert to Smart Object Átalakítás intelligens objektummá diff --git a/crates/ui-egui/src/i18n/id.tsv b/crates/ui-egui/src/i18n/id.tsv index cf6b237912..d9275f5015 100644 --- a/crates/ui-egui/src/i18n/id.tsv +++ b/crates/ui-egui/src/i18n/id.tsv @@ -460,7 +460,8 @@ Smart Object Smart Object Convert to Smart Object Konversi ke Smart Object Convert to Embedded Konversi ke Tertanam - Embed Linked Konversi ke Tertanam + Embed Linked Tanamkan yang Tertaut + Embed All Linked Tanamkan Semua yang Tertaut Convert to Layers Konversi ke Layer Convert to Linked… Konversi ke Tertaut… Edit Contents Edit Isi diff --git a/crates/ui-egui/src/i18n/it.tsv b/crates/ui-egui/src/i18n/it.tsv index 07584bbb16..959360a212 100644 --- a/crates/ui-egui/src/i18n/it.tsv +++ b/crates/ui-egui/src/i18n/it.tsv @@ -491,7 +491,8 @@ Smart Object Oggetto avanzato Convert to Smart Object Converti in oggetto avanzato Convert to Embedded Converti in incorporato - Embed Linked Converti in incorporato + Embed Linked Incorpora collegato + Embed All Linked Incorpora tutti i collegati Convert to Linked… Converti in oggetto collegato… Edit Contents Modifica contenuto Replace Contents… Sostituisci contenuto… diff --git a/crates/ui-egui/src/i18n/ja.tsv b/crates/ui-egui/src/i18n/ja.tsv index 38a06b9a91..2c92e7669d 100644 --- a/crates/ui-egui/src/i18n/ja.tsv +++ b/crates/ui-egui/src/i18n/ja.tsv @@ -500,7 +500,8 @@ Smart Object スマートオブジェクト Convert to Smart Object スマートオブジェクトに変換 Convert to Embedded 埋め込みに変換 - Embed Linked 埋め込みに変換 + Embed Linked リンクを埋め込む + Embed All Linked すべてのリンクを埋め込む Convert to Layers レイヤーに変換 Convert to Linked… リンクに変換… Edit Contents コンテンツを編集 diff --git a/crates/ui-egui/src/i18n/ko.tsv b/crates/ui-egui/src/i18n/ko.tsv index db4dcde109..ed5a3425fd 100644 --- a/crates/ui-egui/src/i18n/ko.tsv +++ b/crates/ui-egui/src/i18n/ko.tsv @@ -465,7 +465,8 @@ Smart Object 스마트 오브젝트 Convert to Smart Object 스마트 오브젝트로 변환 Convert to Embedded 포함된 오브젝트로 변환 - Embed Linked 포함된 오브젝트로 변환 + Embed Linked 연결된 항목 포함 + Embed All Linked 모든 연결된 항목 포함 Convert to Layers 레이어로 변환 Convert to Linked… 연결된 오브젝트로 변환… Edit Contents 내용 편집 diff --git a/crates/ui-egui/src/i18n/nb.tsv b/crates/ui-egui/src/i18n/nb.tsv index 534cd67f91..6adba3b748 100644 --- a/crates/ui-egui/src/i18n/nb.tsv +++ b/crates/ui-egui/src/i18n/nb.tsv @@ -1922,7 +1922,8 @@ Combine Shapes Kombiner former Contract… Trekk sammen… Convert to Embedded Konverter til innebygd - Embed Linked Konverter til innebygd + Embed Linked Bygg inn koblet + Embed All Linked Bygg inn alle koblede Convert to Layers Konverter til lag Convert to Linked… Konverter til koblet… Count Telling diff --git a/crates/ui-egui/src/i18n/nl.tsv b/crates/ui-egui/src/i18n/nl.tsv index 4878ad503d..34bce20cab 100644 --- a/crates/ui-egui/src/i18n/nl.tsv +++ b/crates/ui-egui/src/i18n/nl.tsv @@ -432,7 +432,8 @@ Smart Object Slim object Convert to Smart Object Omzetten naar slim object Convert to Embedded Omzetten naar ingesloten - Embed Linked Omzetten naar ingesloten + Embed Linked Gekoppeld insluiten + Embed All Linked Alles gekoppeld insluiten Convert to Layers Omzetten naar lagen Convert to Linked… Omzetten naar gekoppeld… Edit Contents Inhoud bewerken diff --git a/crates/ui-egui/src/i18n/pl.tsv b/crates/ui-egui/src/i18n/pl.tsv index 527017252a..c212fe5c43 100644 --- a/crates/ui-egui/src/i18n/pl.tsv +++ b/crates/ui-egui/src/i18n/pl.tsv @@ -475,7 +475,8 @@ Smart Object Obiekt inteligentny Convert to Smart Object Konwertuj na obiekt inteligentny Convert to Embedded Konwertuj na osadzony - Embed Linked Konwertuj na osadzony + Embed Linked Osadź połączony + Embed All Linked Osadź wszystkie połączone Convert to Layers Konwertuj na warstwy Convert to Linked… Konwertuj na połączony… Edit Contents Edytuj zawartość diff --git a/crates/ui-egui/src/i18n/pt-br.tsv b/crates/ui-egui/src/i18n/pt-br.tsv index 722fbc1fa9..e7aba2791e 100644 --- a/crates/ui-egui/src/i18n/pt-br.tsv +++ b/crates/ui-egui/src/i18n/pt-br.tsv @@ -463,7 +463,8 @@ Smart Object Objeto inteligente Convert to Smart Object Converter em objeto inteligente Convert to Embedded Converter em incorporado - Embed Linked Converter em incorporado + Embed Linked Incorporar vinculado + Embed All Linked Incorporar todos os vinculados Convert to Layers Converter em camadas Convert to Linked… Converter em vinculado… Edit Contents Editar conteúdo diff --git a/crates/ui-egui/src/i18n/ru.tsv b/crates/ui-egui/src/i18n/ru.tsv index e96cffcad0..7c2b4819f1 100644 --- a/crates/ui-egui/src/i18n/ru.tsv +++ b/crates/ui-egui/src/i18n/ru.tsv @@ -2019,7 +2019,8 @@ Combine Shapes Комбинировать фигуры Contract… Сжать… Convert to Embedded Преобразовать во встроенный - Embed Linked Преобразовать во встроенный + Embed Linked Встроить связанный + Embed All Linked Встроить все связанные Convert to Layers Преобразовать в слои Convert to Linked… Преобразовать в связанный… Count Счёт diff --git a/crates/ui-egui/src/i18n/sr.tsv b/crates/ui-egui/src/i18n/sr.tsv index 7051756499..bfc6be1660 100644 --- a/crates/ui-egui/src/i18n/sr.tsv +++ b/crates/ui-egui/src/i18n/sr.tsv @@ -488,7 +488,8 @@ Smart Object Pametni objekat Convert to Smart Object Pretvori u pametni objekat Convert to Embedded Pretvori u ugrađeni - Embed Linked Pretvori u ugrađeni + Embed Linked Ugradi povezani + Embed All Linked Ugradi sve povezane Convert to Layers Pretvori u slojeve Convert to Linked… Pretvori u povezani… Edit Contents Uredi sadržaj diff --git a/crates/ui-egui/src/i18n/sv.tsv b/crates/ui-egui/src/i18n/sv.tsv index 5e437c096a..c1878c4cc6 100644 --- a/crates/ui-egui/src/i18n/sv.tsv +++ b/crates/ui-egui/src/i18n/sv.tsv @@ -1920,7 +1920,8 @@ Combine Shapes Kombinera former Contract… Dra ihop… Convert to Embedded Konvertera till inbäddat - Embed Linked Konvertera till inbäddat + Embed Linked Bädda in länkat + Embed All Linked Bädda in alla länkade Convert to Layers Konvertera till lager Convert to Linked… Konvertera till länkat… Count Antal diff --git a/crates/ui-egui/src/i18n/tr.tsv b/crates/ui-egui/src/i18n/tr.tsv index 86f5deb061..36b46ec0e7 100644 --- a/crates/ui-egui/src/i18n/tr.tsv +++ b/crates/ui-egui/src/i18n/tr.tsv @@ -398,7 +398,8 @@ Smart Object Akıllı Nesne Convert to Smart Object Akıllı Nesneye Dönüştür Convert to Embedded Gömülüye Dönüştür - Embed Linked Gömülüye Dönüştür + Embed Linked Bağlantılıyı Göm + Embed All Linked Tüm Bağlantılıları Göm Convert to Layers Katmanlara Dönüştür Convert to Linked… Bağlantılıya Dönüştür… Edit Contents İçeriği Düzenle diff --git a/crates/ui-egui/src/i18n/uk.tsv b/crates/ui-egui/src/i18n/uk.tsv index 0c1a1cc1bd..10e982dedd 100644 --- a/crates/ui-egui/src/i18n/uk.tsv +++ b/crates/ui-egui/src/i18n/uk.tsv @@ -1986,7 +1986,8 @@ Combine Shapes Об'єднати фігури Contract… Стиснути… Convert to Embedded Перетворити на вбудований - Embed Linked Перетворити на вбудований + Embed Linked Вбудувати пов'язаний + Embed All Linked Вбудувати всі пов'язані Convert to Layers Перетворити на шари Convert to Linked… Перетворити на пов'язаний… Count Підрахунок diff --git a/crates/ui-egui/src/i18n/vi.tsv b/crates/ui-egui/src/i18n/vi.tsv index a0f29f1b8c..83390d5679 100644 --- a/crates/ui-egui/src/i18n/vi.tsv +++ b/crates/ui-egui/src/i18n/vi.tsv @@ -373,7 +373,8 @@ Color Table… Bảng màu… Combine Shapes Kết hợp hình Convert to Embedded Chuyển thành nhúng - Embed Linked Chuyển thành nhúng + Embed Linked Nhúng mục liên kết + Embed All Linked Nhúng tất cả mục liên kết Convert to Layers Chuyển thành lớp Convert to Linked… Chuyển thành liên kết… Convert to Smart Object Chuyển thành đối tượng thông minh diff --git a/crates/ui-egui/src/i18n/zh-hans.tsv b/crates/ui-egui/src/i18n/zh-hans.tsv index 5f1b968c37..0ffb032ecf 100644 --- a/crates/ui-egui/src/i18n/zh-hans.tsv +++ b/crates/ui-egui/src/i18n/zh-hans.tsv @@ -483,7 +483,8 @@ Smart Object 智能对象 Convert to Smart Object 转换为智能对象 Convert to Embedded 转换为嵌入对象 - Embed Linked 转换为嵌入对象 + Embed Linked 嵌入链接对象 + Embed All Linked 嵌入所有链接对象 Convert to Layers 转换为图层 Convert to Linked… 转换为链接对象… Edit Contents 编辑内容 diff --git a/crates/ui-egui/src/i18n/zh-hant.tsv b/crates/ui-egui/src/i18n/zh-hant.tsv index 5051d416ec..0522dabf5b 100644 --- a/crates/ui-egui/src/i18n/zh-hant.tsv +++ b/crates/ui-egui/src/i18n/zh-hant.tsv @@ -482,7 +482,8 @@ Smart Object 智慧型物件 Convert to Smart Object 轉換為智慧型物件 Convert to Embedded 轉換為嵌入 - Embed Linked 轉換為嵌入 + Embed Linked 嵌入連結 + Embed All Linked 嵌入所有連結 Convert to Layers 轉換為圖層 Convert to Linked… 轉換為連結… Edit Contents 編輯內容 From b9cf495f573672b72426f66c75a2d8ec44bf96fe Mon Sep 17 00:00:00 2001 From: Trevor Brown Date: Thu, 5 Nov 2026 14:00:46 -0500 Subject: [PATCH 3/3] Embed All Linked: tests check each object keeps its own linked file; regenerate the scorecard (#11401) The Embed All Linked test now gives every fixture a different fill and asserts each embedded source carries its own linked file name and bytes, and leaves the already embedded object alone. docs/scorecard.md is regenerated with cargo xtask scorecard after the parity checklist. Co-Authored-By: Claude Fable 5.1 --- crates/engine/src/embed_all_linked_tests.rs | 30 ++++++++++++++++++--- docs/scorecard.md | 4 +-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/crates/engine/src/embed_all_linked_tests.rs b/crates/engine/src/embed_all_linked_tests.rs index 1eda310490..70bed5c0c1 100644 --- a/crates/engine/src/embed_all_linked_tests.rs +++ b/crates/engine/src/embed_all_linked_tests.rs @@ -11,11 +11,11 @@ fn label(id: &str) -> &'static str { } /// Adds a layer with a few painted pixels (an empty layer can't become a smart object). -fn painted_layer(s: &mut Session) { +fn painted_layer(s: &mut Session, red: f32) { s.execute("layer.new.layer", json!({})).unwrap(); s.edit("setup", |doc, active| { let surf = doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap(); - surf.fill_rect(photocraft_geom::Rect::new(2, 2, 10, 10), &[1.0, 0.0, 0.0, 1.0]); + surf.fill_rect(photocraft_geom::Rect::new(2, 2, 10, 10), &[red, 1.0 - red, 0.0, 1.0]); Ok(()) }) .unwrap(); @@ -27,7 +27,7 @@ fn three(dir: &std::path::Path) -> (Session, [u64; 3]) { s.execute("file.new", json!({"width": 32, "height": 24})).unwrap(); let mut ids = [0u64; 3]; for (i, slot) in ids.iter_mut().enumerate() { - painted_layer(&mut s); + painted_layer(&mut s, 0.25 * (i + 1) as f32); *slot = s.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap()["layer"].as_u64().unwrap(); if i < 2 { let path = dir.join(format!("linked{i}.pcraft")); @@ -46,6 +46,19 @@ fn is_linked(s: &Session, id: u64) -> bool { } } +/// The file name and bytes an embedded smart object carries. +fn embedded(s: &Session, id: u64) -> (String, Vec) { + let doc = &s.active().unwrap().doc; + let layer = doc.walk().into_iter().map(|(_, _, l)| l).find(|l| l.id.0 == id).unwrap(); + match &layer.content { + LayerContent::Smart(sm) => match &sm.source { + SmartSource::Embedded { file_name, bytes } => (file_name.clone(), bytes.to_vec()), + SmartSource::Linked { .. } => panic!("still linked"), + }, + other => panic!("not smart: {}", other.kind_name()), + } +} + fn temp_dir(name: &str) -> std::path::PathBuf { let dir = std::env::temp_dir().join(format!("pc-embed-all-{name}-{}", std::process::id())); std::fs::remove_dir_all(&dir).ok(); @@ -70,10 +83,19 @@ fn embed_all_linked_embeds_both_linked_objects_in_one_undoable_step() { assert!(is_linked(&s, ids[0]) && is_linked(&s, ids[1]) && !is_linked(&s, ids[2])); assert!(s.is_enabled("layer.smartObjects.embedAllLinked")); let before = s.active().unwrap().history.entries().len(); + let files: Vec> = (0..2).map(|i| photocraft_format::read_file(&dir.join(format!("linked{i}.pcraft"))).unwrap()).collect(); + assert_ne!(files[0], files[1], "the fixtures differ"); + let third = embedded(&s, ids[2]); let r = s.execute("layer.smartObjects.embedAllLinked", json!({})).unwrap(); assert_eq!(r["embedded"], json!([ids[0], ids[1]])); assert!(ids.iter().all(|&id| !is_linked(&s, id))); + for (i, file) in files.iter().enumerate() { + let (name, bytes) = embedded(&s, ids[i]); + assert_eq!(name, format!("linked{i}.pcraft"), "object {i} keeps its own file name"); + assert_eq!(&bytes, file, "object {i} carries its own linked file's bytes"); + } + assert_eq!(embedded(&s, ids[2]), third, "the already embedded object is untouched"); let entries = s.active().unwrap().history.entries(); assert_eq!(entries.len(), before + 1, "one history step"); assert_eq!(entries.last().map(String::as_str), Some("Embed All Linked")); @@ -91,7 +113,7 @@ fn embed_all_linked_with_no_linked_object_is_an_error_not_a_panic() { assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "no document"); assert!(s.execute("layer.smartObjects.embedAllLinked", json!({})).is_err()); s.execute("file.new", json!({"width": 16, "height": 16})).unwrap(); - painted_layer(&mut s); + painted_layer(&mut s, 1.0); s.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap(); assert!(!s.is_enabled("layer.smartObjects.embedAllLinked"), "only embedded objects"); let before = s.active().unwrap().history.entries().len(); diff --git a/docs/scorecard.md b/docs/scorecard.md index c540f7b060..5727644e7c 100644 --- a/docs/scorecard.md +++ b/docs/scorecard.md @@ -11,7 +11,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js | [Tools](#tools) | 36 | 9 | 0 | | | [Workspace and UI](#workspace-and-ui) | 15 | 6 | 2 | settings that do nothing: 10 of 189 (target 0) | | [Type](#type) | 5 | 5 | 0 | | -| [Automation](#automation) | 5 | 3 | 3 | 660 of 660 menu items live (100.0%) | +| [Automation](#automation) | 5 | 3 | 3 | 658 of 658 menu items live (100.0%) | | [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 30 of 30 crates; panic_hunt present | | [Distribution](#distribution) | 5 | 5 | 1 | | | [Open bugs](#open-bugs) | 31 | 1 | 0 | | @@ -254,7 +254,7 @@ Unread: `general.color_picker`, `workspace.auto_show_hidden_panels`, `workspace. ## Automation -Menu wiring (`docs/parity-checklist.md`): 660 of 660 menu items live (100.0%). This counts dispatch, not behaviour. +Menu wiring (`docs/parity-checklist.md`): 658 of 658 menu items live (100.0%). This counts dispatch, not behaviour. | Id | Target | Status | Issue | Note | |---|---|---|---|---|