diff --git a/crates/benilla-app/assets/ui/KeyBindingsPage.xml b/crates/benilla-app/assets/ui/KeyBindingsPage.xml index a89fa332..92297b23 100644 --- a/crates/benilla-app/assets/ui/KeyBindingsPage.xml +++ b/crates/benilla-app/assets/ui/KeyBindingsPage.xml @@ -408,6 +408,11 @@ KeyBindings_Output("") KeyBindingsPage_Refresh() end, + -- The stock entry's own (`Blizzard_BindingUI.lua:21-23`): `StaticPopup_OnUpdate` + -- compares the timeout with 0 every frame (`StaticPopup.lua:1713`). + timeout = 0, + whileDead = 1, + showAlert = 1, } -- Reset To Default confirms, as the era's does; our string, since 1.12 has none. StaticPopupDialogs["CONFIRM_RESET_KEYBINDINGS"] = { @@ -422,6 +427,8 @@ KeyBindings_Output("") KeyBindingsPage_Refresh() end, + timeout = 0, + whileDead = 1, } -- ── Search ── a binding's tag is its display name uppercased, as the era's. diff --git a/crates/benilla-app/src/ui_script/keybindings_tests.rs b/crates/benilla-app/src/ui_script/keybindings_tests.rs index ab529494..c1c2ae23 100644 --- a/crates/benilla-app/src/ui_script/keybindings_tests.rs +++ b/crates/benilla-app/src/ui_script/keybindings_tests.rs @@ -336,6 +336,9 @@ fn the_esc_ladder_closes_the_window_and_the_checkbox_switches_sets() { .unwrap(), "the box springs back until the popup decides" ); + // A frame with the popup up runs `StaticPopup_OnUpdate`, which compares its timeout. + s.tick(0.1); + assert!(s.errors().is_empty(), "{:?}", s.errors()); s.run("StaticPopup1Button2:Click()").unwrap(); assert_eq!(s.current_binding_set(), 2); assert!(s.character_bindings_exist()); @@ -352,6 +355,25 @@ fn the_esc_ladder_closes_the_window_and_the_checkbox_switches_sets() { assert!(s.errors().is_empty(), "{:?}", s.errors()); } +/// `StaticPopup_Show` copies an entry's `timeout` into `timeleft`, and `StaticPopup_OnUpdate` +/// compares it with 0 every frame (`StaticPopup.lua:1713`), so every entry declares one, as each +/// stock entry does. +#[test] +fn every_dialog_declares_a_timeout() { + benilla_formats::wow_data_or_skip!(); + let s = harness(); + let missing = s + .eval::( + "local out = {} \ + for which, d in pairs(StaticPopupDialogs) do \ + if type(d.timeout) ~= 'number' then table.insert(out, which) end \ + end \ + table.sort(out) return table.concat(out, ' ')", + ) + .unwrap(); + assert_eq!(missing, "", "dialogs with no numeric timeout"); +} + #[test] fn search_surfaces_bindings_as_live_rows_under_the_redirect_head() { benilla_formats::wow_data_or_skip!();