Beispiel #1
0
 def test_set_window_fullscreen(self):
     # TODO: HIDDEN avoids flickering, but is this really a sufficient test?
     flags = (video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN,
              video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN,
              video.SDL_WINDOW_RESIZABLE | video.SDL_WINDOW_MINIMIZED |
              video.SDL_WINDOW_HIDDEN)
     for flag in flags:
         window = video.create_window("Test", 0, 0, 1024, 768, flag)
         video.set_window_fullscreen(window, True)
         flags = video.get_window_flags(window)
         self.assertEqual(flags & video.SDL_WINDOW_FULLSCREEN,
                          video.SDL_WINDOW_FULLSCREEN)
         video.set_window_fullscreen(window, False)
         flags = video.get_window_flags(window)
         self.assertNotEqual(flags & video.SDL_WINDOW_FULLSCREEN,
                             video.SDL_WINDOW_FULLSCREEN)
         video.destroy_window(window)
Beispiel #2
0
 def test_get_window_flags(self):
     flags = (video.SDL_WINDOW_BORDERLESS,
              video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN,
              video.SDL_WINDOW_RESIZABLE | video.SDL_WINDOW_MINIMIZED)
     for flag in flags:
         window = video.create_window("Test", 10, 10, 10, 10, flag)
         wflags = video.get_window_flags(window)
         # TODO: this constantly fails - why?
         self.assertEqual((wflags & flag), flag)
Beispiel #3
0
 def test_create_window(self):
     # Borderless to ensure that the size check works
     flags = (video.SDL_WINDOW_BORDERLESS,
              video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN)
     for flag in flags:
         window = video.create_window("Test", 10, 10, 10, 10, flag)
         self.assertIsInstance(window, video.SDL_Window)
         self.assertEqual(video.get_window_position(window), (10, 10))
         self.assertEqual(video.get_window_size(window), (10, 10))
         self.assertEqual(video.get_window_flags(window) & flag, flag)
         self.assertEqual(video.get_window_title(window), "Test")
         video.destroy_window(window)
Beispiel #4
0
    def test_get_window_display(self):
        numdisplays = video.get_num_video_displays()
        flags = (video.SDL_WINDOW_BORDERLESS,
                 video.SDL_WINDOW_BORDERLESS | video.SDL_WINDOW_HIDDEN)
        for flag in flags:
            window = video.create_window("Test", 10, 10, 10, 10, flag)
            self.assertIsInstance(window, video.SDL_Window)
            self.assertEqual(video.get_window_position(window), (10, 10))
            self.assertEqual(video.get_window_size(window), (10, 10))
            self.assertEqual(video.get_window_flags(window) & flag, flag)
            self.assertEqual(video.get_window_title(window), "Test")

            dindex = video.get_window_display(window)
            self.assertTrue(0 <= dindex <= numdisplays,
                            "Invalid display index")
            video.destroy_window(window)
            self.assertRaises(sdl.SDLError, video.get_window_display, window)