Add tests for the pygame UI's resize and font logic#97
Merged
Conversation
PygameUserInterface had no dedicated tests — only the factory test, which just constructs it and calls cleanup. The window-resize clamping (enforcing a minimum window size) and the font-rescaling guard (keeping fonts usable at tiny sizes) were untested real logic, so a regression there would go unnoticed. Adds characterization tests (headless, under the dummy SDL drivers like the factory test): a too-small resize clamps to the minimum, a larger resize is honored exactly, and the fonts stay renderable after a tiny resize. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
dmccoystephenson
left a comment
Member
Author
There was a problem hiding this comment.
Self-review:
- Scope: PASS — one new test file; characterization only, no production change.
- Tests-new: PASS — resize clamp (small/large) and font-usability-when-tiny cover previously-untested PygameUserInterface logic.
- Headless-pygame: PASS — runs under dummy SDL like the factory test; CI green (214).
- Targeting: saveFileManager surveyed first and found already well-covered, so effort went to the real gap.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Stage B test-expansion:
PygameUserInterfacehad no dedicated test file — only the factory test (construct + cleanup). This adds characterization coverage for its untested, deterministic logic.tests/ui/test_pygameUserInterface.py: a sub-minimum_handle_resizeclamps tomin_width/min_height; a larger resize is honored exactly;_update_fontskeeps all three fonts renderable at a tiny window (the min-size guard).Run headless under the dummy SDL drivers, matching the existing factory test and CI. Characterization only — no production code changed.
Test plan
SDL_VIDEODRIVER=dummy SDL_AUDIODRIVER=dummy python3 -m pytest— 214 passed (3 new)Triage note
saveFileManagerfirst (save-critical) — already comprehensively tested (30+ cases), so coverage effort went to the genuine gap (pygame UI). Make the shop's money recharge over time. #20 still deferred (design decision).🤖 Generated with Claude Code