Files
WoW-Hybrid-gateway/tests/item_armor_presentation_test.lua
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

28 lines
2.8 KiB
Lua

-- Presentation fixtures only. Gameplay and actual native layout remain separate.
local pre,hook
issecretvalue=function(v)return v=='SECRET'end
GetLocale=function()return 'enUS'end
Enum={TooltipDataType={Item=0},TooltipDataLineType={None=0}}
TooltipDataProcessor={AddTooltipPreCall=function(_,fn)pre=fn end,AddLinePreCall=function(_,fn)hook=fn end}
GWArmorPresentationData={version=1,items={[108]={armor=38,block=0,subclass=1},[33155]={armor=2853,block=53,subclass=6}}}
C_Item={GetItemInfoInstant=function(i)return i,nil,nil,nil,nil,4,i==108 and 1 or 6 end,GetItemInfo=function()return 'source item'end,GetItemStats=function(link)if link=='item:108'then return{RESISTANCE0_NAME=38}else return{RESISTANCE0_NAME=2853,ITEM_MOD_BLOCK_VALUE_SHORT=53}end end}
local function data(id,texts)local d={id=id,type=0,lines={}};for _,text in ipairs(texts)do d.lines[#d.lines+1]={type=0,leftText=text}end;return d end
local base=data(33155,{'2,929 Armor','55 Block','+24 Stamina','-76 Armor','Equip: Increases the Block Value of your shield by 53.','Equip: Increases the Block Value of your shield by 19.'})
C_TooltipInfo={GetItemByID=function()return base end}
dofile(assert(arg[1]))
local function render(d,getter)
local out={};local t={GetProcessingTooltipInfo=function()return getter or{getterName='GetItemByID',getterArgs={d.id}}end,AddLine=function(_,s)out[#out+1]=s end}
pre(t,d);for _,l in ipairs(d.lines)do if not hook(t,l)then out[#out+1]=l.leftText end end;return out
end
local r=render(data(108,{'35 Armor','+1 Stamina','+3 Armor','Enchanted: Health +100'}));assert(table.concat(r,'|')=='38 Armor|+1 Stamina|Enchanted: Health +100')
r=render(base);assert(table.concat(r,'|')=='2,853 Armor|53 Block|+24 Stamina|Equip: Increases the Block Value of your shield by 19.')
r=render(base,{getterName='GetInventoryItem',getterArgs={'player',17}});assert(r[1]=='2,853 Armor'and r[2]=='53 Block')
local changed=data(33155,{'3,029 Armor','55 Block','-76 Armor','Equip: Increases the Block Value of your shield by 53.'});r=render(changed,{getterName='GetInventoryItem',getterArgs={'player',17}});assert(r[1]=='3,029 Armor'and r[3]=='-76 Armor')
r=render(data(108,{'35 Armor','+3 Armor','+3 Armor'}));assert(#r==3 and r[1]=='35 Armor')
r=render(data(33155,{'2,929 Armor','55 Block','-76 Armor','Equip: Increases the Block Value of your shield by 53.','Equip: Increases the Block Value of your shield by 53.'}));assert(r[2]=='55 Block'and #r==4)
local original=C_Item.GetItemStats;C_Item.GetItemStats=function()return{RESISTANCE0_NAME=99}end
r=render(data(108,{'35 Armor','+3 Armor'}));assert(#r==2 and r[1]=='35 Armor');C_Item.GetItemStats=original
r=render(data(108,{'SECRET','+3 Armor'}));assert(#r==2)
assert(GWArmorPresentationDiagnostics.errors==0)
print('Shared armor totals, intrinsic block, extra source equip bonuses, instance changes, ambiguous enchants and secret values pass.')