54 lines
1.4 KiB
GDScript
54 lines
1.4 KiB
GDScript
extends SceneTree
|
|
|
|
const MainScene = preload("res://main.tscn")
|
|
|
|
var game: Control
|
|
var failures: Array[String] = []
|
|
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("run_test")
|
|
|
|
|
|
func run_test() -> void:
|
|
game = MainScene.instantiate()
|
|
game.auto_boot = false
|
|
root.add_child(game)
|
|
await settle(12)
|
|
game.locale = "zh_CN"
|
|
game.text_scale = 1.0
|
|
game.reduced_motion = false
|
|
game.muted = true
|
|
game.boot_verified = true
|
|
game.front_choice = "Hearthguard"
|
|
game.rear_choice = "Farstring"
|
|
game.depart()
|
|
var elapsed := 0.0
|
|
while game.page != game.AppPage.VICTORY and elapsed < 22.0:
|
|
await process_frame
|
|
elapsed += 1.0 / 30.0
|
|
if game.page != game.AppPage.VICTORY:
|
|
failures.append("dynamic slice did not reach victory")
|
|
if game.guard_events != 1 or game.rear_events != 1 or game.victory_events != 1:
|
|
failures.append("dynamic slice role events were not committed exactly once")
|
|
await create_timer(1.6).timeout
|
|
game.queue_free()
|
|
game = null
|
|
await settle(120)
|
|
if failures.is_empty():
|
|
print("ABG_P9_0R1_DYNAMIC_SLICE_OK duration=%.2f phases=6 advance=1 front_response=1 rear_action=1 enemy_defeat=1 victory=1 renderer=normal" % elapsed)
|
|
call_deferred("finish", 0)
|
|
else:
|
|
for failure in failures:
|
|
push_error(failure)
|
|
call_deferred("finish", 1)
|
|
|
|
|
|
func finish(exit_code: int) -> void:
|
|
quit(exit_code)
|
|
|
|
|
|
func settle(frames: int) -> void:
|
|
for frame in range(frames):
|
|
await process_frame
|