extends SceneTree func _initialize() -> void: call_deferred("run") func run() -> void: var agent = load("res://tests/pcb/power_agent.gd").new() root.add_child(agent) agent.session = "test" agent.boot = "test" agent.cabinet = load("res://data/cabinets/cabinet_01.tres") await agent.execute({"id": "prepare", "session": "test", "type": "prepare", "game": "pacman", "game_config": {"power_on_device": "cab1_btn_ylw", "rfid_credit_device": "cab1_rfid1"}}) assert(agent.phase == "powered_off") assert(agent.outcomes.prepare.ok) agent.game.set_physics_process(false) await agent.execute({"id": "power", "session": "test", "type": "power_on"}) assert(agent.phase == "booting" and agent.outcomes.power.ok) agent.game._physics_process(2.0) await agent.execute({"id": "power", "session": "test", "type": "power_on"}) assert(agent.game.boot_elapsed == 2.0, "Duplicate commands must not restart boot") agent.game._physics_process(2.0) assert(agent.phase == "ready") assert(agent.reports.any(func(r): return r.get("event") == "power_ready")) await agent.execute({"id": "reset", "session": "test", "type": "reset"}) assert(agent.phase == "idle" and agent.game == null) agent.queue_free() await process_frame print("MANAGED PACMAN POWER: PASS") quit()