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_bitsize and Surface.get_bytesize tests. #1898
Conversation
I think the doc there is just warning that you won't save any bytes per pixel by using a 15bit depth surface over a 16bit depth surface as there is no such thing as a 7th of a byte in this context. Test looks pretty good to me. 👍 The only thing it looks like isn't being tested is the same thing that we are having some trouble with over in this PR: #1881 Namely this assert: Lines 2667 to 2668 in de3654a
... raised - I believe - when Thanks for contributing! |
I tried adding The weird thing is, it doesn't raise an error. After adding |
I looked into it a bit and |
Sounds to me like unit testing may have uncovered a genuine bug, which is half of the point of it after all! 👍 I'll have a look into it. |
Are you serious? How am I supposed to cope with not writing unit tests for my projects now?! Well, anyway. That bug's probably way too complicated for my level of knowledge, so am I done here? If so, I'll find the next issue to solve. Also, why don't you guys enforce squashing multiple commits into one for pull requests(when multiple don't make sense)? |
Yeah, I think this can probably just sit here until the underlying problem is found and fixed and we can merge this in.
Is that a thing other open source projects are doing? I heard it was a contentious topic with some preferring to see every dirty commit secret. I think the truth is that there are no rules but those people make a good case for end everyone agrees to use. On the topic of the actual issue I can reproduce with this on windows:
That block raises the correct assert in pygame 1.9.6 but will often segfault (or sometimes return odd values) on pygame 2.0.0.dev10. |
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.
Looks like you could add that assert test back in now, the fix has been merged into master and seems to work.
That's great. I'll probably do that in a few hours, if not, tomorrow for sure. |
Looks like this test may be causing another test to fail on the SDL 1 build. I think this is not a specific problem with this test but actually a general problem with the surface tests. Some tests are being careful to So, I think it is going to be a good idea to make sure all tests that call Here is a decent example: Lines 738 to 761 in 9e8fedc
|
…ytesize unit tests
CI for this test should be fixed by this PR: |
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.
Hooray CI is passing. LGTM! 👍
Thanks @lkito. Are you ready for it to be merged in? |
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.
👍 🎉
Yes, this one is ready and once #1900 passes tests, it will be ready too. |
Added get_bytesize unit tests as per issue #1799
Hi, this is my first time contributing to pygame so forgive newb mistakes I make.
I wrote get_bitsize tests and added some get_bytesite tests, too. Thing is, I'm not sure I understand something in the doc of get_bitsize:
"Returns the number of bits used to represent each pixel. This value may not exactly fill the number of bytes used per pixel. For example a 15 bit Surface still requires a full 2 bytes."
Is this right? Because when I create a Surface with depth of 15, get_bitsize returns 15, not 16, as the doc suggests.
Also, if invalid depth passing checks are out of place in get_bitsize, I'll get rid of them, or maybe I should put them elsewhere?