Skip to content
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

SVG and XCF support missing from Windows binaries #10

Open
1 task done
a-hurst opened this issue Jan 19, 2022 · 2 comments
Open
1 task done

SVG and XCF support missing from Windows binaries #10

a-hurst opened this issue Jan 19, 2022 · 2 comments

Comments

@a-hurst
Copy link

a-hurst commented Jan 19, 2022

Issue:

In adding unit tests back to the CI for the PySDL2 conda feedstock, I noticed some unexpected test failures for the Windows binaries. Specifically, all the tests related to XCF or SVG identification/import failed despite working fine with the Linux/macOS runners:

______________________ TestSDLImage.test_IMG_LoadSVG_RW _______________________

self = <sdl2.test.sdlimage_test.TestSDLImage object at 0x000002589C77CD60>

    @pytest.mark.skipif(sdlimage.dll.version < 2002, reason="Added in 2.0.2")
    def test_IMG_LoadSVG_RW(self):
        fp = open(_get_image_path("svg"), "rb")
        sf = sdlimage.IMG_LoadSVG_RW(rwops.rw_from_object(fp))
        fp.close()
>       assert isinstance(sf.contents, surface.SDL_Surface)
E       ValueError: NULL pointer access

fp         = <_io.BufferedReader name='D:\\bld\\pysdl2_1642551982139\\_test_env\\lib\\site-packages\\sdl2\\test\\resources\\surfacetest.svg'>
self       = <sdl2.test.sdlimage_test.TestSDLImage object at 0x000002589C77CD60>
sf         = <sdl2.surface.LP_SDL_Surface object at 0x000002589CBEE8C0>

..\_test_env\lib\site-packages\sdl2\test\sdlimage_test.py:261: ValueError
______________________ TestSDLImage.test_IMG_LoadXCF_RW _______________________

self = <sdl2.test.sdlimage_test.TestSDLImage object at 0x000002589D202850>

    @pytest.mark.xfail(is32bit or ismacos, reason="XCF currently broken on 32-bit and macOS")
    def test_IMG_LoadXCF_RW(self):
        fp = open(_get_image_path("xcf"), "rb")
        sf = sdlimage.IMG_LoadXCF_RW(rwops.rw_from_object(fp))
        fp.close()
>       assert isinstance(sf.contents, surface.SDL_Surface)
E       ValueError: NULL pointer access

self       = <sdl2.test.sdlimage_test.TestSDLImage object at 0x000002589D202850>
sf         = <sdl2.surface.LP_SDL_Surface object at 0x000002589CBF80C0>

..\_test_env\lib\site-packages\sdl2\test\sdlimage_test.py:291: ValueError

Looking at the build setup here, it looks like this is because the XCF and SVG formats were never added to this section of the CMake build file:

set(SDLIMAGE_SUPPORT_BMP ON CACHE BOOL "Support for BMP file format")
set(SDLIMAGE_SUPPORT_GIF ON CACHE BOOL "Support for GIF file format")
set(SDLIMAGE_SUPPORT_LBM ON CACHE BOOL "Support for LBM file format")
set(SDLIMAGE_SUPPORT_PCX ON CACHE BOOL "Support for PCX file format")
set(SDLIMAGE_SUPPORT_PNM ON CACHE BOOL "Support for PNM file format")
set(SDLIMAGE_SUPPORT_TGA ON CACHE BOOL "Support for TGA file format")
set(SDLIMAGE_SUPPORT_XPM ON CACHE BOOL "Support for XPM file format")
set(SDLIMAGE_SUPPORT_XV ON CACHE BOOL "Support for XV file format")

Neither format has any external dependencies, so adding:

set(SDLIMAGE_SUPPORT_SVG ON CACHE BOOL "Support for SVG file format")
set(SDLIMAGE_SUPPORT_XCF ON CACHE BOOL "Support for XCF file format")

...

if(SDLIMAGE_SUPPORT_SVG)
  add_definitions(-DLOAD_SVG)
endif()
if(SDLIMAGE_SUPPORT_XCF)
  add_definitions(-DLOAD_XCF)
endif()

to the file should fix it!

Cheers,

Austin

@dschreij
Copy link
Contributor

Thanks @a-hurst. I haven't touched this recipe for a while. I will try your suggestion right away (and add you as someone with maintainer access to this repo too?)

@dschreij
Copy link
Contributor

I changed the CMakeLists.txt file as suggested above. Let's hope it does the trick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants