Eight tickets. The last one is the interesting one. #166 - PLAINER DIALOG. Every spoken line rewritten: the nine prologue lines and all twenty quest brief/done pairs. Mostly splitting em-dash subclauses into sentences and dropping the literary register ("hulls" -> "ships", "That is our hands back" -> "That frees us for other work"). Same meaning, same voice. #167 - NOTHING ANNOUNCED TWICE. Quests carry an `important` flag; seven of the twenty have it, and they are the search for the World Ship. A quest handed out with its goal ALREADY met is now credited in silence unless it is one of those - no brief, no answer, both signals still fired and the index still moved, so it appears ticked in the objectives panel. The chain used to stop the game to set a task the player had already done, then stop it again to congratulate them on it. #168 - THE KEYBOARD CAN ANSWER A DIALOG. The rule the ticket asks for (still arriving, show it all; already whole, move on) was already the rule for a click since #149, but a key press reached the banner and did nothing - and this game is played with WASD and a mouse. Touch, click and key now go through one door. Modifiers alone and auto-repeat echoes are not presses. #169 - A LOADING SCREEN. A press raises a cover, and the load happens after it has been on screen for a frame, so the wait is something the player is watching. Deliberately still a blocking load: load_threaded_request() comes back FAILED for these scenes, reporting text-parse errors that load() does not produce, because the global class names and preloads they reach each other through are not resolvable off the loading thread. A progress bar is not worth a menu that sometimes refuses to start the game, and the web build ships with thread support off anyway. Further presses while loading are ignored - on the web a button fires on PRESS, so an impatient double tap costs nothing to make and used to build the world twice. #170 - THE PICTURE BEFORE THE CAPTION. The prologue's first line was up before the scene had finished arriving, so the game opened STOPPED (#128) over a convoy nobody had seen yet. It flies for three seconds first. #171 - THE CONTROLS FOLLOW WHAT IS BEING HELD. is_touchscreen_available() asks whether a touch COULD arrive, and in a browser that is yes on any laptop whose panel reports touch support - so the web build put thumb sticks over a screen being played with a mouse, and switched mouse aiming off on the machine it exists for. The reading is now the last input actually used, it lives in GameState so the sticks and the guns cannot disagree, and it is two-way: nothing can strand a tablet, because the gesture that needs the controls is the gesture that brings them back. A touch suppresses mouse evidence for a second, so the click Godot manufactures out of a tap is not mistaken for a mouse. #172 - AIM AT A PLACE. Every gun was handed the same direction, so a fleet firing at something threw a sheet of parallel bolts past either side of it and only the middle hull could hit - worse the wider the formation. Guns now take a POINT and each hull works out its own heading to it, so the fleet's fire converges. The mouse already had a place and was flattening it into a bearing; a pushed stick names the point at the guns' reach along it, so touch loses nothing. The assist (#89) still bends a shot onto an enemy, now per hull and around that hull's own heading. The aim guide stops at the point and marks it. #173 - AND THE ONE THAT EXPLAINS ITSELF. "In the web export version the fleet can not store any resources" is not a web bug. It is the third time the Godot editor's .tres writer has quietly dropped a property it thought was default-valued: InterceptorVesselDefinition losing `capabilities` leaves cargo_capacity at 20 and takes away the "cargo" claim that fleet_cargo_capacity() actually gates on, so the hold is zero and nothing can be mined or carried. That is the symptom, word for word. test_definitions_intact caught it in the suite. What it could not do is catch it in a BUILD - an export is taken from the working tree at whatever moment the editor last touched it, which is exactly when the damage is done and exactly where nobody is running tests. The checks move to core/CatalogCheck.gd and now run at startup in every build as well as in the test, from the same function. On the web push_error lands in the on-page log web_shell.html mirrors, which is the only error a phone can read. The tree is intact today, so a fresh export should restore the hold. The point of the change is that the next time it is not, the build says so. Full suite green at 154/154. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0139MmxRAJSUe1j77kftAWv3
142 lines
5.6 KiB
GDScript
142 lines
5.6 KiB
GDScript
extends SceneTree
|
|
|
|
# Headless gameplay test: run with
|
|
# godot --headless -s res://tests/test_main_menu.gd
|
|
# Verifies:
|
|
# 1. the menu loads with Play/Map Editor/Quit; Map Editor is enabled and
|
|
# reaches PlanetSetupEditor.tscn (#48)
|
|
# 2. there is no Quit entry in any build - a web build has nothing to quit
|
|
# to, and Android's back gesture already does it
|
|
# 3. Play resets GameState to a fresh game AND reaches Main.tscn
|
|
# 4. #169 - a press puts a loading screen up FIRST and swaps the scene
|
|
# afterwards. A button that does nothing for several seconds reads as a
|
|
# button that was not pressed, which is how the web build reads; the
|
|
# order is the whole fix, so it is the thing asserted.
|
|
# 5. #169 - a second press while a load is running is ignored, or an
|
|
# impatient double tap builds the world twice (on the web a button fires
|
|
# on PRESS, so that tap costs nothing to make)
|
|
|
|
var menu: Node
|
|
var game_state: Node
|
|
var elapsed: float = 0.0
|
|
var stage: int = 0
|
|
|
|
|
|
func _initialize() -> void:
|
|
game_state = root.get_node("GameState")
|
|
menu = load("res://ui/MainMenu.tscn").instantiate()
|
|
root.add_child(menu)
|
|
current_scene = menu
|
|
|
|
|
|
func _process(delta: float) -> bool:
|
|
elapsed += delta
|
|
match stage:
|
|
0:
|
|
# A scene added to the tree inside _initialize() has not had its
|
|
# _ready() flushed yet - see test_planet_setups.gd for the same
|
|
# hazard - so the menu's @onready buttons aren't valid until a
|
|
# frame has actually processed.
|
|
if elapsed < 0.1:
|
|
return false
|
|
if not menu.editor_button.enabled:
|
|
return _fail("map editor button is not enabled (#48 shipped)")
|
|
# Both development entries follow the same rule, and the rule is
|
|
# what is under test rather than the concrete boolean - this run
|
|
# is from Godot, so it exercises the "shown" branch.
|
|
var developing: bool = menu.is_developer_build()
|
|
if menu.editor_button.visible != developing or menu.editor_label.visible != developing:
|
|
return _fail("map editor entry visibility did not follow is_developer_build()")
|
|
if menu.dev_button.visible != developing or menu.dev_label.visible != developing:
|
|
return _fail("dev mode entry visibility did not follow is_developer_build()")
|
|
if menu.has_node("UI/QuitButton") or menu.has_node("UI/QuitLabel"):
|
|
return _fail("the menu still carries a Quit entry")
|
|
|
|
_press(menu.editor_button)
|
|
|
|
# --- 4. the cover goes up before anything blocks --------------
|
|
if menu.loading_path != "res://surface/PlanetSetupEditor.tscn":
|
|
return _fail("the press did not start a load (loading_path %s)" % menu.loading_path)
|
|
if menu.loading_screen == null or not menu.loading_screen.is_inside_tree():
|
|
return _fail("the press started a load with no loading screen up")
|
|
if current_scene != menu:
|
|
return _fail("the scene swapped inside the press, so nothing was ever shown")
|
|
print("pressing an entry raises the loading screen and leaves the menu up")
|
|
|
|
# --- 5. and a second press changes nothing --------------------
|
|
var screen: Node = menu.loading_screen
|
|
_press(menu.editor_button)
|
|
_press(menu.play_button)
|
|
if menu.loading_screen != screen \
|
|
or menu.loading_path != "res://surface/PlanetSetupEditor.tscn":
|
|
return _fail("a second press while loading started another scene")
|
|
print("further presses while a load is running are ignored")
|
|
|
|
elapsed = 0.0
|
|
stage = 1
|
|
return false
|
|
1:
|
|
# Waited on rather than timed: the load is spread over frames now,
|
|
# and how many it takes is a property of the machine.
|
|
var on_editor: bool = current_scene != null and current_scene.name == "PlanetSetupEditor"
|
|
if not on_editor:
|
|
if elapsed < 30.0:
|
|
return false
|
|
return _fail("pressing Map Editor did not reach PlanetSetupEditor.tscn in 30s")
|
|
print("the load finished and the scene swapped")
|
|
|
|
# Return to the menu the same way the player would, then test Play.
|
|
menu = load("res://ui/MainMenu.tscn").instantiate()
|
|
root.add_child(menu)
|
|
current_scene = menu
|
|
elapsed = 0.0
|
|
stage = 2
|
|
return false
|
|
2:
|
|
if elapsed < 0.1:
|
|
return false
|
|
# Dirty the game state exactly like an in-progress run would,
|
|
# so a genuine reset is distinguishable from a coincidental match.
|
|
game_state.bank_inventory.set_amount(GameState.RESOURCE_ORE, 999)
|
|
game_state.add_building(GameState.BUILDING_MOTHERSHIP, Vector2.ZERO)
|
|
game_state.surviving_ship_count = 1
|
|
game_state.planet_capture["chunk:1:1"] = {"captured": [true], "conquered": true}
|
|
|
|
_press(menu.play_button)
|
|
elapsed = 0.0
|
|
stage = 3
|
|
return false
|
|
3:
|
|
var on_main: bool = current_scene != null and current_scene.name == "Main"
|
|
if not on_main and elapsed < 30.0:
|
|
return false
|
|
# A normal game now starts with NOTHING banked - the opening
|
|
# mining run is the tutorial, and 500 free ore skipped it.
|
|
var reset_ok: bool = game_state.rocks == 0 and game_state.buildings.is_empty() \
|
|
and game_state.surviving_ship_count == GameState.STARTING_SHIP_COUNT \
|
|
and game_state.planet_capture.is_empty()
|
|
print("on_main=%s reset_ok=%s rocks=%d buildings=%d ship_count=%d" % [
|
|
on_main, reset_ok, game_state.rocks, game_state.buildings.size(),
|
|
game_state.surviving_ship_count
|
|
])
|
|
if not on_main or not reset_ok:
|
|
return _fail("Play did not reset to a fresh game before reaching Main.tscn")
|
|
print("TEST_MAIN_MENU: PASS")
|
|
quit(0)
|
|
return true
|
|
return false
|
|
|
|
|
|
func _press(button: IconButton) -> void:
|
|
var down: InputEventScreenTouch = InputEventScreenTouch.new()
|
|
down.pressed = true
|
|
button._gui_input(down)
|
|
var up: InputEventScreenTouch = InputEventScreenTouch.new()
|
|
up.pressed = false
|
|
button._gui_input(up)
|
|
|
|
|
|
func _fail(message: String) -> bool:
|
|
print("TEST_MAIN_MENU: FAIL (%s)" % message)
|
|
quit(1)
|
|
return true
|