1import unittest
2import sys
3import pygame
4
5SDL2 = pygame.get_sdl_version()[0] >= 2
6
7if SDL2:
8    from pygame._sdl2 import video
9
10    class VideoModuleTest(unittest.TestCase):
11        default_caption = "pygame window"
12
13        @unittest.skipIf(
14            not (sys.maxsize > 2 ** 32),
15            "32 bit SDL 2.0.16 has an issue.",
16        )
17        def test_renderer_set_viewport(self):
18            """works."""
19            window = video.Window(title=self.default_caption, size=(800, 600))
20            renderer = video.Renderer(window=window)
21            renderer.logical_size = (1920, 1080)
22            rect = pygame.Rect(0, 0, 1920, 1080)
23            renderer.set_viewport(rect)
24            self.assertEqual(renderer.get_viewport(), (0, 0, 1920, 1080))
25
26    if __name__ == "__main__":
27        unittest.main()
28