mirror of
https://github.com/bryanthaboi/gen1recomp
synced 2026-09-26 13:33:27 -04:00
a9ce423bdc
CLOSES #1275, CLOSES #1295, CLOSES #1384, CLOSES #1628, CLOSES #1677, CLOSES #1682, CLOSES #1691, CLOSES #1813, CLOSES #1822, CLOSES #1861, CLOSES #1867, CLOSES #1868, CLOSES #1869, CLOSES #1870, CLOSES #1871, CLOSES #1872, CLOSES #1874, CLOSES #1876, CLOSES #1878, CLOSES #1880, CLOSES #1881, CLOSES #1882, CLOSES #1884, CLOSES #1885, CLOSES #1886, CLOSES #1887, CLOSES #1888, CLOSES #1889, CLOSES #1890, CLOSES #1891, CLOSES #1892, CLOSES #1893, CLOSES #1894, CLOSES #1895, CLOSES #1896, CLOSES #1899, CLOSES #1900, CLOSES #1901
82 lines
2.7 KiB
Lua
82 lines
2.7 KiB
Lua
-- engine/pokegear/pokegear.asm:454, :740 (#1884)
|
|
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
|
|
local T = require("tests.harness")
|
|
local check = T.check
|
|
love = love or require("tests.love_stub")
|
|
|
|
local Pokegear = require("src.ui.gen2.Pokegear")
|
|
|
|
local function newInput()
|
|
local input = { pressed = {} }
|
|
function input:press(button) self.pressed[button] = true end
|
|
function input:wasPressed(button)
|
|
if self.pressed[button] then
|
|
self.pressed[button] = nil
|
|
return true
|
|
end
|
|
return false
|
|
end
|
|
function input:isDown() return false end
|
|
return input
|
|
end
|
|
|
|
local function newGear(ids)
|
|
local input = newInput()
|
|
local cards = {}
|
|
for index, id in ipairs(ids) do cards[index] = { id = id, label = id } end
|
|
local gear = setmetatable({
|
|
cards = cards, cardIndex = 1, mode = "strip", station = 1,
|
|
game = { input = input },
|
|
}, { __index = Pokegear })
|
|
gear.updatePhone = function() end
|
|
gear.stepMapCursor = function() end
|
|
gear.ensureTuned = function() end
|
|
gear.tickRadio = function() end
|
|
gear.tuneRadio = function() end
|
|
gear.stopRadio = function() end
|
|
return gear, input
|
|
end
|
|
|
|
local function press(gear, input, button)
|
|
input:press(button)
|
|
gear:update(0)
|
|
end
|
|
|
|
local gear, input = newGear({ "clock", "phone" })
|
|
check(gear:card().id == "clock", "the gear opens on the clock")
|
|
press(gear, input, "right")
|
|
check(gear:card().id == "phone", "right takes the phone")
|
|
gear:update(0)
|
|
check(gear.mode == "card", "which enters its card without an A")
|
|
press(gear, input, "left")
|
|
check(gear:card().id == "clock", "left goes back to the clock")
|
|
press(gear, input, "right")
|
|
check(gear:card().id == "phone", "and the clock still pages right")
|
|
|
|
local full, fullInput = newGear({ "clock", "map", "phone", "radio" })
|
|
full.cardIndex, full.mode = 3, "card"
|
|
press(full, fullInput, "left")
|
|
check(full:card().id == "map", "the phone's left takes the map first")
|
|
press(full, fullInput, "right")
|
|
check(full:card().id == "phone", "and the map pages back")
|
|
press(full, fullInput, "right")
|
|
check(full:card().id == "radio", "the phone's right takes the radio")
|
|
press(full, fullInput, "left")
|
|
check(full:card().id == "phone", "and the radio's left takes it back")
|
|
|
|
local radioOnly, radioInput = newGear({ "clock", "radio" })
|
|
radioOnly.mode = "card"
|
|
press(radioOnly, radioInput, "right")
|
|
check(radioOnly:card().id == "radio", "the clock falls through to the radio")
|
|
press(radioOnly, radioInput, "left")
|
|
check(radioOnly:card().id == "clock", "and the radio falls back to the clock")
|
|
|
|
local left, leftInput = newGear({ "clock", "map" })
|
|
left.mode = "card"
|
|
press(left, leftInput, "left")
|
|
check(left:card().id == "clock", "left does nothing on the clock")
|
|
|
|
T.finish("gen2 pokegear paging bug 1884")
|