Exemplo n.º 1
0
    def test_SDL_GetWindowDisplayIndex(self):
        numdisplays = video.SDL_GetNumVideoDisplays()
        flags = (video.SDL_WINDOW_BORDERLESS,
                 video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN)
        for flag in flags:
            window = video.SDL_CreateWindow(b"Test", 10, 11, 12, 13, flag)
            assert isinstance(window.contents, video.SDL_Window)
            px, py = c_int(), c_int()
            video.SDL_GetWindowPosition(window, byref(px), byref(py))
            assert (px.value, py.value) == (10, 11)
            video.SDL_GetWindowSize(window, byref(px), byref(py))
            assert (px.value, py.value) == (12, 13)
            assert video.SDL_GetWindowFlags(window) & flag == flag
            assert video.SDL_GetWindowTitle(window) == b"Test"

            dindex = video.SDL_GetWindowDisplayIndex(window)
            assert 0 <= dindex <= numdisplays, "Invalid display index"
            video.SDL_DestroyWindow(window)
Exemplo n.º 2
0
    def test_SDL_SetWindowDisplayMode(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)
            dindex = video.SDL_GetWindowDisplayIndex(window)
            dmode = video.SDL_DisplayMode()

            ret = video.SDL_GetCurrentDisplayMode(dindex, byref(dmode))
            assert ret == 0

            video.SDL_SetWindowDisplayMode(window, dmode)
            wmode = video.SDL_DisplayMode()
            ret = video.SDL_GetWindowDisplayMode(window, byref(wmode))
            assert ret == 0
            # TODO: refresh rates differ
            #self.assertEqual(dmode, wmode)

            video.SDL_DestroyWindow(window)
Exemplo n.º 3
0
    def test_SDL_GetWindowDisplayIndex(self):
        numdisplays = video.SDL_GetNumVideoDisplays()
        flags = (video.SDL_WINDOW_BORDERLESS,
                 video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN)
        for flag in flags:
            window = video.SDL_CreateWindow(b"Test", 10, 11, 12, 13, flag)
            self.assertIsInstance(window.contents, video.SDL_Window)
            px, py = c_int(), c_int()
            video.SDL_GetWindowPosition(window, byref(px), byref(py))
            self.assertEqual((px.value, py.value), (10, 11))
            video.SDL_GetWindowSize(window, byref(px), byref(py))
            self.assertEqual((px.value, py.value), (12, 13))
            self.assertEqual(video.SDL_GetWindowFlags(window) & flag, flag)
            self.assertEqual(video.SDL_GetWindowTitle(window), b"Test")

            dindex = video.SDL_GetWindowDisplayIndex(window)
            self.assertTrue(0 <= dindex <= numdisplays,
                            "Invalid display index")
            video.SDL_DestroyWindow(window)