72 lines
2.2 KiB
Lua
72 lines
2.2 KiB
Lua
-- Exercise the actual AccountLogin source without a game process or credentials.
|
|
-- Run: lua tests/priority_first_press_glue_test.lua path/to/5612756.lua
|
|
assert(arg[1], "AccountLogin source path required")
|
|
|
|
CreateFromMixins = function() return {} end
|
|
NarrationEditBoxMixin = {}
|
|
StaticPopupDialogs = {}
|
|
SOUNDKIT = {GS_LOGIN = 1}
|
|
|
|
local route, popup, reads, writes, logins, cleared, saved
|
|
local account = {GetText = function() return "fixture-account" end}
|
|
local password = {
|
|
GetText = function()
|
|
reads = reads + 1
|
|
return "fixture-password"
|
|
end,
|
|
SetText = function(_, value)
|
|
writes = writes + 1
|
|
assert(value == "")
|
|
end,
|
|
}
|
|
AccountLogin = {UI = {
|
|
AccountEditBox = account,
|
|
PasswordEditBox = password,
|
|
AccountsDropdown = {IsShown = function() return false end},
|
|
SaveAccountNameCheckButton = {IsControlChecked = function() return false end},
|
|
}}
|
|
C_Login = {
|
|
GetTurtleRealmSnapshot = function(query, row, chunk)
|
|
assert(query == 12 and row == 0 and chunk == 0)
|
|
return route
|
|
end,
|
|
ClearLastError = function() cleared = cleared + 1 end,
|
|
Login = function(name, box)
|
|
assert(name == "fixture-account" and box == password)
|
|
logins = logins + 1
|
|
end,
|
|
}
|
|
StaticPopup_Show = function(key, text)
|
|
popup = {key, text}
|
|
end
|
|
PlaySound = function() end
|
|
SetSavedAccountName = function(value) saved = value end
|
|
SetUsesToken = function() end
|
|
|
|
dofile(arg[1])
|
|
|
|
local function exercise(value)
|
|
route, popup, reads, writes, logins, cleared, saved = value, nil, 0, 0, 0, 0, nil
|
|
AccountLogin_Login()
|
|
end
|
|
|
|
exercise(0)
|
|
assert(popup and popup[1] == "OKAY" and popup[2]:find("initializing"))
|
|
assert(reads == 0 and writes == 0 and logins == 0 and cleared == 0)
|
|
|
|
exercise(1)
|
|
assert(popup and popup[1] == "OCTO_PRIORITY_ROUTE_WAIT")
|
|
assert(reads == 0 and writes == 0 and logins == 0 and cleared == 0)
|
|
|
|
exercise(4)
|
|
assert(popup and popup[1] == "OKAY" and popup[2]:find("not ready"))
|
|
assert(reads == 0 and writes == 0 and logins == 0 and cleared == 0)
|
|
|
|
for _, ready in ipairs({2, 3}) do
|
|
exercise(ready)
|
|
assert(popup == nil and reads == 1 and writes == 1)
|
|
assert(logins == 1 and cleared == 1 and saved == "")
|
|
end
|
|
|
|
print("priority first press: NONE/PENDING wait without credential access; ready routes submit")
|