test(input): the display-pointer fixture defines rx_option, which mouse_capture now asks (#178) #187

Merged
HumanBean merged 1 commit from d4nkn3ss/Longshot:fix/test-display-pointer-rx-option into main 2026-11-13 16:38:17 +00:00
Contributor

Why

tests/test_display_pointer.py fails on main: since #178 (Mouse camera Off) its fixture doesn't link, so the checks of the mouse pointer and capture code in host/display.c and host/posix/display_sdl.c aren't running.

What changed

  • tests: tests/display_pointer_test.cpp defines rx_option(int, int) in both its win and sdl namespaces, returning the option's default. #178 made mouse_capture() in both display files ask rx_option(6, 0) (Mouse camera), declared inside the function, so the pasted copies need it in their own namespace: without it, ld.lld: error: undefined symbol: win::rx_option(int, int).

Flags and settings

None

Measurements

main: 000f19fb (2026-11-13)
this PR: fix/test-display-pointer-rx-option @ 840a9223
Hardware: Windows 11, llvm-mingw clang 23 (the Longshot Builder's), Python 3.12
Scene: n/a (game-free)
Method: python -I -B tests/run_all.py display_pointer on both sides
How to reproduce: the command above, with clang++ on PATH

main @ 000f19fb this PR @ 840a9223
tests/test_display_pointer.py FAIL: ld.lld: error: undefined symbol: win::rx_option(int, int) pass

Testing

Tested: the row above on Windows 11.

Full suite: python -I -B tests/run_all.py on this branch @ 840a9223, Windows 11: 486 passed, 2 failed, 33 skipped: tests/test_check_third_party.py (#80) and tests/test_release.py (#119, #144, #145), both failing on main the same way.

Not tested: Linux: the check runs there too (no RUN_ALL_SKIP) and its sdl copy needs the same definition, added here; not run on Linux.

Needs other testers: None

Screenshots

Nothing on screen

Risk and rollback

Test-only; reverting the commit is enough.

Issues

None

Checklist

For everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description).
  • Rebased on current main.
  • python -I -B tests/run_all.py run and passing (any failure that also fails on main is named above).
  • Tested in the game, or what wasn't is named under Testing. (Test-only change: nothing in the game.)
  • Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests).
  • Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (A test result: the same on every run.)
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

If applicable

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • A check under tests/ that reads changed source updated in this PR, not weakened.

🤖 Generated with Claude Code

## Why `tests/test_display_pointer.py` fails on `main`: since #178 (Mouse camera Off) its fixture doesn't link, so the checks of the mouse pointer and capture code in `host/display.c` and `host/posix/display_sdl.c` aren't running. ## What changed - tests: `tests/display_pointer_test.cpp` defines `rx_option(int, int)` in both its `win` and `sdl` namespaces, returning the option's default. #178 made `mouse_capture()` in both display files ask `rx_option(6, 0)` (Mouse camera), declared inside the function, so the pasted copies need it in their own namespace: without it, `ld.lld: error: undefined symbol: win::rx_option(int, int)`. ## Flags and settings None ## Measurements main: 000f19fb (2026-11-13) this PR: fix/test-display-pointer-rx-option @ 840a9223 Hardware: Windows 11, llvm-mingw clang 23 (the Longshot Builder's), Python 3.12 Scene: n/a (game-free) Method: `python -I -B tests/run_all.py display_pointer` on both sides How to reproduce: the command above, with clang++ on PATH | | main @ 000f19fb | this PR @ 840a9223 | |---|---|---| | `tests/test_display_pointer.py` | FAIL: `ld.lld: error: undefined symbol: win::rx_option(int, int)` | pass | ## Testing **Tested:** the row above on Windows 11. **Full suite:** `python -I -B tests/run_all.py` on this branch @ 840a9223, Windows 11: 486 passed, 2 failed, 33 skipped: `tests/test_check_third_party.py` (#80) and `tests/test_release.py` (#119, #144, #145), both failing on `main` the same way. **Not tested:** Linux: the check runs there too (no `RUN_ALL_SKIP`) and its `sdl` copy needs the same definition, added here; not run on Linux. **Needs other testers:** None ## Screenshots Nothing on screen ## Risk and rollback Test-only; reverting the commit is enough. ## Issues None ## Checklist ### For everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`). - [x] Rebased on current `main`. - [x] `python -I -B tests/run_all.py` run and passing (any failure that also fails on `main` is named above). - [x] Tested in the game, or what wasn't is named under Testing. (Test-only change: nothing in the game.) - [x] Testing filled in: what was tested, what wasn't, and what needs other testers (with test requests). - [x] Measured: main and this PR at named commits, on the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (A test result: the same on every run.) - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### If applicable - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
test(input): the display-pointer fixture defines rx_option, which mouse_capture now asks (#178)
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
840a922316
#178 (Mouse camera Off) made mouse_capture() in host/display.c and host/posix/display_sdl.c ask rx_option(6, 0), declared
inside the function. tests/display_pointer_test.cpp pastes those functions into its own namespaces and had no
rx_option, so the fixture didn't link: "ld.lld: error: undefined symbol: win::rx_option(int, int)". Both namespaces
now define it, returning the option's default.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
HumanBean approved these changes 2026-11-13 16:17:38 +00:00
HumanBean left a comment

Approve. The fix is right and still applies to current main.

What's good

  • The stub matches the real int rx_option(int id, int otherwise) (host/rx_backend.c:502, which returns otherwise when no renderer is attached). Returning otherwise is also what the game does before the renderer is up.
  • With the default, rx_option(6, 0) returns 0 (Mouse camera on), so mouse_capture() takes its normal capture path, which is the path the check exercises. Nothing the check covered before is hidden.
  • The definition has to be in the namespace because mouse_capture() declares rx_option at block scope, and that declaration resolves to win::rx_option.
  • host/display.c, host/posix/display_sdl.c, tests/test_display_pointer.py and the fixture have not changed on main@origin since this PR's base (main@origin is 1ef93e79, the PR's base). It applies cleanly.

Must change

  • None.

Should change

  • The sdl copy isn't needed. The SDL fixture stubs mouse_capture (static void mouse_capture(int on){mouse_captured=on;}) rather than cutting it, and none of the SDL functions it cuts call rx_option. Since it's non-static it doesn't warn, so it does no harm, but the description says the sdl copy "needs the same definition". Either drop it, or keep it and change the comment to say it's there for when mouse_capture gets cut.
  • Optional: the Mouse camera Off branch (rx_option(6, 0) == 2, where capture is refused) isn't tested anywhere. The stub could take a settable value so a case can check that mouse_capture(1) does nothing when the option is Off.
Approve. The fix is right and still applies to current main. **What's good** - The stub matches the real `int rx_option(int id, int otherwise)` (`host/rx_backend.c:502`, which returns `otherwise` when no renderer is attached). Returning `otherwise` is also what the game does before the renderer is up. - With the default, `rx_option(6, 0)` returns 0 (Mouse camera on), so `mouse_capture()` takes its normal capture path, which is the path the check exercises. Nothing the check covered before is hidden. - The definition has to be in the namespace because `mouse_capture()` declares `rx_option` at block scope, and that declaration resolves to `win::rx_option`. - `host/display.c`, `host/posix/display_sdl.c`, `tests/test_display_pointer.py` and the fixture have not changed on main@origin since this PR's base (main@origin is 1ef93e79, the PR's base). It applies cleanly. **Must change** - None. **Should change** - The `sdl` copy isn't needed. The SDL fixture stubs `mouse_capture` (`static void mouse_capture(int on){mouse_captured=on;}`) rather than cutting it, and none of the SDL functions it cuts call `rx_option`. Since it's non-static it doesn't warn, so it does no harm, but the description says the `sdl` copy "needs the same definition". Either drop it, or keep it and change the comment to say it's there for when `mouse_capture` gets cut. - Optional: the Mouse camera Off branch (`rx_option(6, 0) == 2`, where capture is refused) isn't tested anywhere. The stub could take a settable value so a case can check that `mouse_capture(1)` does nothing when the option is Off.
@ -127,6 +128,7 @@ constexpr uint32_t WM_APP=0x8000;
#ifndef WM_CLOSE
constexpr uint32_t WM_CLOSE=0x0010;
#endif
int rx_option(int, int otherwise) { return otherwise; } // (the menu's options: defaults; mouse_capture asks Mouse camera, 6)
Owner

This one is never used. The sdl namespace stubs mouse_capture (a few lines up) instead of cutting it, and none of the SDL functions the check cuts (hos_mouse_pointer, pointer_publish_at, pointer_update, drawable_size, sdl_button_bit, hos_posix_post_message, menu_mouse) call rx_option. It's harmless since it's non-static, but either drop it or say in the comment that it's there for when mouse_capture gets cut, and fix the description, which says the sdl copy is needed.

This one is never used. The `sdl` namespace stubs `mouse_capture` (a few lines up) instead of cutting it, and none of the SDL functions the check cuts (`hos_mouse_pointer`, `pointer_publish_at`, `pointer_update`, `drawable_size`, `sdl_button_bit`, `hos_posix_post_message`, `menu_mouse`) call `rx_option`. It's harmless since it's non-static, but either drop it or say in the comment that it's there for when `mouse_capture` gets cut, and fix the description, which says the sdl copy is needed.
HumanBean added this to the v3.0.0 milestone 2026-11-13 16:38:17 +00:00
HumanBean deleted branch fix/test-display-pointer-rx-option 2026-11-13 16:38:19 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 3s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
MagicBeanDev/Longshot!187
No description provided.