KAZIK/tools/tests/test_hell_tower_runthrough.py
Игорь Федосеев eef2039c7e feat(hell_tower): integrate custom hell sprites, redesign tower menu, and fix entrance crash
- Add ResolveHellAssetPath to automatically load *-hell variants during tournamentMode with fallback to vanilla assets
- Rebuild Hell Tower briefing menu using HellTower_menu background with smooth floor cursor and sliding callout info card
- Fix buffer overrun in RenderHellTower3D by packing helltower-menu at native 640x480 resolution with bounds-checked blit
- Temporarily disable tower background music per user request
- Add asset packing pipeline, verification tools, and automated 10-floor run-through smoke test
2026-10-26 19:44:06 +03:00

45 lines
1.9 KiB
Python

"""Automated smoke test for Hell Tower 10-floor run-through."""
import subprocess
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
POKER_ASM = ROOT / "poker.asm"
def main():
print("[1/4] Preparing test harness in poker.asm...")
code = POKER_ASM.read_text(encoding="cp1251")
target = "\nIFDEF CASINO_ACTION_TEST\n"
if "CASINO_ACTION_TEST equ 1\n" not in code:
code = code.replace(target, "\nCASINO_ACTION_TEST equ 1\nIFDEF CASINO_ACTION_TEST\n")
POKER_ASM.write_text(code, encoding="cp1251")
try:
print("[2/4] Building poker.exe with test harness...")
build_res = subprocess.run(["cmd.exe", "/c", "build.bat"], cwd=ROOT, capture_output=True, text=True)
if build_res.returncode != 0:
print("[FAIL] Build failed:", build_res.stdout, build_res.stderr)
return 1
print("[3/4] Running Hell Tower 10-floor run-through...")
run_res = subprocess.run([str(ROOT / "poker.exe")], cwd=ROOT, capture_output=True, timeout=15)
print(f"Hell Tower test completed with exit code: {run_res.returncode}")
if run_res.returncode != 0:
print(f"[FAIL] Hell Tower run-through failed with code {run_res.returncode}")
return run_res.returncode
print("[SUCCESS] All 10 floors of Hell Tower completed without errors or crashes!")
finally:
print("[4/4] Restoring normal poker.asm and rebuilding...")
restored = POKER_ASM.read_text(encoding="cp1251")
if "CASINO_ACTION_TEST equ 1\n" in restored:
restored = restored.replace("CASINO_ACTION_TEST equ 1\n", "")
POKER_ASM.write_text(restored, encoding="cp1251")
subprocess.run(["cmd.exe", "/c", "build.bat"], cwd=ROOT, capture_output=True, text=True)
print("[OK] Production poker.exe rebuilt cleanly.")
return 0
if __name__ == "__main__":
sys.exit(main())