Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .github/damage-meter-chat-reports.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
41 changes: 41 additions & 0 deletions .tools/damage-meter-report-tests/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Damage meter report checks

Requires Python and `lupa` (with its Lua 5.1 runtime):

```sh
python -m pip install lupa
python .tools/damage-meter-report-tests/run_reports.py
```

The runner compiles the damage meter and its options with Lua 5.1, exercises
the real report module against mocked WoW APIs, and executes the real header
button lifecycle against lightweight frame objects. It never controls WoW or
sends live chat. These files are excluded from addon packages by `.pkgmeta`.

Coverage includes ranked damage/healing reports; current, overall and named
segments; counts and filtered deaths; secret/empty data; UTF-8 message limits;
destination validation; ordered one-click sends; cancellation; opt-in button
creation; dialog event cleanup; and native UI factory, accent and scale contracts.
Native widget rendering and server delivery still require in-game verification.

## Live verification

1. With a fresh profile, confirm no report button appears. Enable **Damage
Meters > Header > Enable Chat Reports** and check every window's header.
2. Open damage and healing reports for current, overall and boss segments.
Compare the preview, totals, rates, percentages and ordering with the meter.
3. Choose five entries and click **Send Report** once. Check the header and
available ranked rows arrive in order in Say, Party, Raid, Instance Chat,
Guild, an authorized Officer channel, Whisper, and a joined channel.
4. Check one-player reports, a longer preview, scrolling, narrow meter headers,
alternate accent colors, panel scales, and a non-English locale.
5. Close during a paced send, start combat, leave the destination group, disable
reports, delete the originating window, and switch profiles. Confirm pending
lines stop, the dialog closes as applicable, and no Lua errors appear.
6. Attach before/after screenshots of the headers, dialog and resulting chat.

Say and custom-channel sends outside an instance stay on the original click's
call stack. Other destinations use a cancellable 0.3-second interval solely
to pace the requested messages. There is no background collection, polling, or
automatic report. Blizzard chat permissions, rate limits and delivery remain
server-controlled; a successful API call is not a server acknowledgement.
42 changes: 42 additions & 0 deletions .tools/damage-meter-report-tests/header_scenarios.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
-- Execute the real window's report-button lifecycle with lightweight controls.
local cfg, created, opened, closed = {}, 0, 0, 0
local W = {settingsBtn={}, segmentBtn={}, modeBtn={}, resetBtn={}, winActionBtn={}}
W.hdrBtns = {W.settingsBtn, W.segmentBtn, W.modeBtn, W.resetBtn, W.winActionBtn}
local env = setmetatable({
W = W,
DB = function() return cfg end,
EllesmereUI = {L=function(s) return s end},
ns = {Report={
Open=function(window) assert(window==W); opened=opened+1 end,
Close=function(window) assert(window==W); closed=closed+1 end,
}},
MakeHeaderBtn=function(texture, offset, tooltip, click)
created=created+1
assert(texture=="dm_report.png" and tooltip=="Report to Chat")
return {Click=click, Hide=function(self) self.hidden=true end}
end,
}, {__index=_G})
local factory=assert(loadstring(REPORT_BUTTON_SOURCE, "report-button lifecycle"))
setfenv(factory, env); factory()
W.SyncReportButton()
assert(created==0 and #W.hdrBtns==5, "default-off builds no button")
cfg.reportEnabled=true
local hooked=0
W.HookHeaderButton=function(button) assert(button==W.reportBtn); hooked=hooked+1 end
W.SyncReportButton()
assert(created==1 and #W.hdrBtns==6 and W.hdrBtns[4]==W.reportBtn, "enable inserts report control")
assert(hooked==1, "late-created report button inherits header hover behavior")
assert(W.hdrBtns[5]==W.resetBtn and W.hdrBtns[6]==W.winActionBtn, "existing controls keep order")
W.reportBtn.Click()
assert(opened==1, "click reports from owning window")
W.SyncReportButton()
assert(created==1 and #W.hdrBtns==6, "header refresh does not duplicate controls")
cfg.reportEnabled=false
W.SyncReportButton()
assert(W.reportBtn.hidden and #W.hdrBtns==5 and closed==1, "disable hides control and closes dialog")
cfg.reportEnabled=true
W.SyncReportButton()
assert(created==1 and #W.hdrBtns==6, "re-enable reuses control")
assert(hooked==1, "re-enable does not duplicate hover hooks")
assert(W.hdrBtns[1]==W.settingsBtn and W.hdrBtns[3]==W.modeBtn, "other header controls unchanged")
print("PASS: header opt-in, ordering, ownership, disable and re-enable scenarios")
Loading