File: guid_test.py

package info (click to toggle)
pysdl2 0.9.17%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,328 kB
  • sloc: python: 24,685; makefile: 36; sh: 8
file content (20 lines) | stat: -rw-r--r-- 735 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
from ctypes import create_string_buffer

import pytest
import sdl2


@pytest.mark.skipif(sdl2.dll.version < 2231, reason="not available")
def test_SDL_GUIDToString():
    guid_str = b'030000007e050000060300001c3a0000' # Wiimote on macOS
    guid = sdl2.SDL_GUIDFromString(guid_str)
    buff = create_string_buffer(33)
    sdl2.SDL_GUIDToString(guid, buff, 33) # Get GUID string
    assert guid_str == buff.value

@pytest.mark.skipif(sdl2.dll.version < 2231, reason="not available")
def test_SDL_GUIDFromString():
    guid_str = b'030000007e050000060300001c3a0000' # Wiimote on macOS
    expected = [3, 0, 0, 0, 126, 5, 0, 0, 6, 3, 0, 0, 28, 58, 0, 0]
    guid = sdl2.SDL_GUIDFromString(guid_str)
    assert list(guid.data) == expected