Fix stat panel not rebuilding when switching specs

RebuildStatRows hid the previous rows through vals.label, but StatValues
never stored the label font string. The first spec change that altered
the stat keys raised "attempt to index a nil value (field 'label')",
aborting RefreshUI before the new rows were created. The previous spec's
panel stayed on screen, so a Holy priest kept seeing Shadow's
"+Spell Damage" row instead of "+Healing".

Store the label in StatValues so old rows hide correctly and the panel
rebuilds with the new spec's profile.

Add a UI smoke test using mocked frames (font strings now record
text/shown; frames track Show/Hide/IsShown). It switches Shadow -> Holy
and asserts the visible rows change; with the bug reverted it fails with
the same nil-label error.

Also print usage for a bare "/amibis spec" instead of toggling the
window, which was a surprising side effect and made tests order-dependent.

107 passing.
This commit is contained in:
dfj committed 2026-10-24 13:42:08 +02:00
1 parent 5fba4ac10c
commit cc3971fe93
6 files changed
+106 -7

No files matched your search

+4 -3
View File
@@ -27,6 +27,7 @@ apt-get download lua5.4 && dpkg -x lua5.4_*.deb /tmp/lua && /tmp/lua/usr/bin/lua
| `test_stats.lua` | `ScanItemStats`: MAX aggregation across alias keys (spell damage schools, healing, haste/crit/mp5 ratings), single-mapping pass-through, unmapped key filtering, nil handling |
| `test_compare.lua` | `CompareGear`: BIS counting, weighted upgrade ranking, positive-diffs-only scoring, per-spec stat profiles (Shadow counts spell damage, Holy counts healing, Warrior counts strength/AP, tank mitigation stats), `GetStatKeysForSpec`, `GetCompletionRatio` |
| `test_slash.lua` | `/amibis spec <name>` parsing: override set/clear, case and multi-word normalization, `spec clear` not treated as a spec name |
| `test_ui.lua` | UI smoke test with mocked frames: the stats panel rebuilds when switching Shadow → Holy (regression: old rows were hidden via a missing `label` field, which errored and left the Shadow rows on screen) |
## Layout
@@ -54,6 +55,6 @@ your dev machine, never in the game client.
## Not covered
`UI/ComparisonFrame.lua` — its helpers are file-locals and testing them would
require a full frame API mock. The logic worth testing (stat scanning, scoring,
phase data) lives in the two suites above.
Most of `UI/ComparisonFrame.lua` — layout/anchoring and event wiring still need in-game
verification. `test_ui.lua` covers the stats-panel rebuild path using mocked frames
(font strings record `text`/`shown`, frames track `Show`/`Hide`/`IsShown`).