Files
ShaguTweaks-ClassicAPI/tests/test_quest_parchment.lua
T

39 lines
2.5 KiB
Lua

local root=(arg[1] or '.')..'/'
local f=assert(io.open(root..'mods/dark-ui-elements.lua','r'))
local source=f:read('*a');f:close();assert(loadstring(source))
local a=assert(string.find(source,'local function RestoreQuestParchment',1,true))
local b=assert(string.find(source,'local function DarkenFrame',a,true))
local restore=assert(loadstring(string.sub(source,a,b-1)..'return RestoreQuestParchment'))()
local methods={}
function methods:GetTexture() return self.path end
function methods:SetTexture(v) self.path=v end
function methods:GetWidth() return self.width end
function methods:GetHeight() return self.height end
function methods:SetWidth(v) self.width=v end
function methods:SetHeight(v) self.height=v end
function methods:SetPoint(...) self.point=arg end
function methods:SetTexCoord(...) self.uv=arg end
function methods:SetVertexColor(...) self.color=arg end
local function texture(path,w,h) return setmetatable({path=path,width=w,height=h},{__index=methods}) end
for _,name in ipairs({'GossipFrameGreetingPanel','QuestFrameGreetingPanel','QuestFrameDetailPanel','QuestFrameProgressPanel','QuestFrameRewardPanel'}) do
local regions={}
for _,suffix in ipairs({'TopLeft','TopRight','BotLeft','BotRight'}) do
table.insert(regions,texture('Interface\\QuestFrame\\UI-QuestGreeting-'..suffix,string.find(suffix,'Left') and 256 or 128,256))
end
table.insert(regions,texture('Interface\\QuestFrame\\UI-Quest-BotLeftPatch',128,64))
local panel={GetName=function() return name end,GetRegions=function() return unpack(regions) end}
function panel:CreateTexture(_,layer) assert(layer=='ARTWORK');local t=texture();table.insert(regions,t);return t end
restore(panel);assert(table.getn(regions)==9)
local left,right=regions[1].stQuestPaper,regions[2].stQuestPaper
assert(left.width==234 and left.height==182 and left.color[1]==1)
assert(right.width==67 and right.uv[2]==67/128)
assert(regions[4].stQuestPaper.height==148)
assert(not regions[5].stQuestPaper) -- the bottom patch is not a 256px tile
restore(panel);assert(table.getn(regions)==9)
end
assert(not string.find(source,'["^GossipFrameGreetingPanel$"]',1,true))
assert(not string.find(source,'["^QuestFrame(.+)Panel$"]',1,true))
local f=assert(io.open(root..'mods/reduced-actionbar.lua','r'));local reduced=f:read('*a');f:close()
assert(loadstring(reduced));assert(string.find(reduced,'ShaguTweaks.EnableActionBarMovers()',1,true))
print('Native quest/gossip parchment: four original crops, right-tile dimensions, no stationery overlay, idempotence; Reduced Actionbar enables movement')