py-sdl / py-sdl2

Python ctypes wrapper around SDL2
Other
304 stars 49 forks source link

tests: Don't try to create more than one Renderer for the same Window #262

Closed smcv closed 1 year ago

smcv commented 1 year ago

The SDL API is that it's a programming error to mix the Renderer API with use of a window surface. Some Renderer implementations create a window surface, making it invalid to attach more than one Renderer to the same window. SDL 2.28 is better at detecting this than previous versions were, causing some of py-sdl2's unit tests to fail with:

Error encountered creating the SDL renderer: Surface already associated with window

when running with the dummy video backend and software renderer (which are used in Debian as automated tests to check for obvious regressions).

Some instances of this were already fixed in 0.9.15, most likely as part of "Try fixing renderer tests w/ dummy on Windows". For the remaining failing cases, avoid the failure by creating a new Window for each part of the test.

Bug-Debian: https://bugs.debian.org/1038823

Merge Checklist

a-hurst commented 1 year ago

Nice, thanks for this! One less thing to tackle when updating the bindings to 2.28.