-- [PFUI=1] texlua theme.lua 1 casual -- Opens every window and checks what the theme made of it: with pfUI every window and control is skinned the OctoPad way, -- without pfUI nothing is touched. local here = arg[0]:match("^(.*)/") or "." dofile(here .. "/lib.lua") local W, ER, S, P, try = H.W, H.ER, H.S, H.P, H.try local PF = os.getenv("PFUI") ~= nil local fails = 0 local function check(ok, what) if not ok then fails = fails + 1; P("FAIL " .. what) else P("ok " .. what) end end PLAY(40) local opened = {} for _, fn in ipairs({ "ShowSettings", "ShowWizard", "ShowGuideMenu", "ShowHelp", "ShowExport", "ShowWelcome", "ShowTracker", "ShowWindow", "ShowQuestLogPanel" }) do if ER[fn] then local ok = try(fn, function() ER[fn]() end); if ok then table.insert(opened, fn) end end end try("ShowChainNotice", function() if ER.ShowChainNotice then ER.ShowChainNotice("A quest", 4, "Next") end end) try("simple", function() if ER.SetSimple then ER.SetSimple(true) end end) QuestLogFrame:Show() W.Tick(0.2, 12) -- every frame of the addon, by walking down from its windows local windows = { "pfQuest_xpGuideSettings", "pfQuest_xpGuideWizardFrame", "pfQuest_xpGuideGuide", "pfQuest_xpGuideChainNotice", "pfQuest_xpGuideTips", "pfQuest_xpGuideSkipMenu", "pfQuest_xpGuideArrow" } local all = {} local function collect(f, d) if not f or d > 14 then return end table.insert(all, f) for _, c in ipairs(f._children or {}) do collect(c, d + 1) end end local present = 0 for _, n in ipairs(windows) do if _G[n] then present = present + 1; collect(_G[n], 0) end end check(present >= 6, present .. " of " .. #windows .. " windows were built") local lower = string.lower local function path(t) return t and t._path and lower(t._path) or "" end local n = { panel = 0, panelSk = 0, close = 0, closeSk = 0, check = 0, checkSk = 0, icon = 0, iconSk = 0, bd = 0, bdSk = 0, fs = 0, fsPf = 0, hl = 0, hlSk = 0, input = 0, inputSk = 0 } local closeX, blizzBackdrop = 0, 0 for _, f in ipairs(all) do local np = path(f._normal) if f._kind == "Button" or f._kind == "CheckButton" then if f.erFlat and f._isClose == nil and _G[(f._name or "") .. ""] then end if L53.match(np, "ui%-panel%-button") or (f.erFlat and not f.erCloseText and not L53.match(f._name or "", "Close")) then n.panel = n.panel + 1; if f.erFlat then n.panelSk = n.panelSk + 1 end end if L53.match(np, "minimizebutton") or (L53.match(f._name or "", "Close$") and not f.pic) then n.close = n.close + 1; if f.erFlat then n.closeSk = n.closeSk + 1 end if f.erText and f.erText._text == "x" then closeX = closeX + 1 end end if L53.match(np, "ui%-checkbox") or f.erCheck then n.check = n.check + 1; if f.erCheck then n.checkSk = n.checkSk + 1 end end if L53.match(np, "interface\\icons\\") then n.icon = n.icon + 1; if f.erIcon then n.iconSk = n.iconSk + 1 end end end if f._backdrop and not (f._backdrop.pf) then blizzBackdrop = blizzBackdrop + 1 end if f.erRound then n.bd = n.bd + 1 end if f._kind == "EditBox" and f._name and _G[f._name .. "Left"] then n.input = n.input + 1; if f.erInput then n.inputSk = n.inputSk + 1 end end for _, r in ipairs(f._regions or {}) do if r._kind == "FontString" then n.fs = n.fs + 1; if r._font == pfUI_font then end; if r.erFont then n.fsPf = n.fsPf + 1 end end if r._kind == "Texture" and (L53.match(path(r), "questtitlehighlight") or r.erTex and r._path == "Interface\\Buttons\\WHITE8X8") then n.hl = n.hl + 1; if r.erTex then n.hlSk = n.hlSk + 1 end end end end P(string.format("found: %d frames, %d panel buttons, %d close, %d checks, %d icon buttons, %d inputs, %d font strings, %d row highlights", #all, n.panel, n.close, n.check, n.icon, n.input, n.fs, n.hl)) local S = _G.pfQuest_xpGuideSettings if PF then check(n.panel > 20 and n.panelSk == n.panel, "every panel button is OctoPad's flat button (" .. n.panelSk .. "/" .. n.panel .. ")") check(n.close >= 3 and n.closeSk == n.close and closeX == n.close, "every close button is a flat x (" .. closeX .. "/" .. n.close .. ")") check(n.check >= 20 and n.checkSk == n.check, "every checkbox has pfUI's skin (" .. n.checkSk .. "/" .. n.check .. ")") check(n.icon == n.iconSk, "icon buttons have the rounded border and cropped icon (" .. n.iconSk .. "/" .. n.icon .. ")") check(n.inputSk == n.input, "input boxes have pfUI's backdrop (" .. n.inputSk .. "/" .. n.input .. ")") check(blizzBackdrop == 0, "no Blizzard backdrop left (" .. blizzBackdrop .. " left)") check(n.fsPf / math.max(1, n.fs) > 0.9, string.format("pfUI's font on %d of %d font strings", n.fsPf, n.fs)) check(n.hl > 0 and n.hlSk == n.hl, "row highlights are the accent tint (" .. n.hlSk .. "/" .. n.hl .. ")") check(S and S._w == 640 + 132, "settings: sidebar layout (width " .. tostring(S and S._w) .. ")") local tab1, tab2 = _G.pfQuest_xpGuideSettingsTab1, _G.pfQuest_xpGuideSettingsTab2 ER.ShowSettings(2) local c1, c2 = tab1.backdrop._bdc, tab2.backdrop._bdc check(c2[1] == .2 and c2[2] == 1 and c2[3] == .8 and not (c1[1] == .2 and c1[2] == 1), "the open page's sidebar button is the accent, the others are not") -- hover lights up the border local b = _G.pfQuest_xpGuideSettingsButton1 this = b; b._scripts.OnEnter(); local hb = b.backdrop._bdc check(hb[2] == 1 and hb[3] == .8, "mouse-over lights the button border in the accent") this = b; b._scripts.OnLeave(); local lb = b.backdrop._bdc check(lb[2] ~= 1, "and it goes back on mouse-out") -- the gold step box border is the accent local box = _G.pfQuest_xpGuideGuideNow check(box and box.backdrop and box.backdrop._bdc[2] == 1 and box.backdrop._bdc[3] == .8, "the step box's gold border is the accent") local cur for i = 1, 60 do local r = _G["pfQuest_xpGuideGuideRow" .. i] if r and r:IsShown() and r.bar:IsShown() then cur = r end end check(cur and cur.bar._vc and cur.bar._vc[2] == 1 and cur.bar._vc[3] == .8, "the list marks the current step in the accent") -- skinning twice is harmless local before = pfUI.calls.backdrop for i = 1, 5 do ER.Skin.Tree(S) end check(pfUI.calls.backdrop == before, "skinning again does nothing new") -- the minimap button sits on the square's edge check(ER.Skin.SquareMinimap(), "pfUI's square minimap is recognised") else check(n.bd == 0 and n.panelSk == 0 and n.closeSk == 0 and n.checkSk == 0, "without pfUI nothing is skinned") local wrong = 0 for _, f in ipairs(all) do for _, r in ipairs(f._regions or {}) do if r.erFont and r._font ~= STANDARD_TEXT_FONT then wrong = wrong + 1 end end end check(n.fsPf > 0 and wrong == 0, "without pfUI the guide's text is on pfQuest's font (" .. n.fsPf .. " font strings)") check(S and S._w == 520, "settings: tabs along the top as before (width " .. tostring(S and S._w) .. ")") check(blizzBackdrop >= 10, "windows keep their own backdrops (" .. blizzBackdrop .. ")") check(not ER.Skin.SquareMinimap(), "minimap button keeps its round placement") end -- the setting SlashCmdList.PFQUEST_XPGUIDE("theme") check(ER.db.pfuiThemeOff == true and not ER.Skin.On(), "/er theme turns the look off") SlashCmdList.PFQUEST_XPGUIDE("theme") check(not ER.db.pfuiThemeOff and ER.Skin.On() == PF, "/er theme turns it back on") P(fails == 0 and "ALL PASSED" or (fails .. " FAILED")) REPORT()