fix(ui): game-ui's tests build again, and one message carries the menu's language (#3152) #3187

Merged
HumanBean merged 2 commits from cuecuemoar/Longshot:fix/cjk-fonts-followup into main 2026-12-04 20:19:22 +00:00
Contributor

Summary

#3152 was merged at the review bot's fix commit (f8825d1), which had not been built, and two things came with it:

  • cargo test -p game-ui no longer compiles on main (error[E0282]: type annotations needed, game/crates/ui/src/text.rs). The fix changed fallback_plan to take impl FnMut(&'static str) -> bool, and two tests still passed &|p| .... They pass their closures by value now. fallbacks_from's doc comment is reworded in the file's style; the code is unchanged.
  • Two messages carry the menu's language. #3137 added Msg::Language (the theme's text sizes) while #3152 was in review, and the rebase kept #3152's as Msg::FontLanguage (the texts' locale, which font draws a Han letter first), each with its own field in Presents. Both hold the renderer's i18n::lang_code(): the start-up view's menu_lang and the status's are filled from it (gpu/vk/vk_menu.cpp). Msg::Language now also sets the fonts' language and lays every text out again when it changed, as FontLanguage did; FontLanguage and its field are gone.

Read first: game/crates/ui/src/core.rs (Msg::Language's handler), game/crates/longshot-game/src/ui.rs (game_ui_present).

See #3152, #3075.

Testing

Tested: Windows 10, RTX 4090, driver 617.42, 2560x1440, by hand; runtime v3.2.0-309-g73a31480b (game/crates/ui, longshot-game/src/ui.rs and api/src/services/ui.rs identical to this head's), Insert menu, Graphics tab, Game language set in the run's settings, Menu language Auto: Simplified Chinese, Korean and Japanese each drawn in full, no boxes, as with #3152. No fault in any of the three runs' logs.

Checks (Linux, WSL Ubuntu 22.04), on cfd1c1781 against main 9f76a4379 (this head 92f01007d is the same two changes plus the test below, rebased onto edeb8e2b5, whose new commits touch only the builder):

  • cargo test -q -p game-ui: main does not compile (E0282); on 92f01007d 188 passed, 0 failed (with #3152's fallback_tries_later_files_after_read_and_registration_failures).
  • New, another_menu_language_lays_every_text_out_again_in_its_fonts_once (game/crates/ui/src/core/tests.rs): Msg::Language to the UI core drops the laid-out texts, lays the mod's roots out and paints them again once, and the same language again does nothing. Nothing tested that path before: with the handler's font part taken out, it fails (the texts laid out in the other language are dropped).
  • A cold review by a second agent (the diff, the renderer's two language fields, the first frame, the order in the batch): nothing blocking; its point, no test of the language reaching the fonts, is the test above.
  • scripts/check_host_compile.py, Linux and Windows (llvm-mingw): both pass on both sides. cargo fmt --check clean; cargo clippy -p game-ui -p longshot-game -p api --all-targets has nothing in the changed files (on 92f01007d too).
  • The whole suite --strict: here 844 passed, 46 failed, 13 skipped; main fails the same 46 files (they fail on main in this WSL). main's side stopped before its totals line, after its last three one-at-a-time checks (test_recorder_sync, test_prepare_stall, test_sampler_admission, none reading the UI).

Still to test:

  • Linux (any GPU), in the game: the Insert menu, Graphics tab, in Simplified Chinese, Traditional Chinese, Japanese and Korean, expecting every letter and the language names drawn (from #3152's review, L1: the game does not run in WSL here; @Beanstalk or by hand).

Measurements

Nothing to measure: a test's call and one message folded into another, sent at the same changes as before.

Risks

The fonts' language now arrives with Msg::Language, sent only when the renderer's start-up view gives a code (as the theme's was); FontLanguage was sent with en when the renderer gave none. With no code the texts keep no locale, and Han is drawn by fontique's default (Simplified Chinese's font first). Nothing changes in saves or settings; a revert is enough.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says.
  • mise run test passes (any failure that also fails on main is named).
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here (game-ui's tests: they do not build on main, they pass here).
  • Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers").
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_01VxeaZmaAApz6unGJRcGT4M

## Summary #3152 was merged at the review bot's fix commit (f8825d1), which had not been built, and two things came with it: - **`cargo test -p game-ui` no longer compiles on `main`** (`error[E0282]: type annotations needed`, `game/crates/ui/src/text.rs`). The fix changed `fallback_plan` to take `impl FnMut(&'static str) -> bool`, and two tests still passed `&|p| ...`. They pass their closures by value now. `fallbacks_from`'s doc comment is reworded in the file's style; the code is unchanged. - **Two messages carry the menu's language.** #3137 added `Msg::Language` (the theme's text sizes) while #3152 was in review, and the rebase kept #3152's as `Msg::FontLanguage` (the texts' locale, which font draws a Han letter first), each with its own field in `Presents`. Both hold the renderer's `i18n::lang_code()`: the start-up view's `menu_lang` and the status's are filled from it (`gpu/vk/vk_menu.cpp`). `Msg::Language` now also sets the fonts' language and lays every text out again when it changed, as `FontLanguage` did; `FontLanguage` and its field are gone. Read first: `game/crates/ui/src/core.rs` (`Msg::Language`'s handler), `game/crates/longshot-game/src/ui.rs` (`game_ui_present`). See #3152, #3075. ## Testing **Tested:** Windows 10, RTX 4090, driver 617.42, 2560x1440, by hand; runtime `v3.2.0-309-g73a31480b` (`game/crates/ui`, `longshot-game/src/ui.rs` and `api/src/services/ui.rs` identical to this head's), Insert menu, Graphics tab, Game language set in the run's settings, Menu language Auto: Simplified Chinese, Korean and Japanese each drawn in full, no boxes, as with #3152. No fault in any of the three runs' logs. Checks (Linux, WSL Ubuntu 22.04), on cfd1c1781 against `main` 9f76a4379 (this head 92f01007d is the same two changes plus the test below, rebased onto edeb8e2b5, whose new commits touch only the builder): - `cargo test -q -p game-ui`: `main` does not compile (E0282); on 92f01007d 188 passed, 0 failed (with #3152's `fallback_tries_later_files_after_read_and_registration_failures`). - New, `another_menu_language_lays_every_text_out_again_in_its_fonts_once` (`game/crates/ui/src/core/tests.rs`): `Msg::Language` to the UI core drops the laid-out texts, lays the mod's roots out and paints them again once, and the same language again does nothing. Nothing tested that path before: with the handler's font part taken out, it fails (`the texts laid out in the other language are dropped`). - A cold review by a second agent (the diff, the renderer's two language fields, the first frame, the order in the batch): nothing blocking; its point, no test of the language reaching the fonts, is the test above. - `scripts/check_host_compile.py`, Linux and Windows (llvm-mingw): both pass on both sides. `cargo fmt --check` clean; `cargo clippy -p game-ui -p longshot-game -p api --all-targets` has nothing in the changed files (on 92f01007d too). - The whole suite `--strict`: here 844 passed, 46 failed, 13 skipped; `main` fails the same 46 files (they fail on `main` in this WSL). `main`'s side stopped before its totals line, after its last three one-at-a-time checks (`test_recorder_sync`, `test_prepare_stall`, `test_sampler_admission`, none reading the UI). **Still to test:** - Linux (any GPU), in the game: the Insert menu, Graphics tab, in Simplified Chinese, Traditional Chinese, Japanese and Korean, expecting every letter and the language names drawn (from #3152's review, L1: the game does not run in WSL here; @Beanstalk or by hand). ## Measurements Nothing to measure: a test's call and one message folded into another, sent at the same changes as before. ## Risks The fonts' language now arrives with `Msg::Language`, sent only when the renderer's start-up view gives a code (as the theme's was); `FontLanguage` was sent with `en` when the renderer gave none. With no code the texts keep no locale, and Han is drawn by fontique's default (Simplified Chinese's font first). Nothing changes in saves or settings; a revert is enough. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. - [x] `mise run test` passes (any failure that also fails on `main` is named). - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A fix: a game-free test that fails on `main` and passes here (`game-ui`'s tests: they do not build on `main`, they pass here). - [x] Host code builds on Windows (llvm-mingw) and Linux, with UTF-8 paths. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Tier 1 hardware it can affect is tested (docs/dev/standards.md, "Hardware tiers"). - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01VxeaZmaAApz6unGJRcGT4M
#3152's review fix changed fallback_plan to take `impl FnMut(&'static str) -> bool`, but two tests still passed
`&|p| ...`: the closure's argument type could not be inferred (E0282), so `cargo test -p game-ui` no longer compiles on
main. The tests pass their closures by value now. fallbacks_from's doc comment says what it does in the file's words.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZmaAApz6unGJRcGT4M
refactor(ui): one message for the menu's language: Msg::Language sets the texts' locale too (#3152)
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
cfd1c17813
#3152 and #3137 each added a message for the menu's language in the same few hours, and #3152's rebase kept both
(Msg::Language for the theme's text sizes, Msg::FontLanguage for the fonts), each with its own field in Presents. Both
carry the renderer's i18n::lang_code(): the startup view's menu_lang and the status's are filled from it. Msg::Language
now also sets the fonts' language (a change lays every text out again, as FontLanguage did); FontLanguage and its field
are gone.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01VxeaZmaAApz6unGJRcGT4M
Author
Contributor

Tested in game: Windows 10, RTX 4090, driver 617.42, 2560x1440, by hand: runtime v3.2.0-309-g73a31480b (the changed UI files identical to this head), Insert menu, Graphics tab, Menu language Auto: Simplified Chinese, Korean and Japanese each drawn in full, no boxes; no fault in the three runs' logs.

Tested in game: Windows 10, RTX 4090, driver 617.42, 2560x1440, by hand: runtime v3.2.0-309-g73a31480b (the changed UI files identical to this head), Insert menu, Graphics tab, Menu language Auto: Simplified Chinese, Korean and Japanese each drawn in full, no boxes; no fault in the three runs' logs.
cuecuemoar force-pushed fix/cjk-fonts-followup from cfd1c17813
Some checks failed
PR description / Title and description (pull_request_target) Has been cancelled
CI / What the change needs (pull_request) Has been cancelled
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Has been cancelled
CI / Third-party parts and guide screenshots (pull_request) Has been cancelled
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Has been cancelled
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Has been cancelled
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Has been cancelled
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Has been cancelled
CI / Website build and checks (pull_request) Has been cancelled
to 92f01007dc
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Successful in 6s
2026-12-04 18:06:47 +00:00
Compare
Author
Contributor

Pushed 92f01007d: a cold review found nothing blocking but no test of Msg::Language reaching the fonts; added another_menu_language_lays_every_text_out_again_in_its_fonts_once (fails with the handler's font part removed), dropped a needless closure annotation, rebased onto edeb8e2b5 (its new commits touch only the builder). game-ui 188/188, fmt and clippy clean. The in-game run stands: the game-run code is unchanged.

Pushed 92f01007d: a cold review found nothing blocking but no test of Msg::Language reaching the fonts; added another_menu_language_lays_every_text_out_again_in_its_fonts_once (fails with the handler's font part removed), dropped a needless closure annotation, rebased onto edeb8e2b5 (its new commits touch only the builder). game-ui 188/188, fmt and clippy clean. The in-game run stands: the game-run code is unchanged.
cuecuemoar changed title from WIP: fix(ui): game-ui's tests build again, and one message carries the menu's language (#3152) to fix(ui): game-ui's tests build again, and one message carries the menu's language (#3152) 2026-12-04 18:07:12 +00:00
Author
Contributor

@Beanstalk On Linux (any GPU, the Steam Deck welcome), this PR's head against main: with the Game language set to Simplified Chinese, then Traditional Chinese, Japanese and Korean (Menu language Auto), open the Insert menu on its Graphics tab and take a screenshot of each. Expecting every letter drawn, no boxes, the same as or better than main (main's game-ui code is #3152's, so the two should look alike), and no fault in the log. This checks the system CJK fonts are found and used as fallbacks on Linux (Noto Sans CJK / Source Han), which only Windows has run so far.

@Beanstalk On Linux (any GPU, the Steam Deck welcome), this PR's head against main: with the Game language set to Simplified Chinese, then Traditional Chinese, Japanese and Korean (Menu language Auto), open the Insert menu on its Graphics tab and take a screenshot of each. Expecting every letter drawn, no boxes, the same as or better than main (main's game-ui code is #3152's, so the two should look alike), and no fault in the log. This checks the system CJK fonts are found and used as fallbacks on Linux (Noto Sans CJK / Source Han), which only Windows has run so far.
Member

@cuecuemoar only members of BigBeans can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.

@cuecuemoar only members of `BigBeans` can start the farm. One of them can approve this request by reacting 👍 to it or to this comment.
HumanBean deleted branch fix/cjk-fonts-followup 2026-12-04 20:19:22 +00:00
Some checks are pending
CI / What the change needs (pull_request) Blocked by required conditions
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Blocked by required conditions
CI / Third-party parts and guide screenshots (pull_request) Blocked by required conditions
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Blocked by required conditions
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Blocked by required conditions
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Blocked by required conditions
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Blocked by required conditions
CI / Website build and checks (pull_request) Blocked by required conditions
beanstalk/approval not approved yet
PR description / Title and description (pull_request_target) Successful in 6s
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!3187
No description provided.