From 6780393f45bb222ffefc59e4a8bd87a15922402e Mon Sep 17 00:00:00 2001 From: syybott Date: Sat, 15 Aug 2026 19:39:48 -0500 Subject: [PATCH] Add extended battle HUD visual coverage --- tests/drivers/battle_hud_layout_lock_test.lua | 36 ++++++++++ .../drivers/fill_extended_auto_menu_test.lua | 53 +++++++++++++++ .../drivers/fill_extended_white_hud_test.lua | 64 ++++++++++++++++++ .../drivers/fixed_extended_black_hud_test.lua | 64 ++++++++++++++++++ .../drivers/fixed_extended_white_hud_test.lua | 65 +++++++++++++++++++ .../drivers/fixed_extended_world_hud_test.lua | 65 +++++++++++++++++++ 6 files changed, 347 insertions(+) create mode 100644 tests/drivers/battle_hud_layout_lock_test.lua create mode 100644 tests/drivers/fill_extended_auto_menu_test.lua create mode 100644 tests/drivers/fill_extended_white_hud_test.lua create mode 100644 tests/drivers/fixed_extended_black_hud_test.lua create mode 100644 tests/drivers/fixed_extended_white_hud_test.lua create mode 100644 tests/drivers/fixed_extended_world_hud_test.lua diff --git a/tests/drivers/battle_hud_layout_lock_test.lua b/tests/drivers/battle_hud_layout_lock_test.lua new file mode 100644 index 00000000..24b44732 --- /dev/null +++ b/tests/drivers/battle_hud_layout_lock_test.lua @@ -0,0 +1,36 @@ +local U = require("tests.drivers.util") + +local OUT = os.getenv("SHOT_DIR") or "battle-hud-layout-lock" +local BEFORE = OUT .. "/battle_hud_wide_extended.png" +local AFTER = OUT .. "/battle_hud_og_locked_standard.png" + +return function(game) + os.remove(BEFORE) + os.remove(AFTER) + + local options = game.save.options + options.battleLayout = "wide" + options.battleHud = "extended" + + local menu = require("src.ui.Screens").push(game, "OptionsMenu") + local layoutRow, hudRow + for _, row in ipairs(menu.rows) do + if row.id == "battleLayout" then layoutRow = row end + if row.id == "battleHud" then hudRow = row end + end + assert(layoutRow and hudRow, "battle layout/HUD rows are present") + + menu.index = 6 + menu.scroll = 3 + assert(hudRow.value(game) == "EXTENDED", "WIDE displays EXTENDED") + assert(U.shot(game, BEFORE), "WIDE/EXTENDED screenshot was written") + + layoutRow.step(game, 1) + assert(options.battleLayout == "og", "layout switched to OG") + assert(options.battleHud == "standard", "OG normalized HUD to STANDARD") + assert(hudRow.value(game) == "STANDARD", "OG displays STANDARD") + assert(U.shot(game, AFTER), "OG/STANDARD screenshot was written") + + print("[driver] BATTLE_HUD_LAYOUT_LOCK_PASS") + game.driverDone = true +end diff --git a/tests/drivers/fill_extended_auto_menu_test.lua b/tests/drivers/fill_extended_auto_menu_test.lua new file mode 100644 index 00000000..94311bab --- /dev/null +++ b/tests/drivers/fill_extended_auto_menu_test.lua @@ -0,0 +1,53 @@ +-- Visual and behavioral acceptance for the adaptive BATTLE BG menu rule. +return function(game) + local U = dofile("tests/drivers/util.lua") + local DIR = os.getenv("SHOT_DIR") or "/tmp/shots" + + love.window.setMode(1920, 1080, { resizable = true }) + U.wait(3) + + local options = game.save.options + options.battleLayout = "wide" + options.battleFit = "fixed" + options.battleHud = "extended" + options.battleBg = "black" + + local menu = require("src.ui.Screens").push(game, "OptionsMenu") + local fitRow, bgRow + local bgIndex + for i, row in ipairs(menu.rows) do + if row.id == "battleFit" then fitRow = row end + if row.id == "battleBg" then bgRow, bgIndex = row, i end + end + assert(fitRow and bgRow and bgIndex, "battle size/background rows are present") + + fitRow.step(game, 1) + assert(options.battleFit == "fill", "battle size switched to FILL") + assert(options.battleBg == "white", "FILL + EXTENDED normalized background to WHITE") + assert(bgRow.value(game) == "AUTO", "adaptive background is labeled AUTO") + assert(bgRow.step(game, 1) == false, "AUTO background row is locked") + assert(options.battleBg == "white", "locked AUTO retains the WHITE value") + + menu.index = bgIndex + menu.scroll = math.max(0, bgIndex - 5) + U.wait(2) + local autoPath = DIR .. "/fill_extended_auto_menu.png" + os.remove(autoPath) + local ok = U.shot(game, autoPath) + + fitRow.step(game, -1) + assert(options.battleFit == "fixed", "battle size switched back to FIXED") + assert(bgRow.value(game) == "WHITE", "FIXED exposes the stored WHITE choice") + assert(bgRow.step(game, 1) == true and options.battleBg == "black", + "FIXED can select BLACK") + assert(bgRow.step(game, 1) == true and options.battleBg == "world", + "FIXED can select WORLD") + U.wait(2) + local fixedPath = DIR .. "/fixed_extended_background_choices.png" + os.remove(fixedPath) + ok = U.shot(game, fixedPath) and ok + + U.log(ok and "FILL_EXTENDED_AUTO_MENU_PASS" + or "FILL_EXTENDED_AUTO_MENU_FAIL") + love.event.quit(ok and 0 or 1) +end diff --git a/tests/drivers/fill_extended_white_hud_test.lua b/tests/drivers/fill_extended_white_hud_test.lua new file mode 100644 index 00000000..fc1a3f2a --- /dev/null +++ b/tests/drivers/fill_extended_white_hud_test.lua @@ -0,0 +1,64 @@ +-- Visual acceptance driver for WIDE + FILL + EXTENDED + WHITE. +-- The full physical-window backing remains white while the four battle HUD +-- panels move to their approved window anchors. +return function(game) + local U = dofile("tests/drivers/util.lua") + local DIR = os.getenv("SHOT_DIR") or "/tmp/shots" + local BattleState = require("src.battle.BattleState") + local Pokemon = require("src.pokemon.Pokemon") + + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(3) + + local options = game.save.options + options.battleLayout = "wide" + options.battleFit = "fill" + options.battleHud = "extended" + options.battleBg = "white" + + game.save.party = { Pokemon.new(game.data, "PIKACHU", 100) } + U.teleport(game, "ROUTE_1", 5, 5, "down") + U.wait(60) + + local battle = BattleState.newWild(game, "PIDGEY", 3, + { onFinish = function() end }) + game.overworld:pushBattle(battle) + U.wait(360) + + battle.introSlide = 0 + battle.introBalls = nil + battle.showEnemyTrainer = false + battle.showPlayerBack = false + battle.enemySendingOut = false + battle.sendingOut = false + battle.phase = "menu" + battle.menuIndex = 1 + U.wait(2) + + assert(battle:extendedHUD(), "FILL/WHITE activates the approved extended HUD") + assert(not battle:extendedWorldHUD(), "FILL/WHITE does not use FIXED's paper band") + + local path = DIR .. "/fill_extended_white_separate_layer.png" + os.remove(path) + local ok = U.shot(game, path) + + love.window.setMode(960, 540, { resizable = true }) + U.wait(5) + local smallPath = DIR .. "/fill_extended_white_small_16x9.png" + os.remove(smallPath) + ok = U.shot(game, smallPath) and ok + + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(5) + local NamingScreen = require("src.ui.NamingScreen") + game.stack:push(NamingScreen.new(game, { + title = "NICKNAME?", maxLen = 10, onDone = function() end, + })) + U.wait(5) + local overlayPath = DIR .. "/fill_extended_white_naming_overlay.png" + os.remove(overlayPath) + ok = U.shot(game, overlayPath) and ok + + U.log(ok and "FILL_EXTENDED_WHITE_PASS" or "FILL_EXTENDED_WHITE_FAIL") + love.event.quit(ok and 0 or 1) +end diff --git a/tests/drivers/fixed_extended_black_hud_test.lua b/tests/drivers/fixed_extended_black_hud_test.lua new file mode 100644 index 00000000..5676c314 --- /dev/null +++ b/tests/drivers/fixed_extended_black_hud_test.lua @@ -0,0 +1,64 @@ +local U = require("tests.drivers.util") + +local OUT = os.getenv("SHOT_DIR") or "fixed-extended-black" +local FULL = OUT .. "/fixed_extended_black_full.png" +local SMALL = OUT .. "/fixed_extended_black_small_16x9.png" +local OVERLAY = OUT .. "/fixed_extended_black_overlay.png" + +return function(game) + local BattleState = require("src.battle.BattleState") + local Pokemon = require("src.pokemon.Pokemon") + + os.remove(FULL) + os.remove(SMALL) + os.remove(OVERLAY) + + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(3) + + local options = game.save.options + options.battleLayout = "wide" + options.battleFit = "fixed" + options.battleHud = "extended" + options.battleBg = "black" + + game.save.party = { Pokemon.new(game.data, "PIKACHU", 100) } + U.teleport(game, "ROUTE_1", 5, 5, "down") + U.wait(60) + + local battle = BattleState.newWild(game, "PIDGEY", 3, + { onFinish = function() end }) + game.overworld:pushBattle(battle) + U.wait(360) + battle.introSlide = 0 + battle.introBalls = nil + battle.showEnemyTrainer = false + battle.showPlayerBack = false + battle.enemySendingOut = false + battle.sendingOut = false + battle.phase = "menu" + battle.menuIndex = 1 + U.wait(2) + + assert(battle:extendedHUD(), "BLACK activates the approved extended HUD") + assert(battle:extendedBlackHUD(), "BLACK activates the white vertical battle band") + assert(not battle:extendedWorldHUD(), "BLACK remains separate from WORLD") + assert(U.shot(game, FULL), "full black-background screenshot was written") + + love.window.setMode(960, 540, { resizable = true }) + U.wait(10) + assert(U.shot(game, SMALL), "small black-background screenshot was written") + + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(10) + battle.blankForAskName = true + local naming = require("src.ui.NamingScreen").new(game, { + title = "NICKNAME?", maxLen = 10, onDone = function() end, + }) + game.stack:push(naming) + U.wait(10) + assert(U.shot(game, OVERLAY), "black-background overlay screenshot was written") + + print("[driver] FIXED_EXTENDED_BLACK_PASS") + love.event.quit(0) +end diff --git a/tests/drivers/fixed_extended_white_hud_test.lua b/tests/drivers/fixed_extended_white_hud_test.lua new file mode 100644 index 00000000..7f528de5 --- /dev/null +++ b/tests/drivers/fixed_extended_white_hud_test.lua @@ -0,0 +1,65 @@ +local U = require("tests.drivers.util") + +local OUT = os.getenv("SHOT_DIR") or "fixed-extended-white" +local FULL = OUT .. "/fixed_extended_white_full.png" +local SMALL = OUT .. "/fixed_extended_white_small_16x9.png" +local OVERLAY = OUT .. "/fixed_extended_white_overlay.png" + +return function(game) + local BattleState = require("src.battle.BattleState") + local Pokemon = require("src.pokemon.Pokemon") + + os.remove(FULL) + os.remove(SMALL) + os.remove(OVERLAY) + + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(3) + + local options = game.save.options + options.battleLayout = "wide" + options.battleFit = "fixed" + options.battleHud = "extended" + options.battleBg = "white" + + game.save.party = { Pokemon.new(game.data, "PIKACHU", 100) } + U.teleport(game, "ROUTE_1", 5, 5, "down") + U.wait(60) + + local battle = BattleState.newWild(game, "PIDGEY", 3, + { onFinish = function() end }) + game.overworld:pushBattle(battle) + U.wait(360) + battle.introSlide = 0 + battle.introBalls = nil + battle.showEnemyTrainer = false + battle.showPlayerBack = false + battle.enemySendingOut = false + battle.sendingOut = false + battle.phase = "menu" + battle.menuIndex = 1 + U.wait(2) + assert(battle:extendedHUD(), "WHITE activates the approved extended HUD") + assert(not battle:extendedWorldHUD(), "WHITE keeps its opaque paper field") + assert(U.shot(game, FULL), "full WHITE screenshot was written") + + love.window.setMode(960, 540, { resizable = true }) + U.wait(10) + assert(U.shot(game, SMALL), "small WHITE screenshot was written") + + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(10) + battle.blankForAskName = true + local naming = require("src.ui.NamingScreen").new(game, { + title = "NICKNAME?", + maxLen = 10, + initial = "", + onDone = function() end, + }) + game.stack:push(naming) + U.wait(10) + assert(U.shot(game, OVERLAY), "WHITE overlay screenshot was written") + + print("[driver] FIXED_EXTENDED_WHITE_PASS") + love.event.quit(0) +end diff --git a/tests/drivers/fixed_extended_world_hud_test.lua b/tests/drivers/fixed_extended_world_hud_test.lua new file mode 100644 index 00000000..8ed309a2 --- /dev/null +++ b/tests/drivers/fixed_extended_world_hud_test.lua @@ -0,0 +1,65 @@ +-- Visual acceptance driver for the first EXTENDED HUD configuration only: +-- WIDE + FIXED + EXTENDED + WORLD. +-- POKEPORT_DRIVER=tests/drivers/fixed_extended_world_hud_test.lua \ +-- POKEPORT_IDENTITY=fixed-extended-world POKEPORT_TOUCH=0 \ +-- SHOT_DIR=/tmp/shots love . +return function(game) + local U = dofile("tests/drivers/util.lua") + local DIR = os.getenv("SHOT_DIR") or "/tmp/shots" + local BattleState = require("src.battle.BattleState") + local Pokemon = require("src.pokemon.Pokemon") + + -- Match the 16:9 acceptance screenshot so the fixed 304x144 surface has + -- measurable space above and below it. + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(3) + + local options = game.save.options + options.battleLayout = "wide" + options.battleFit = "fixed" + options.battleHud = "extended" + options.battleBg = "world" + + game.save.party = { Pokemon.new(game.data, "PIKACHU", 100) } + U.teleport(game, "ROUTE_1", 5, 5, "down") + U.wait(60) + + local battle = BattleState.newWild(game, "PIDGEY", 3, + { onFinish = function() end }) + game.overworld:pushBattle(battle) + U.wait(360) + + battle.introSlide = 0 + battle.introBalls = nil + battle.showEnemyTrainer = false + battle.showPlayerBack = false + battle.enemySendingOut = false + battle.sendingOut = false + battle.phase = "menu" + battle.menuIndex = 1 + U.wait(2) + + local path = DIR .. "/fixed_extended_world_separate_layer.png" + os.remove(path) + local ok = U.shot(game, path) + + love.window.setMode(960, 540, { resizable = true }) + U.wait(5) + local smallPath = DIR .. "/fixed_extended_world_small_16x9.png" + os.remove(smallPath) + ok = U.shot(game, smallPath) and ok + + love.window.setMode(2048, 1152, { resizable = true }) + U.wait(5) + local NamingScreen = require("src.ui.NamingScreen") + game.stack:push(NamingScreen.new(game, { + title = "NICKNAME?", maxLen = 10, onDone = function() end, + })) + U.wait(5) + local overlayPath = DIR .. "/fixed_extended_world_naming_overlay.png" + os.remove(overlayPath) + ok = U.shot(game, overlayPath) and ok + + U.log(ok and "FIXED_EXTENDED_WORLD_PASS" or "FIXED_EXTENDED_WORLD_FAIL") + love.event.quit(ok and 0 or 1) +end