EventAnimator now emits CollisionOccurred at the end of the collision
phase, carrying the struck cell and victim/destroyer identity. Main pans
and zooms the camera onto the cell over 0.45s and shows a fading toast
("Pion détruit par Tour — retourné au stock", or "collision mutuelle"
for same-status ties). The toast fades out after 3s and leaves the
camera framing the collision so the player can inspect the aftermath
before resuming.
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
"""Smoke test for collision camera pan + notification toast."""
|
|
import sys, time
|
|
from pathlib import Path
|
|
|
|
sys.path.insert(0, str(Path(__file__).resolve().parents[2]))
|
|
|
|
from tools.automation.harness import Harness
|
|
|
|
|
|
def main():
|
|
with Harness.launch(run_name="collision") as h:
|
|
h.load_mission("campaign_01", 0)
|
|
|
|
# Two Pawns that will collide on (1,0) at turn 1 — mutual destruction
|
|
h.place("Pawn", (0, 0), (1, 0))
|
|
h.place("Pawn", (2, 0), (1, 0))
|
|
h.screenshot("01_before_collision")
|
|
|
|
h.set_speed(0.2)
|
|
h.play()
|
|
time.sleep(1.5)
|
|
|
|
h.screenshot("02_during_pan_zoom")
|
|
time.sleep(1.0)
|
|
h.screenshot("03_toast_visible")
|
|
|
|
s = h.state()
|
|
print(f"[after] phase={s['phase']} pieces={len(s['pieces'])} stock={s['remainingStock']}")
|
|
assert s['phase'] == 'Paused', f"Expected auto-pause after collision, got {s['phase']}"
|
|
assert len(s['pieces']) == 0, "Both pawns should have been returned to stock"
|
|
print("OK — collision auto-pause, pieces returned to stock")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|