Skip to content

Add tests for the pygame UI's resize and font logic#97

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/pygame-ui-tests
Jun 13, 2026
Merged

Add tests for the pygame UI's resize and font logic#97
dmccoystephenson merged 1 commit into
mainfrom
feature/pygame-ui-tests

Conversation

@dmccoystephenson

Copy link
Copy Markdown
Member

Summary

Stage B test-expansion: PygameUserInterface had 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_resize clamps to min_width/min_height; a larger resize is honored exactly; _update_fonts keeps 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

  • Surveyed saveFileManager first (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

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 dmccoystephenson left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dmccoystephenson dmccoystephenson merged commit bc4a842 into main Jun 13, 2026
1 check passed
@dmccoystephenson dmccoystephenson deleted the feature/pygame-ui-tests branch June 13, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant