Files
sacred_k/tools/autotest-load.ps1
T
khallaandClaude Opus 5.5 c6c5530709 Maps in widened views: TAB overlay in place, M map across the full width
- hud: shift SetViewport/Clear with moved windows (TAB overview map)
- megamap: view constants patched to the render width (clip, scroll limit,
  edge scrolling, centre, dark band, zoomed view and its markers); frame
  stretched to the screen edges, zoom controls and their click area centred
- hud: Anchor::Screen windows are drawn and clicked unshifted but still own
  the event scope
- autotest waits for log markers instead of fixed delays (~18 s per run)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-16 01:12:34 +02:00

47 lines
2.0 KiB
PowerShell

# Automated smoke test: start the game, load a save game (-Save: its row in
# the list, 1 = the first, selected by default), take
# screenshots in-game and with the ESC menu open, then stop the game.
#
# .\tools\autotest-load.ps1 -Name ws_on # current sacred_re.ini
# .\tools\autotest-load.ps1 -Name ws_off -Ini "[widescreen]`r`nEnabled=0"
#
# -Ini temporarily appends settings to build\x86-debug\sacred_re.ini.
# Click positions are for the classic (menu) layout scaled onto a 3440x1440
# monitor; adjust for other monitors. Don't touch mouse/keyboard while it runs.
param(
[string]$Name = "autotest",
[string]$Ini = "",
[int]$LoadTimeoutSeconds = 60,
# Row of the save game in the load screen's list (1-3 visible rows).
[int]$Save = 1,
# Runs in-game after loading, before the screenshots (e.g. clicks).
[scriptblock]$InGame = $null
)
$ErrorActionPreference = "Stop"
. (Join-Path $PSScriptRoot "game-input.ps1")
$root = Split-Path $PSScriptRoot
$iniPath = Join-Path $root "build\x86-debug\sacred_re.ini"
$iniBackup = if (Test-Path $iniPath) { Get-Content $iniPath -Raw } else { "" }
if ($Ini) { Set-Content $iniPath ($iniBackup + "`r`n" + $Ini + "`r`n") -Encoding ASCII }
$game = $null
try {
$game = Start-Sacred
Click-At 1720 779 -AfterMs 1500 # main menu: "Spiel laden"
if ($Save -gt 1) {
Click-At 1342 (609 + ($Save - 1) * 254) -AfterMs 800 # load screen: the save's name (rows 254 px apart)
}
Click-At 2382 568 -AfterMs 2000 # load screen: "Laden"
Click-At 1551 826 -AfterMs 0 # confirm: "Ok"
Wait-Log "cEngine End and exit constructor" -TimeoutSeconds $LoadTimeoutSeconds -AfterMs 1500 -Game $game
if ($InGame) { & $InGame }
Save-Screen "screenshots\${Name}_ingame.png" | Out-Null
Press-Key 0x1B -AfterMs 2500 # ESC menu
Save-Screen "screenshots\${Name}_esc.png" | Out-Null
"game alive at end: $(-not $game.HasExited)"
} finally {
Stop-Sacred $game
if ($Ini) { Set-Content $iniPath $iniBackup -Encoding ASCII -NoNewline }
}