mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-20 20:50:21 +02:00
ok
This commit is contained in:
@@ -8,6 +8,8 @@
|
||||
-- Case 1 (level path, cancelable): open EvolutionState directly, wait a
|
||||
-- few frames into the flash (t well under FLASH_FRAMES=220), hold B, and
|
||||
-- assert the mon stays CATERPIE with "stopped evolving" text on screen.
|
||||
-- Case 1b: after cancel, checkParty with no level-ups must not re-offer;
|
||||
-- a subsequent level-up set must offer again (EvolveAfterBattle parity).
|
||||
-- Case 2 (control): let the flash run to completion with no input and
|
||||
-- assert the mon becomes METAPOD with the "Congratulations!" text.
|
||||
--
|
||||
@@ -103,6 +105,27 @@ return function(game)
|
||||
assert(done1, "cancel onDone never fired")
|
||||
assert(mon.species == "CATERPIE", "species changed after cancel tail")
|
||||
|
||||
-- === Case 1b: after B-cancel, checkParty without a level-up must not
|
||||
-- re-offer (regression: cancelled mons stuck at threshold tried again
|
||||
-- after every later battle, even non-participants). ===
|
||||
local nQuiet = Evolution.checkParty(game, nil, {})
|
||||
assert(nQuiet == 0, "checkParty with no level-ups re-offered after cancel")
|
||||
assert(not evoTop(), "EvolutionState opened after quiet afterBattle")
|
||||
assert(mon.species == "CATERPIE", "species changed on quiet checkParty")
|
||||
|
||||
local nLevel = Evolution.checkParty(game, nil, { [mon] = true })
|
||||
assert(nLevel == 1, "checkParty after a real level-up should offer once")
|
||||
if not waitFor(evoTop, 300) then
|
||||
error("EvolutionState never opened after level-up re-offer")
|
||||
end
|
||||
U.wait(20)
|
||||
U.hold(game, "b", 20) -- cancel so case 2 stays independent
|
||||
if not waitFor(function() return not evoTop() end, 240) then
|
||||
error("level-up re-offer did not abort on B")
|
||||
end
|
||||
mashUntil(function() return not findText("stopped evolving") end, 80)
|
||||
assert(mon.species == "CATERPIE", "species changed after re-offer cancel")
|
||||
|
||||
-- === Case 2 (control): no input -> evolution completes ===
|
||||
local mon2 = Pokemon.new(game.data, "CATERPIE", 7)
|
||||
table.insert(game.save.party, 1, mon2)
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
-- Driver: party list must not sit under the bottom message box (#262).
|
||||
-- Gen1 (pokered engine/menus/party_menu.asm RedrawPartyMenu_) places the
|
||||
-- first name at hlcoord 3, 0 and advances each entry by 2*SCREEN_WIDTH.
|
||||
-- The recomp used y = (i-1)*16 + 12, which shoved a full party down so
|
||||
-- slot 6 was clipped by the "Choose a POKéMON." text box (tile row 12).
|
||||
-- This driver opens a 6-mon party menu, screenshots it, and asserts
|
||||
-- PartyMenu.entryY keeps slot 6's HP row above y=96.
|
||||
-- POKEPORT_DRIVER=tests/drivers/party_bug262_offset_test.lua \
|
||||
-- POKEPORT_IDENTITY=bug262 POKEPORT_TOUCH=0 POKEPORT_VERSION=red love .
|
||||
return function(game)
|
||||
local U = dofile("tests/drivers/util.lua")
|
||||
local DIR = os.getenv("SHOT_DIR") or "/tmp/shots"
|
||||
local Pokemon = require("src.pokemon.Pokemon")
|
||||
local Screens = require("src.ui.Screens")
|
||||
local PartyMenu = require("src.ui.PartyMenu")
|
||||
|
||||
local pass, fail = 0, 0
|
||||
local function check(label, ok)
|
||||
if ok then pass = pass + 1; U.log("PASS", label)
|
||||
else fail = fail + 1; U.log("FAIL", label) end
|
||||
end
|
||||
|
||||
game.save.party = {
|
||||
Pokemon.new(game.data, "CHARMANDER", 12),
|
||||
Pokemon.new(game.data, "PARAS", 10),
|
||||
Pokemon.new(game.data, "DIGLETT", 15),
|
||||
Pokemon.new(game.data, "FARFETCHD", 5),
|
||||
Pokemon.new(game.data, "GASTLY", 20),
|
||||
Pokemon.new(game.data, "SANDSHREW", 22),
|
||||
}
|
||||
|
||||
U.teleport(game, "ROUTE_1", 5, 5, "down")
|
||||
Screens.push(game, "PartyMenu")
|
||||
U.wait(8)
|
||||
U.shot(game, DIR .. "/party_bug262_offset.png")
|
||||
|
||||
local pm = game.stack:top()
|
||||
check("top is PartyMenu", getmetatable(pm) == PartyMenu)
|
||||
check("entryY(1) == 0", PartyMenu.entryY(1) == 0)
|
||||
check("entryY(6) == 80", PartyMenu.entryY(6) == 80)
|
||||
check("slot 6 HP row < message box y=96", PartyMenu.entryY(6) + 8 < 96)
|
||||
check("field message == 'Choose a POKéMON.'",
|
||||
pm and pm.bottomMessage and pm:bottomMessage() == "Choose a POKéMON.")
|
||||
|
||||
U.log(("RESULT pass=%d fail=%d"):format(pass, fail))
|
||||
end
|
||||
Reference in New Issue
Block a user