From 15133858b314b61d33d3a74b167ca83e25ce0304 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 30 Nov 2026 04:48:09 +0100 Subject: [PATCH 1/4] Test that an empty Links list retires the chosen link --- crates/ui-egui/src/panels/properties/links.rs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/crates/ui-egui/src/panels/properties/links.rs b/crates/ui-egui/src/panels/properties/links.rs index 7874ec318..10cea392c 100644 --- a/crates/ui-egui/src/panels/properties/links.rs +++ b/crates/ui-egui/src/panels/properties/links.rs @@ -956,6 +956,29 @@ mod ui223_links_tests { assert_eq!(app.session.journal.last(), Some(&(command.to_owned(), payload))); } + #[test] + fn ui223_links_empty_list_drops_the_selected_link_before_undo_restores_it() { + let (app, items, assets) = graphics(); + let mut h = harness(app); + click(&mut h, "studio-b/photo.svg"); + assert!(!button(&h, "Go To").facts.as_ref().unwrap().disabled); + + let deleted = h.state_mut().run("edit.clear", json!({"ids": items})).unwrap(); + assert_eq!(deleted["deleted"], 3); + idle(&mut h, 3); + assert!(h.query_by_label("No placed graphics.").is_some()); + h.state_mut().run("edit.undo", json!({})).unwrap(); + idle(&mut h, 3); + assert!(h.query_by_label("studio-b/photo.svg").is_some(), "the same link has returned"); + assert!(h.query_by_label("Choose a link.").is_some(), "the empty list retired the old selection"); + assert!(h.query_by_label("Go To").is_none(), "restoring the links does not select one"); + + click(&mut h, "studio-b/photo.svg"); + let go = button(&h, "Go To"); + click_at(&mut h, go.rect); + assert_last_command(h.state(), "links.goTo", json!({"asset": assets[1].0})); + } + #[test] fn ui223_links_pointer_go_to_preserves_same_named_asset_identity() { let (app, items, assets) = graphics(); From 61a3a2bd177a32ec234e738fbab7c2c94fbda4e0 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 30 Nov 2026 04:51:15 +0100 Subject: [PATCH 2/4] Identify the restored link button without its duplicate detail label --- crates/ui-egui/src/panels/properties/links.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/properties/links.rs b/crates/ui-egui/src/panels/properties/links.rs index 10cea392c..1f700697a 100644 --- a/crates/ui-egui/src/panels/properties/links.rs +++ b/crates/ui-egui/src/panels/properties/links.rs @@ -969,7 +969,7 @@ mod ui223_links_tests { assert!(h.query_by_label("No placed graphics.").is_some()); h.state_mut().run("edit.undo", json!({})).unwrap(); idle(&mut h, 3); - assert!(h.query_by_label("studio-b/photo.svg").is_some(), "the same link has returned"); + assert!(h.query_by_role_and_label(egui::accesskit::Role::Button, "studio-b/photo.svg").is_some(), "the same link has returned"); assert!(h.query_by_label("Choose a link.").is_some(), "the empty list retired the old selection"); assert!(h.query_by_label("Go To").is_none(), "restoring the links does not select one"); From 1b0284d10dc4c41958230010adf8864dac9623f7 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Mon, 30 Nov 2026 04:54:22 +0100 Subject: [PATCH 3/4] Clear the selected Links row when no links remain --- crates/ui-egui/src/panels/properties/links.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/panels/properties/links.rs b/crates/ui-egui/src/panels/properties/links.rs index 1f700697a..b9e6970da 100644 --- a/crates/ui-egui/src/panels/properties/links.rs +++ b/crates/ui-egui/src/panels/properties/links.rs @@ -583,10 +583,6 @@ mod framework { if unavailable && !rows.is_empty() { small(ui, None, &tr("Link status is unavailable."), Shade::Muted, None); } - if rows.is_empty() { - Text::new(tr("No placed graphics.")).shade(Shade::Muted).show(ui); - return; - } // The chosen row belongs to the document it was chosen in, and holds only while that document still lists it: a // row of another document, or one gone from this list, is no choice. let row_id = |r: &Value| r["asset"].as_u64().or_else(|| r["story"].as_u64()); @@ -595,6 +591,10 @@ mod framework { if chosen.is_none() { ui.data_mut(|d| d.remove::(sel_key)); } + if rows.is_empty() { + Text::new(tr("No placed graphics.")).shade(Shade::Muted).show(ui); + return; + } // Status and Page ยท PPI are as wide as their widest entry (a chip sized to its words, a short readout) and Name // takes the rest, so a file name stays readable and every column fits the panel; long source paths are cut. let width = ui.available_width(); From 7213321949c758cb4729ed9965e52bb15614d259 Mon Sep 17 00:00:00 2001 From: skylartaylor Date: Tue, 1 Dec 2026 20:46:12 +0100 Subject: [PATCH 4/4] test: check that Escape removes the font picker --- crates/ui-egui/src/panels/font_menu_ui_tests.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/font_menu_ui_tests.rs b/crates/ui-egui/src/panels/font_menu_ui_tests.rs index d7fcb4217..494ab2920 100644 --- a/crates/ui-egui/src/panels/font_menu_ui_tests.rs +++ b/crates/ui-egui/src/panels/font_menu_ui_tests.rs @@ -243,10 +243,12 @@ fn font_popups_stay_bounded_and_anchored_to_each_text_selection_field() { click_at(&mut h, at.center()); h.run_steps(4); let input = h.get_by(|n| n.role() == egui::accesskit::Role::TextInput && n.is_focused()).rect(); + assert!(h.query_by_label("Search fonts").is_some(), "the open picker exposes its search field"); geometry.push((at, input)); h.key_press(egui::Key::Escape); h.run_steps(4); - assert!(!h.ctx.text_edit_focused(), "Escape closes the font picker"); + assert!(h.query_by_label("Search fonts").is_none(), "Escape removes the font picker search field"); + assert!(!h.ctx.text_edit_focused(), "Escape leaves no text edit focused"); } for (at, input) in &geometry { assert!(input.width() >= 350.0 && input.width() <= 600.0, "the search fits a main-sized dropdown: {geometry:?}");