Repository navigation
feat(booth): add a kiosk mode that returns idle games to the attract screen #43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0826426
feat(booth): add a kiosk mode that returns idle games to the attract …
esthor ffb6381
style(booth): keep the booth test within the line limit
esthor 62970a7
fix(router): let a window close quit even during a route transition
esthor 250e937
chore(booth): commit the booth test's Godot UID like the other suites
esthor fcaed4c
test(booth): cover --booth and --route through a real launch
esthor 1184361
test(booth): assert the launched scene and child exit codes
esthor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,92 @@ | ||
| extends SceneTree | ||
| ## Booth mode: idle routes return to the hub, input keeps a game alive, the menu can't quit | ||
| ## the kiosk, and --route=<name> picks a launch route. The startup flags are checked by launching | ||
| ## the game as a child process, so _ready()'s own argument handling is covered. | ||
| ## Run headless with --script res://tests/booth_mode.gd. | ||
| var failures := 0 | ||
| var router: Node | ||
|
|
||
| func _initialize() -> void: | ||
| call_deferred("run") | ||
|
|
||
| func check(ok: bool, message: String) -> void: | ||
| print("PASS: " if ok else "FAIL: ", message) | ||
| if not ok: | ||
| failures += 1 | ||
|
|
||
| func wait(seconds: float) -> void: | ||
| await create_timer(seconds, true).timeout | ||
|
|
||
| func settle_route() -> void: | ||
| for i in 300: | ||
| if not router.busy: | ||
| break | ||
| await process_frame | ||
| await process_frame | ||
|
|
||
| ## Launch the game headless with user args for two simulated seconds (fixed 60 fps, so the | ||
| ## route fade always completes) and return its exit code and combined output. | ||
| func launch(user_args: Array[String]) -> Dictionary: | ||
| var args: Array[String] = ["--headless", "--path", ProjectSettings.globalize_path("res://"), | ||
| "--fixed-fps", "60", "--quit-after", "120", "--"] | ||
| args.append_array(user_args) | ||
| var output: Array = [] | ||
| var code := OS.execute(OS.get_executable_path(), args, output, true) | ||
| return {"code": code, "log": "\n".join(output)} | ||
|
|
||
| func on_hub() -> bool: | ||
| return current_scene != null and current_scene.scene_file_path == router.ROUTES["hub"] | ||
|
|
||
| func run() -> void: | ||
| router = root.get_node("AppRouter") | ||
| await wait(0.3) | ||
| check(not router.booth and not router.is_processing(), "Booth mode is off without --booth") | ||
|
|
||
| var launch: String = router.launch_route(PackedStringArray(["--route=heroes_vs_villains"])) | ||
| check(launch == "heroes_vs_villains", "--route names a launch route") | ||
| launch = router.launch_route(PackedStringArray(["--booth"])) | ||
| check(launch == "", "No --route means the default scene") | ||
|
|
||
| var plain := launch([]) | ||
| check(plain.code == 0, "A plain launch exits cleanly") | ||
| check(not plain.log.contains("booth mode on") and not plain.log.contains("launched route"), | ||
| "A plain launch starts without booth mode or a launch route") | ||
| var kiosk := launch(["--booth", "--route=heroes_vs_villains"]) | ||
| check(kiosk.code == 0, "A booth launch exits cleanly") | ||
| check(kiosk.log.contains("AppRouter: booth mode on"), "Launching with --booth turns booth mode on") | ||
| var opened: String = "AppRouter: launched route heroes_vs_villains (%s)" \ | ||
| % router.ROUTES["heroes_vs_villains"] | ||
| check(kiosk.log.contains(opened), "Launching with --route opens that route's scene") | ||
|
|
||
| router.go("platformer") | ||
| await settle_route() | ||
| await wait(0.5) | ||
| check(not on_hub(), "Without booth mode an idle game stays put") | ||
|
|
||
| router.set_booth(true) | ||
| router.idle_limit = 0.6 | ||
| check(router.booth and router.is_processing(), "set_booth enables the idle timer") | ||
| for i in 4: | ||
| await wait(0.25) | ||
| var key := InputEventKey.new() | ||
| key.physical_keycode = KEY_RIGHT | ||
| key.pressed = true | ||
| Input.parse_input_event(key) | ||
| Input.flush_buffered_events() | ||
| check(not on_hub(), "Input inside the idle window keeps the game running") | ||
|
|
||
| await wait(1.2) | ||
| await settle_route() | ||
| check(on_hub(), "An idle game returns to the hub's attract screen") | ||
|
|
||
| var before: int = router.get_child_count() | ||
| router.quit_game() | ||
| check(not router.busy and router.get_child_count() == before, | ||
| "The menu's Quit is ignored in booth mode") | ||
|
|
||
| router.set_booth(false) | ||
| router.idle_limit = router.IDLE_SECONDS | ||
| root.get_node("AudioService").shutdown() | ||
| await wait(0.4) | ||
| print("Booth mode failures: ", failures) | ||
| quit(1 if failures else 0) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://c7s3s7spaejbm |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
Add the booth suite to CI.
The PR notes that CI’s hand-written test list omits
booth_mode.gd. Add this standalone script to that list so future changes run its booth and launch-route checks automatically.As per path instructions, “Suggest focused regression coverage for changed behavior, not blanket coverage goals.”
🤖 Prompt for AI Agents
Source: Path instructions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Agent: Claude Code | Model: Opus 5.5 | Thinking: High | Acting on behalf of: Erik | Skill: none]
Agreed that it should run in CI. #40 replaces the hand-written list with a runner that discovers every
tests/**/*.gd, so this suite gets picked up with no list entry. Rather than add a line to an array #40 deletes, I'll update this branch frommainafter #40 merges. That also switches this suite's teardown toAudioService.settle(), which #40 introduces and its strict leak check expects, and confirms the suite passes in CI here before this merges. @coderabbitai does that plan work for you?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@esthorYes, that plan works. There is no need to add an entry to the list that#40will remove.After
#40merges:main.AudioService.settle().tests/booth_mode.gdand that the suite passes the strict leak check.The finding remains open until those steps are complete.
You are interacting with an AI system.