- Add Help, Settings, Pause and review to the top-modal close chain so right-click and Esc behave consistently. - Restore the venue menu after menu Settings and prevent Help from opening Pause behind itself. - Reopen pause after in-shift Settings apply and recapture the mouse/unfreeze state on close. - Extend the session smoke for menu Settings, right-click Help and guard unfreeze.
109 lines
3.7 KiB
GDScript
109 lines
3.7 KiB
GDScript
extends SceneTree
|
|
## Session-shell smoke: boot the main scene, confirm the venue menu is showing,
|
|
## start a Joke Shop shift, open the pause overlay and settings, then return to
|
|
## the menu. Exits non-zero on failure.
|
|
##
|
|
## Usage:
|
|
## godot --headless --path . --script res://src/test/smoke_session_shell.gd
|
|
## godot --path . --script res://src/test/smoke_session_shell.gd (windowed)
|
|
var _frames := 0
|
|
var _manager = null
|
|
var _main = null
|
|
|
|
func _initialize() -> void:
|
|
var packed: PackedScene = load("res://scenes/main.tscn")
|
|
if packed == null:
|
|
printerr("cannot load main scene")
|
|
quit(1)
|
|
return
|
|
_main = packed.instantiate()
|
|
root.add_child(_main)
|
|
print("boot: main scene added")
|
|
|
|
func _process(_delta: float) -> bool:
|
|
_frames += 1
|
|
if _frames == 5:
|
|
_manager = _main.get_node_or_null("GameManager")
|
|
if _manager == null or _manager.start_menu == null or not _manager.start_menu.visible:
|
|
printerr("start menu not visible before settings check")
|
|
quit(1)
|
|
return true
|
|
_manager._open_settings()
|
|
if _frames == 7:
|
|
if _manager.settings_panel == null or not _manager.settings_panel.visible:
|
|
printerr("settings did not open from the venue menu")
|
|
quit(1)
|
|
return true
|
|
_manager.settings_panel._on_cancel()
|
|
if _frames == 8:
|
|
if not _manager.start_menu.visible:
|
|
printerr("cancelling menu settings did not return to the venue menu")
|
|
quit(1)
|
|
return true
|
|
print("boot: menu settings cancel returns to menu")
|
|
_manager._open_help()
|
|
_manager._handle_cancel(true)
|
|
if _frames == 9:
|
|
if _manager.help_overlay.visible or not _manager.start_menu.visible:
|
|
printerr("right-click did not close Help and keep the venue menu")
|
|
quit(1)
|
|
return true
|
|
print("boot: help closes on right-click")
|
|
if _frames == 10:
|
|
_manager = _main.get_node_or_null("GameManager")
|
|
if _manager.start_menu == null or not _manager.start_menu.visible:
|
|
printerr("start menu not visible at boot")
|
|
quit(1)
|
|
return true
|
|
print("boot: start menu visible")
|
|
_manager._on_venue_selected("hollywood_building_night")
|
|
if _frames == 20:
|
|
if str(_manager.active_scenario_id) != "hollywood_building" \
|
|
or int(_manager.coordinator.current_phase) != 3:
|
|
printerr("night variant did not resolve: id=%s phase=%s offset=%.1f" % [
|
|
str(_manager.active_scenario_id), str(_manager.coordinator.current_phase),
|
|
float(_manager.coordinator.phase_offset_s)])
|
|
quit(1)
|
|
return true
|
|
print("boot: night variant starts Hollywood in the late phase")
|
|
_manager._quit_to_menu()
|
|
if _frames == 30:
|
|
_manager._on_venue_selected("joke_shop")
|
|
if _frames == 260:
|
|
if _manager.npcs.size() == 0:
|
|
printerr("no NPCs spawned after shift start (id=%s running=%s elapsed=%.1f phase=%d)" % [
|
|
str(_manager.active_scenario_id), str(_manager.coordinator.running),
|
|
float(_manager.coordinator.elapsed_s), int(_manager.coordinator.current_phase)])
|
|
quit(1)
|
|
return true
|
|
print("boot: shift running, npcs=%d" % _manager.npcs.size())
|
|
_manager._open_pause()
|
|
if _frames == 270:
|
|
if _manager.pause_overlay == null or not _manager.pause_overlay.visible:
|
|
printerr("pause overlay did not open")
|
|
quit(1)
|
|
return true
|
|
print("boot: pause overlay visible")
|
|
_manager._open_settings()
|
|
if _frames == 280:
|
|
if _manager.settings_panel == null or not _manager.settings_panel.visible:
|
|
printerr("settings panel did not open")
|
|
quit(1)
|
|
return true
|
|
print("boot: settings visible")
|
|
_manager.settings_panel._on_cancel()
|
|
if _manager.guard.input_locked:
|
|
printerr("guard stayed frozen after settings cancel")
|
|
quit(1)
|
|
return true
|
|
_manager._quit_to_menu()
|
|
if _frames == 290:
|
|
if not _manager.start_menu.visible:
|
|
printerr("quit-to-menu did not return to the start menu")
|
|
quit(1)
|
|
return true
|
|
print("SMOKE PASS: menu -> shift -> pause -> settings -> menu")
|
|
quit(0)
|
|
return true
|
|
return false
|