def test_SDL_GetKeyboardFocus(self): # window = keyboard.SDL_GetKeyboardFocus() # TODO: x # self.assertEqual(window, None) rwin = video.SDL_CreateWindow(b"test", 10, 10, 10, 10, 0) window = keyboard.SDL_GetKeyboardFocus() if window: assert video.SDL_GetWindowID(window) == video.SDL_GetWindowID(rwin) video.SDL_DestroyWindow(rwin) window = keyboard.SDL_GetKeyboardFocus()
def test_SDL_GetWindowID(self): flags = (video.SDL_WINDOW_BORDERLESS, video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN) for flag in flags: window = video.SDL_CreateWindow(b"Test", 10, 10, 10, 10, flag) assert video.SDL_GetWindowID(window) >= 0 video.SDL_DestroyWindow(window)
def test_SDL_GetWindowFromID(self): flags = (video.SDL_WINDOW_BORDERLESS, video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN) for flag in flags: window = video.SDL_CreateWindow(b"Test", 10, 10, 10, 10, flag) window2 = video.SDL_GetWindowFromID(video.SDL_GetWindowID(window)) self.assertEqual(video.SDL_GetWindowID(window), video.SDL_GetWindowID(window2)) self.assertEqual(video.SDL_GetWindowTitle(window), video.SDL_GetWindowTitle(window2)) px1, py1, px2, py2 = c_int(), c_int(), c_int(), c_int() video.SDL_GetWindowPosition(window, byref(px1), byref(px2)) video.SDL_GetWindowPosition(window2, byref(px2), byref(px2)) self.assertEqual((px1.value, py1.value), (px2.value, py2.value)) video.SDL_GetWindowSize(window, byref(px1), byref(px2)) video.SDL_GetWindowSize(window2, byref(px2), byref(px2)) self.assertEqual((px1.value, py1.value), (px2.value, py2.value))
def test_SDL_GetWindowFromID(self): get_id = video.SDL_GetWindowID get_title = video.SDL_GetWindowTitle flags = (video.SDL_WINDOW_BORDERLESS, video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN) for flag in flags: window = video.SDL_CreateWindow(b"Test", 10, 10, 10, 10, flag) window2 = video.SDL_GetWindowFromID(video.SDL_GetWindowID(window)) assert get_id(window) == get_id(window2) assert get_title(window) == get_title(window2) px1, py1, px2, py2 = c_int(), c_int(), c_int(), c_int() video.SDL_GetWindowPosition(window, byref(px1), byref(px2)) video.SDL_GetWindowPosition(window2, byref(px2), byref(px2)) assert (px1.value, py1.value) == (px2.value, py2.value) video.SDL_GetWindowSize(window, byref(px1), byref(px2)) video.SDL_GetWindowSize(window2, byref(px2), byref(px2)) assert (px1.value, py1.value) == (px2.value, py2.value)