New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Surface.get_locked test #1826
Surface.get_locked test #1826
Conversation
Looks pretty solid, I suppose we could also try
(you can check for assertions being raised with https://github.com/pygame/pygame/blob/master/test/blit_test.py#L135) |
Sorry, but how does that test .get_locked()? As another check that a surface is locked? |
Yeah, my thinking was just a double check that the flag was accurately reporting what was happening deeper in the code somewhere. I mean probably the code right now is just checking for the flag in blit before raising an assert so we would be just in a circle, but perhaps at some point in the codes life it might check for locked-ness of a surface in a different way internally in SDL or pygame and the flag we check with The blit code is a big old mess of code so I could definitely see it :) Honestly, I think this kind of testing could easily fit in the unit test for lock() (when that exists) - checking that surfaces locked there both can't be blitted on and report that they are locked with get_locked() so we could just punt it over to there if you think it makes this test clearer? |
Yes, I think this would work as a test for lock(), then for get_locked() it will check against the blit check, rather than the expected value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Then it all looks good to me, I'll make a mental note for the .lock() unit test. 👍 🍾
Uses the fact that blitting to or from a locked surface raises and error to check get_locked against the actual state rather than the expected state.
New changes also look good! :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 thanks
Test for #1803