mirror of
https://github.com/bryanthaboi/gen1recomp.git
synced 2026-08-21 05:00:43 +02:00
72592665d7
Every existing test around these callsites only ever runs with an
empty/fixture Data.text, so none of them could tell a properly-wired
romText/t._X call apart from a literal that never looked at the
catalog at all -- every assertion passed either way, the same coverage
gap the museum ticket clerk and status abbreviation fixes hit earlier.
Seven new tests fake the real label for each fix and assert the pushed
or queued message uses the translated value, plus a vanilla case per
fix confirming the no-catalog fallback still matches the original
English literal exactly:
- box_release_confirmation_romtext.lua (BoxMenu _OnceReleasedText, via
a TextBox.new spy so real pagination/choice behavior stays intact)
- slot_machine_lined_up_romtext.lua (SlotMachine _LinedUpText, symbol
concatenated in front of the translated suffix)
- battle_fainted_message_romtext.lua (BattleState onFaint, both
_PlayerMonFaintedText and _EnemyMonFaintedText, confirming the raw
name reaches each without a duplicated "Enemy")
- battle_catch_messages_romtext.lua (BattleState storeCaughtMon,
_ItemUseBallText06 plus both _ItemUseBallText07/08 branches on
EVENT_MET_BILL)
- battle_ball_dodge_romtext.lua (BattleState throwBall,
_ItemUseBallText00's \f-merge collapsing to exactly one queued
message)
- overworld_field_faint_heal_romtext.lua (OverworldController
applyFieldPoison's _PokemonFaintedText, and
useSoftboiledFieldMove's _ItemUseNoEffectText/_PotionText including
the recovered-amount slot the old literal never showed)
- overworld_hidden_item_romtext.lua (OverworldController
tryHiddenObject's _FoundHiddenItemText, both the {PLAYER} token and
the item name landing in the right slots)
Confirmed several of these fail against the pre-fix code and pass
against the current code, not just reasoned about it. Not every one of
the 15 fixed callsites has its own dedicated test -- the ShopMenu,
LinkBattle, trainer-withdraw/sent-out and the normal (non-hidden)
found-item sites share the same romText mechanism already proven
correct by the seven tests above, and building the heavier fixtures
each would need (a full mart flow, a link session, a trainer AI
switch, an object_event NPC) wasn't judged worth it for what would be
the same assertion shape again.
40 lines
1.6 KiB
Lua
40 lines
1.6 KiB
Lua
-- SlotMachine:resolveWin's "%s lined up!\nScored %d coins!" message used
|
|
-- to interpolate the symbol id AND the payout into one bare Lua literal.
|
|
-- The real _LinedUpText label has no slot for the symbol at all (the
|
|
-- original ROM drew it separately) -- only for the coin count. This test
|
|
-- fakes _LinedUpText and checks the symbol is concatenated in front of the
|
|
-- translated suffix, with the payout correctly substituted into it.
|
|
package.path = "./?.lua;./?/init.lua;" .. package.path
|
|
|
|
local T = require("tests.modkit")
|
|
local Data = T.fixtures.fresh()
|
|
|
|
local SlotMachine = require("src.ui.SlotMachine")
|
|
|
|
local function mkSelf()
|
|
local game = { data = Data, save = { coins = 0 } }
|
|
return setmetatable({ game = game, allowMatchesCounter = 0 }, SlotMachine)
|
|
end
|
|
|
|
-- translated: the fake suffix reaches self.message, with the symbol
|
|
-- concatenated in front and the payout substituted into the fake text
|
|
do
|
|
local self = mkSelf()
|
|
Data.text._LinedUpText = " FAKE-SUFFIX {RAM:wStringBuffer}!"
|
|
self:resolveWin({ symbol = "CHERRY", payout = 8 })
|
|
T.eq(self.message, "CHERRY FAKE-SUFFIX 8!",
|
|
"a translated _LinedUpText reaches the lined-up message")
|
|
Data.text._LinedUpText = nil
|
|
end
|
|
|
|
-- vanilla: with no catalog entry, the English literal still substitutes,
|
|
-- with its own leading space (the original had no slot for the symbol)
|
|
do
|
|
local self = mkSelf()
|
|
self:resolveWin({ symbol = "CHERRY", payout = 8 })
|
|
T.eq(self.message, "CHERRY lined up!\nScored 8 coins!",
|
|
"no catalog entry still falls back to the English literal")
|
|
end
|
|
|
|
T.finish("slot_machine_lined_up_romtext")
|