Files
WoW-Hybrid-gateway/tests/native_guild_controls_ui_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

30 lines
1.8 KiB
Lua

-- W15c: addon reload must leave Blizzard's guild entry points and controls
-- unmodified while preserving both original edit-box forms for Add Friend.
local hooked, frames, friend = {}, {}, nil;
WoWHybridUI = {}; StaticPopupDialogs = {}; ACCEPT = "Accept"; CANCEL = "Cancel";
function strtrim(s) return s:match("^%s*(.-)%s*$"); end
C_FriendList = { AddFriend = function(name) friend=name; end };
function hooksecurefunc(target, key, callback) hooked[#hooked+1]={target,key,callback}; end
function CreateFrame(_,name,parent)
local f={events={},scripts={}};
function f:RegisterEvent(e) self.events[e]=true; end
function f:SetScript(e,fn) self.scripts[e]=fn; end
frames[#frames+1]=f; return f;
end
local guildToggles=0;
function ToggleGuildFrame() guildToggles=guildToggles+1; end
function ToggleCommunitiesFrame() guildToggles=guildToggles+1; end
local originalGuild, originalCommunities=ToggleGuildFrame,ToggleCommunitiesFrame;
CommunitiesFrame={marker="original"};
assert(loadfile(assert(arg[1])))();
for _,frame in ipairs(frames) do if frame.events.PLAYER_LOGIN then frame.scripts.OnEvent(frame,"PLAYER_LOGIN"); end; end
assert(ToggleGuildFrame==originalGuild and ToggleCommunitiesFrame==originalCommunities);
assert(#hooked==0 and #frames==1 and not WoWHybridUI.guildRosterPanel);
ToggleGuildFrame();ToggleGuildFrame();assert(guildToggles==2);
local dialog=StaticPopupDialogs.WOWHYBRID_ADD_FRIEND;
local box={GetText=function()return " Chatpeer ";end,SetFocus=function()end};
dialog.OnAccept({GetEditBox=function()return box;end});assert(friend=="Chatpeer");friend=nil;
dialog.OnAccept({EditBox=box});assert(friend=="Chatpeer");
assert(WoWHybridUI.guildPresentation=="BlizzardCommunities");
print("PASS original guild entry points untouched; no guild frame/hooks; both Friends edit-box contracts preserved");