local root=assert(arg[1]) local P={} assert(loadfile(root..'LayoutPolicy.lua'))('RuenUI',P) local width,height UIParent={GetWidth=function()return width end,GetHeight=function()return height end} for _,case in ipairs({{1280,720,380,190},{1366,768,400,190}, {1920,1080,570,230},{2133,1200,620,260},{3840,2160,620,260}, {3840/2.8125,2160/2.8125,400,190}})do width,height=case[1],case[2] local w,h=P.DefaultChatSize() assert(w==case[3] and h==case[4],'incorrect chat size for '..width..'x'..height) end -- Native selection margins clamp chat without the player moving it. Accept -- both native serializations, scale the margin, and reject actual saved moves. UIParent.GetEffectiveScale=function()return .64 end ChatFrame1={GetClampRectInsets=function()return -32,25,60,-32 end, GetEffectiveScale=function()return .64 end} local x,y=P.DefaultChatOrigin();assert(x==32 and y==45) Enum={EditModeChatFrameSetting={WidthHundreds=0,WidthTensAndOnes=1,HeightHundreds=2,HeightTensAndOnes=3}} RuenUIDB={chatDefaultSize={width=620,height=260}} local system={anchorInfo={point='BOTTOMLEFT',relativeTo='UIParent',relativePoint='BOTTOMLEFT',offsetX=20,offsetY=45}, settings={{setting=0,value=6},{setting=1,value=20},{setting=2,value=2},{setting=3,value=60}}} assert(P.IsDefaultChatSystem(system));system.anchorInfo.offsetX=32;assert(P.IsDefaultChatSystem(system)) system.anchorInfo.offsetX=60;assert(not P.IsDefaultChatSystem(system),'custom anchor misidentified as default') ChatFrame1.GetEffectiveScale=function()return .96 end x,y=P.DefaultChatOrigin();assert(x==48 and y==48,'native margins were not scaled') system.anchorInfo.offsetX=48;system.anchorInfo.offsetY=48;assert(P.IsDefaultChatSystem(system)) system.settings[4].value=10;assert(not P.IsDefaultChatSystem(system),'custom height misidentified as default') ChatFrame1.GetClampRectInsets=nil;x,y=P.DefaultChatOrigin();assert(x==20 and y==45,'missing margin API fallback') local font,size,flags='native-cyrillic-capable-font',12,'OUTLINE' local changes=0 ChatFrame1={GetFont=function()return font,size,flags end} function FCF_SetChatWindowFontSize(_,frame,value)assert(frame==ChatFrame1);size=value;changes=changes+1 end RuenUICharacter={};P.ApplyChatDefaults() assert(size==14 and changes==1 and RuenUICharacter.chatFontOriginal.size==12) P.ApplyChatDefaults();assert(changes==1,'font defaults reapplied') size=16;P.RestoreChatDefaults();assert(size==16,'restore overwrote later font choice') size=14;P.RestoreChatDefaults();assert(size==12,'font restore failed') RuenUICharacter={version=5};size=18;P.ApplyChatDefaults();assert(size==18,'upgrade changed existing font') local count=0;for _ in pairs(P.controlFrameSet)do count=count+1 end assert(count==10 and #P.controlFrameNames==10,'control declarations inconsistent/duplicated') print('PASS: responsive chat defaults at 720p-4K/logical UI scale; shared ten-frame reservations, readable fresh-install chat font, idempotency, custom font and upgrade preservation, conditional restore')