Duplicate Layer: the dialog title drops the menu item's ellipsis (#16349)

Layer › Duplicate Layer… opened a window titled "Duplicate Layer…"
("Duplicate Layers…" for several layers, "Duplicate Group…" on a
group). The titles now read without the ellipsis, as #15541 did for
Stroke and New Group; the shared title test covers the three cases.
This commit is contained in:
RickiNano committed 2026-11-21 23:46:51 +01:00
1 parent 0dfd74dd33
commit 76312b153b
2 files changed
+19 -5

No files matched your search

@@ -25,7 +25,7 @@ fn harness() -> Harness<'static, Box<PhotocraftApp>> {
#[test]
fn dialog_titles_drop_the_menu_ellipsis() {
let cases: [(&str, Open); 4] = [
let cases: [(&str, Open); 7] = [
("Stroke", |app| {
crate::stroke_ui::open(app);
}),
@@ -38,6 +38,19 @@ fn dialog_titles_drop_the_menu_ellipsis() {
("New Brush Preset", |app| {
crate::brush_preset_dialog::open(app, None);
}),
// Layer › Duplicate Layer… names its window after what is selected (#16349).
("Duplicate Layer", |app| {
crate::duplicate_layer_ui::open(app).unwrap();
}),
("Duplicate Layers", |app| {
app.run("layer.new.layer", json!({})).unwrap();
app.run("select.allLayers", json!({})).unwrap();
crate::duplicate_layer_ui::open(app).unwrap();
}),
("Duplicate Group", |app| {
app.run("layer.groupLayers", json!({})).unwrap();
crate::duplicate_layer_ui::open(app).unwrap();
}),
];
for (title, open) in cases {
let mut h = harness();
@@ -52,13 +52,14 @@ pub fn open(app: &mut PhotocraftApp) -> Result<DialogId, String> {
let selected = st.selected_layers();
let layer = st.active_layer.and_then(|id| st.doc.layer(id)).ok_or("no active layer")?;
let captured = json!({"document": st.doc.id.0, "selected": selected.iter().map(|id| id.0).collect::<Vec<_>>()});
// Several selected layers keep their names, as in Photoshop's Duplicate Layers.
// Several selected layers keep their names, as in Photoshop's Duplicate Layers. The window
// title is the menu item's name without its ellipsis (#16349).
let (title, name) = if selected.len() > 1 {
(tl!("Duplicate Layers…"), None)
(tl!("Duplicate Layers"), None)
} else if layer.is_group() {
(tl!("Duplicate Group…"), Some(st.doc.copy_name(&layer.name)))
(tl!("Duplicate Group"), Some(st.doc.copy_name(&layer.name)))
} else {
(tl!("Duplicate Layer…"), Some(st.doc.copy_name(&layer.name)))
(tl!("Duplicate Layer"), Some(st.doc.copy_name(&layer.name)))
};
let mut options: Vec<(String, Label)> = destinations(app).into_iter().map(|(key, name)| (key, Label::from(name))).collect();
options.push(("new".to_string(), Label::from(tl!("New"))));