Skip to content

Document drawButton repeat-fire semantics and local dev/test setup - #26

Merged
dmccoystephenson merged 1 commit into
mainfrom
feature/readme-docs-accuracy
Jul 29, 2026
Merged

Document drawButton repeat-fire semantics and local dev/test setup#26
dmccoystephenson merged 1 commit into
mainfrom
feature/readme-docs-accuracy

Conversation

@dmccoystephenson

@dmccoystephenson dmccoystephenson commented Jul 29, 2026

Copy link
Copy Markdown
Member

Summary

  • README.md's drawButton bullet said the callback fires "on click", but the implementation polls mouse state on every call with no click-edge detection — it fires once per call while the mouse is held down, not once per click. Reworded the bullet and added a matching docstring on drawButton so the behavior is discoverable from an IDE.
  • Added a test that holds the mouse down across several drawButton calls and asserts the callback fires once per call, pinning the documented (intentionally unchanged) behavior.
  • Added a README "Development" section documenting the venv + pip install -e ".[test]" + pytest sequence, mirroring .github/workflows/test.yml, and noting the suite is headless via conftest.py.
  • Added .venv/ to .gitignore since the new Development section tells contributors to create one.

No public API changes — documentation and test-only, plus a docstring.

Deferred: issue #23 (drawImage per-call re-read/re-scale caching) is a separate, non-documentation change to graphik.py and was left for a future cycle rather than batched with these README fixes.

Test plan

  • python3 -m py_compile src/main/python/preponderous/graphik/graphik.py
  • python3 -m pytest -q → 20 passed (19 previously + 1 new)

Closes #24
Closes #25


This PR description was drafted during a Gardener session (Stephenson-Software/gardener).

drawButton polls mouse state on every call with no click-edge detection,
so its callback fires once per call while held down, not once per click.
The README described it as firing "on click", which reads as once-per-click.
Reword the README bullet, add a matching docstring on drawButton, and pin
the documented behavior with a test that holds the mouse down across
several calls. Deliberately left the underlying polling behavior
unchanged: the vendored copies in Roam/Apex/Ophidian/Patchwork/Tic-Tak-Toe
are written against it.

Also add a README Development section covering the venv + pip install
+ pytest sequence (mirroring .github/workflows/test.yml) and headless
SDL setup, and ignore .venv/ in .gitignore, since the repo had no
documented way to run the test suite locally.

Closes #24
Closes #25

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@dmccoystephenson

dmccoystephenson commented Jul 29, 2026

Copy link
Copy Markdown
Member Author

Self-review rubric:

Universal:

  • Scope: PASS — every changed file (.gitignore, README.md, graphik.py, test_graphik.py) is necessary for README misdescribes drawButton's callback semantics #24 or README documents no way to run the test suite locally #25; no unrelated formatting/renames.
  • Tests-new: PASS — the new test test_draw_button_fires_callback_once_per_call_while_mouse_held exercises the documented repeat-fire behavior.
  • Tests-fix: N/A (not a bug fix — this PR documents existing, intentionally-unchanged behavior). Sensitivity checked instead: temporarily patched drawButton to add edge-detection and re-ran the new test — it FAILED (1 == 5 assertion error), confirming it actually detects a behavior change rather than being a tautology. Reverted with git checkout -- and re-confirmed 20/20 pass.
  • Sibling structure: PASS — new test follows the same style as its neighbors (uses _make_graphik, monkeypatch on pygame.mouse, matches the parametrized test right above it).
  • Sibling renames: N/A — no identifier renames in this PR.
  • Docs: PASS — README drawButton bullet, graphik.py docstring, and the new Development section all describe the current, verified behavior.
  • Issue resolution: PASS — README misdescribes drawButton's callback semantics #24's exact concern (README wording vs. polling implementation) is fixed with matching evidence (docstring + test); README documents no way to run the test suite locally #25's exact concern (no local test-running docs) is fixed with a Development section mirroring .github/workflows/test.yml.
  • Manual validation: PASS — py_compile succeeds, import smoke test succeeds, pytest → 20 passed on the PR head.

Repo-specific:

  • camelCase: N/A — no new public methods added.
  • Backward-compat: PASS — no existing public member's signature/behavior changed; gh search code "drawButton" org:Preponderous-Software org:Stephenson-Software shows only consumers calling it, none relying on once-per-click semantics that this PR would break (the repeat-fire behavior itself is unchanged, only documented).
  • Headless: PASS — new test uses the existing conftest.py dummy SDL drivers, no real display/audio needed.
  • Version sync: N/A — no version string touched.
  • No new deps: PASS — no new imports; Dependencies list in README unchanged (still just pygame).

Deferred: issue #23 (drawImage caching) is left for a future cycle — it's a separate, non-documentation change to graphik.py's runtime behavior, not batched with these README-scoped fixes.

Summary: all rubric items pass; no judgment-call flags to leave inline.


drafted by Claude on behalf of Daniel Stephenson

@dmccoystephenson
dmccoystephenson merged commit e7c5746 into main Jul 29, 2026
5 checks passed
@dmccoystephenson
dmccoystephenson deleted the feature/readme-docs-accuracy branch July 29, 2026 08:17
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.

README documents no way to run the test suite locally README misdescribes drawButton's callback semantics

1 participant