- the help window is the reference's own `HelpFrame.xml`, and ours was less than half its size, so this is mostly arrival: the category list, the per-category GM and harassment pages, the stuck page, the bug report, the PvP policy line; four things we had built go with the swap — one-click filing from Home, the Home unstick button, the downed-queue refusal message, and ticket abandonment, a capability loss rather than a look change, since `AbandonTicket` exists in neither the binding table nor the 1.12 FrameXML corpus and any return of it goes on top of the stock window; `GMSURVEY_DISPLAY` arrives with no producer, a real 1.12 event (`SignalEvent` `0x5e797b`) whose whole UI is a LoadOnDemand addon not on our chain; and the stock file needs two orderings ours did not, the micro-button row before its GM status ask and the buff frame before its repoll timer (1889, superseding 1687)
- the cast bar, the action-button regions and the font registry are the reference's own files too: our `CastingBar.xml` was `CastingBarFrame.xml` under another name, with the literal "Failed" where the reference reads the `FAILED` GlobalString (1886); `ActionButtonTemplate.xml` seats above our `ActionBar.xml` because the later-registered template wins, and it declares zero scripts, so the regions migrate while the handlers stay ours until `ActionButton.lua`'s verbs do (1887); `Fonts.xml` is manifest entry 0, all 51 fonts match by name, and its one real difference, `ITEM_QUALITY_COLORS`, moves to UIParent where the reference declares it (1888); the harnesses were the real cost — those reading our files off disk could not name a chain file and now read through the manifest's own rule — and the event-producer gate, having cried wolf at the cast bar's `SPELLCAST_INTERRUPTED` fired through a variable, now matches the fired tuple's shape
- of the 189 events benilla fires, three are not in the client — `BAG_UPDATE_DELAYED` (a Classic Era name), `LOOT_UPDATE` and `UPDATE_LOOT_ROLL` (invented here, no listener anywhere) — found against the reference binary's own string table, and a gate now fails any fire of a name the client cannot dispatch unless it wears a `BENILLA_` prefix (1883); two payloads the reference gives that we did not: `UNIT_HAPPINESS` carries its unit token, without which no `UNIT_*` consumer reads it, and `CHARACTER_POINTS_CHANGED` carries the point deltas `ChatFrame.lua` compares unguarded, so nil raised (1884); and `PLAYER_LEVEL_UP` carries all nine — level, health and mana gain, talent points (not on the wire: the client derives `(newLevel >= 10) ? 1 : 0` at `0x5e407c`) and the five stat gains — matched to the ding by level, a demotion's absent gains sent as zeros since a nil raises where a zero reads as no line
- the chain gap report could not run — one of its six probes had no player seated where a stock addon formats `UnitName("player")` at load, the other five each carrying an identical copy-pasted seed — and the repaired instrument prices each window's cost: 13 stock files load clean with nothing missing (the action bars, the cast bar, the fonts, the help, friends, game-menu and sound-options windows among them) and the near ones name their missing verb, with "loads clean" still not "swapped" (1885); and `UpdateNameplates`, recorded as the missing engine verb blocking the UIParent keystone, is FrameXML — defined in `UIOptionsFrame.lua`, absent from the binding table, its whole body four nameplate verbs that are already ours — so it is twelve lines transcribed into our options frame, the reference's own Show-then-Hide no-op included (1890 corrects 1878)
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
135 lines
5.0 KiB
Rust
135 lines
5.0 KiB
Rust
//! The duel UI (decision 0633, DuelFrame.xml): the challenge popup's show/accept/decline, the
|
|
//! out-of-bounds warning's countdown text and its in-bounds dismissal, and the DUEL_FINISHED
|
|
//! sweep — the Lua wiring between the four engine events `ui_duel`'s feed fires and the shared
|
|
//! StaticPopup engine, driven exactly as that feed drives it.
|
|
|
|
use benilla_ui::script::{DuelRequest, ScriptValue, UiScript};
|
|
|
|
use super::test_ui::load_ui as load_xml;
|
|
|
|
fn setup() -> UiScript {
|
|
let mut s = UiScript::new().unwrap();
|
|
s.set_screen_size(1024.0, 768.0);
|
|
load_xml(&s, "Interface\\FrameXML\\Fonts.xml");
|
|
load_xml(&s, "MoneyFrame.xml");
|
|
load_xml(&s, "UiPanels.xml");
|
|
load_xml(&s, r"Interface\FrameXML\UIPanelTemplates.lua");
|
|
load_xml(&s, r"Interface\FrameXML\UIPanelTemplates.xml");
|
|
load_xml(&s, "DuelFrame.xml");
|
|
s
|
|
}
|
|
|
|
/// `DUEL_REQUESTED(name)` raises the challenge popup with the challenger's name filled in, and
|
|
/// Accept queues `AcceptDuel()`.
|
|
#[test]
|
|
fn the_challenge_popup_shows_the_name_and_accept_queues_the_accept() {
|
|
let mut s = setup();
|
|
s.fire_event(
|
|
"DUEL_REQUESTED",
|
|
vec![ScriptValue::Str("Onerogue".to_string())],
|
|
);
|
|
assert!(
|
|
s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap(),
|
|
"DUEL_REQUESTED shows the challenge popup"
|
|
);
|
|
assert_eq!(
|
|
s.eval::<String>("return StaticPopup1Text:GetText()")
|
|
.unwrap(),
|
|
"Onerogue has challenged you to a duel.",
|
|
"arg1 fills the GlobalStrings template's %s"
|
|
);
|
|
s.run("StaticPopup_OnClick(StaticPopup1, 1)").unwrap();
|
|
assert_eq!(s.take_duel_requests(), vec![DuelRequest::Accept]);
|
|
assert!(
|
|
!s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap(),
|
|
"accepting closes it"
|
|
);
|
|
}
|
|
|
|
/// Decline queues `CancelDuel()` — and so does ESC, because the entry is `hideOnEscape` and the
|
|
/// engine routes an escape through OnCancel.
|
|
#[test]
|
|
fn decline_and_escape_both_cancel() {
|
|
let mut s = setup();
|
|
s.fire_event("DUEL_REQUESTED", vec![ScriptValue::Str("Twomage".into())]);
|
|
s.run("StaticPopup_OnClick(StaticPopup1, 2)").unwrap();
|
|
assert_eq!(s.take_duel_requests(), vec![DuelRequest::Cancel]);
|
|
|
|
s.fire_event("DUEL_REQUESTED", vec![ScriptValue::Str("Twomage".into())]);
|
|
s.run("ToggleGameMenu()").unwrap();
|
|
assert_eq!(s.take_duel_requests(), vec![DuelRequest::Cancel]);
|
|
assert!(!s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap());
|
|
}
|
|
|
|
/// The out-of-bounds warning is a bare countdown: no buttons, its text rendered by the
|
|
/// StaticPopup engine's per-tick branch, and `DUEL_INBOUNDS` takes it away.
|
|
#[test]
|
|
fn out_of_bounds_counts_down_and_inbounds_dismisses_it() {
|
|
let mut s = setup();
|
|
s.fire_event("DUEL_OUTOFBOUNDS", vec![]);
|
|
assert!(s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap());
|
|
assert!(
|
|
!s.eval::<bool>("return StaticPopup1Button1:IsShown()")
|
|
.unwrap(),
|
|
"a warning, not a question — no buttons"
|
|
);
|
|
s.tick(0.05);
|
|
assert_eq!(
|
|
s.eval::<String>("return StaticPopup1Text:GetText()")
|
|
.unwrap(),
|
|
"Exiting duel area, you will forfeit in 10 seconds.",
|
|
"the engine's countdown branch fills %d %s"
|
|
);
|
|
s.fire_event("DUEL_INBOUNDS", vec![]);
|
|
assert!(
|
|
!s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap(),
|
|
"coming back inside clears the warning"
|
|
);
|
|
assert!(
|
|
s.take_duel_requests().is_empty(),
|
|
"the bounds pair never sends anything"
|
|
);
|
|
}
|
|
|
|
/// `DUEL_FINISHED` sweeps **both** dialogs and sends nothing — the case that matters is a duel
|
|
/// ending while the challenge popup is still up (the other side cancelled first), which must not
|
|
/// leave a stale popup or fire a second cancel.
|
|
#[test]
|
|
fn finishing_sweeps_both_dialogs_silently() {
|
|
let mut s = setup();
|
|
s.fire_event("DUEL_REQUESTED", vec![ScriptValue::Str("Twomage".into())]);
|
|
assert!(s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap());
|
|
s.fire_event("DUEL_FINISHED", vec![]);
|
|
assert!(
|
|
!s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap(),
|
|
"the challenge popup goes away with the duel"
|
|
);
|
|
assert!(
|
|
s.take_duel_requests().is_empty(),
|
|
"a hide is not a decline — the duel is already over"
|
|
);
|
|
|
|
s.fire_event("DUEL_OUTOFBOUNDS", vec![]);
|
|
s.fire_event("DUEL_FINISHED", vec![]);
|
|
assert!(!s.eval::<bool>("return StaticPopup1:IsVisible()").unwrap());
|
|
assert!(s.take_duel_requests().is_empty());
|
|
}
|
|
|
|
/// The four Era globals queue their intents and nothing else — `StartDuel`/`StartDuelUnit` carry
|
|
/// their argument through so the app can resolve it.
|
|
#[test]
|
|
fn the_era_globals_queue_their_intents() {
|
|
let mut s = setup();
|
|
s.run("AcceptDuel(); CancelDuel(); StartDuel('Onerogue'); StartDuelUnit('target')")
|
|
.unwrap();
|
|
assert_eq!(
|
|
s.take_duel_requests(),
|
|
vec![
|
|
DuelRequest::Accept,
|
|
DuelRequest::Cancel,
|
|
DuelRequest::StartByName("Onerogue".into()),
|
|
DuelRequest::StartByUnit("target".into()),
|
|
]
|
|
);
|
|
}
|