test: pin drawImage's preservation of per-pixel alpha - #44
Merged
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Self-review rubric (performed inline; not an independent review):
Judgment call: the BMP fixture relies on SDL keeping a 32-bit BMP's alpha channel on load. Both SDL 2.0.16 locally and the CI wheels do. A PNG would be the more realistic sprite format but needs SDL_image, so BMP was kept for consistency with the existing fixture's portability rationale. Requesting Copilot as a reviewer failed ( This comment was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener). drafted by Claude on behalf of Daniel Stephenson |
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
drawImage's implementation comment promises but that no test pinned:convert_alpha()"preserves any per-pixel alpha" the loaded file carries, so a sprite's transparent pixels leave the display underneath visible.test_draw_image_converts_loaded_surface_for_faster_blitsonly asserts that the cached surface gained theSRCALPHAflag. A conversion that adds an alpha channel while discarding the file's own (e.g.convert().convert_alpha()) satisfies that check yet paints transparent sprite backgrounds opaque — a regression every consumer drawing sprites (Roam, Ophidian, etc.) would notice._write_solid_imagehelper.Mutation check
Performed by editing
graphik.pytemporarily and restoring it afterwards:drawImageload line..._converts_loaded_surface...convert_alpha()(current)convert()convert().convert_alpha()The last row is the gap this test closes.
Test plan
python3 -m py_compile src/main/python/preponderous/graphik/graphik.pypreponderous.graphik.graphikpytest(headless viaconftest.py): 53 passed (pygame 2.1.2 / SDL 2.0.16, run locally)Deferred issues
All open issues were deferred because each one waits on a maintainer decision:
publish.ymltrigger, and changes to.github/workflows/are excluded from autonomous work..github/workflows/test.yml, which is also excluded from autonomous work.preponderous.*projects, which cannot be determined from inside this repository.No tracking issue. The gap was found during a test-coverage sweep in triage.
This PR description was drafted during a Gardener session (https://github.com/Stephenson-Software/gardener).
🤖 Generated with Claude Code
drafted by Claude on behalf of Daniel Stephenson