PdfCraft: An open-source PDF reader and editor written by scratch in pure Rust
Integration: a script-opened panel reveals a background Inspector tab (#3580)
aiongg9595f5940ccb
diff --git a/crates/ui-egui/src/js_ui.rs b/crates/ui-egui/src/js_ui.rsindex ecc87736d..bf7b2a591 100644--- a/crates/ui-egui/src/js_ui.rs+++ b/crates/ui-egui/src/js_ui.rs@@ -77,6 +77,9 @@ impl PdfCraftApp {};// Show/Hide: a panel already showing closes.self.right = (self.right != Some(panel)).then_some(panel);+ if self.right.is_some() {+ self.pending_panel_reveals.push(crate::docking::Panel::Inspector);+ }}Request::Focus(_) | Request::Beep | Request::Reset(_) => {}}diff --git a/crates/ui-egui/tests/it/control.rs b/crates/ui-egui/tests/it/control.rsindex 5a6869b06..0dca0f866 100644--- a/crates/ui-egui/tests/it/control.rs+++ b/crates/ui-egui/tests/it/control.rs@@ -1547,6 +1547,22 @@ fn explicit_panel_requests_reveal_inactive_group_members() {h.get_by_label("Header and footer");}+/// #3580 review: a panel a script opens (`app.execMenuItem("ShowHideBookmarks")`) is shown even+/// when the inspector is a background tab of a custom docking layout.+#[test]+fn a_script_opened_panel_reveals_an_inactive_inspector() {+ let (mut h, c) = harness();+ ok(&mut h, &c, "ui.set", json!({"key":"panel", "value":"pages"}));+ ok(&mut h, &c, "ui.dock", json!({"operation":"move", "panel":"inspector", "target":"tools", "zone":"center"}));+ ok(&mut h, &c, "ui.dock", json!({"operation":"activate", "panel":"tools"}));+ h.run_steps(3);+ assert!(h.query_by_label("This document has no bookmarks.").is_none());+ let id = h.state().active_ids().unwrap().1;+ h.state_mut().run_button_script(id, "", "app.execMenuItem('ShowHideBookmarks')");+ h.run_steps(4);+ h.get_by_label("This document has no bookmarks.");+}+#[test]fn home_and_combine_suppress_inspector_without_forgetting_layout_or_choice() {use pdfcraft_ui_egui::docking::Panel;