surface_test: Expect intended behaviour if SDL2 is new enough #290
+12
−4
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.
In older versions of "classic" SDL2, including the 2.32.x series, intersecting an empty rectangle with another rectangle would have an empty result (w=0, h=0) with an uninitialized position (x, y arbitrary). However, SDL upstream considers this to be a bug, and it caused observable visual issues in some older games when used in conjunction with sdl12-compat.
This test previously asserted that the clip rectangle would not be equal to the requested clip rectangle, but that was only true because of this bug: the uninitialized x and y coordinates were very unlikely to be equal to the requested rectangle. With the bug fix in sdl2-compat, the coordinates come out as equal to those that were requested.
If SDL2 is sufficiently new, assert that the comparison result is true (which is the correct result according to SDL upstream), and if not, make no assertion (in case the bug fix is backported).
Resolves: #289
Merge Checklist
closes #<issue-number>to automatically close an issue