Initial project sync

This commit is contained in:
wxm
2026-07-06 22:55:14 -07:00
commit 8cca00d0da
1066 changed files with 58585 additions and 0 deletions
+99
View File
@@ -0,0 +1,99 @@
extends SceneTree
var failures: Array[String] = []
func _init() -> void:
_run.call_deferred()
func _run() -> void:
root.size = Vector2i(1152, 648)
var settings := _ensure_game_settings()
settings.call("set_difficulty", &"normal")
var flow: Node = load("res://autoload/game_flow_manager.gd").new()
flow.name = "FlowUnderTest"
flow.set("manage_scene", false)
root.add_child(flow)
await process_frame
flow.call("_set_state", &"Title")
await process_frame
_expect_equal(StringName(str(flow.get("state"))), &"Title", "Flow should start on title")
var title_screen := flow.get("_screens").get(&"Title", null) as Control
_expect(title_screen != null, "Title screen should exist")
if title_screen != null:
_expect(title_screen.get_node_or_null("MenuArt") is TextureRect, "Title should use the panel frame art")
_expect(title_screen.get_node_or_null("TitleLogo") is TextureRect, "Title should show the game logo art")
_expect(title_screen.get_node_or_null("TitleDifficultyValue") is Label, "Title should show the current-difficulty footer (2026-07-05 mockup)")
_expect(title_screen.get_node_or_null("StartGameButton") is Button, "Title should expose the start button")
_expect(title_screen.get_node_or_null("DifficultyButton") is Button, "Title should expose the difficulty button")
_expect(title_screen.get_node_or_null("QuitGameButton") is Button, "Title should expose the quit button")
await _click(Vector2(191, 355))
_expect_equal(StringName(str(flow.get("state"))), &"DifficultySelect", "Clicking difficulty opens the difficulty page")
var difficulty_screen := flow.get("_screens").get(&"DifficultySelect", null) as Control
_expect(difficulty_screen != null, "Difficulty screen should exist")
if difficulty_screen != null:
_expect(difficulty_screen.get_node_or_null("MenuArt") is TextureRect, "Difficulty should use the panel frame art")
_expect(difficulty_screen.get_node_or_null("DifficultyFooterValue") is Label, "Difficulty screen should show the current-difficulty footer (2026-07-05 mockup)")
_expect(difficulty_screen.get_node_or_null("ConfirmStartButton") is Button, "Difficulty should expose the start command")
_expect(difficulty_screen.get_node_or_null("BackTitleButton") is Button, "Difficulty should expose the back command")
await _click(Vector2(191, 221))
_expect_equal(StringName(str(flow.get("_pending_difficulty"))), &"easy", "Clicking easy selects the easy difficulty")
_expect_equal(StringName(str(settings.get("difficulty"))), &"easy", "Clicking easy applies the selected difficulty immediately")
await _click(Vector2(191, 558))
_expect_equal(StringName(str(flow.get("state"))), &"Title", "Clicking the reference back button returns to title")
flow.free()
_finish()
func _click(position: Vector2) -> void:
var motion := InputEventMouseMotion.new()
motion.position = position
root.push_input(motion)
await process_frame
var press := InputEventMouseButton.new()
press.button_index = MOUSE_BUTTON_LEFT
press.position = position
press.pressed = true
root.push_input(press)
await process_frame
var release := InputEventMouseButton.new()
release.button_index = MOUSE_BUTTON_LEFT
release.position = position
release.pressed = false
root.push_input(release)
await process_frame
func _ensure_game_settings() -> Node:
var settings := root.get_node_or_null("GameSettings")
if settings != null:
return settings
settings = load("res://autoload/game_settings.gd").new()
settings.name = "GameSettings"
root.add_child(settings)
return settings
func _expect(condition: bool, label: String) -> void:
if not condition:
failures.append(label)
func _expect_equal(actual: Variant, expected: Variant, label: String) -> void:
if actual != expected:
failures.append("%s: expected %s, got %s" % [label, expected, actual])
func _finish() -> void:
if failures.is_empty():
print("PASS menu difficulty confirm")
quit(0)
else:
for failure: String in failures:
push_error(failure)
quit(1)