-- API simulation: checks configuration/undo, not rendering or gameplay performance. local root = assert(arg[1], 'Pass the RuenUI directory with a trailing slash') local bundled = true local source = (assert(os.getenv('RUEN_NATIVE_UI'))..'/') Enum = {EditModePresetLayouts = {Modern = 1}} APIDocumentation = {AddDocumentationTable = function(_, d) for _, t in ipairs(d.Tables or {}) do if t.Type == 'Enumeration' then Enum[t.Name] = {}; for _, f in ipairs(t.Fields) do Enum[t.Name][f.Name] = f.EnumValue end end end end} dofile(source .. 'EditModeManagerConstantsDocumentation.lua') dofile(source .. 'NamePlateConstantsDocumentation.lua') Enum.PlayerSwingType = {MainHand=0, OffHand=1, Ranged=2} Enum.SoftTargetEnableFlags = {Any = 3}; bit = require('bit'); SlashCmdList = {} function CopyTable(t) if type(t) ~= 'table' then return t end local r = {}; for k,v in pairs(t) do r[k] = CopyTable(v) end; return r end local eventFrame local function noop() end function CreateFrame(_, name) local f = {scripts = {}, shown = true, attributes = {}} function f:SetScript(event, fn) self.scripts[event] = fn end function f:SetSize(w,h) self.w,self.h=w,h end function f:GetSize() return self.w or 430,self.h or 36 end function f:IsShown() return self.shown end function f:Hide() self.shown=false end function f:Show() self.shown=true end function f:SetAlpha(a) self.alpha=a end function f:SetFrameStrata() end function f:EnableMouse() end function f:GetLeft() return 100 end function f:GetBottom() return 50 end function f:SetAttribute(k,v) self.attributes[k]=v end function f:CreateTexture() return CreateFrame('Texture') end function f:CreateFontString() return CreateFrame('Font') end for _,k in ipairs({'RegisterEvent','UnregisterEvent','SetPoint','RegisterForClicks','SetAllPoints','SetColorTexture','SetText','SetWidth','SetJustifyH','SetStatusBarTexture','SetStatusBarColor','SetMinMaxValues','SetValue','RegisterUnitEvent'}) do f[k]=noop end if name then _G[name]=f end eventFrame=eventFrame or f return f end UIParent={}; TargetFrameToT={} function RegisterUnitWatch(f) f.watched=true end function UnregisterUnitWatch(f) f.watched=false end local currentClass="SHAMAN" function UnitClass() return currentClass,currentClass end function GetNumShapeshiftForms() return StanceBar and StanceBar.shown and 10 or 0 end function UnitExists() return false end function UnitName() return 'Test' end function UnitHealthMax() return 100 end function UnitHealth() return 50 end -- Core's first anonymous frame must own the login event. local realCreate=CreateFrame eventFrame=CreateFrame('Frame') local bootstrap=true function CreateFrame(kind,name,...) if bootstrap and kind=='Frame' and not name then bootstrap=false; return eventFrame end return realCreate(kind,name,...) end local barNames={'MainActionBar','MultiBarBottomLeft','MultiBarBottomRight','MultiBarRight','MultiBarLeft','MultiBar5','MultiBar6','MultiBar7'} for _,name in ipairs(barNames) do realCreate('Frame',name) end local bars={false,false,false,false,true,false,false} local initialBars=CopyTable(bars) local settings={lockActionBars=true} for i=1,7 do settings['PROXY_SHOW_ACTIONBAR_'..(i+1)]=bars[i] end function GetActionBarToggles() return unpack(bars) end function MultiActionBar_Update() for i=2,8 do _G[barNames[i]].shown=settings['PROXY_SHOW_ACTIONBAR_'..i] end end Settings={GetSetting=function(k) return settings[k]~=nil end, SetValue=function(k,v) assert(type(v)=='boolean'); settings[k]=v; if k=='lockActionBars' then return end; bars[tonumber(k:match('(%d+)$'))-1]=v; MultiActionBar_Update() end} local modified='ALT' local mouseModifier='SHIFT' function GetModifiedClick(k)return k=='MOUSEOVERCAST' and mouseModifier or modified end function SetModifiedClick(k,v)if k=='MOUSEOVERCAST' then mouseModifier=v else modified=v end end function IsMouseoverCastSupported()return false end local bindings={W='MOVEFORWARD',S='MOVEBACKWARD',A='TURNLEFT',D='TURNRIGHT',Q='STRAFELEFT',E='STRAFERIGHT',R='REPLY',F='ASSISTTARGET',G='TARGETLASTTARGET',B='OPENALLBAGS',C='TOGGLECHARACTER0',F1='TARGETSELF',['CTRL-1']='BONUSACTIONBUTTON1',['SHIFT-1']='ACTIONPAGE1',['SHIFT-MOUSEWHEELUP']='PREVACTIONPAGE',['ALT-F']='INTERACTTARGET'} for i=1,12 do bindings[tostring(i)]='ACTIONBUTTON'..i end local initialBindings=CopyTable(bindings) function GetBindingKey(action) local k={}; for key,a in pairs(bindings) do if a==action then k[#k+1]=key end end; return unpack(k) end function GetBindingAction(k) return bindings[k] or '' end local profileEngine=dofile('tests/secure-binding-fixture.lua') function SetBinding(k,a) bindings[k]=a; return true end function SaveBindings() end function GetCurrentBindingSet() return 1 end local combat=false function InCombatLockdown() return combat end function time() return 1 end local changes,cvars=0,{lockActionBars='1'} C_CVar={GetCVar=function(k) return cvars[k] or '0' end,SetCVar=function(k,v) changes=changes+1; cvars[k]=tostring(v) end} function IsGraphicsSettingValueSupported() return 0 end C_Timer={After=function(_,fn) fn() end} local reloads=0 function ReloadUI() reloads=reloads+1 end C_AddOns={IsAddOnLoaded=function() return true end} LeaPlusDB={AutoSellJunk='Off'}; LeaMapsDB={ShowCoords='Off'} VoiceQuestDB={enabled=false,maleVoice=999}; VoiceQuestCharDB={useOwn=true} local layout={layoutName='Modern',layoutType=Enum.EditModeLayoutType.Preset,systems={}} local function add(kind,index) layout.systems[#layout.systems+1]={system=Enum.EditModeSystem[kind],systemIndex=index,settings={}} end for i=1,8 do add('ActionBar',i) end for i=1,5 do add('UnitFrame',i) end for _,i in ipairs({11,12,13}) do add('ActionBar',i) end for _,kind in ipairs({'TotemActionBar','VehicleLeaveButton','ExtraAbilities'}) do add(kind,1) end for _,kind in ipairs({'MainActionBarEndCap','StatusTrackingBar'}) do add(kind,1); add(kind,2) end for _,kind in ipairs({'CastBar','ChatFrame','MicroMenu','Bags','ObjectiveTracker','Minimap','DamageMeter'}) do add(kind,1) end local manager={layoutInfo={activeLayout=1,layouts={layout}}}; EditModeManagerFrame=manager function manager:GetLayouts() return self.layoutInfo.layouts end function manager:GetActiveLayoutInfo() return self.layoutInfo.layouts[self.layoutInfo.activeLayout] end function manager:AreLayoutsOfTypeMaxed() return false end function manager:CreateLayoutTbls() self.ready=true end function manager:MakeNewLayout(l,t,n) assert(self.ready); l.layoutName=n; l.layoutType=t; table.insert(self.layoutInfo.layouts,l) end EditModePresetLayoutManager={GetCopyOfPresetLayouts=function() return {CopyTable(layout)} end} C_EditMode={SetActiveLayout=function(i) manager.layoutInfo.activeLayout=i end,ConvertLayoutInfoToString=function() return 'simulation-export' end} -- Add deterministic frame geometry, tooltip hooks and inventory cursor behavior. local hooks={} local objectHooks=setmetatable({},{__mode='k'}) function hooksecurefunc(object,key,fn) if type(object)=='string' then hooks[object]=key else hooks[key]=fn objectHooks[object]=objectHooks[object] or {} objectHooks[object][key]=fn end end function GameTooltip_SetDefaultAnchor() end function GameTooltip_ShowCompareItem() end function GetScreenWidth() return UIParent:GetWidth() end local cf=assert(io.open((assert(os.getenv('RUEN_NATIVE_UI'))..'/Mainline-ContainerFrame.lua'))) local nativeContainer=cf:read('*a');cf:close() assert(loadstring(assert(nativeContainer:match('(function ContainerFrameItemButton_CalculateItemTooltipAnchors%b().-\nend)'))))() local function enrich(f,name) f.name=name function f:GetName() return self.name end function f:GetParent() return self.parent or UIParent end function f:GetOwner() return self.owner end function f:GetAnchorType() return self.anchorType or 'ANCHOR_NONE' end function f:SetAnchorType(value) self.anchorType=value end function f:GetEffectiveScale() return (self==UIParent and self.scale or UIParent.scale)*(self.localScale or 1) end function f:GetScale() return self.localScale or 1 end function f:SetScaleBase(value) self.localScale=value end function f:SetScale() error('must not call taint-prone native scale override') end function f:SetWidth(w) self.w=w end function f:GetWidth() return self.w or 100 end function f:GetHeight() return self.h or 36 end function f:SetHeight(h) self.h=h end function f:GetSize() return self:GetWidth(),self:GetHeight() end function f:ClearAllPoints() assert(not combat or not self.name or self.name=='RuenSwingTimers' or self.name=='GameTooltip' or self.name:match('^ShoppingTooltip'),'protected geometry changed in combat'); self.point=nil end function f:SetPoint(point,relative,relativePoint,x,y) if type(relative)=='string' then relative=_G[relative] end self.point={point,relative,relativePoint,x or 0,y or 0} end f.ClearAllPointsBase=f.ClearAllPoints; f.SetPointBase=f.SetPoint function f:GetPoint() if self.point then return unpack(self.point) end end function f:GetNumPoints() return self.point and 1 or 0 end function f:HookScript(event,fn) self.scripts[event]=fn end function f:SetClampedToScreen() end local function fraction(point,axis) if axis=='x' then return point:find('LEFT') and 0 or point:find('RIGHT') and 1 or 0.5 end return point:find('BOTTOM') and 0 or point:find('TOP') and 1 or 0.5 end function f:rect() local scale=self:GetEffectiveScale()/UIParent.scale local w,h=self:GetWidth()*scale,self:GetHeight()*scale if self==UIParent then return 0,0,w,h end if not self.point then return 0,0,w,h end local p,relative,rp,x,y=unpack(self.point) local l,b,rw,rh=relative:rect() return l+rw*fraction(rp,'x')+x*scale-w*fraction(p,'x'),b+rh*fraction(rp,'y')+y*scale-h*fraction(p,'y'),w,h end function f:GetLeft() local l=self:rect();return l/(self:GetEffectiveScale()/UIParent.scale) end function f:GetBottom() local _,b=self:rect();return b/(self:GetEffectiveScale()/UIParent.scale) end function f:GetTop() local _,b,_,h=self:rect();return (b+h)/(self:GetEffectiveScale()/UIParent.scale) end function f:GetRight() local l,_,w=self:rect();return (l+w)/(self:GetEffectiveScale()/UIParent.scale) end function f:UpdateHeight() self.h=self.editModeHeight end return f end local previousCreate=CreateFrame function CreateFrame(kind,name,...) return enrich(previousCreate(kind,name,...),name) end for _,name in ipairs(barNames) do enrich(_G[name],name) end for _,name in ipairs({'ChatFrame1','PartyFrame','CompactRaidFrameContainer','UIParent','MinimapCluster','BagsBar','MicroMenuContainer','ObjectiveTrackerFrame','GameTooltip','StanceBar','PetActionBar','PossessActionBar','MultiCastActionBarFrame','MainMenuBarVehicleLeaveButton','ExtraAbilityContainer','PlayerCastingBarFrame','PlayerFrame','PetFrame','TargetFrame','TargetFrameToT','FocusFrame'}) do CreateFrame('Frame',name) end UIParent.w,UIParent.h,UIParent.scale=1706.4,960,1.25 ChatFrame1.w,ChatFrame1.h=380,150;ChatFrame1:SetPoint('BOTTOMLEFT',UIParent,'BOTTOMLEFT',20,45) PartyFrame.w,PartyFrame.h=230,300;CompactRaidFrameContainer.w,CompactRaidFrameContainer.h=360,304 PartyFrame.shown=false;CompactRaidFrameContainer.shown=false GameTooltip.w,GameTooltip.h=220,120;GameTooltip.shown=false function manager:IsShown() return false end function manager:HookScript() end function manager:UpdateSystems() end StanceBar.w,StanceBar.h,StanceBar.localScale=338,30,0.8 PetActionBar.w,PetActionBar.h,PetActionBar.localScale=338,30,0.8 PossessActionBar.w,PossessActionBar.h,PossessActionBar.localScale=66,30,0.8 MultiCastActionBarFrame.w,MultiCastActionBarFrame.h=230,38 MainMenuBarVehicleLeaveButton.w,MainMenuBarVehicleLeaveButton.h=32,32 ExtraAbilityContainer.w,ExtraAbilityContainer.h=250,120 PlayerCastingBarFrame.w,PlayerCastingBarFrame.h=240,20 PlayerFrame.w,PlayerFrame.h=232,100;TargetFrame.w,TargetFrame.h=232,100 FocusFrame.w,FocusFrame.h=232,100;FocusFrame.localScale=.75 PetFrame.w,PetFrame.h=130,45;PetFrame:SetPoint('TOPRIGHT',PlayerFrame,'BOTTOMRIGHT',0,-4) TargetFrameToT.w,TargetFrameToT.h=130,45;TargetFrameToT:SetPoint('TOPRIGHT',TargetFrame,'BOTTOMRIGHT',0,-4) local byKind={[Enum.EditModeSystem.ActionBar]={MainActionBar,MultiBarBottomLeft,MultiBarBottomRight,MultiBarRight,MultiBarLeft,MultiBar5,MultiBar6,MultiBar7},[Enum.EditModeSystem.Minimap]={MinimapCluster},[Enum.EditModeSystem.Bags]={BagsBar},[Enum.EditModeSystem.MicroMenu]={MicroMenuContainer},[Enum.EditModeSystem.ObjectiveTracker]={ObjectiveTrackerFrame}} local function setting(s,k) for _,v in ipairs(s.settings) do if v.setting==k then return v.value end end end byKind[Enum.EditModeSystem.ActionBar][Enum.EditModeActionBarSystemIndices.PetActionBar]=PetActionBar byKind[Enum.EditModeSystem.ChatFrame]={ChatFrame1} C_EditMode.SetActiveLayout=function(i) manager.layoutInfo.activeLayout=i for _,s in ipairs(manager:GetActiveLayoutInfo().systems) do local list=byKind[s.system];local f=list and list[s.systemIndex or 1] if f and s.anchorInfo then f.systemInfo=s if s.system==Enum.EditModeSystem.ActionBar and (s.systemIndex or 1)<=8 then local rows=setting(s,Enum.EditModeActionBarSetting.NumRows) or 1 f.w=(rows==1 and 495 or 252);f.h=rows*36+(rows-1)*2 elseif f==PetActionBar then local scale=(50+10*(setting(s,Enum.EditModeActionBarSetting.IconSize) or 3))/100 -- Native small buttons are 30px; padding is between containers. f.localScale=1;f.w=10*30*scale+9*(2+(setting(s,Enum.EditModeActionBarSetting.IconPadding) or 2));f.h=30*scale elseif f==ChatFrame1 then local S=Enum.EditModeChatFrameSetting f.w=100*setting(s,S.WidthHundreds)+setting(s,S.WidthTensAndOnes) f.h=100*setting(s,S.HeightHundreds)+setting(s,S.HeightTensAndOnes) elseif f==MinimapCluster then f.w,f.h=215,256 elseif f==BagsBar then f.w,f.h=315,45;f.localScale=0.8 elseif f==MicroMenuContainer then f.w,f.h=241.6,32 elseif f==ObjectiveTrackerFrame then f.w,f.h=250,400 end local a=s.anchorInfo f:SetPoint(a.point,a.relativeTo,a.relativePoint,a.offsetX/f:GetScale(),a.offsetY/f:GetScale()) end end end C_EditMode.GetLayouts=function() return CopyTable(manager.layoutInfo) end local classSaves=0 C_EditMode.SaveLayouts=function(info) assert(info~=manager.layoutInfo and info.layouts~=manager.layoutInfo.layouts,'shared layout was passed instead of detached copy') assert(not combat,'native layout saved in combat') classSaves=classSaves+1 manager.layoutInfo=CopyTable(info) C_EditMode.SetActiveLayout(info.activeLayout) end local cursor,actions=nil,{[37]={'spell',999},[3]={'item',117}} for i=1,12 do _G['MultiBarLeftButton'..i]={action=36+i} end function GetActionInfo(slot) local a=actions[slot]; if a then return unpack(a) end end function GetCursorInfo() if cursor then return unpack(cursor) end end function ClearCursor() cursor=nil end function PickupItem(id) cursor={'item',id} end function PlaceAction(slot) actions[slot]=cursor;cursor=nil end function PickupAction(slot) cursor=actions[slot];actions[slot]=nil end C_Item={PickupItem=PickupItem,GetItemCount=function(id) return id==6948 and 1 or 0 end,GetItemInfoInstant=function(id) return id,'','',nil,nil,id==99999 and 7 or 0,(id==117 or id==453) and 5 or 0 end} C_Container={GetContainerNumSlots=function(bag) return bag==0 and 4 or 0 end,GetContainerItemID=function(_,slot) return ({117,453,117,99999})[slot] end} local P={Translate=function(s) return s end, Localized=function(en) return en end} assert(loadfile(root..'Profile.lua'))('RuenUI',P) assert(loadfile(root..'Controls.lua'))('RuenUI',P) assert(loadfile(root..'CharacterProfiles.lua'))('RuenUI',P) assert(loadfile(root..'LayoutPolicy.lua'))('RuenUI',P) assert(loadfile(root..'Brand.lua'))('RuenUI',P) assert(loadfile(root..'ClassLayout.lua'))('RuenUI',P) for _,file in ipairs({'ButtonStyle.lua','PetExtras.lua','SwingTimers.lua','ExtraBars.lua','OverlayLayout.lua','DamageMeters.lua','ClassAssist.lua','HardwareProfile.lua','FrameTiming.lua','Optimizer.lua','GunAudio.lua','Benchmark.lua'}) do assert(loadfile(root..file))('RuenUI',P) end local available={'JUMP','TARGETNEARESTENEMY','TARGETPREVIOUSENEMY'} for _,entry in ipairs(P.menuBindings) do available[#available+1]=entry[2] end function GetNumBindings() return #available end function GetBinding(i) return available[i] end function UpdateContainerFrameAnchors() if hooks.UpdateContainerFrameAnchors then hooks.UpdateContainerFrameAnchors() end end CreateFrame('Frame','ContainerFrameCombinedBags') ContainerFrameCombinedBags.w,ContainerFrameCombinedBags.h=420,330 ContainerFrameCombinedBags.shown=false ContainerFrameCombinedBags.SetScale=ContainerFrameCombinedBags.SetScaleBase if bundled then assert(loadfile(root..'AddonPresets.lua'))('RuenUI',P) end assert(loadfile(root..'LayoutRecovery.lua'))('RuenUI',P) assert(loadfile(root..'Core.lua'))('RuenUI',P) RuenUICharacter={original={},version=2,addedBindings={['ALT-F']='INTERACTTARGET'}} RuenUIDB={original={},reports={},graphicsVersion=P.graphicsVersion} cvars.graphicsLightMode='1' eventFrame.scripts.OnEvent(eventFrame,'PLAYER_ENTERING_WORLD') assert(RuenUICharacter.version==P.version,RuenUICharacter.layoutStatus) assert(cvars.graphicsLightMode=='1','UI update reset graphics') assert(cvars.lockActionBars=='0' and settings.lockActionBars==false,'action and pet slots must be unlocked in both CVar and Settings') assert(RuenUICharacter.verification.verified,'visible bar verification failed') assert(math.abs(PetActionBar:GetWidth()-408)<.01 and math.abs(PetActionBar:GetHeight()-39)<.01,'native larger pet geometry missing') for i=1,7 do assert(bars[i], 'all 96 slots must be enabled') end local keys={'Q','W','R','T','A','G','H','Z','X','C','V','B'} for i,k in ipairs(keys) do assert(bindings[k]=='ACTIONBUTTON'..i,k) assert(bindings['SHIFT-'..k]=='MULTIACTIONBAR1BUTTON'..i) assert(bindings['CTRL-'..k]=='MULTIACTIONBAR2BUTTON'..i) assert(bindings['ALT-'..k]=='MULTIACTIONBAR5BUTTON'..i, 'near-hand fourth row missing') end for _,prefix in ipairs({'','SHIFT-','CTRL-','CTRL-SHIFT-'}) do assert(bindings[prefix..'E']=='MOVEFORWARD' and bindings[prefix..'D']=='MOVEBACKWARD') assert(bindings[prefix..'S']=='STRAFELEFT' and bindings[prefix..'F']=='STRAFERIGHT') end local numberKeys={'1','2','3','4','5','6','7','8','9','0','-','='} for _,r in ipairs({{'CTRL-','4'},{'SHIFT-','3'},{'ALT-','6'},{'CTRL-SHIFT-','7'}}) do for i,key in ipairs(numberKeys) do assert(bindings[r[1]..key]=='MULTIACTIONBAR'..r[2]..'BUTTON'..i,'missing utility binding') end end assert(modified=='NONE' and cvars.autoSelfCast=='1','Alt abilities must not force self-cast') assert(bindings.F1=='TARGETSELF') for i=1,10 do assert(GetBindingAction(numberKeys[i],true)=='MULTIACTIONBAR4BUTTON'..i,'non-pet class needs utility numbers'); assert(GetBindingAction('CTRL-'..numberKeys[i],true)=='BONUSACTIONBUTTON'..i) end assert(actions[37][1]=='spell' and actions[37][2]==999,'existing click slot overwritten') assert(actions[3][2]==117,'original food shortcut moved') assert(actions[38][2]==6948 and actions[39][2]==117 and actions[40][2]==453,'hearth/food copies missing') assert(not actions[41],'duplicate or nonfood item seeded') local function gap(upper,lower) return upper:GetBottom()*(upper:GetEffectiveScale()/UIParent.scale)-lower:GetTop()*(lower:GetEffectiveScale()/UIParent.scale) end for _,display in ipairs({{1920,1080,1.40625},{2560,1440,1.875},{2133,1200,1.25}}) do UIParent.scale=display[3];UIParent.w=display[1]/display[3];UIParent.h=display[2]/display[3] local originalAnchor=MultiBarLeft.systemInfo.anchorInfo local originalHeight=ObjectiveTrackerFrame.editModeHeight UIParent.scripts.OnSizeChanged() assert(MultiBarLeft.systemInfo.anchorInfo==originalAnchor,'runtime must not mutate shared native layout state') assert(ObjectiveTrackerFrame.editModeHeight==originalHeight,'runtime must not mutate native tracker configuration') assert(MultiBarLeft.point[2]==UIParent and BagsBar.point[2]==UIParent,'protected controls must not anchor to layout-managed frames') local function edge(f,method) return f[method](f)*f:GetEffectiveScale()/UIParent.scale end for _,method in ipairs({'GetLeft','GetRight'}) do assert(math.abs(edge(BagsBar,method)-edge(MicroMenuContainer,method))<0.01,'corner row edges misaligned') assert(math.abs(edge(BagsBar,method)-edge(MultiBarLeft,method))<0.01,'click/bags edges misaligned') end assert(gap(BagsBar,MicroMenuContainer)>=9.9,'bags/menu overlap') assert(gap(MultiBarLeft,BagsBar)>=13.9,'click/bags overlap') assert(gap(MinimapCluster,ObjectiveTrackerFrame)>=23.9,'map/quests overlap') assert(gap(ObjectiveTrackerFrame,MultiBarRight)>=23.9,'quests/click overlap') assert(gap(MultiBarBottomLeft,MainActionBar)>=3.9,'combat rows overlap') assert(gap(PlayerCastingBarFrame,RuenSwingTimers)>=17.9,'swing covers cast spell label') assert(math.abs(RuenSwingTimers:GetWidth()-PlayerCastingBarFrame:GetWidth())<0.01,'swing/cast widths differ') GameTooltip.owner=UIParent;GameTooltip.shown=true hooks.GameTooltip_SetDefaultAnchor(GameTooltip,UIParent) local tx,ty,tw,th=GameTooltip:rect() for _,name in ipairs({'MultiBarRight','MultiBarLeft','ObjectiveTrackerFrame','PlayerFrame','TargetFrame'}) do local x,y,w,h=_G[name]:rect() assert(math.min(tx+tw,x+w)<=math.max(tx,x)+1 or math.min(ty+th,y+h)<=math.max(ty,y)+1,'tooltip overlaps '..name) end end -- Validate all class-control combinations, with maximum native stance/pet counts. local function intersects(a,b) local al,ab,aw,ah=a:rect();local bl,bb,bw,bh=b:rect() if a==PetActionBar then aw=aw+select(3,P.PetExtraGeometry()) end if b==PetActionBar then bw=bw+select(3,P.PetExtraGeometry()) end return math.min(al+aw,bl+bw)-math.max(al,bl)>1 and math.min(ab+ah,bb+bh)-math.max(ab,bb)>1 end local controls={'RuenSwingTimers','StanceBar','PetActionBar','PossessActionBar','MultiCastActionBarFrame','MainMenuBarVehicleLeaveButton','ExtraAbilityContainer','PlayerCastingBarFrame','PlayerFrame','PetFrame','TargetFrame','TargetFrameToT','RuenTargetTargetTarget','FocusFrame'} local scenarios={ warrior={'StanceBar'}, paladin={'StanceBar'}, hunter={'StanceBar','PetActionBar','PetFrame'}, rogue={'StanceBar'}, priest={'StanceBar'}, shaman={'MultiCastActionBarFrame'}, mage={'PetActionBar','PetFrame'}, warlock={'PetActionBar','PetFrame'}, druid={'StanceBar'}, possessed={'PossessActionBar','PetActionBar','MainMenuBarVehicleLeaveButton'}, maximum={'StanceBar','PetActionBar','PetFrame','MultiCastActionBarFrame','PossessActionBar','MainMenuBarVehicleLeaveButton'}, } assert(RuenUIDB.classLayoutVersion==8 and classSaves==2,'class migration missing or repeated') for _,name in ipairs({'PartyFrame','CompactRaidFrameContainer'}) do _G[name].shown=true;UIParent.scripts.OnSizeChanged() assert(not intersects(_G[name],MultiBar7),'group overlaps reserve bars') assert(_G[name]:GetTop()<=UIParent.h,'group is offscreen') _G[name].shown=false end local standardAnchor=CopyTable(manager:GetActiveLayoutInfo().systems[1].anchorInfo) for _,display in ipairs({{1920,1080,1.40625},{2560,1440,1.875},{2133,1200,1.25}}) do UIParent.scale=display[3];UIParent.w=display[1]/display[3];UIParent.h=display[2]/display[3] UIParent.scripts.OnSizeChanged() for class,names in pairs(scenarios) do currentClass=class:upper() for _,n in ipairs(controls) do _G[n].shown=false end for _,n in ipairs(names) do _G[n].shown=true end for _,n in ipairs({'RuenSwingTimers','PlayerCastingBarFrame','PlayerFrame','TargetFrame','TargetFrameToT','RuenTargetTargetTarget','FocusFrame','ExtraAbilityContainer'}) do _G[n].shown=true end CompactRaidFrameContainer.shown=class~='maximum' UIParent.scripts.OnSizeChanged() assert(not CompactRaidFrameContainer.shown or CompactRaidFrameContainer:GetTop()*CompactRaidFrameContainer:GetScale()<=UIParent.h,'full raid offscreen '..class..' '..table.concat(display,',')..' '..table.concat(P.groupLayoutIssues or {},';')) if PetActionBar.shown then local l,b,w,h=PetActionBar:rect() assert(math.abs(l+(w+select(3,P.PetExtraGeometry()))/2-UIParent.w/2)<.01,class..' twelve-button pet row not centered') UIParent.scripts.OnSizeChanged() local l2,b2=PetActionBar:rect() assert(math.abs(l-l2)<.01 and math.abs(b-b2)<.01,'pet layout drifts on refresh') end for _,n in ipairs(controls) do local f=_G[n] if f.shown then local l,b,w,h=f:rect() assert(l>=0 and b>=0 and l+w<=UIParent.w and b+h<=UIParent.h,class..' offscreen '..n) assert(not CompactRaidFrameContainer.shown or not intersects(f,CompactRaidFrameContainer),class..' full raid overlap '..n) for _,other in ipairs({'MainActionBar','MultiBarBottomLeft','MultiBarBottomRight','MultiBarLeft','MultiBarRight','MultiBar5','MultiBar6','MultiBar7','BagsBar','MicroMenuContainer'}) do assert(not intersects(f,_G[other]),class..' overlaps combat/corner '..n..'/'..other) end end end for i,n in ipairs(controls) do for j=i+1,#controls do local other=controls[j] if _G[n].shown and _G[other].shown then assert(not intersects(_G[n],_G[other]),class..' controls overlap '..n..'/'..other..' '..table.concat({_G[n]:rect()},',')..' vs '..table.concat({_G[other]:rect()},',')) end end end end end CompactRaidFrameContainer.shown=false -- Partial and fully learned totems center the actual controls, not empty slots. currentClass='SHAMAN' for _,n in ipairs(controls) do _G[n].shown=false end MultiCastActionBarFrame.shown=true for i=1,4 do local f=CreateFrame('Button','MultiCastSlotButton'..i) f.w,f.h=32,32;f:SetPoint('BOTTOMLEFT',MultiCastActionBarFrame,'BOTTOMLEFT',36+(i-1)*40,3) end for _,count in ipairs({1,2,4}) do for i=1,4 do _G['MultiCastSlotButton'..i].shown=i<=count end UIParent.scripts.OnSizeChanged() local left=MultiCastSlotButton1:GetLeft() local right=_G['MultiCastSlotButton'..count]:GetRight() assert(math.abs((left+right)/2-UIParent.w/2)<0.01,'visible totems not centered') assert(PlayerFrame:GetBottom()<360,'single class row left excessive vertical space') local before=MultiCastActionBarFrame:GetLeft() UIParent.scripts.OnSizeChanged() assert(math.abs(MultiCastActionBarFrame:GetLeft()-before)<0.01,'totem centering drifted') end for i=1,4 do _G['MultiCastSlotButton'..i].shown=false end -- A form learned in combat must already have its reserved anchor. Hooks defer. local stancePoint=StanceBar.point;combat=true StanceBar.scripts.OnShow();assert(StanceBar.point==stancePoint,'form show moved secure geometry in combat') combat=false;UIParent.scripts.OnSizeChanged() local previous=classSaves;P.MigrateClassLayout();assert(classSaves==previous,'migration repeated') local oldShared=manager.layoutInfo;RuenUIDB.classLayoutVersion=nil bindings.Q='MY_SPELL';local cv=changes P.MigrateClassLayout() assert(oldShared.layouts[2].systems[1].anchorInfo.offsetY==standardAnchor.offsetY,'migration changed main bars') assert(bindings.Q=='MY_SPELL' and cv==changes,'class migration reset controls/graphics') bindings.Q='ACTIONBUTTON1' print('PASS: maximum class controls, all 9 class profiles, possession/exit, live frame growth, 1080p/1440p, combat guard and detached per-class migration') -- Notification and native-panel regression coverage, injected into the full HUD simulation. local function makePopup(name,w,h) local f=CreateFrame('Frame',name);f.w,f.h,f.shown=w,h,false function f:IsProtected()return false end function f:ClearAllPoints()self.point=nil end f.ClearAllPointsBase=f.ClearAllPoints return f end local buffs=makePopup('BuffFrame',300,45) local breath=makePopup('MirrorTimer1',260,30) local social=makePopup('ChatAlertFrame',10,10) local quick=makePopup('QuickJoinToastButton',32,32) local bn=makePopup('BNToastFrame',250,63) local timeAlert=makePopup('TimeAlertFrame',250,50) local shard=makePopup('ShardTransferImminentFrame',250,50) local roll=makePopup('GroupLootContainer',256,400) local rolls={} for i=1,4 do rolls[i]=makePopup('GroupLootFrame'..i,286,80) end roll.rollFrames=rolls local talking=makePopup('TalkingHeadFrame',570,155) local alertHost=makePopup('AlertFrame',10,10) local loot1=makePopup('LootTest1',326,80) local loot2=makePopup('LootTest2',326,80) local achievement=makePopup('AchievementTest',360,104) local activeAlerts={} alertHost.alertFrameSubSystems={{alertFramePool={EnumerateActive=function() local i=0;return function()i=i+1;return activeAlerts[i] end end}}} local function nativeSocial() social.shown=true;social:SetPoint('BOTTOMLEFT',ChatFrame1,'TOPLEFT',-20,27) quick.shown=true;quick:SetPoint('BOTTOMLEFT',social,'BOTTOMLEFT',0,0) bn.shown=true;bn:SetPoint('BOTTOMLEFT',quick,'TOPLEFT',0,0) timeAlert.shown=true;timeAlert:SetPoint('BOTTOMLEFT',bn,'TOPLEFT',0,0) shard.shown=true;shard:SetPoint('BOTTOMLEFT',social,'TOPLEFT',30,55) end for _,display in ipairs({{1920,1080,1.40625},{2560,1440,1.875},{1920,1080,1},{2560,1440,1},{1366,768,1}}) do UIParent.scale=display[3];UIParent.w=display[1]/display[3];UIParent.h=display[2]/display[3] for class,names in pairs(scenarios) do if class~='maximum' then currentClass=class:upper() for _,n in ipairs(controls)do _G[n].shown=false end for _,n in ipairs(names)do _G[n].shown=true end for _,n in ipairs({'PlayerCastingBarFrame','PlayerFrame','TargetFrame','TargetFrameToT','RuenTargetTargetTarget','FocusFrame'})do _G[n].shown=true end ExtraAbilityContainer.shown=false CompactRaidFrameContainer.shown=true buffs.shown=true;buffs:SetPoint('TOPRIGHT',UIParent,'TOPRIGHT',-240,-8) breath.shown=true;breath:SetPoint('TOP',UIParent,'TOP',0,-75) nativeSocial();UIParent.scripts.OnSizeChanged() for _,popup in ipairs({quick,bn,timeAlert,shard})do for _,n in ipairs({'MultiBar6','MultiBar7','PartyFrame','CompactRaidFrameContainer'})do if _G[n].shown then assert(not intersects(popup,_G[n]),class..': toast blocked by '..n)end end end -- No protected control may move when a social alert appears during combat. local reserveAnchor=MultiBar6.point;combat=true bn.shown=true;P.PositionOverlayFrames();assert(MultiBar6.point==reserveAnchor) combat=false -- Every combat/utility/bag tooltip is rechecked after its text grows. local oldOwner=GameTooltip.owner GameTooltip.shown=false;GameTooltip.scripts.OnHide(GameTooltip) GameTooltip.owner=MultiBar6;GameTooltip.shown=true for _,size in ipairs({{220,120},{300,260}})do GameTooltip.w,GameTooltip.h=size[1],size[2] GameTooltip.scripts.OnSizeChanged(GameTooltip) for _,obstacle in ipairs(P.OverlayObstacles(false))do local l,b,w,h=GameTooltip:rect() assert((P.tooltipOverSocial and (obstacle.name=='ChatFrame1' or obstacle.name=='Social notifications')) or not (lobstacle.left and bobstacle.bottom),'tooltip blocks '..(obstacle.name or '?')..' '..class..' '..table.concat(display,',')..' '..tostring(P.tooltipUnplaced)..' tip '..table.concat({GameTooltip:rect()},',')..' raid '..table.concat({CompactRaidFrameContainer:rect()},',')) end end GameTooltip.owner=oldOwner;GameTooltip.w,GameTooltip.h=220,120 GameTooltip.shown=false -- independent notification cases; saturation is checked separately for _,case in ipairs({'loot','rolls','talking'})do breath.shown=case~='talking' activeAlerts={};loot1.shown=false;loot2.shown=false;achievement.shown=false;roll.shown=false;talking.shown=false if case=='loot' or case=='mixed' then loot1.shown=true;loot2.shown=true;achievement.shown=true;activeAlerts={loot1,loot2,achievement} end if case=='rolls' or case=='mixed' then roll.shown=true end if case=='talking' or case=='mixed' then talking.shown=true end for _,f in ipairs(rolls)do f.shown=roll.shown end P.PositionOverlayFrames() assert(#P.overlayUnplaced==0,display[1]..'/'..class..'/'..case..': no room for '..table.concat(P.overlayUnplaced,',')) -- A later native reanchor/late addon event is repaired, including combat -- notifications, without moving secure action buttons. if case=='loot' then loot1:SetPoint('BOTTOMLEFT',UIParent,'BOTTOMLEFT',450,48) local anchor=MainActionBar.point;combat=true P.overlayListener.scripts.OnEvent(nil,'ADDON_LOADED') assert(MainActionBar.point==anchor,'alert event moved protected bars') combat=false end local problems=P.OverlayAudit() assert(#problems==0,display[1]..'/'..class..'/'..case..': '..table.concat(problems,',')) local popupList={talking,loot1,loot2,achievement,unpack(rolls)} for i,f in ipairs(popupList)do if f.shown then for j=i+1,#popupList do if popupList[j].shown then assert(not intersects(f,popupList[j]),'alerts overlap each other')end end end end end for _,f in ipairs(rolls)do f.shown=false end roll.shown=false;talking.shown=false;loot1.shown=false;loot2.shown=false;achievement.shown=false;activeAlerts={} end end end -- Reflow bag geometry after the native bank OnShow stack has returned; never -- recursively invoke Blizzard's bag manager from a Ruen event or command. -- Saturated layouts must fail visibly in diagnostics without hiding an alert, -- dropping its content, changing protected controls or crashing. ExtraAbilityContainer.shown=true;UIParent.scripts.OnSizeChanged() local huge=makePopup('OversizeTest',UIParent.w+100,UIParent.h+100) huge.shown=true;activeAlerts={huge};local hugePoint=huge.point P.PositionOverlayFrames() assert(#P.overlayUnplaced==1 and huge.shown and huge.point==hugePoint) assert(#P.OverlayAudit()>0,'unplaced alert absent from diagnostics') huge.shown=false;activeAlerts={};ExtraAbilityContainer.shown=false local nativeAnchors=UpdateContainerFrameAnchors UpdateContainerFrameAnchors=function()error('Ruen called native bag manager')end local nativeAfter=C_Timer.After;local pending={} C_Timer.After=function(_,fn)pending[#pending+1]=fn end ContainerFrameCombinedBags.shown=true;ContainerFrameCombinedBags.h=330 local before=ContainerFrameCombinedBags.point hooks.UpdateContainerFrameAnchors() assert(ContainerFrameCombinedBags.point==before and #pending==1,'bag hook ran inline in bank OnShow') while #pending>0 do local f=table.remove(pending,1);f()end SlashCmdList.RUENUI('bags') while #pending>0 do local f=table.remove(pending,1);f()end C_Timer.After=nativeAfter;UpdateContainerFrameAnchors=nativeAnchors ContainerFrameCombinedBags.shown=false CompactRaidFrameContainer.shown=false for _,f in ipairs({buffs,breath,social,quick,bn,timeAlert,shard,roll,talking,loot1,loot2,achievement})do f.shown=false end print('PASS: social stack reserved in/out of combat; loot/achievement stacks, four loot rolls, dialogue popups; saturated layouts reported without hiding alerts; all clear every class HUD at 1080p/1440p/1366x768; bank hook deferred with no native manager invocation') -- Simulate the native sequence: SetOwner/default anchor -> blank/partial text -- -> SetAction final text -> next-frame callbacks. Rendering happens afterward. local oldAfter=C_Timer.After local pending={} C_Timer.After=function(_,fn) pending[#pending+1]=fn end local function flush() local n=0 while #pending>0 do n=n+1;assert(n<=8,'tooltip resize feedback loop') table.remove(pending,1)() end return n end local owner=CreateFrame('Button','TooltipSpellTest');owner.parent=MainActionBar local secondOwner=CreateFrame('Button','TooltipOtherSpellTest');secondOwner.parent=MultiBarLeft local originalClear,originalSet=GameTooltip.ClearAllPointsBase,GameTooltip.SetPointBase local placements=0 GameTooltip.ClearAllPointsBase=function(self)self.point=nil end GameTooltip.SetPointBase=function(self,...) placements=placements+1;originalSet(self,...) -- A layout pass may itself emit a size notification. It must settle. self.scripts.OnSizeChanged(self) end local originalFind=P.FindOverlayPosition;local searches=0 P.FindOverlayPosition=function(...)searches=searches+1;return originalFind(...)end local function nativeRefresh(button,width,height) GameTooltip.owner=button GameTooltip.shown=false;GameTooltip.scripts.OnHide(GameTooltip) GameTooltip.w,GameTooltip.h=0,0 -- Native anchoring happens before text is repopulated every refresh. originalSet(GameTooltip,'BOTTOMRIGHT',UIParent,'BOTTOMRIGHT',-13,13) hooks.GameTooltip_SetDefaultAnchor(GameTooltip,button) GameTooltip.scripts.OnSizeChanged(GameTooltip) GameTooltip.w,GameTooltip.h=320,16 GameTooltip.scripts.OnSizeChanged(GameTooltip) GameTooltip.w,GameTooltip.h=width,height;GameTooltip.shown=true GameTooltip.scripts.OnShow(GameTooltip) GameTooltip.scripts.OnSizeChanged(GameTooltip) assert(#pending==1,'tooltip refresh was not coalesced') flush() end local function anchor() local point,relative,rp,x,y=GameTooltip:GetPoint(1) assert(point=='BOTTOMRIGHT' and relative==UIParent and rp=='BOTTOMLEFT') return x,y end GameTooltip.shown=false;GameTooltip.scripts.OnHide(GameTooltip);flush() for _,display in ipairs({{1920,1080,1.40625},{2560,1440,1.875},{2560,1440,1}})do UIParent.scale=display[3];UIParent.w=display[1]/display[3];UIParent.h=display[2]/display[3] UIParent.scripts.OnSizeChanged();flush() nativeRefresh(owner,240,180) local x,y=anchor();local count=searches combat=true for i=1,100 do nativeRefresh(owner,240,180) local nx,ny=anchor() assert(math.abs(nx-x)<.001 and math.abs(ny-y)<.001,'stationary spell tooltip jittered') end combat=false assert(searches==count,'refreshes repeatedly searched for another tooltip position') -- A genuinely larger finished tooltip may reflow once; shrinking afterward -- must not send it back to a different anchor every cooldown refresh. nativeRefresh(owner,290,300) x,y=anchor();count=searches for i=1,30 do nativeRefresh(owner,240,180);local nx,ny=anchor() assert(nx==x and ny==y,'shrinking tooltip oscillated') nativeRefresh(owner,290,300);nx,ny=anchor() assert(nx==x and ny==y,'returning tooltip oscillated') end assert(searches==count,'settled footprint was not retained') local before=placements GameTooltip.scripts.OnSizeChanged(GameTooltip);flush() assert(placements==before,'unchanged tooltip rewrote its own anchor') nativeRefresh(secondOwner,220,120) assert(GameTooltip.owner==secondOwner,'moving to a different button lost its owner') -- Real dismissal ends the hover. The next tooltip must measure afresh. GameTooltip.shown=false;GameTooltip.scripts.OnHide(GameTooltip);flush() nativeRefresh(owner,220,120) end -- Custom anchors belonging to another UI/addon remain under that owner's control. local custom=CreateFrame('Frame','CustomTooltipOwner');custom.parent=UIParent GameTooltip.shown=false;GameTooltip.scripts.OnHide(GameTooltip);flush() GameTooltip.owner=custom;GameTooltip.shown=true originalSet(GameTooltip,'TOPLEFT',custom,'BOTTOMLEFT',5,-5) local customPoint=GameTooltip.point GameTooltip.scripts.OnShow(GameTooltip);GameTooltip.scripts.OnSizeChanged(GameTooltip);flush() assert(GameTooltip.point==customPoint,'unmanaged custom tooltip was moved') GameTooltip.shown=false;GameTooltip.scripts.OnHide(GameTooltip);flush() GameTooltip.ClearAllPointsBase,GameTooltip.SetPointBase=originalClear,originalSet P.FindOverlayPosition=originalFind;C_Timer.After=oldAfter GameTooltip.w,GameTooltip.h=220,120;GameTooltip.owner=UIParent;GameTooltip.shown=true print('PASS: 480 native spell refreshes stable across resolutions and combat; temporary blank/partial text ignored; growth/shrink stable; no resize feedback or repeated searches; new owners and custom anchors respected') -- Regression: an old alt still has mask 11 after a different character has -- completed the account-wide layout migration (mask 127). local originalCharacter=RuenUICharacter local originalBars={GetActionBarToggles()} local originalQ=bindings.Q local function setLegacyBars() for i=1,7 do Settings.SetValue('PROXY_SHOW_ACTIONBAR_'..(i+1),i==1 or i==2 or i==4) end end local function assertExpanded() local visible={GetActionBarToggles()} for i=1,7 do assert(visible[i],'old character still missing action bar '..(i+1))end assert(RuenUICharacter.extraBarsVisibilityVersion==1,'visibility not marked per character') end assert(RuenUIDB.extraBarsVersion==1,'fixture needs already-migrated account') local saves,graphics=classSaves,changes local existingSpell=actions[37] bindings.Q='MY_PERSONAL_HUNTER_BINDING' local oldBackup={false,false,false,false,false,false,false} RuenUICharacter={version=P.version,oldBars=oldBackup,personalSetting='keep'} setLegacyBars();P.MigrateExtraBars() assertExpanded() assert(RuenUICharacter.oldBars==oldBackup,'original restore snapshot overwritten') assert(classSaves==saves,'visibility repair rewrote shared Edit Mode layout') assert(changes==graphics and actions[37]==existingSpell and bindings.Q=='MY_PERSONAL_HUNTER_BINDING','visibility repair reset graphics, abilities or bindings') assert(RuenUICharacter.personalSetting=='keep') -- Subsequent refreshes, reloads and lock/unlock may not undo manual choices. Settings.SetValue('PROXY_SHOW_ACTIONBAR_7',false) P.MigrateExtraBars();P.MigrateExtraBars(true) assert(not bars[6],'migration repeated after completion') -- A second character gets its own migration and backup, not the first alt's. RuenUICharacter={version=P.version};setLegacyBars();P.MigrateExtraBars() assertExpanded() for i=1,7 do assert(RuenUICharacter.oldBars[i]==(i==1 or i==2 or i==4),'wrong pre-upgrade bar snapshot')end -- A guarded attempt must not mark completion before it can enable anything. for _,guard in ipairs({'combat','disabled','edit','override','foreign'})do RuenUICharacter={version=P.version};setLegacyBars() local name=manager:GetActiveLayoutInfo().layoutName local shown=manager.IsShown if guard=='combat' then combat=true elseif guard=='disabled' then RuenUIDB.disabled=true elseif guard=='edit' then manager.IsShown=function()return true end elseif guard=='override' then manager.overrideLayoutInfo={} else manager:GetActiveLayoutInfo().layoutName='Personal Layout' end P.MigrateExtraBars() assert(not bars[5] and not RuenUICharacter.extraBarsVisibilityVersion,'guarded migration changed or marked state: '..guard) combat=false;RuenUIDB.disabled=nil;manager.IsShown=shown;manager.overrideLayoutInfo=nil manager:GetActiveLayoutInfo().layoutName=name P.MigrateExtraBars();assertExpanded() end RuenUICharacter=originalCharacter;bindings.Q=originalQ for i=1,7 do Settings.SetValue('PROXY_SHOW_ACTIONBAR_'..(i+1),originalBars[i]) end print('PASS: old mask-11 characters upgrade independently on migrated accounts; original backups, actions, custom bindings and graphics preserved; repeat/manual choices and combat/edit/disabled/foreign-layout guards respected') -- Rebranding preserves a pre-existing layout and narration choices. local savedLayout=CopyTable(manager:GetActiveLayoutInfo()) manager:GetActiveLayoutInfo().layoutName=P.legacyLayoutName local voice={Language={Voice='ruRU',Fallback='enUS'},personal=17} SpokenSettings={profiles={['Brad Narration']=voice},profileKeys={Tester='Brad Narration',Other='Personal'},global={NewCharacterProfile='Brad Narration'}} local activeVoice='Brad Narration' SpokenEnv={Addon={db={GetCurrentProfile=function() return activeVoice end,SetProfile=function(_,name) activeVoice=name end}}} local keyBefore=bindings.Q;local graphicsBefore=changes P.MigrateBrand() assert(manager:GetActiveLayoutInfo().layoutName=='Ruen UI - Clear ESDF') assert(manager:GetActiveLayoutInfo().systems[1].anchorInfo.offsetY==savedLayout.systems[1].anchorInfo.offsetY) assert(SpokenSettings.profiles['Ruen Narration']==voice and not SpokenSettings.profiles['Brad Narration']) assert(activeVoice=='Ruen Narration' and voice.Language.Voice=='ruRU' and voice.personal==17) assert(SpokenSettings.profileKeys.Tester=='Ruen Narration' and SpokenSettings.profileKeys.Other=='Personal') assert(bindings.Q==keyBefore and changes==graphicsBefore) local savesBefore=classSaves;P.MigrateBrand();assert(classSaves==savesBefore) assert(SLASH_RUENUI1=='/ruen' and SLASH_RUENUI2=='/ruenui' and SLASH_RUENUI3==nil) print('PASS: Ruen UI name migration preserves geometry, bindings, graphics and Russian narration; old command remains an alias') -- Native pet dragging must work without Shift; keep native right-click behavior. Settings.GetValue=function(key) return settings[key] end local pickedPet function PickupPetAction(id) pickedPet=id end function IsModifiedClick() return false end BaseActionButtonMixin={BaseActionButtonMixin_OnDragStart=function() end} assert(loadfile((assert(os.getenv('RUEN_NATIVE_UI'))..'/PetActionBar.lua')))() PetActionBar.Update=function() end PetActionButtonMixin.PetActionButtonMixin_OnDragStart({SetChecked=function() end,GetID=function() return 4 end}) assert(pickedPet==4,'native pet dragging still requires Shift') -- Explicit unlock is combat guarded and does not change assignments or bindings. settings.lockActionBars=true;combat=true;SlashCmdList.RUENUI('unlock') assert(settings.lockActionBars==true,'unlock changed settings in combat') combat=false;SlashCmdList.RUENUI('unlock');assert(settings.lockActionBars==false) SlashCmdList.RUENUI('lock');assert(settings.lockActionBars and cvars.lockActionBars=='1') local locks=changes;eventFrame.scripts.OnEvent(eventFrame,'PLAYER_ENTERING_WORLD');assert(settings.lockActionBars and changes==locks,'login reset user lock') SlashCmdList.RUENUI('unlock');assert(not settings.lockActionBars) print('PASS: native pet ability drag without Shift, and guarded unlock command') -- New mouse/menu migration and native inventory clearance. assert(bindings.BUTTON3=='JUMP' and bindings.SPACE=='JUMP') assert(bindings.BUTTON4=='TARGETPREVIOUSENEMY' and bindings.BUTTON5=='TARGETNEARESTENEMY') assert(bindings.N=='TOGGLEWORLDMAP' and not bindings.M) assert(bindings.P=='TOGGLESPELLBOOK' and bindings['SHIFT-P']=='TOGGLEPROFESSIONBOOK') assert(bindings.L=='TOGGLEGROUPFINDER' and bindings.F8=='RUENUI_MACROS') ContainerFrameCombinedBags.shown=true for _,display in ipairs({{1920,1080,1.40625},{2560,1440,1.875},{2133,1200,1.25}}) do UIParent.scale=display[3];UIParent.w=display[1]/display[3];UIParent.h=display[2]/display[3] ContainerFrameCombinedBags.localScale=1 UIParent.scripts.OnSizeChanged() local function edge(f,m) return f[m](f)*f:GetEffectiveScale()/UIParent.scale end assert(edge(ContainerFrameCombinedBags,'GetBottom')>=edge(MultiBarLeft,'GetTop')+21.9,'bag covers click bar') assert(edge(ContainerFrameCombinedBags,'GetBottom')>=edge(MultiBarBottomRight,'GetTop')+21.9,'bag covers combat rows') assert(not intersects(ContainerFrameCombinedBags,ObjectiveTrackerFrame),'bag covers quest column') assert(edge(ContainerFrameCombinedBags,'GetLeft')>=0 and edge(ContainerFrameCombinedBags,'GetTop')<=UIParent.h,'bag extends off screen') assert(ContainerFrameCombinedBags.point[2]==UIParent,'bag must not anchor to protected bar') end local bagPoint=ContainerFrameCombinedBags.point combat=true;UpdateContainerFrameAnchors();assert(ContainerFrameCombinedBags.point==bagPoint,'bag moved in combat');combat=false -- Large inventory must still fit above controls. ContainerFrameCombinedBags.h=900 UpdateContainerFrameAnchors() assert(ContainerFrameCombinedBags:GetTop()*ContainerFrameCombinedBags:GetEffectiveScale()/UIParent.scale<=UIParent.h, 'large bag top='..ContainerFrameCombinedBags:GetTop()..' scale='..ContainerFrameCombinedBags:GetScale()..' ui='..UIParent.h..' unplaced='..tostring(P.bagUnplaced)) ContainerFrameCombinedBags.h=330;ContainerFrameCombinedBags.shown=false -- A control-only migration leaves a user's combat keys/CVars/layout intact. RuenUIDB.controlsVersion=nil bindings.Q='PERSONAL_COMBAT';bindings.P='OLD_SPELL_KEY' local oldGraphics=changes;local oldLayout=manager:GetActiveLayoutInfo() eventFrame.scripts.OnEvent(eventFrame,'PLAYER_ENTERING_WORLD') assert(bindings.Q=='PERSONAL_COMBAT' and changes==oldGraphics and manager:GetActiveLayoutInfo()==oldLayout) assert(bindings.P=='TOGGLESPELLBOOK') bindings.P='PERSONAL_MENU' eventFrame.scripts.OnEvent(eventFrame,'PLAYER_ENTERING_WORLD') assert(bindings.P=='PERSONAL_MENU','one-time migration overwritten personal menu key') SlashCmdList.RUENUI('bindings');assert(bindings.P=='TOGGLESPELLBOOK') -- Language changes use Spoken's live profile and native CVars, no API spoofing. local voiceProfile={Language={Voice='enUS',Fallback='enUS'}} SpokenEnv={Addon={db={profile=voiceProfile}}} Spoken={GetLanguageChoice=function() return voiceProfile.Language.Voice,voiceProfile.Language.Fallback end,StopAll=function() end} function GetLocale() return 'enUS' end function GetAvailableLocales() return 'enUS','ruRU' end cvars.textLocale,cvars.audioLocale='enUS','enUS' SlashCmdList.RUENUI('voice ru') assert(voiceProfile.Language.Voice=='ruRU' and cvars.textLocale=='enUS') SlashCmdList.RUENUI('language ru') assert(cvars.textLocale=='ruRU' and cvars.audioLocale=='ruRU') SlashCmdList.RUENUI('language en') assert(cvars.textLocale=='enUS' and cvars.audioLocale=='enUS' and voiceProfile.Language.Voice=='enUS') function GetAvailableLocales() return 'enUS' end SlashCmdList.RUENUI('language ru') assert(cvars.textLocale=='enUS' and cvars.audioLocale=='enUS' and voiceProfile.Language.Voice=='ruRU','unsupported locale must not change game CVars') local prior=changes;SlashCmdList.RUENUI('language nonsense');assert(changes==prior) function GetAvailableLocales() return 'enUS','ruRU' end combat=true;SlashCmdList.RUENUI('language ru');assert(cvars.textLocale=='enUS');combat=false SlashCmdList.RUENUI('help');SlashCmdList.RUENUI('language') local before=changes eventFrame.scripts.OnEvent(eventFrame,'PLAYER_ENTERING_WORLD') assert(changes==before,'subsequent login reapplied settings') -- Profile migration on both account/character binding sets preserves persisted -- keys, custom keys, action assignments and graphics while changing only the -- current character's effective number controls. local savedBindings,savedCharacter,savedDB=CopyTable(bindings),CopyTable(RuenUICharacter),CopyTable(RuenUIDB) local originalSet=GetCurrentBindingSet local activeSet=1 function GetCurrentBindingSet()return activeSet end for _,bindingSet in ipairs({1,2}) do activeSet=bindingSet RuenUIDB=CopyTable(savedDB);RuenUICharacter=CopyTable(savedCharacter) RuenUICharacter.numberBindingBases=nil;RuenUICharacter.numberProfile='utility' local scope=bindingSet==1 and RuenUIDB or RuenUICharacter scope.petBindingsVersion=2;scope.extraBindingsVersion=1 for i,key in ipairs(numberKeys) do bindings[key]=i<=10 and 'BONUSACTIONBUTTON'..i or 'CLICK RuenPetExtraButton'..i..':LeftButton' bindings['CTRL-'..key]='MULTIACTIONBAR4BUTTON'..i end bindings['ALT-Q']='MY_ALT_SPELL';bindings['SHIFT-1']='MY_SHIFT_SPELL';bindings['-']='PERSONAL_MINUS' local persistent=CopyTable(bindings) local actionSnapshot=CopyTable(actions);local graphicsBefore=changes combat=true;P.ApplyExtraBindings(false) assert(not RuenUICharacter.numberBindingBases,'combat migration was not deferred') combat=false;P.ApplyExtraBindings(false) for i=1,10 do assert(GetBindingAction(numberKeys[i],true)=='MULTIACTIONBAR4BUTTON'..i) assert(GetBindingAction('CTRL-'..numberKeys[i],true)=='BONUSACTIONBUTTON'..i) end assert(GetBindingAction('-',true)=='PERSONAL_MINUS','custom minus stolen') for k,v in pairs(persistent)do assert(bindings[k]==v,'profile mutated persisted binding '..k)end assert(changes==graphicsBefore,'binding migration changed graphics') for slot,a in pairs(actionSnapshot) do assert(actions[slot][1]==a[1] and actions[slot][2]==a[2],'binding migration changed actions')end bindings['1']='PERSONAL_KEY';P.ApplyPetBindings(false) assert(GetBindingAction('1',true)=='PERSONAL_KEY','later manual change was overridden') P.ClearCharacterBindings() assert(GetBindingAction('CTRL-1',true)=='MULTIACTIONBAR4BUTTON1','profile restore left override') end GetCurrentBindingSet=originalSet;bindings=savedBindings;RuenUICharacter=savedCharacter;RuenUIDB=savedDB P.ApplyCharacterBindings(false) print('PASS: account/character base bindings unchanged by profile migration; custom keys, action slots, combat deferral and override restoration') -- A graphics-only upgrade must not replace the existing UI layout or custom keys. RuenUIDB.graphicsVersion=1 bindings.Z='USER_PREFERENCE' local layoutsBefore=#manager:GetLayouts() eventFrame.scripts.OnEvent(eventFrame,'PLAYER_ENTERING_WORLD') assert(RuenUIDB.graphicsVersion==P.graphicsVersion) assert(cvars.graphicsComputeEffects=='2' and cvars.graphicsLightMode=='1') assert(cvars.maxFPS=='60' and cvars.maxFPSBk=='15' and cvars.RenderScale=='1') assert(cvars.MSAAQuality=='0,0' and cvars.groundEffectDensity=='24') assert(bindings.Z=='USER_PREFERENCE' and #manager:GetLayouts()==layoutsBefore,'graphics upgrade reset user UI') local afterGraphics=changes eventFrame.scripts.OnEvent(eventFrame,'PLAYER_ENTERING_WORLD') assert(changes==afterGraphics,'graphics upgrade reapplied every login') SlashCmdList.RUENUI('apply'); assert(#manager:GetLayouts()==2) combat=true;before=changes;SlashCmdList.RUENUI('apply');assert(changes==before) combat=false -- Exercise the actual reset commands with enlarged, moved and saved chat. do local function equal(a,b) if type(a)~=type(b) then return false end if type(a)~='table' then return a==b end for k,v in pairs(a)do if not equal(v,b[k])then return false end end for k in pairs(b)do if a[k]==nil then return false end end return true end local originalClass=currentClass local priorKey,priorFPS,priorShadow=bindings.Z,cvars.maxFPS,cvars.graphicsShadowQuality bindings.Z='MY_CUSTOM_BINDING';cvars.maxFPS='37';cvars.graphicsShadowQuality='0' local originalCvars,originalBindings,originalActions=CopyTable(cvars),CopyTable(bindings),CopyTable(actions) local otherLayout=CopyTable(manager.layoutInfo.layouts[1]) local function enlargeChat() for _,s in ipairs(manager:GetActiveLayoutInfo().systems)do if s.system==Enum.EditModeSystem.ChatFrame then local S=Enum.EditModeChatFrameSetting for _,v in ipairs(s.settings)do if v.setting==S.HeightHundreds then v.value=5 end if v.setting==S.HeightTensAndOnes then v.value=50 end end s.anchorInfo.offsetX=60;s.anchorInfo.offsetY=120 end end C_EditMode.SetActiveLayout(manager.layoutInfo.activeLayout) end enlargeChat() local shared=manager.layoutInfo;local prior=CopyTable(shared) local function assertChat() assert(ChatFrame1:GetHeight()==150,'chat reset did not restore compact height') assert(ChatFrame1:GetWidth()<=380,'chat reset did not restore compact width') assert(ChatFrame1:GetLeft()==20 and ChatFrame1:GetBottom()==45,'chat reset did not restore anchor') end SlashCmdList.RUENUI('chat reset');assertChat() assert(equal(shared,prior),'chat reset mutated shared layout data') for i,s in ipairs(prior.layouts[prior.activeLayout].systems)do if s.system~=Enum.EditModeSystem.ChatFrame then assert(equal(s,manager:GetActiveLayoutInfo().systems[i]),'chat reset altered another saved system') end end assert(not intersects(ChatFrame1,MultiBar6) and not intersects(ChatFrame1,MultiBar7),'reset left chat/bar overlap') assert(RuenUICharacter.layoutBeforeReset=='simulation-export','missing recovery export') C_EditMode.SetActiveLayout(manager.layoutInfo.activeLayout);assertChat() for _,class in ipairs({'HUNTER','WARLOCK','ROGUE','DRUID','WARRIOR','PALADIN','PRIEST','MAGE','SHAMAN'})do currentClass=class;enlargeChat() manager:GetActiveLayoutInfo().systems[1].anchorInfo.offsetY=400 SlashCmdList.RUENUI('layout reset');assertChat() assert(manager:GetActiveLayoutInfo().systems[1].anchorInfo.offsetY==48,'main bar reset failed for '..class) assert(#manager:GetLayouts()==layoutsBefore and equal(manager.layoutInfo.layouts[1],otherLayout),'reset replaced unrelated layouts') end currentClass=originalClass assert(equal(cvars,originalCvars),'layout reset changed graphics/gameplay CVars') assert(equal(bindings,originalBindings) and equal(actions,originalActions),'layout reset changed keys/actions') bindings.Z=priorKey;cvars.maxFPS=priorFPS;cvars.graphicsShadowQuality=priorShadow for _,guard in ipairs({'combat','edit','override','disabled','other'})do local shown=manager.IsShown;local savedName=manager:GetActiveLayoutInfo().layoutName if guard=='combat'then combat=true elseif guard=='edit'then manager.IsShown=function()return true end elseif guard=='override'then manager.overrideLayoutInfo={} elseif guard=='disabled'then RuenUIDB.disabled=true else manager:GetActiveLayoutInfo().layoutName='Personal Layout' end local prior=CopyTable(manager.layoutInfo);local saves=classSaves SlashCmdList.RUENUI('chat reset');SlashCmdList.RUENUI('layout reset') assert(equal(manager.layoutInfo,prior) and saves==classSaves,'reset ignored guard: '..guard) combat=false;manager.IsShown=shown;manager.overrideLayoutInfo=nil;RuenUIDB.disabled=nil manager:GetActiveLayoutInfo().layoutName=savedName end print('PASS: saved chat and nine-class layout reset, detached native state, persistence, unrelated layout/CVar/key/action preservation, combat/edit/override/disabled guards') end bindings.Z='USER_NEW_ACTION';actions[39]={'item',888} SlashCmdList.RUENUI('restore') for k,a in pairs(initialBindings) do if k~='ALT-F' then assert(bindings[k]==a,'undo mismatch '..k) end end assert(bindings.Z=='USER_NEW_ACTION' and not bindings['ALT-F']) assert(actions[39][2]==888 and not actions[38] and not actions[40],'seeded action undo changed user edits') assert(actions[37][2]==999 and actions[3][2]==117) assert(RuenUIDB.disabled and manager.layoutInfo.activeLayout==1) assert(reloads==0,'never reload the game from a timer') print('PASS: '..(bundled and 'portable' or 'live')..' ESDF, 96 bindings, action/pet lock, four combat rows and two utility groups, inventory-safe seeding, undo, geometry at 1080p/1440p/scaled desktop, tooltip clearance, graphics retention and combat guard') -- Exercise the native visibility methods, not a model of their conditions. local meterSource=(assert(os.getenv('RUEN_NATIVE_UI'))..'/DamageMeter.lua') CVarCallbackRegistry={SetCVarCachable=noop,GetCVarValueBool=function(_,k)return cvars[k]=='1'end} assert(loadfile(meterSource))() local inside,kind,available,inEdit=true,'party',true,false function IsInInstance()return inside,kind end C_DamageMeter={IsDamageMeterAvailable=function()return available,available and nil or 'restricted'end} local meter=makePopup('DamageMeter',400,200) meter.systemInfo={settings={}};meter.visibility=Enum.DamageMeterVisibility.InCombat meter:SetPoint('TOPLEFT',UIParent,'TOPLEFT',50,-70) local originalMeterPoint=meter.point meter.ShouldBeShown=DamageMeterMixin.ShouldBeShown meter.UpdateShownState=DamageMeterMixin.UpdateShownState function meter:IsEditing()return inEdit end function meter:IsPlayerInCombat()return combat end function meter:IsPlayerInGroup()return true end function meter:SetShown(v)self.shown=v end function meter:UpdateSessionTimerState()end function meter:RefreshLayout()end local nativeMeterSelect=C_EditMode.SetActiveLayout C_EditMode.SetActiveLayout=function(index) nativeMeterSelect(index) for _,s in ipairs(manager:GetActiveLayoutInfo().systems)do if s.system==Enum.EditModeSystem.DamageMeter then meter.systemInfo=s meter.visibility=setting(s,Enum.EditModeDamageMeterSetting.Visibility) or Enum.DamageMeterVisibility.InCombat meter:UpdateShownState() end end end function meter:UpdateSystemSettingVisibility() self.visibility=setting(self.systemInfo,Enum.EditModeDamageMeterSetting.Visibility) or Enum.DamageMeterVisibility.InCombat self:UpdateShownState() end function meter:OnUpdateSystem()end function manager:IsShown()return inEdit end -- Never leave unrelated popup stress fixtures enabled for these scenarios. activeAlerts={} for _,f in ipairs({roll,talking,loot1,loot2,achievement,breath,buffs,ContainerFrameCombinedBags,GameTooltip,unpack(rolls)})do f.shown=false end SlashCmdList.RUENUI('apply') assert(cvars.damageMeterEnabled=='1' and RuenUIDB.original.damageMeterEnabled=='0') for _,case in ipairs({{false,'none',false},{true,'party',true},{true,'raid',true},{true,'pvp',false},{true,'arena',false},{true,'scenario',false},{false,'party',false}})do inside,kind=case[1],case[2] P.damageMeterListener.scripts.OnEvent(nil,'PLAYER_ENTERING_WORLD') assert(meter:IsShown()==case[3],'instance gate '..kind) end inside,kind=true,'party';P.RefreshDamageMeters() local p=meter.point;combat=true;inside=false;P.damageMeterListener.scripts.OnEvent(nil,'ZONE_CHANGED_NEW_AREA') assert(meter:IsShown() and p==meter.point,'combat change was not deferred') combat=false;P.damageMeterListener.scripts.OnEvent(nil,'PLAYER_REGEN_ENABLED');assert(not meter:IsShown()) SlashCmdList.RUENUI('meters show');assert(meter:IsShown()) SlashCmdList.RUENUI('meters off');assert(not meter:IsShown()) SlashCmdList.RUENUI('meters auto');inside=true available=false;P.RefreshDamageMeters();assert(not meter:IsShown(),'native availability bypassed') available=true;P.RefreshDamageMeters();assert(meter:IsShown()) inEdit=true;P.RefreshDamageMeters();assert(meter.w==400 and meter.h==200,'Edit Mode did not regain dimensions') inEdit=false;P.RefreshDamageMeters();assert(meter.w<=260) -- A native layout refresh must not overwrite its shared settings table. local info=meter.systemInfo;local infoBefore=CopyTable(info) meter:UpdateSystemSettingVisibility();hooks.UpdateSystemSettingVisibility() assert(meter:IsShown() and meter.systemInfo==info and setting(info,Enum.EditModeDamageMeterSetting.Visibility)==setting(infoBefore,Enum.EditModeDamageMeterSetting.Visibility)) local samples=0 for _,display in ipairs({{1920,1080,1.40625},{2560,1440,1.875},{1920,1080,1},{2560,1440,1},{1366,768,1}})do UIParent.scale=display[3];UIParent.w=display[1]/display[3];UIParent.h=display[2]/display[3] for class,names in pairs(scenarios)do if class~='maximum' then currentClass=class:upper() for _,n in ipairs(controls)do _G[n].shown=false end for _,n in ipairs(names)do _G[n].shown=true end for _,n in ipairs({'PlayerCastingBarFrame','PlayerFrame','TargetFrame','TargetFrameToT','RuenTargetTargetTarget','FocusFrame'})do _G[n].shown=true end ExtraAbilityContainer.shown=false;CompactRaidFrameContainer.shown=true nativeSocial();UIParent.scripts.OnSizeChanged();P.RefreshDamageMeters() assert(meter:IsShown(),display[1]..'/'..class..': '..tostring(RuenUICharacter.damageMeterStatus.reason)) local l,b,w,h=meter:rect() assert(l>=0 and b>=0 and l+w<=UIParent.w and b+h<=UIParent.h) for _,o in ipairs(P.OverlayObstacles(false))do if o.name~='DamageMeter' then assert(not(lo.left and bo.bottom),'meter blocks '..(o.name or '?')..' '..class) end end GameTooltip.owner=MainActionBar;GameTooltip.shown=true;GameTooltip.w,GameTooltip.h=240,150 P.ResetTooltipPosition(GameTooltip);P.PositionTooltip(GameTooltip,true) assert(not intersects(meter,GameTooltip),'tooltip overlaps meter') GameTooltip.shown=false ContainerFrameCombinedBags.shown=true;ContainerFrameCombinedBags.w,ContainerFrameCombinedBags.h=400,200 SlashCmdList.RUENUI('bags');assert(P.bagOverHUD or not intersects(meter,ContainerFrameCombinedBags),'bag overlaps meter') ContainerFrameCombinedBags.shown=false for _,f in ipairs(rolls)do f.shown=true end P.PositionOverlayFrames() assert(#P.overlayUnplaced==0,'no room for rolls with meter '..class) for _,f in ipairs(rolls)do assert((P.overlayOverOptional and P.overlayOverOptional[f]) or not intersects(meter,f),'loot roll overlaps meter');f.shown=false end samples=samples+1 end end end -- Restore returns native geometry/visibility and the original collection CVar. SlashCmdList.RUENUI('restore') assert(cvars.damageMeterEnabled=='0' and meter.w==400 and meter.h==200) assert(meter.visibility==Enum.DamageMeterVisibility.InCombat) print('PASS: native damage meter instance gate, PvP exclusion, manual modes, native availability, combat deferral, Edit Mode handoff, restore; '..samples..' all-class/resolution meter/bag/tooltip/loot clearance scenarios') -- Native cooldown selection and visibility, including unknown spell filtering. local cdSource=(assert(os.getenv('RUEN_NATIVE_UI'))..'/') local function nativeMethods(file,receiver,methods,prefix) local f=assert(io.open(cdSource..file));local text=f:read('*a');f:close() for _,method in ipairs(methods)do local body=assert(text:match('(function '..receiver..':'..method..'%b().-\nend)'),method) assert(loadstring((prefix or '')..'\n'..body))() end end CooldownViewerMixin={};CooldownViewerSettingsDataProviderMixin={} nativeMethods('CooldownViewer.lua','CooldownViewerMixin',{'ShouldBeShown','UpdateShownState','GetCooldownIDs','GetItemCount','GetStride'},'local cooldownViewerEnabledCVar="cooldownViewerEnabled"') nativeMethods('CooldownViewerSettingsDataProvider.lua','CooldownViewerSettingsDataProviderMixin',{'GetOrderedCooldownIDsForCategory'}) local provider={order={},spells={}} provider.GetOrderedCooldownIDsForCategory=CooldownViewerSettingsDataProviderMixin.GetOrderedCooldownIDsForCategory function provider:GetOrderedCooldownIDs()return self.order end function provider:GetCooldownInfoForID(id)return self.spells[id]end local cdSettingsOpen,cdAvailable=false,true CooldownViewerSettings={GetDataProvider=function()return provider end,IsVisible=function()return cdSettingsOpen end,IsShown=function()return cdSettingsOpen end,ShowUIPanel=function()cdSettingsOpen=true end} function UnitAffectingCombat()return combat end function assertsafe(v,msg)assert(v,msg)end C_CooldownViewer={IsCooldownViewerAvailable=function()return cdAvailable end,SetLayoutData=function()error('must not overwrite custom cooldown spells/layouts')end} local cdNames={'EssentialCooldownViewer','UtilityCooldownViewer','BuffIconCooldownViewer','BuffBarCooldownViewer'} for i,name in ipairs(cdNames)do local f=CreateFrame('Frame',name);f.cooldownViewerCategory=i-1 f.GetCooldownIDs=CooldownViewerMixin.GetCooldownIDs f.ShouldBeShown=CooldownViewerMixin.ShouldBeShown f.UpdateShownState=CooldownViewerMixin.UpdateShownState f.GetItemCount=CooldownViewerMixin.GetItemCount function f:GetCategory()return self.cooldownViewerCategory end function f:IsEditing()return inEdit end function f:SetShown(v)self.shown=v end function f:RefreshData()end function f:OnUpdateSystem()end end -- Decode the actual native slider encoding and sizes, not saved table guesses. local nativeSetActive=C_EditMode.SetActiveLayout C_EditMode.SetActiveLayout=function(index) nativeSetActive(index) local S=Enum.EditModeCooldownViewerSetting for _,s in ipairs(manager:GetActiveLayoutInfo().systems)do if s.system==Enum.EditModeSystem.CooldownViewer then local i=s.systemIndex;local f=_G[cdNames[i]] if s.settings[1] then assert(s.isInDefaultPosition==false and s.anchorInfo.relativeTo=='UIParent','viewer still owned by bottom stacking manager')end local n=f:GetItemCount();local scale=(50+10*(setting(s,S.IconSize) or 0))/100 local stride=(i==3 or i==4) and n or (setting(s,S.IconLimit) or 6) local gap=(setting(s,S.IconPadding) or 8)-(i==4 and 2 or 4) local size=({50,30,40,30})[i]*scale if i==4 then f.w=220*((setting(s,S.BarWidthScale) or 50)+50)/100*scale;f.h=n*size+(n-1)*gap else f.w=math.min(n,stride)*size+(math.min(n,stride)-1)*gap;f.h=math.ceil(n/stride)*size+(math.ceil(n/stride)-1)*gap end f.visibleSetting=setting(s,S.VisibleSetting);f:UpdateShownState() end end end local function spellSet(counts) provider.order={};provider.spells={} for i,count in ipairs(counts)do for j=1,count do local id=i*100+j;provider.order[#provider.order+1]=id;provider.spells[id]={category=i-1,isKnown=true} end end provider.order[#provider.order+1]=9999;provider.spells[9999]={category=0,isKnown=false} end for _,l in ipairs(manager.layoutInfo.layouts)do for i=1,4 do l.systems[#l.systems+1]={system=Enum.EditModeSystem.CooldownViewer,systemIndex=i,settings={}}end end spellSet({6,5,3,2}) SlashCmdList.RUENUI('apply') assert(gap(ObjectiveTrackerFrame,MultiBarRight)>=23.9,'native cooldown configuration restored tracker over utility controls') C_EditMode.SetActiveLayout(2) P.RefreshClassAssist();assert(not RuenUICharacter.classAssistError,RuenUICharacter.classAssistError) assert(cvars.cooldownViewerEnabled=='1') for _,name in ipairs(cdNames)do assert(not _G[name]:IsShown(),'auto viewer visible out of combat')end combat=true for _,name in ipairs(cdNames)do _G[name]:UpdateShownState();assert(_G[name]:IsShown(),'native combat visibility')end local saveCount=classSaves;local beforePoint=EssentialCooldownViewer.point P.ClassAssistCommand('cooldowns','off');assert(classSaves==saveCount and EssentialCooldownViewer.point==beforePoint,'cooldowns mutated during combat') combat=false;P.classAssistListener.scripts.OnEvent(nil,'PLAYER_REGEN_ENABLED') for _,name in ipairs(cdNames)do assert(not _G[name]:IsShown(),'off visibility')end P.ClassAssistCommand('cooldowns','show');assert(EssentialCooldownViewer:IsShown()) assert(gap(ObjectiveTrackerFrame,MultiBarRight)>=23.9,'cooldown mode change restored tracker over utility controls') assert(#EssentialCooldownViewer:GetCooldownIDs()==6,'unknown spells leaked into native category') assert(#P.classAssistReserved==4 and #RuenUICharacter.classAssistUnplaced==0) -- Geometry stress is deliberately synthetic; lists remain native, not Ruen spell lists. local cdSamples=0 for _,display in ipairs({{1920,1080,1.40625},{2560,1440,1.875},{1920,1080,1},{2560,1440,1},{1366,768,1}})do UIParent.scale=display[3];UIParent.w=display[1]/display[3];UIParent.h=display[2]/display[3] for class,controlNames in pairs(scenarios)do if class~='maximum' then currentClass=class:upper() for _,n in ipairs(controls)do _G[n].shown=false end for _,n in ipairs(controlNames)do _G[n].shown=true end for _,n in ipairs({'PlayerCastingBarFrame','PlayerFrame','TargetFrame','TargetFrameToT','RuenTargetTargetTarget','FocusFrame'})do _G[n].shown=true end ExtraAbilityContainer.shown=false;CompactRaidFrameContainer.shown=true;inside=true;kind='raid' for _,count in ipairs({{1,1,0,0},{6,5,3,2},{12,12,8,6},{16,16,16,10}})do spellSet(count);nativeSocial();UIParent.scripts.OnSizeChanged();P.RefreshClassAssist();hooks.UpdateSystems();P.RefreshDamageMeters() assert(not RuenUICharacter.classAssistError,RuenUICharacter.classAssistError) assert(count[1]>6 or #RuenUICharacter.classAssistUnplaced==0,'unplaced viewer '..class..' '..display[1]..' '..table.concat(count,',')) for _,r in ipairs(P.classAssistReserved)do assert(r.left>=0 and r.bottom>=0 and r.right<=UIParent.w and r.top<=UIParent.h,'offscreen '..r.name) for _,o in ipairs(P.OverlayObstacles(false))do if o.name~=r.name then assert(not(r.lefto.left and r.bottomo.bottom),'viewer '..r.name..' blocks '..(o.name or '?')..' '..class) end end end assert(meter:IsShown() or (count[1]>6 and RuenUICharacter.damageMeterStatus.reason=='no free space'),'meter cannot fit with cooldowns '..class..' '..table.concat(count,',')..' '..display[1]) GameTooltip.owner=MainActionBar;GameTooltip.shown=true;GameTooltip.w,GameTooltip.h=220,130 P.ResetTooltipPosition(GameTooltip);P.PositionTooltip(GameTooltip,true) for _,r in ipairs(P.classAssistReserved)do assert(not intersects(GameTooltip,_G[r.name]),'tooltip overlaps cooldowns')end GameTooltip.shown=false if count[1]<=6 then ContainerFrameCombinedBags.shown=true;ContainerFrameCombinedBags.w,ContainerFrameCombinedBags.h=400,200 SlashCmdList.RUENUI('bags') for _,r in ipairs(P.classAssistReserved)do assert(P.bagOverHUD or not intersects(ContainerFrameCombinedBags,_G[r.name]),'bags overlap cooldowns '..class..' '..display[1]..' '..table.concat(count,','))end ContainerFrameCombinedBags.shown=false for _,f in ipairs(rolls)do f.shown=true end P.PositionOverlayFrames() if #P.overlayUnplaced>0 then print('FAILED DISPLAY',unpack(display));print('SPELL COUNTS',unpack(count)) for _,o in ipairs(P.OverlayObstacles(false))do print('RECT',o.name,o.left,o.bottom,o.right-o.left,o.top-o.bottom)end for _,f in ipairs(rolls)do print('ROLL',f.name,f:rect())end end assert(#P.overlayUnplaced==0,'loot rolls cannot fit with normal cooldown groups '..class) for _,f in ipairs(rolls)do for _,r in ipairs(P.classAssistReserved)do assert((P.overlayOverOptional and P.overlayOverOptional[f]) or not intersects(f,_G[r.name]),'loot overlaps cooldowns')end f.shown=false end end cdSamples=cdSamples+1 end end end end -- Known spell/talent changes are reflected and custom category ordering is retained. spellSet({2,0,0,0});P.classAssistListener.scripts.OnEvent(nil,'SPELLS_CHANGED') assert(#P.classAssistReserved==1 and not UtilityCooldownViewer:IsShown(),'empty categories left placeholders') provider.spells[9999].isKnown=true;provider.spells[9999].category=1 P.classAssistListener.scripts.OnEvent(nil,'PLAYER_TALENT_UPDATE') assert(UtilityCooldownViewer:GetCooldownIDs()[1]==9999 and #P.classAssistReserved==2) P.ClassAssistCommand('cooldowns','settings');assert(cdSettingsOpen) saveCount=classSaves;P.RefreshClassAssist();assert(saveCount==classSaves and #P.classAssistReserved==0,'settings editor not respected') cdSettingsOpen=false;P.RefreshClassAssist();assert(#P.classAssistReserved==2) -- Failed optional subsystem recovers without disabling later refreshes. local getAvail=C_CooldownViewer.IsCooldownViewerAvailable C_CooldownViewer.IsCooldownViewerAvailable=function()error('fixture unavailable')end P.RefreshClassAssist();assert(RuenUICharacter.classAssistError) C_CooldownViewer.IsCooldownViewerAvailable=getAvail;P.RefreshClassAssist();assert(not RuenUICharacter.classAssistError) print('PASS: native cooldown selection/unknown filtering, combat visibility, empty categories, talent/learned changes, settings handoff, error recovery; '..cdSamples..' class/resolution/full-HUD cooldown+meter+tooltip clearance cases') -- Display choices belong to each character; changing one does not change the -- legacy account defaults inherited by an unvisited alt. do local original=RuenUICharacter local dbCooldown,dbMeter=RuenUIDB.cooldownsMode,RuenUIDB.damageMeterMode RuenUIDB.cooldownsMode='auto';RuenUIDB.damageMeterMode='auto' P.ClassAssistCommand('cooldowns','off');P.DamageMeterCommand('off') local first=RuenUICharacter RuenUICharacter={version=5,original={}};P.EnsureCharacterProfile() assert(RuenUICharacter.cooldownsMode=='auto' and RuenUICharacter.damageMeterMode=='auto') P.ClassAssistCommand('cooldowns','show');P.DamageMeterCommand('show') assert(first.cooldownsMode=='off' and first.damageMeterMode=='off') assert(RuenUIDB.cooldownsMode=='auto' and RuenUIDB.damageMeterMode=='auto') RuenUICharacter=original;RuenUIDB.cooldownsMode=dbCooldown;RuenUIDB.damageMeterMode=dbMeter P.ClassAssistCommand('cooldowns','off');P.DamageMeterCommand('auto') end -- Class defaults, native modifiers, account/character transitions and overrides. function IsMouseoverCastSupported()return true end local nativeSetting=Settings.SetValue settings.MOUSEOVERCAST='SHIFT' Settings.SetValue=function(k,v)if k=='MOUSEOVERCAST' then settings[k]=v;mouseModifier=v else nativeSetting(k,v)end end local guid='player-1';function UnitGUID()return guid end local chars={};local keysBefore=CopyTable(bindings);local selfBefore=modified for _,class in ipairs({'PRIEST','DRUID','PALADIN','SHAMAN','HUNTER','WARLOCK','MAGE','ROGUE','WARRIOR'})do currentClass=class;guid='player-'..class RuenUICharacter={original={},rolePreference=({PRIEST=true,DRUID=true,PALADIN=true,SHAMAN=true})[class] and 'HEALER' or 'DAMAGER'};chars[class]=RuenUICharacter cvars.enableMouseoverCast='0';mouseModifier='SHIFT' P.ApplyMouseover(false) local expected=({PRIEST=true,DRUID=true,PALADIN=true,SHAMAN=true})[class] and '1' or '0' assert(cvars.enableMouseoverCast==expected,'class mouseover '..class) assert(mouseModifier==(expected=='1' and 'NONE' or 'SHIFT')) local changesBefore=changes;P.ApplyMouseover(false);assert(changes==changesBefore,'mouseover reapplied repeatedly') cvars.enableMouseoverCast=expected=='1' and '0' or '1';P.ApplyMouseover(false) assert(cvars.enableMouseoverCast~=expected,'manual Options preference overwritten') end currentClass='SHAMAN';guid='player-SHAMAN';RuenUICharacter=chars.SHAMAN;P.ApplyMouseover(false) assert(cvars.enableMouseoverCast=='1' and mouseModifier=='NONE','returning to hybrid did not restore class default') local oldChar=RuenUICharacter;guid='player-SHAMAN-2';RuenUICharacter={original={}};P.ApplyMouseover(false) P.ClassAssistCommand('mouseover','off');assert(cvars.enableMouseoverCast=='0') guid='player-SHAMAN';RuenUICharacter=oldChar;P.ApplyMouseover(false);assert(cvars.enableMouseoverCast=='1','same-class characters interfered') combat=true;P.ClassAssistCommand('mouseover','off');assert(cvars.enableMouseoverCast=='1') combat=false;P.classAssistListener.scripts.OnEvent(nil,'PLAYER_REGEN_ENABLED');assert(cvars.enableMouseoverCast=='0' and mouseModifier=='SHIFT','deferred disable lost original modifier') P.ClassAssistCommand('mouseover','on');assert(cvars.enableMouseoverCast=='1' and mouseModifier=='NONE') P.ClassAssistCommand('mouseover','auto');assert(RuenUICharacter.mouseoverMode=='auto') P.RestoreClassAssist();assert(mouseModifier=='SHIFT' and not RuenUICharacter.mouseoverApplied and not P.mouseoverPending) for k,v in pairs(keysBefore)do assert(bindings[k]==v,'mouseover altered binding '..k)end for k,v in pairs(bindings)do assert(keysBefore[k]==v,'mouseover introduced binding '..k)end assert(modified==selfBefore,'mouseover replaced self-cast controls') print('PASS: mouseover defaults for all nine classes, no extra modifier, independent character preferences, manual Options edits, combat deferral, recovery/undo; all action/movement/mouse/self-cast bindings unchanged') -- Left shelf migration and resize: no shortcut or action slot changes. RuenUICharacter.original=RuenUICharacter.original or {} RuenUIDB.disabled=false local keysSnapshot=CopyTable(bindings);local actionSnapshot=CopyTable(actions) local nativeSnapshot=CopyTable(manager:GetActiveLayoutInfo()) local tracked={} for _,s in ipairs(nativeSnapshot.systems)do if s.system==Enum.EditModeSystem.ActionBar and s.systemIndex<=6 then tracked[s.systemIndex]=CopyTable(s) end end local function eq(a,b) if type(a)~=type(b)then return false end if type(a)~='table'then return a==b end for k,v in pairs(a)do if not eq(v,b[k])then return false end end for k in pairs(b)do if a[k]==nil then return false end end return true end RuenUIDB.leftBarsVersion=nil;RuenUIDB.leftBarRows=nil combat=true;local saves=classSaves;P.MigrateLeftBars();assert(classSaves==saves,'left migration ran in combat') combat=false;inEdit=true;P.MigrateLeftBars();assert(classSaves==saves,'left migration ran in edit mode');inEdit=false for _,case in ipairs({{2133,1200,1,2},{1920,1080,1,2},{1920,1080,1.40625,2},{1366,768,1,2},{2560,1440,1.875,2},{2560,1440,1,2}})do UIParent.scale=case[3];UIParent.w=case[1]/case[3];UIParent.h=case[2]/case[3] currentClass='HUNTER';for _,n in ipairs(controls)do _G[n].shown=false end PlayerFrame.shown=true;TargetFrame.shown=true;PetFrame.shown=true;PetActionBar.shown=true P.MigrateLeftBars();hooks.UpdateSystems();UIParent.scripts.OnSizeChanged() assert(RuenUIDB.leftBarRows==case[4],'wrong responsive row count') assert(MultiBar6.h==(case[4]==1 and 36 or 74) and MultiBar7.h==MultiBar6.h,'wrong native shape') assert(math.abs(MultiBar6:GetLeft()-ChatFrame1:GetLeft())<.01,'left shelf not aligned with chat') assert(math.abs(MultiBar6:GetLeft()-MultiBar7:GetLeft())<.01 and math.abs(MultiBar6:GetRight()-MultiBar7:GetRight())<.01) assert(gap(MultiBar7,MultiBar6)>=5.9,'left row gap') local dockPoint=CopyTable(MultiBar6.point);MultiBar6:SetPoint('BOTTOMLEFT',UIParent,'BOTTOMLEFT',20,215) MultiBar6.scripts.OnShow();assert(MultiBar6:GetBottom()>215,'late native show not repaired') local beforeCombat=MultiBar6.point;combat=true;MultiBar6.scripts.OnShow();assert(MultiBar6.point==beforeCombat,'shelf moved in combat');combat=false hooks.UpdateSystems() local socialSpace=P.SocialNotificationSpace(function(f,m)return f[m](f)*f:GetEffectiveScale()/UIParent.scale end) assert(MultiBar6:GetBottom()>=socialSpace.top+11.9,'social area not clear') for _,n in ipairs({'PlayerFrame','PetFrame','PetActionBar','MainActionBar','MultiBar5'})do assert(not intersects(MultiBar6,_G[n]) and not intersects(MultiBar7,_G[n]),'left shelf overlaps '..n)end for _,s in ipairs(manager:GetActiveLayoutInfo().systems)do if s.system==Enum.EditModeSystem.ActionBar and (s.systemIndex==7 or s.systemIndex==8)then assert(setting(s,Enum.EditModeActionBarSetting.NumRows)==case[4]) assert(s.anchorInfo.relativeTo=='UIParent' and not s.isInDefaultPosition) assert(s.anchorInfo.offsetY>=socialSpace.top+11.9,'saved native anchor fell into notification space') end end saves=classSaves;P.MigrateLeftBars();assert(saves==classSaves,'left migration repeated without width change') end assert(eq(bindings,keysSnapshot) and eq(actions,actionSnapshot),'shelf migration changed keybindings or actions') for _,s in ipairs(manager:GetActiveLayoutInfo().systems)do if s.system==Enum.EditModeSystem.ActionBar and s.systemIndex<=6 then assert(eq(s,tracked[s.systemIndex]),'left migration changed unrelated action bar settings') end end -- A fresh preset's native player frame starts top-left, before Ruen activates. local oldIndex=manager.layoutInfo.activeLayout;manager.layoutInfo.activeLayout=1 PlayerFrame:SetPoint('TOPLEFT',UIParent,'TOPLEFT',20,-20) local preset=CopyTable(manager.layoutInfo.layouts[1]);P.ConfigureLeftBarSystems(preset) for _,s in ipairs(preset.systems)do if s.system==Enum.EditModeSystem.ActionBar and s.systemIndex>=7 and s.systemIndex<=8 then assert(s.anchorInfo.offsetY