test(libSceFont): cover sceFontGetLibrary and sceFontSetFontsOpenMode #12757

Merged
legendary-cookie merged 1 commit from upstream-pr/12757 into main 2026-11-02 13:39:44 +00:00
legendary-cookie commented 2026-10-29 08:25:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by legendary-cookie on 2026-10-29T08:25:52Z.


What

Adds sceFontGetLibrary and sceFontSetFontsOpenMode checks to GuestFont.cpp: GetLibrary with a null output returns SCE_FONT_ERROR_INVALID_PARAMETER and with an open font returns the library it was opened from; SetFontsOpenMode returns SCE_FONT_ERROR_INVALID_LIBRARY for a null and a zero-initialised FontLibNative, SCE_FONT_ERROR_INVALID_PARAMETER for mode 3, and SCE_FONT_OK for modes 0 to 2.

Source: the null-output error and owning library of GetLibrary and all of SetFontsOpenMode follow the shadPS4 port (GetLibrary, SetFontsOpenMode), not a console measurement. docs/dev/debt/libSceFont.md gets a Silent stubs entry for SetFontsOpenMode, which validates the mode but stores nothing, and an Unknown function info entry for GetLibrary. GetLibrary's invalid-handle path, which clears the output here but not in shadPS4, is left untested because nothing records its source.

Tested

Windows 11, WinLibs GCC 15.2.0 UCRT r7 (the CI toolchain), Release, BUILD_TESTING=ON, on main 4c7d275bef: ctest -R ^guest_font$ passes, and all 10 font tests pass. Mutation-checked: returning a null library from a valid font, or accepting mode 3 or rejecting mode 2, each makes the test fail. tools/check_conventions.py --base origin/main passes; tools/pr_overlap.py reports no overlap. Not run on Linux or macOS.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a
  • AI-assisted: yes (Claude Code, OpenAI Codex)

\U0001F916 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5064749930 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/12757). Originally posted by [legendary-cookie](https://github.com/legendary-cookie) on 2026-10-29T08:25:52Z. --- ### What Adds `sceFontGetLibrary` and `sceFontSetFontsOpenMode` checks to `GuestFont.cpp`: `GetLibrary` with a null output returns `SCE_FONT_ERROR_INVALID_PARAMETER` and with an open font returns the library it was opened from; `SetFontsOpenMode` returns `SCE_FONT_ERROR_INVALID_LIBRARY` for a null and a zero-initialised `FontLibNative`, `SCE_FONT_ERROR_INVALID_PARAMETER` for mode 3, and `SCE_FONT_OK` for modes 0 to 2. Source: the null-output error and owning library of `GetLibrary` and all of `SetFontsOpenMode` follow the shadPS4 port ([GetLibrary](https://github.com/shadps4-emu/shadPS4/blob/b6f0c58dba9ee75b93477703032ae4f1e0de8f1c/src/core/libraries/font/font.cpp#L2039-L2046), [SetFontsOpenMode](https://github.com/shadps4-emu/shadPS4/blob/b6f0c58dba9ee75b93477703032ae4f1e0de8f1c/src/core/libraries/font/font.cpp#L5796-L5821)), not a console measurement. `docs/dev/debt/libSceFont.md` gets a Silent stubs entry for `SetFontsOpenMode`, which validates the mode but stores nothing, and an Unknown function info entry for `GetLibrary`. `GetLibrary`'s invalid-handle path, which clears the output here but not in shadPS4, is left untested because nothing records its source. ### Tested Windows 11, WinLibs GCC 15.2.0 UCRT r7 (the CI toolchain), Release, `BUILD_TESTING=ON`, on `main` 4c7d275bef: `ctest -R ^guest_font$` passes, and all 10 font tests pass. Mutation-checked: returning a null library from a valid font, or accepting mode 3 or rejecting mode 2, each makes the test fail. `tools/check_conventions.py --base origin/main` passes; `tools/pr_overlap.py` reports no overlap. Not run on Linux or macOS. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a - [x] AI-assisted: yes (Claude Code, OpenAI Codex) \U0001F916 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!12757
No description provided.