Add max buffs and max debuffs settings

- /tfb buffs 0-32 and /tfb debuffs 0-16, plus two options-panel sliders.
- Saved settings are validated and reset when out of range.
- A lowered debuff limit hides extra debuffs instead of spilling them into the
  buff row; the buff limit applies to spilled debuffs too.
- Works on the native and ClassicAPI paths and with test mode.
- Bump to 0.9.6; tests now 23 scenarios.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W3rwutyoLNHxXPycYWSMc
This commit is contained in:
2026-11-01 00:42:19 +00:00
co-authored by Claude Sonnet 5.5
parent 2a0ab55ece
commit 3d7ac932e1
7 changed files with 87 additions and 23 deletions
+33
View File
@@ -253,6 +253,39 @@ assert(TargetFrameBuff_IsTest())
SlashCmdList.TARGETFRAMEBUFF("test off")
assert(not TargetFrameBuff_IsTest() and not TargetFrameBuff1:IsShown() and not TargetFrameDebuff1:IsShown())
''')
run("max buffs and debuffs limit display, no spill when lowered", 'InstallAPI(true)', '''
for i=1,20 do auras.HELPFUL[i]=Aura("Buff"..i) end
for i=1,18 do auras.HARMFUL[i]=Aura("Debuff"..i) end
Tick()
assert(TargetFrameBuff20:IsShown() and TargetFrameDebuff16:IsShown())
assert(TargetFrameBuff21Icon.texture=="Debuff17")
SlashCmdList.TARGETFRAMEBUFF("buffs 5"); SlashCmdList.TARGETFRAMEBUFF("debuffs 3")
assert(TargetFrameBuffDB.maxBuffs==5 and TargetFrameBuffDB.maxDebuffs==3)
assert(TargetFrameBuff5:IsShown() and not TargetFrameBuff6:IsShown())
assert(TargetFrameBuff5Icon.texture=="Buff5")
assert(TargetFrameDebuff3:IsShown() and not TargetFrameDebuff4:IsShown())
SlashCmdList.TARGETFRAMEBUFF("debuffs 0"); assert(not TargetFrameDebuff1:IsShown())
SlashCmdList.TARGETFRAMEBUFF("buffs 0"); assert(not TargetFrameBuff1:IsShown())
SlashCmdList.TARGETFRAMEBUFF("buffs 40"); assert(TargetFrameBuffDB.maxBuffs==0)
SlashCmdList.TARGETFRAMEBUFF("debuffs x"); assert(TargetFrameBuffDB.maxDebuffs==0)
SlashCmdList.TARGETFRAMEBUFF("reset")
assert(TargetFrameBuffDB.maxBuffs==32 and TargetFrameBuffDB.maxDebuffs==16)
assert(TargetFrameBuff21:IsShown() and TargetFrameBuff21Icon.texture=="Debuff17")
''')
run("limits on the native path, corrupt values and options sliders", '''
nativeBuffs={"A","B","C","D"}; nativeDebuffs={{"X",1,"Magic"},{"Y",1,"Magic"},{"Z",1,"Magic"}}
TargetFrameBuffDB={maxBuffs=-5,maxDebuffs=99}
InterfaceOptions_AddCategory=function(p) registered=p end
InterfaceOptionsFrame_OpenToCategory=function(p) p.refresh() end
''', '''
Tick()
assert(TargetFrameBuffDB.maxBuffs==32 and TargetFrameBuffDB.maxDebuffs==16)
assert(TargetFrameBuff4:IsShown() and TargetFrameDebuff3:IsShown())
TargetFrameBuffSlider3:SetValue(2); TargetFrameBuffSlider4:SetValue(1)
assert(TargetFrameBuffDB.maxBuffs==2 and TargetFrameBuffDB.maxDebuffs==1)
assert(TargetFrameBuff2:IsShown() and not TargetFrameBuff3:IsShown())
assert(TargetFrameDebuff1:IsShown() and not TargetFrameDebuff2:IsShown())
''')
ET.parse(addon/"TargetFrameBuff.xml")
print("PASS XML parsing")
print(f"{passed} Lua regression scenarios passed; XML parsed.")