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

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

67 lines
6.4 KiB
Lua

-- Exercise saved original70334 menu transitions and list regeneration.
local root=arg[1] or 'runtime/continuation-20261113/codex/PTR-feedback-disable/native70334-ui/interface/addons/'
local function frame()
local f={shown=true,scripts={}}
function f:Hide()self.shown=false end;function f:Show()self.shown=true;if self.scripts.OnShow then self.scripts.OnShow(self)end end
function f:HookScript(event,fn)self.scripts[event]=fn end
return f
end
StaticPopupDialogs={};ACCEPT='Accept';CANCEL='Cancel';GUILD='Guild'
GUILDCONTROL_GUILDRANKS='Ranks';GUILDCONTROL_RANK_PERMISSIONS='Permissions';GUILDCONTROL_BANK_PERMISSIONS='Bank';GUILDCONTROL_DISCORD_SETTINGS='Discord %s'
local leader,discord=true,false
function IsGuildLeader()return leader end;function IsInGuild()return true end
function StaticPopup_Hide()end;function CreateAtlasMarkup()return '[icon]'end
C_Discord={IsEnabled=function()return discord end,UpdateDiscordServers=function()end,UpdateGuildLobby=function()end}
C_GuildBank={IsGuildBankEnabled=function()return true end}
assert(loadfile(root..'blizzard_guildcontrolui/blizzard_guildcontrolui.lua'))()
assert(loadfile(root..'blizzard_communities/communitieslist.lua'))()
GuildControlUI=frame();GuildControlUI.dropdown={SetWidth=function()end,SetupMenu=function(self,fn)self.generator=fn end}
GuildControlUIRankOrderFrame=frame();GuildControlUIRankSettingsFrame=frame();GuildControlUIRankBankFrame=frame();GuildControlUIRankDiscordFrame=frame()
GuildControlUI.orderFrame=GuildControlUIRankOrderFrame;GuildControlUI.rankPermFrame=GuildControlUIRankSettingsFrame;GuildControlUI.bankTabFrame=GuildControlUIRankBankFrame;GuildControlUI.discordFrame=GuildControlUIRankDiscordFrame
local nativeUpdates=0;GuildControlUI_RankPermissions_Update=function()nativeUpdates=nativeUpdates+1 end;GuildControlUI_RankOrder_Update=function()end;GuildControlUI_BankTabPermissions_Update=function()end;GuildControlUI_Discord_Update=function()end
for _,key in ipairs({'BankBg','BankLabel','Checkbox15','Checkbox16','Checkbox19','GoldBox','Checkbox5','Checkbox7','Checkbox6','Checkbox8','Checkbox18','Checkbox18Tooltip','Checkbox21','OfficerBg'})do _G['GuildControlUIRankSettingsFrame'..key]=frame()end
GuildControlUIRankSettingsFrame.OfficerCheckbox=frame();GuildControlUIRankSettingsFrame.OfficerPermissions=frame()
GuildControlUI_SetupSelected(1)
local function menu()
local rows={};GuildControlUI.dropdown.generator(nil,{SetTag=function()end,CreateRadio=function(_,label,selected,callback,data)rows[#rows+1]={label=label,selected=selected,callback=callback,data=data}end});return rows
end
assert(#menu()==3) -- Original bank-enabled client really exposes bank3.
ScrollBoxConstants={RetainScrollPosition=1};Enum={ClubType={Character=1,BattleNet=2}}
C_Club={ShouldAllowClubType=function()return true end};C_ClubFinder={IsEnabled=function()return true end,IsCommunityFinderEnabled=function()return true end}
function CreateDataProvider()
local d={rows={}};function d:Insert(r)table.insert(self.rows,r)end
function d:RemoveAllByPredicate(predicate)for i=#self.rows,1,-1 do if predicate(self.rows[i])then table.remove(self.rows,i)end end end
return d
end
local nativeGuild={clubId='real-source-guild'}
local list=setmetatable({ScrollBox={SetDataProvider=function(self,p)self.provider=p end,GetDataProvider=function(self)return self.provider end}}, {__index=CommunitiesListMixin})
CommunitiesGuildLogFrame=frame()
CommunitiesFrame={GuildLogButton=frame(),GuildInfoTab=frame(),CommunitiesList=list,GuildFinderFrame={UpdateType=function()end},SetTitle=function(self,title)self.title=title end}
function list:GetCommunitiesFrame()return CommunitiesFrame end
function list:GetCommunitiesList()return {nativeGuild}end
function list:ValidateTickets()end;function list:GetTickets()return {}end;function list:GetInvitations()return {}end;function list:GetClubFinderInvitations()return {}end
list:Update();assert(#list.ScrollBox.provider.rows==4) -- guild/find/join/guildfinder
function hooksecurefunc(target,key,callback)
if type(target)=='string'then callback=key;key=target;target=_G end
local original=target[key];target[key]=function(...)original(...);callback(...)end
end
local eventFrame
function CreateFrame()local f=frame();function f:RegisterEvent()end;function f:SetScript(_,fn)self.onEvent=fn end;eventFrame=f;return f end
local guildToggle=function()end;ToggleGuildFrame=guildToggle;local communitiesToggle=function()end;ToggleCommunitiesFrame=communitiesToggle
assert(loadfile('client_addons/WoWHybridUI/NativeSocialSimplify.lua'))();eventFrame.onEvent()
assert(ToggleGuildFrame==guildToggle and ToggleCommunitiesFrame==communitiesToggle and CommunitiesFrame.title=='Guild')
local rows=menu();assert(#rows==2 and rows[1].data==1 and rows[2].data==2)
rows[2].callback(2);assert(GuildControlUI.selectedTab==2 and GuildControlUI.currFrame==GuildControlUIRankSettingsFrame and nativeUpdates==1)
for _,key in ipairs({'BankBg','BankLabel','Checkbox15','Checkbox16','Checkbox19','GoldBox'})do assert(not _G['GuildControlUIRankSettingsFrame'..key].shown)end
for _,key in ipairs({'Checkbox18','Checkbox18Tooltip','Checkbox21','OfficerBg'})do assert(not _G['GuildControlUIRankSettingsFrame'..key].shown)end
assert(not GuildControlUIRankSettingsFrame.OfficerCheckbox.shown and not GuildControlUIRankSettingsFrame.OfficerPermissions.shown)
assert(not CommunitiesFrame.GuildLogButton.shown and not CommunitiesGuildLogFrame.shown and CommunitiesFrame.GuildInfoTab.shown)
CommunitiesFrame.GuildLogButton:Show();CommunitiesGuildLogFrame:Show();assert(not CommunitiesFrame.GuildLogButton.shown and not CommunitiesGuildLogFrame.shown)
for _,key in ipairs({'Checkbox5','Checkbox7','Checkbox6','Checkbox8'})do assert(_G['GuildControlUIRankSettingsFrame'..key].shown)end
GuildControlUI_SetupSelected(3);assert(GuildControlUI.selectedTab==1 and not GuildControlUIRankBankFrame.shown and GuildControlUIRankOrderFrame.shown)
list:Update();local filtered=list.ScrollBox.provider.rows;assert(#filtered==2 and filtered[1].clubInfo==nativeGuild and filtered[2].setGuildFinder)
-- Existing Discord gate and native officer transition are deliberately preserved.
discord=true;rows=menu();assert(#rows==3 and rows[3].data==4);leader=false;GuildControlUI_Setup();rows=menu();assert(#rows==1 and rows[1].data==4 and GuildControlUI.selectedTab==4)
eventFrame.onEvent();assert(not WoWHybridUI.guildRosterPanel)
print('PASS original native rank callbacks/list regeneration, hidden bank controls, guild/header retained, unsupported community rows removed, Discord preserved')