Ejemplo n.º 1
0
    def test_SDL_GetRendererInfo(self):
        failed = 0
        rcount = render.SDL_GetNumRenderDrivers()
        for i in range(rcount):
            window = video.SDL_CreateWindow(b"Test", 10, 10, 10, 10,
                                            video.SDL_WINDOW_HIDDEN)
            self.assertIsInstance(window.contents, video.SDL_Window)
            renderer = render.SDL_CreateRenderer(window, i, self._RENDERFLAGS)
            if not (renderer and renderer.contents):
                failed += 1
                video.SDL_DestroyWindow(window)
                continue
            self.assertIsInstance(renderer.contents, render.SDL_Renderer)
            info = render.SDL_RendererInfo()
            ret = render.SDL_GetRendererInfo(renderer, byref(info))
            self.assertEqual(ret, 0)
            render.SDL_DestroyRenderer(renderer)

            #self.assertRaises(sdl.SDLError, render.SDL_GetRendererInfo,
            #                  renderer)

            video.SDL_DestroyWindow(window)
        self.assertFalse(failed == rcount, "could not create a renderer")
        self.assertRaises((AttributeError, TypeError),
                          render.SDL_GetRendererInfo, None)
        self.assertRaises((AttributeError, TypeError),
                          render.SDL_GetRendererInfo, "Test")
        dogc()
Ejemplo n.º 2
0
    def test_SDL_GetRendererInfo(self):
        failed = 0
        rcount = render.SDL_GetNumRenderDrivers()
        for i in range(rcount):
            window = video.SDL_CreateWindow(b"Test", 10, 10, 10, 10,
                                            video.SDL_WINDOW_HIDDEN)
            assert isinstance(window.contents, video.SDL_Window)
            renderer = render.SDL_CreateRenderer(window, i, self._RENDERFLAGS)
            if not (renderer and renderer.contents):
                failed += 1
                video.SDL_DestroyWindow(window)
                continue
            assert isinstance(renderer.contents, render.SDL_Renderer)
            info = render.SDL_RendererInfo()
            ret = render.SDL_GetRendererInfo(renderer, byref(info))
            assert ret == 0
            render.SDL_DestroyRenderer(renderer)

            #self.assertRaises(sdl.SDLError, render.SDL_GetRendererInfo,
            #                  renderer)

            video.SDL_DestroyWindow(window)
        assert not (failed == rcount), "could not create a renderer"
        with pytest.raises((AttributeError, TypeError)):
            render.SDL_GetRendererInfo(None)
        with pytest.raises((AttributeError, TypeError)):
            render.SDL_GetRendererInfo("Test")
        dogc()
Ejemplo n.º 3
0
 def test_SDL_GetRenderDriverInfo(self):
     success = False
     drivers = render.SDL_GetNumRenderDrivers()
     for x in range(drivers):
         info = render.SDL_RendererInfo()
         ret = render.SDL_GetRenderDriverInfo(x, byref(info))
         self.assertEqual(ret, 0)
         # We must find at least one software renderer
         if info.name == b"software":
             success = True
     self.assertTrue(success, "failed on retrieving the driver information")
Ejemplo n.º 4
0
 def test_SDL_RendererInfo(self):
     info = render.SDL_RendererInfo()
     self.assertIsInstance(info, render.SDL_RendererInfo)
Ejemplo n.º 5
0
 def test_SDL_RendererInfo(self):
     info = render.SDL_RendererInfo()
     assert isinstance(info, render.SDL_RendererInfo)