79 lines
2.9 KiB
GDScript
79 lines
2.9 KiB
GDScript
extends SceneTree
|
|
|
|
const Main = preload("res://main.gd")
|
|
const Fixture = preload("res://tests/p9_8/runtime_fixture.gd")
|
|
|
|
var failures: Array[String] = []
|
|
|
|
|
|
func _initialize() -> void:
|
|
call_deferred("run_test")
|
|
|
|
|
|
func run_test() -> void:
|
|
root.content_scale_mode = Window.CONTENT_SCALE_MODE_CANVAS_ITEMS
|
|
root.content_scale_aspect = Window.CONTENT_SCALE_ASPECT_EXPAND
|
|
root.content_scale_size = Vector2i(844, 390)
|
|
root.size = Vector2i(844, 390)
|
|
var game = Main.new()
|
|
game.auto_boot = false
|
|
game.p93_experience_enabled = false
|
|
root.add_child(game)
|
|
await process_frame
|
|
var market8 := Fixture.market8()
|
|
expect(game._is_p98_handoff(market8), "exact P9.7 Market 8 is a P9.8 handoff")
|
|
game.start_p97_experience(market8)
|
|
await settle_frames()
|
|
expect(is_instance_valid(game.p97_experience) and game.p98_experience == null, "P9.7 keeps the accepted Relay threshold before continuation")
|
|
expect(game.p97_experience.find_child("P98ContinueContractButton", true, false) != null, "Relay threshold exposes one explicit P9.8 continuation")
|
|
await tap(game.p97_experience.find_child("P98ContinueContractButton", true, false) as Control)
|
|
expect(game.p97_experience == null and is_instance_valid(game.p98_experience), "continuation touch replaces P9.7 with the P9.8 controller")
|
|
expect(game.p98_experience.market.state.p98_activated and int(game.p98_experience.market.state.current_market) == 8, "P9.8 receives the exact Market 8 snapshot")
|
|
expect(game.p98_experience.find_child("P98ArtifactButton_AR-001", true, false) != null, "handoff renders the first Contract decision")
|
|
var v3: Dictionary = game.p98_experience.market.state.snapshot()
|
|
game.p98_experience.queue_free()
|
|
game.p98_experience = null
|
|
await settle_frames()
|
|
game.start_p98_experience(v3)
|
|
await settle_frames()
|
|
expect(is_instance_valid(game.p98_experience) and game.p98_experience.market.state.snapshot() == v3, "valid v3 resumes without rerolling the board")
|
|
game.queue_free()
|
|
for _index in 45:
|
|
await process_frame
|
|
if failures.is_empty():
|
|
print("ABG_P9_8_MAIN_HANDOFF_OK p97_market8=relay_touch p98_v3=resume board=stable controller=exclusive")
|
|
quit(0)
|
|
else:
|
|
for failure in failures:
|
|
push_error(failure)
|
|
quit(1)
|
|
|
|
|
|
func settle_frames() -> void:
|
|
await process_frame
|
|
await process_frame
|
|
|
|
|
|
func tap(control: Control) -> void:
|
|
expect(control != null, "handoff control exists before parsed touch")
|
|
if control == null:
|
|
return
|
|
var point := root.get_final_transform() * control.get_global_rect().get_center()
|
|
var down := InputEventScreenTouch.new()
|
|
down.index = 0
|
|
down.position = point
|
|
down.pressed = true
|
|
Input.parse_input_event(down)
|
|
await process_frame
|
|
var up := InputEventScreenTouch.new()
|
|
up.index = 0
|
|
up.position = point
|
|
up.pressed = false
|
|
Input.parse_input_event(up)
|
|
await settle_frames()
|
|
|
|
|
|
func expect(condition: bool, message: String) -> void:
|
|
if not condition:
|
|
failures.append("P9.8 main handoff: %s" % message)
|