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:
1 parent
5fba4ac10c
commit
cc3971fe93
6 files changed
+106
-7
No files matched your search
@@ -48,15 +48,30 @@ function IsShiftKeyDown() return false end
|
||||
function IsControlKeyDown() return false end
|
||||
|
||||
local function makeChild()
|
||||
return setmetatable({}, {
|
||||
__index = function(_, key)
|
||||
local child = { shown = true, text = "" }
|
||||
return setmetatable(child, {
|
||||
__index = function(self, key)
|
||||
if key == "SetText" then
|
||||
return function(_, value)
|
||||
self.text = value
|
||||
return self
|
||||
end
|
||||
elseif key == "GetText" then
|
||||
return function() return self.text end
|
||||
elseif key == "Show" then
|
||||
return function() self.shown = true; return self end
|
||||
elseif key == "Hide" then
|
||||
return function() self.shown = false; return self end
|
||||
elseif key == "IsShown" then
|
||||
return function() return self.shown end
|
||||
end
|
||||
return function(_, ...) return nil end
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
local function makeFrame()
|
||||
local frame = { fonts = {}, textures = {} }
|
||||
local frame = { fonts = {}, textures = {}, shown = true, width = 0, height = 0 }
|
||||
return setmetatable(frame, {
|
||||
__index = function(self, key)
|
||||
if key == "CreateFontString" then
|
||||
@@ -71,6 +86,25 @@ local function makeFrame()
|
||||
table.insert(self.textures, tx)
|
||||
return tx
|
||||
end
|
||||
elseif key == "Show" then
|
||||
return function() self.shown = true; return self end
|
||||
elseif key == "Hide" then
|
||||
return function() self.shown = false; return self end
|
||||
elseif key == "IsShown" then
|
||||
return function() return self.shown end
|
||||
elseif key == "SetSize" then
|
||||
return function(_, width, height)
|
||||
self.width, self.height = width, height
|
||||
return self
|
||||
end
|
||||
elseif key == "GetWidth" then
|
||||
return function() return self.width end
|
||||
elseif key == "GetHeight" then
|
||||
return function() return self.height end
|
||||
elseif key == "SetWidth" then
|
||||
return function(_, width) self.width = width; return self end
|
||||
elseif key == "SetHeight" then
|
||||
return function(_, height) self.height = height; return self end
|
||||
end
|
||||
return function(_, ...) return self end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user