Source: pysdl2 Version: 0.9.9+dfsg1-5 Severity: serious
Hello, as shown in e.g. https://ci.debian.net/data/autopkgtest/unstable/s390x/p/pysdl2/30731752/log.gz autopkgtests are failing probably due to a Big Endian issue =================================== FAILURES =================================== ________________ TestSDLPixels.test_SDL_MasksToPixelFormatEnum _________________ self = <sdl2.test.pixels_test.TestSDLPixels object at 0x3ffaba52350> def test_SDL_MasksToPixelFormatEnum(self): if sys.byteorder == "little": val = pixels.SDL_MasksToPixelFormatEnum(32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF) else: val = pixels.SDL_MasksToPixelFormatEnum(32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000)
assert val == pixels.SDL_PIXELFORMAT_RGBA8888
E assert 376840196 == 373694468 E + where 373694468 = pixels.SDL_PIXELFORMAT_RGBA8888 sdl2/test/pixels_test.py:175: AssertionError ________________ TestSDLPixels.test_SDL_PixelFormatEnumToMasks _________________ self = <sdl2.test.pixels_test.TestSDLPixels object at 0x3ffaba52230> def test_SDL_PixelFormatEnumToMasks(self): bpp = c_int() r, g, b, a = Uint32(), Uint32(), Uint32(), Uint32() pixels.SDL_PixelFormatEnumToMasks(pixels.SDL_PIXELFORMAT_INDEX1LSB, byref(bpp), byref(r), byref(g), byref(b), byref(a)) assert (bpp.value, r.value, g.value, b.value, a.value) == \ (1, 0, 0, 0, 0) pixels.SDL_PixelFormatEnumToMasks(pixels.SDL_PIXELFORMAT_INDEX1MSB, byref(bpp), byref(r), byref(g), byref(b), byref(a)) assert (bpp.value, r.value, g.value, b.value, a.value) == \ (1, 0, 0, 0, 0)pixels.SDL_PixelFormatEnumToMasks(pixels.SDL_PIXELFORMAT_RGBA8888,
byref(bpp), byref(r), byref(g), byref(b), byref(a)) if sys.byteorder == "little": assert (bpp.value, r.value, g.value, b.value, a.value) == \ (32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF) else:
assert (bpp.value, r.value, g.value, b.value, a.value) == \
(32, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000) E assert (32, 42781900...0, 65280, 255) == (32, 255, 652...0, 4278190080) E At index 1 diff: 4278190080 != 255 E Full diff: E - (32, 255, 65280, 16711680, 4278190080) E + (32, 4278190080, 16711680, 65280, 255) sdl2/test/pixels_test.py:217: AssertionError ________________ TestSDL2ExtArray.test_CTypesView__doublebytes _________________ self = <sdl2.test.sdl2ext_array_test.TestSDL2ExtArray object at 0x3ffa90c7610> def test_CTypesView__doublebytes(self): buf1 = sdlextarray.CTypesView(doublebyteseq, USHORT_SIZE, docopy=True) buf2 = sdlextarray.CTypesView(doublebytebuf, USHORT_SIZE, docopy=False) for singlebytes, shared in ((buf1, False), (buf2, True)): assert isinstance(singlebytes, sdlextarray.CTypesView) assert singlebytes.is_shared == shared assert singlebytes.bytesize == len(doublebyteseq) * 2 offset = 0 cnt = 0 for val in singlebytes.to_bytes(): if cnt > 0: assert val == hibyte16(doublebyteseq[offset]) cnt = 0 offset += 1 else:
assert val == lobyte16(doublebyteseq[offset])
E assert 0 == 1 E + where 1 = lobyte16(1) sdl2/test/sdl2ext_array_test.py:199: AssertionError _________________ TestSDL2ExtArray.test_CTypesView__quadbytes __________________ self = <sdl2.test.sdl2ext_array_test.TestSDL2ExtArray object at 0x3ffa90c65c0> def test_CTypesView__quadbytes(self): buf1 = sdlextarray.CTypesView(quadbyteseq, UINT_SIZE, docopy=True) buf2 = sdlextarray.CTypesView(quadbytebuf, UINT_SIZE, docopy=False) for singlebytes, shared in ((buf1, False), (buf2, True)): assert isinstance(singlebytes, sdlextarray.CTypesView) assert singlebytes.is_shared == shared assert singlebytes.bytesize == len(quadbyteseq) * 4 offset = 0 cnt = 0 for val in singlebytes.to_bytes(): assert val == ltrbyte32(quadbyteseq[offset], cnt) if cnt == 3: offset += 1 cnt = 0 else: cnt += 1cnt = 0
offset = 0 for val in singlebytes.to_uint16(): if cnt > 0: assert val == hibytes32(quadbyteseq[offset]) cnt = 0 offset += 1 else:
assert val == lobytes32(quadbyteseq[offset])
E assert 0 == 255 E + where 255 = lobytes32(255) sdl2/test/sdl2ext_array_test.py:244: AssertionError ______________________ TestSDL2ExtArray.test_create_array ______________________ self = <sdl2.test.sdl2ext_array_test.TestSDL2ExtArray object at 0x3ffa90c7070> def test_create_array(self): barr = bytes(bytearray(singlebyteseq)) for i in (1, 2, 4, 8): parr = sdlextarray.create_array(barr, i) assert isinstance(parr, array.array) if i == 1: assert parr[0] == 0x0 elif i == 2:
assert parr[0] == 0x0100
E assert 1 == 256 sdl2/test/sdl2ext_array_test.py:359: AssertionError __________________________ TestSDL2ExtDraw.test_fill ___________________________ self = <sdl2.test.sdl2ext_draw_test.TestSDL2ExtDraw object at 0x3ffa7ddb610> @pytest.mark.skipif(not _HASNUMPY, reason="pixels3d requires numpy module") def test_fill(self): # Initialize colour and surface/view WHITE = (255, 255, 255) BLACK = (0, 0, 0) sf = SDL_CreateRGBSurface(0, 10, 10, 32, 0, 0, 0, 0) with pytest.warns(ExperimentalWarning): view = sdl2ext.pixels3d(sf.contents, False)# Test with no provided fill area
sdl2ext.fill(sf.contents, WHITE, None)
assert all(x == 255 for x in view[0][0][:3])
E assert False E + where False = all(<generator object TestSDL2ExtDraw.test_fill.<locals>.<genexpr> at 0x3ffa7e01fc0>) sdl2/test/sdl2ext_draw_test.py:40: AssertionError __________________________ TestSDL2ExtDraw.test_line ___________________________ self = <sdl2.test.sdl2ext_draw_test.TestSDL2ExtDraw object at 0x3ffa7ddb7c0> @pytest.mark.skipif(not _HASNUMPY, reason="pixels3d requires numpy module") def test_line(self): # Initialize colour and surface/view WHITE = (255, 255, 255) BLACK = (0, 0, 0) sf = SDL_CreateRGBSurface(0, 10, 10, 32, 0, 0, 0, 0) with pytest.warns(ExperimentalWarning): view = sdl2ext.pixels3d(sf.contents, False)# Test with a single straight line
sdl2ext.line(sf.contents, WHITE, (0, 0, 11, 0))
assert all(x == 255 for x in view[0][0][:3])
E assert False E + where False = all(<generator object TestSDL2ExtDraw.test_line.<locals>.<genexpr> at 0x3ffadb2bed0>) sdl2/test/sdl2ext_draw_test.py:83: AssertionError _____________________ TestSDL2ExtPixelAccess.test_pixels3d _____________________ self = <sdl2.test.sdl2ext_pixelaccess_test.TestSDL2ExtPixelAccess object at 0x3ffa90def50> @pytest.mark.skipif(not _HASNUMPY, reason="numpy module is not supported") def test_pixels3d(self): colors = { 'red': color.Color(255, 0, 0, 255), 'blue': color.Color(0, 0, 255, 255), 'black': color.Color(0, 0, 0, 255), 'white': color.Color(255, 255, 255, 255) } rgba = pixels.SDL_PIXELFORMAT_ABGR8888 # Import test image, convert to RGBA, and open pixels3d view imgsurf = surface.SDL_LoadBMP(self.testfile.encode("utf-8")) imgsurf = surface.SDL_ConvertSurfaceFormat(imgsurf.contents, rgba, 0) with pytest.warns(sdl2ext.compat.ExperimentalWarning): nparray = sdl2ext.pixels3d(imgsurf.contents, transpose=False) assert nparray.shape == (32, 32, 4) # Test different coordinates on surface assert color.Color(*nparray[0][0]) == colors['red']
assert color.Color(*nparray[0][16]) == colors['blue']
E assert Color(r=255, g=255, b=0, a=0) == Color(r=0, g=0, b=255, a=255) E Full diff: E - Color(r=0, g=0, b=255, a=255) E + Color(r=255, g=255, b=0, a=0) sdl2/test/sdl2ext_pixelaccess_test.py:90: AssertionError =========================== short test summary info ============================ FAILED sdl2/test/pixels_test.py::TestSDLPixels::test_SDL_MasksToPixelFormatEnum FAILED sdl2/test/pixels_test.py::TestSDLPixels::test_SDL_PixelFormatEnumToMasks FAILED sdl2/test/sdl2ext_array_test.py::TestSDL2ExtArray::test_CTypesView__doublebytes FAILED sdl2/test/sdl2ext_array_test.py::TestSDL2ExtArray::test_CTypesView__quadbytes FAILED sdl2/test/sdl2ext_array_test.py::TestSDL2ExtArray::test_create_array FAILED sdl2/test/sdl2ext_draw_test.py::TestSDL2ExtDraw::test_fill - assert False FAILED sdl2/test/sdl2ext_draw_test.py::TestSDL2ExtDraw::test_line - assert False FAILED sdl2/test/sdl2ext_pixelaccess_test.py::TestSDL2ExtPixelAccess::test_pixels3d Can you please have a look? thanks G.
OpenPGP_signature
Description: OpenPGP digital signature