fix(tests): keep yellow-fixes suites ROM-free and dig-fade accurate

Drop Data:load from #1635/#1743 engine tests so headless CI without
data/generated/ can run them, and relax dig's #916 hide-ratio check for
white fade-in under spinDrop (#1644).
This commit is contained in:
1jamie
2026-08-25 12:58:03 -05:00
parent 69c7ee89b5
commit 93c7dff4d6
3 changed files with 22 additions and 12 deletions
+12 -2
View File
@@ -1,6 +1,8 @@
-- #1635: PrintItemUseTextAndRemoveItem items must request Heal_Ailment -- #1635: PrintItemUseTextAndRemoveItem items must request Heal_Ailment
-- via extra.useJingle after the "X used Y!" line. -- via extra.useJingle after the "X used Y!" line.
-- --
-- ROM-free: stubs items/text only (CI headless has no data/generated/).
--
-- luajit tests/engine/item_use_jingle_bug1635.lua -- luajit tests/engine/item_use_jingle_bug1635.lua
package.path = "./?.lua;./?/init.lua;" .. package.path package.path = "./?.lua;./?/init.lua;" .. package.path
@@ -9,11 +11,19 @@ if not _G.love then _G.love = require("tests.love_stub") end
local S = require("tests.harness").suite("item use Heal_Ailment jingle #1635") local S = require("tests.harness").suite("item use Heal_Ailment jingle #1635")
local check, eq = S.check, S.eq local check, eq = S.check, S.eq
local Data = require("src.core.Data")
local ItemEffects = require("src.inventory.ItemEffects") local ItemEffects = require("src.inventory.ItemEffects")
local SaveData = require("src.core.SaveData") local SaveData = require("src.core.SaveData")
if not Data.maps then Data:load() end local ITEM_IDS = {
"REPEL", "SUPER_REPEL", "MAX_REPEL",
"X_ATTACK", "X_DEFEND", "X_SPEED", "X_SPECIAL",
"X_ACCURACY", "DIRE_HIT", "GUARD_SPEC", "POKE_DOLL",
}
local Data = { items = {}, text = {} }
for _, id in ipairs(ITEM_IDS) do
Data.items[id] = { name = id:gsub("_", " ") }
end
local save = SaveData.newGame() local save = SaveData.newGame()
save.player.name = "RED" save.player.name = "RED"
@@ -29,11 +29,4 @@ Data.seedMtMoonB2FSuperNerd(empty)
eq(empty.trainer_headers.MtMoonB2F[1].battle, "KEEP", eq(empty.trainer_headers.MtMoonB2F[1].battle, "KEEP",
"seed does not overwrite an existing header") "seed does not overwrite an existing header")
-- live Data load (Red/Blue pin or Yellow seed) must expose the battle label
if not Data.maps then Data:load() end
local header = Data:trainerHeader("MtMoonB2F", 1)
check(header ~= nil, "loaded Data has MtMoonB2F[1]")
eq(header.battle, "_MtMoonB2FSuperNerdTheyreBothMineText",
"engageTrainer can resolve real pre-battle text")
S.finish() S.finish()
+10 -3
View File
@@ -52,7 +52,10 @@ Game.save.party = { Pokemon.new(Data, "FIXMON_A", 20) }
local stack = Game.stack local stack = Game.stack
-- The draw guard both entity passes use: the player sprite is skipped while -- The draw guard both entity passes use: the player sprite is skipped while
-- any of flyAnim / flyArrive / playerHidden is set. -- any of flyAnim / flyArrive / playerHidden is set. Dig/Teleport spinDrop
-- does NOT skip the sprite -- EnterMapAnim draws the spinning trainer under
-- the white fade-in (#1644) -- so "bare" is only a frame with no hide flag
-- and no arrival (gapFrames below).
local function playerHidden(ow) local function playerHidden(ow)
return ow.flyAnim ~= nil or ow.flyArrive ~= nil or ow.playerHidden == true return ow.flyAnim ~= nil or ow.flyArrive ~= nil or ow.playerHidden == true
end end
@@ -115,8 +118,12 @@ check(st.warpFrame ~= nil, "dig departure ends and the warp fade begins")
check(st.fadeFrames > 0, "dig warp fade ran (" .. st.fadeFrames .. " frames)") check(st.fadeFrames > 0, "dig warp fade ran (" .. st.fadeFrames .. " frames)")
eq(st.gapFrames, 0, eq(st.gapFrames, 0,
"no dig fade frame leaves the player standing bare (#916)") "no dig fade frame leaves the player standing bare (#916)")
check(st.fadeFramesHidden >= st.fadeFrames - 1, -- Dig uses white fade-out + fade-in (#1644). Draw-skip hide covers the
"dig fade hidden on every frame but the arrival-arming midpoint (" -- fade-out; the fade-in deliberately shows spinDrop under the veil, so
-- fadeFramesHidden is only the out half (allow one midpoint tick).
local Timing = require("src.core.Timing")
check(st.fadeFramesHidden >= Timing.FADE_OUT_TO_WHITE - 1,
"dig fade-out hidden ("
.. st.fadeFramesHidden .. "/" .. st.fadeFrames .. ")") .. st.fadeFramesHidden .. "/" .. st.fadeFrames .. ")")
check(st.arrivalFrame ~= nil, "dig arrival spin-down arms") check(st.arrivalFrame ~= nil, "dig arrival spin-down arms")
check(ow.playerHidden == false, "dig hide cleared on the new map") check(ow.playerHidden == false, "dig hide cleared on the new map")