feat(qol & backup): add wave progress bar, hover collection, area explosion preview, hotkeys, auto-sync and json save export/import

This commit is contained in:
2026-09-17 13:20:29 +00:00
parent 7cd0792799
commit 23918dab1f
7 changed files with 710 additions and 38 deletions
+38
View File
@@ -843,6 +843,43 @@ def test_modern_dashboard_and_fullscreen():
for name, cond in dashboard_checks:
record(name, "PASS" if cond else "FAIL")
def test_qol_controls_and_backup():
print("\n--- 11d. QoL Controls, Wave Progress Bar & Data Backup/Restore ---")
html_path = os.path.join(GAME_DIR, "index.html")
with open(html_path, "r", encoding="utf-8") as f:
html_code = f.read()
game_js_path = os.path.join(GAME_DIR, "js/game.js")
with open(game_js_path, "r", encoding="utf-8") as f:
game_code = f.read()
wave_js_path = os.path.join(GAME_DIR, "js/systems/wave.js")
with open(wave_js_path, "r", encoding="utf-8") as f:
wave_code = f.read()
auth_js_path = os.path.join(GAME_DIR, "js/systems/auth.js")
with open(auth_js_path, "r", encoding="utf-8") as f:
auth_code = f.read()
grid_js_path = os.path.join(GAME_DIR, "js/systems/grid.js")
with open(grid_js_path, "r", encoding="utf-8") as f:
grid_code = f.read()
qol_checks = [
("Wave progress bar HUD drawing logic present", "Wave Progress Bar" in wave_code and "draw(ctx)" in wave_code),
("Wave progress bar flag & skull markers present", "drawFlags" in wave_code or "flag" in wave_code),
("Hover and swipe collection in game.js", "checkTouchCollect" in game_code and "mousemove" in game_code),
("Area/range explosion preview for bomb plants in grid.js", "drawAreaPreview" in grid_code),
("Plant selection hotkeys 1-6 implemented", "Digit1" in game_code or "Key1" in game_code),
("Shovel hotkey KeyS implemented", "KeyS" in game_code),
("Auto-save on beforeunload & visibilitychange present", "beforeunload" in auth_code or "beforeunload" in game_code),
("Export save file button in HTML and logic in auth.js", "btn-export-save" in html_code and "exportSaveFile" in auth_code),
("Import save file input/button in HTML and logic in auth.js", "input-import-save" in html_code and "importSaveFile" in auth_code),
]
for name, cond in qol_checks:
record(name, "PASS" if cond else "FAIL")
def main():
print("==================================================")
print("🌱 PLANTS VS. ZOMBIES — AUTONOMOUS TEST SUITE 🌱")
@@ -861,6 +898,7 @@ def main():
test_feedback_and_layout_system()
test_plant_shop_and_deck_selection()
test_modern_dashboard_and_fullscreen()
test_qol_controls_and_backup()
test_http_endpoint()
passed = sum(1 for r in TEST_RESULTS if r["status"] == "PASS")