-
Notifications
You must be signed in to change notification settings - Fork 52
Closed
Description
What doesn't work?
Running the automatic tests of py-sdl2 with the recently released freetype 2.14.0, some golden master test fail:
How To Reproduce
I reproduced the issue in conda-forge/pysdl2-feedstock#37, it can be easily reproduced by building py-sdl2 with conda-forge dependencies, I can provide an exact reproducer if useful.
Platform (if relevant):
- OS: Windows, macOS, Linux
- Python Version: 3.10-3.14
- SDL2 Version: 2.32.56
- Using pysdl2-dll: No, using all dependencies from conda-forge
Additional context
This is similar to #212 .
The exact failures are:
2025-09-14T15:32:51.9965976Z =================================== FAILURES ===================================
2025-09-14T15:32:51.9971540Z ____________________________ test_TTF_GlyphMetrics _____________________________
2025-09-14T15:32:51.9971696Z
2025-09-14T15:32:51.9971894Z with_sdl_ttf = None
2025-09-14T15:32:51.9971991Z
2025-09-14T15:32:51.9972216Z def test_TTF_GlyphMetrics(with_sdl_ttf):
2025-09-14T15:32:51.9972445Z expected = {
2025-09-14T15:32:51.9972654Z 'A': [1, 25, 0, 29, 25],
2025-09-14T15:32:51.9972870Z 'j': [-3, 7, -9, 28, 9],
2025-09-14T15:32:51.9973087Z '.': [2, 7, -1, 4, 8]
2025-09-14T15:32:51.9973277Z }
2025-09-14T15:32:51.9989257Z font = sdlttf.TTF_OpenFont(fontfile, 40)
2025-09-14T15:32:51.9993385Z minX, maxX, minY, maxY = c_int(0), c_int(0), c_int(0), c_int(0)
2025-09-14T15:32:51.9994958Z adv = c_int(0)
2025-09-14T15:32:51.9995377Z for char in expected.keys():
2025-09-14T15:32:51.9995697Z ret = sdlttf.TTF_GlyphMetrics(
2025-09-14T15:32:51.9996003Z font, ord(char),
2025-09-14T15:32:51.9996391Z byref(minX), byref(maxX), byref(minY), byref(maxY), byref(adv)
2025-09-14T15:32:51.9996706Z )
2025-09-14T15:32:51.9997015Z results = [x.value for x in (minX, maxX, minY, maxY, adv)]
2025-09-14T15:32:51.9997357Z assert sdlttf.TTF_GetError() == b""
2025-09-14T15:32:51.9997654Z assert ret == 0
2025-09-14T15:32:51.9997951Z > assert results == expected[char]
2025-09-14T15:32:51.9998267Z E assert [-3, 7, -9, 29, 9] == [-3, 7, -9, 28, 9]
2025-09-14T15:32:51.9998553Z E
2025-09-14T15:32:51.9998836Z E At index 3 diff: 29 != 28
2025-09-14T15:32:51.9999087Z E
2025-09-14T15:32:52.0003995Z E Full diff:
2025-09-14T15:32:52.0009341Z E [
2025-09-14T15:32:52.0010003Z E -3,
2025-09-14T15:32:52.0010279Z E 7,
2025-09-14T15:32:52.0010548Z E -9,
2025-09-14T15:32:52.0010807Z E - 28,
2025-09-14T15:32:52.0011108Z E ? ^
2025-09-14T15:32:52.0011363Z E + 29,
2025-09-14T15:32:52.0011616Z E ? ^
2025-09-14T15:32:52.0011864Z E 9,
2025-09-14T15:32:52.0012118Z E ]
2025-09-14T15:32:52.0012297Z
2025-09-14T15:32:52.0012558Z adv = c_int(9)
2025-09-14T15:32:52.0012825Z char = 'j'
2025-09-14T15:32:52.0013136Z expected = {'.': [2, 7, -1, 4, 8], 'A': [1, 25, 0, 29, 25], 'j': [-3, 7, -9, 28, 9]}
2025-09-14T15:32:52.0013599Z font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e86eaed0>
2025-09-14T15:32:52.0013948Z maxX = c_int(7)
2025-09-14T15:32:52.0014257Z maxY = c_int(29)
2025-09-14T15:32:52.0014534Z minX = c_int(-3)
2025-09-14T15:32:52.0014808Z minY = c_int(-9)
2025-09-14T15:32:52.0015090Z results = [-3, 7, -9, 29, 9]
2025-09-14T15:32:52.0015370Z ret = 0
2025-09-14T15:32:52.0015643Z with_sdl_ttf = None
2025-09-14T15:32:52.0015812Z
2025-09-14T15:32:52.0016348Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.13/site-packages/sdl2/test/sdlttf_test.py:373: AssertionError
2025-09-14T15:32:52.0017736Z ___________________________ test_TTF_GlyphMetrics32 ____________________________
2025-09-14T15:32:52.0018150Z
2025-09-14T15:32:52.0018434Z with_sdl_ttf = None
2025-09-14T15:32:52.0018623Z
2025-09-14T15:32:52.0018939Z @pytest.mark.skipif(sdlttf.dll.version < 2018, reason="not available")
2025-09-14T15:32:52.0019297Z def test_TTF_GlyphMetrics32(with_sdl_ttf):
2025-09-14T15:32:52.0019604Z expected = {
2025-09-14T15:32:52.0019882Z 'A': [1, 25, 0, 29, 25],
2025-09-14T15:32:52.0020205Z 'j': [-3, 7, -9, 28, 9],
2025-09-14T15:32:52.0020495Z '.': [2, 7, -1, 4, 8]
2025-09-14T15:32:52.0020760Z }
2025-09-14T15:32:52.0021040Z font = sdlttf.TTF_OpenFont(fontfile, 40)
2025-09-14T15:32:52.0021513Z minX, maxX, minY, maxY = c_int(0), c_int(0), c_int(0), c_int(0)
2025-09-14T15:32:52.0021777Z adv = c_int(0)
2025-09-14T15:32:52.0021998Z for char in expected.keys():
2025-09-14T15:32:52.0022237Z ret = sdlttf.TTF_GlyphMetrics32(
2025-09-14T15:32:52.0022460Z font, ord(char),
2025-09-14T15:32:52.0022716Z byref(minX), byref(maxX), byref(minY), byref(maxY), byref(adv)
2025-09-14T15:32:52.0022952Z )
2025-09-14T15:32:52.0023183Z results = [x.value for x in (minX, maxX, minY, maxY, adv)]
2025-09-14T15:32:52.0023560Z assert sdlttf.TTF_GetError() == b""
2025-09-14T15:32:52.0023792Z assert ret == 0
2025-09-14T15:32:52.0024010Z > assert results == expected[char]
2025-09-14T15:32:52.0024251Z E assert [-3, 7, -9, 29, 9] == [-3, 7, -9, 28, 9]
2025-09-14T15:32:52.0024448Z E
2025-09-14T15:32:52.0024648Z E At index 3 diff: 29 != 28
2025-09-14T15:32:52.0024851Z E
2025-09-14T15:32:52.0025038Z E Full diff:
2025-09-14T15:32:52.0025225Z E [
2025-09-14T15:32:52.0025411Z E -3,
2025-09-14T15:32:52.0025598Z E 7,
2025-09-14T15:32:52.0025784Z E -9,
2025-09-14T15:32:52.0025971Z E - 28,
2025-09-14T15:32:52.0026152Z E ? ^
2025-09-14T15:32:52.0026314Z E + 29,
2025-09-14T15:32:52.0026496Z E ? ^
2025-09-14T15:32:52.0026678Z E 9,
2025-09-14T15:32:52.0026857Z E ]
2025-09-14T15:32:52.0026957Z
2025-09-14T15:32:52.0027130Z adv = c_int(9)
2025-09-14T15:32:52.0027326Z char = 'j'
2025-09-14T15:32:52.0027617Z expected = {'.': [2, 7, -1, 4, 8], 'A': [1, 25, 0, 29, 25], 'j': [-3, 7, -9, 28, 9]}
2025-09-14T15:32:52.0027915Z font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e7f6fdd0>
2025-09-14T15:32:52.0028156Z maxX = c_int(7)
2025-09-14T15:32:52.0028361Z maxY = c_int(29)
2025-09-14T15:32:52.0028562Z minX = c_int(-3)
2025-09-14T15:32:52.0028762Z minY = c_int(-9)
2025-09-14T15:32:52.0028974Z results = [-3, 7, -9, 29, 9]
2025-09-14T15:32:52.0029178Z ret = 0
2025-09-14T15:32:52.0029376Z with_sdl_ttf = None
2025-09-14T15:32:52.0029475Z
2025-09-14T15:32:52.0029929Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.13/site-packages/sdl2/test/sdlttf_test.py:394: AssertionError
2025-09-14T15:32:52.0030838Z ______________________________ test_TTF_SizeText _______________________________
2025-09-14T15:32:52.0033411Z
2025-09-14T15:32:52.0033832Z with_font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e86eaed0>
2025-09-14T15:32:52.0033969Z
2025-09-14T15:32:52.0034182Z def test_TTF_SizeText(with_font):
2025-09-14T15:32:52.0034409Z font = with_font
2025-09-14T15:32:52.0034650Z min_expected_w = 69 # SDL2_ttf 2.0.18
2025-09-14T15:32:52.0034897Z max_expected_w = 70 # SDL2_ttf <= 2.0.15
2025-09-14T15:32:52.0035162Z min_expected_h = 21 # SDL2_ttf 2.0.15 with FreeType 2.10.1
2025-09-14T15:32:52.0035594Z max_expected_h = 25 # SDL2_ttf < 2.0.15
2025-09-14T15:32:52.0035839Z w, h = c_int(0), c_int(0)
2025-09-14T15:32:52.0036082Z sdlttf.TTF_SizeText(font, b"Hi there!", byref(w), byref(h))
2025-09-14T15:32:52.0036344Z > assert w.value >= min_expected_w
2025-09-14T15:32:52.0036559Z E assert 67 >= 69
2025-09-14T15:32:52.0036779Z E + where 67 = c_int(67).value
2025-09-14T15:32:52.0036905Z
2025-09-14T15:32:52.0037117Z font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e86eaed0>
2025-09-14T15:32:52.0037358Z h = c_int(21)
2025-09-14T15:32:52.0037563Z max_expected_h = 25
2025-09-14T15:32:52.0037770Z max_expected_w = 70
2025-09-14T15:32:52.0037974Z min_expected_h = 21
2025-09-14T15:32:52.0038177Z min_expected_w = 69
2025-09-14T15:32:52.0038458Z w = c_int(67)
2025-09-14T15:32:52.0038705Z with_font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e86eaed0>
2025-09-14T15:32:52.0038839Z
2025-09-14T15:32:52.0039297Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.13/site-packages/sdl2/test/sdlttf_test.py:405: AssertionError
2025-09-14T15:32:52.0039817Z ______________________________ test_TTF_SizeUTF8 _______________________________
2025-09-14T15:32:52.0039991Z
2025-09-14T15:32:52.0040221Z with_font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e7f6c5d0>
2025-09-14T15:32:52.0040355Z
2025-09-14T15:32:52.0040558Z def test_TTF_SizeUTF8(with_font):
2025-09-14T15:32:52.0040779Z font = with_font
2025-09-14T15:32:52.0041000Z min_expected_w = 72 # SDL2_ttf 2.0.18
2025-09-14T15:32:52.0041244Z max_expected_w = 73 # SDL2_ttf <= 2.0.15
2025-09-14T15:32:52.0041511Z min_expected_h = 21 # SDL2_ttf 2.0.15 with FreeType 2.10.1
2025-09-14T15:32:52.0041768Z max_expected_h = 25 # SDL2_ttf < 2.0.15
2025-09-14T15:32:52.0041980Z w, h = c_int(0), c_int(0)
2025-09-14T15:32:52.0042946Z sdlttf.TTF_SizeUTF8(font, u"Hï thère!".encode('utf-8'), byref(w), byref(h))
2025-09-14T15:32:52.0043241Z > assert w.value >= min_expected_w
2025-09-14T15:32:52.0043562Z E assert 70 >= 72
2025-09-14T15:32:52.0043785Z E + where 70 = c_int(70).value
2025-09-14T15:32:52.0043904Z
2025-09-14T15:32:52.0044118Z font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e7f6c5d0>
2025-09-14T15:32:52.0044359Z h = c_int(22)
2025-09-14T15:32:52.0044560Z max_expected_h = 25
2025-09-14T15:32:52.0044764Z max_expected_w = 73
2025-09-14T15:32:52.0044963Z min_expected_h = 21
2025-09-14T15:32:52.0045164Z min_expected_w = 72
2025-09-14T15:32:52.0045362Z w = c_int(70)
2025-09-14T15:32:52.0045604Z with_font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e7f6c5d0>
2025-09-14T15:32:52.0045746Z
2025-09-14T15:32:52.0046204Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.13/site-packages/sdl2/test/sdlttf_test.py:418: AssertionError
2025-09-14T15:32:52.0046747Z _____________________________ test_TTF_SizeUNICODE _____________________________
2025-09-14T15:32:52.0046920Z
2025-09-14T15:32:52.0047149Z with_font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e86e90d0>
2025-09-14T15:32:52.0047281Z
2025-09-14T15:32:52.0047490Z def test_TTF_SizeUNICODE(with_font):
2025-09-14T15:32:52.0047712Z font = with_font
2025-09-14T15:32:52.0047934Z min_expected_w = 69 # SDL2_ttf 2.0.18
2025-09-14T15:32:52.0048178Z max_expected_w = 70 # SDL2_ttf <= 2.0.15
2025-09-14T15:32:52.0048441Z min_expected_h = 21 # SDL2_ttf 2.0.15 with FreeType 2.10.1
2025-09-14T15:32:52.0048705Z max_expected_h = 25 # SDL2_ttf < 2.0.15
2025-09-14T15:32:52.0048918Z w, h = c_int(0), c_int(0)
2025-09-14T15:32:52.0049140Z strarr = to_utf16(u"Hi there!")
2025-09-14T15:32:52.0049486Z sdlttf.TTF_SizeUNICODE(font, strarr, byref(w), byref(h))
2025-09-14T15:32:52.0049741Z # For debug purposes
2025-09-14T15:32:52.0049949Z #print(list(strarr))
2025-09-14T15:32:52.0050180Z #print("w = {0}, h = {1}".format(w.value, h.value))
2025-09-14T15:32:52.0050431Z > assert w.value >= min_expected_w
2025-09-14T15:32:52.0050647Z E assert 67 >= 69
2025-09-14T15:32:52.0050867Z E + where 67 = c_int(67).value
2025-09-14T15:32:52.0050977Z
2025-09-14T15:32:52.0051205Z font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e86e90d0>
2025-09-14T15:32:52.0051450Z h = c_int(21)
2025-09-14T15:32:52.0051650Z max_expected_h = 25
2025-09-14T15:32:52.0051855Z max_expected_w = 70
2025-09-14T15:32:52.0052059Z min_expected_h = 21
2025-09-14T15:32:52.0052328Z min_expected_w = 69
2025-09-14T15:32:52.0052575Z strarr = <sdl2.test.sdlttf_test.c_ushort_Array_11 object at 0x7ff3e7f6d250>
2025-09-14T15:32:52.0052833Z w = c_int(67)
2025-09-14T15:32:52.0053082Z with_font = <sdl2.sdlttf.LP_TTF_Font object at 0x7ff3e86e90d0>
2025-09-14T15:32:52.0053232Z
2025-09-14T15:32:52.0053756Z ../_test_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold/lib/python3.13/site-packages/sdl2/test/sdlttf_test.py:435: AssertionError
Metadata
Metadata
Assignees
Labels
No labels