gameinput test: read the pad before expecting a scripted press to end (TEST-GAMEINPUT-SCRIPT-READS) #2159

Manually merged
github merged 1 commit from gh-pr/2159/head into gh-pr/2159/base 2026-11-26 10:20:38 +00:00
Owner

@⁠quartz-heron-58 on GitHub · 2026-11-26 00:29 UTC · original
quartz-heron-58:gameinput-script-reads → main · +8 −1 · 1 files · 1 commits · merged 2026-11-26 02:15 UTC

Claimed in the coordination issue as: TEST-GAMEINPUT-SCRIPT-READS (#1608)

Depends on: none. #2152 edits other places of the same test file; the two merge in either order (checked with git merge-tree against main only, not against each other).

What and why

ctest gameinput_script (gameinput_test --input-script) fails on main in every build with SDL3: "10 checks, 1 failures", the failing check being "long script: the timed press ends while the physical key stays held". Here: 3 of 3 runs on c50ed94b3; on 33bd07cf8, before #2098, the test passed.

#2098 changed update_keyboard_pad so that a scripted press lasts its 300 ms and then until the title has made six GetCurrentReading calls since it began (kReads, at most kMaxHold = 5 s), so a title that polls slowly still sees it. The test was not changed with it: its last step sleeps 350 ms, polls once and expects the press to be over, with only three reads made since the press began. A build without SDL3 has this test disabled, so CI did not show the failure.

This is the test side only. The last step now

  1. checks that the press is still held after its 300 ms while fewer than six reads have been made (the new rule, which had no check),
  2. reads the pad six more times, polls, and expects the release with the physical key still held.

No change to gameinput.cpp. If the six-read rule was not meant to apply this way, the first new check is the one that would say so.

Tested

Windows 11 (26300), MSVC Build Tools 2022, RelWithDebInfo, scripts\build_runtime.ps1 -FetchSdl3 on main 61732aca1 plus this commit: build exit 0.

  • ctest gameinput_script: 5 of 5 runs pass. ctest -R gameinput: 3 of 3 (gameinput_host, gameinput, gameinput_script).
  • gameinput_test.exe --input-script: 11 checks, 0 failures, both new lines PASS.
  • Before the change, same machine: 3 of 3 runs of gameinput_script failed on c50ed94b3.
  • scripts/check_no_game_data.py on the changed file: clean.

Not run: the whole ctest set; Linux/Wine. The timing margin was not stressed: the test relies on 350 ms of sleep being past the 300 ms hold, as it did before.

GPUs tested: n/a (no GPU code)

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: no translator rule)

🤖 Generated with Claude Code

**@⁠quartz-heron-58** on GitHub · 2026-11-26 00:29 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2159) `quartz-heron-58:gameinput-script-reads` → `main` · +8 −1 · 1 files · 1 commits · merged 2026-11-26 02:15 UTC Claimed in the coordination issue as: TEST-GAMEINPUT-SCRIPT-READS (#1608) Depends on: none. #2152 edits other places of the same test file; the two merge in either order (checked with `git merge-tree` against main only, not against each other). ### What and why ctest `gameinput_script` (`gameinput_test --input-script`) fails on main in every build with SDL3: "10 checks, 1 failures", the failing check being "long script: the timed press ends while the physical key stays held". Here: 3 of 3 runs on c50ed94b3; on 33bd07cf8, before #2098, the test passed. #2098 changed `update_keyboard_pad` so that a scripted press lasts its 300 ms and then until the title has made six `GetCurrentReading` calls since it began (`kReads`, at most `kMaxHold` = 5 s), so a title that polls slowly still sees it. The test was not changed with it: its last step sleeps 350 ms, polls once and expects the press to be over, with only three reads made since the press began. A build without SDL3 has this test disabled, so CI did not show the failure. This is the test side only. The last step now 1. checks that the press is still held after its 300 ms while fewer than six reads have been made (the new rule, which had no check), 2. reads the pad six more times, polls, and expects the release with the physical key still held. No change to `gameinput.cpp`. If the six-read rule was not meant to apply this way, the first new check is the one that would say so. ### Tested Windows 11 (26300), MSVC Build Tools 2022, RelWithDebInfo, `scripts\build_runtime.ps1 -FetchSdl3` on main 61732aca1 plus this commit: build exit 0. - ctest `gameinput_script`: 5 of 5 runs pass. `ctest -R gameinput`: 3 of 3 (gameinput_host, gameinput, gameinput_script). - `gameinput_test.exe --input-script`: 11 checks, 0 failures, both new lines PASS. - Before the change, same machine: 3 of 3 runs of `gameinput_script` failed on c50ed94b3. - `scripts/check_no_game_data.py` on the changed file: clean. Not run: the whole ctest set; Linux/Wine. The timing margin was not stressed: the test relies on 350 ms of sleep being past the 300 ms hold, as it did before. GPUs tested: n/a (no GPU code) AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: no translator rule) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Since #2098 a scripted press lasts its 300 ms and then until the title has made
six GetCurrentReading calls since it began. gameinput_test --input-script still
expected the press to be over after 350 ms and three reads, so ctest
gameinput_script failed on main in every build with SDL3 (it is disabled
without SDL3, so CI did not show it).

The test now checks that the press is still held at that point, reads the pad
six more times and then expects the release. Test only.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 10:20:36 +00:00
github manually merged commit 9ea22eaf44 into gh-pr/2159/base 2026-11-26 10:20:38 +00:00
Author
Owner

@⁠klikso on GitHub · 2026-11-26 01:01 UTC · original

Heads-up: #2144 (scripted holds, button@seconds:hold) now edits the same lines of gameinput_test.cpp. After a finding on #1608, its SDL3 loop honours the hold. Its long-script test also checks your read latch: X is still held past 300 ms while there are fewer than six reads, and ends after six. So whichever of the two lands second needs a small rebase, and your check stays covered either way. AI-assisted.

**@⁠klikso** on GitHub · 2026-11-26 01:01 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2159#issuecomment-7179348993) Heads-up: #2144 (scripted holds, `button@seconds:hold`) now edits the same lines of `gameinput_test.cpp`. After a finding on #1608, its SDL3 loop honours the hold. Its long-script test also checks your read latch: X is still held past 300 ms while there are fewer than six reads, and ends after six. So whichever of the two lands second needs a small rebase, and your check stays covered either way. AI-assisted.
Author
Owner

@⁠aslan2142 on GitHub · 2026-11-26 02:15 UTC · original

Merged, thanks! Since #2098 a scripted press lasts until the title has read the pads six times, and the long-script case now reads the pad before expecting the press to end.

  • Tested: your Windows 11 run with SDL3 (gameinput_script 5 of 5, and 3 of 3 failing before the change). Our Wine cross-build has no SDL3, so gameinput_script is disabled there; its gameinput_no_sdl* tests pass on the gfx1036 iGPU with this and #2169 merged onto main ad41fd517.
  • Checked on main 88b290fcb + 9ea22eaf4: it merges cleanly; the semantic suite passes (496 files, 6,336 tests, 0 files failed); the 15 docs and writer tests pass; check_no_game_data.py is clean on the 1 changed files.

AI-assisted (Claude Code, Claude Opus 5.5).

**@⁠aslan2142** on GitHub · 2026-11-26 02:15 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2159#issuecomment-7180623204) Merged, thanks! Since #2098 a scripted press lasts until the title has read the pads six times, and the long-script case now reads the pad before expecting the press to end. - **Tested:** your Windows 11 run with SDL3 (`gameinput_script` 5 of 5, and 3 of 3 failing before the change). Our Wine cross-build has no SDL3, so `gameinput_script` is disabled there; its `gameinput_no_sdl*` tests pass on the gfx1036 iGPU with this and #2169 merged onto `main` `ad41fd517`. - **Checked on `main` `88b290fcb` + `9ea22eaf4`:** it merges cleanly; the semantic suite passes (496 files, 6,336 tests, 0 files failed); the 15 docs and writer tests pass; `check_no_game_data.py` is clean on the 1 changed files. AI-assisted (Claude Code, Claude Opus 5.5).
This discussion has been locked. Commenting is limited to contributors.
No description provided.