Ejemplo n.º 1
0
 def test_get_set_window_position(self):
     window = video.create_window("Test", 10, 10, 10, 10, 0)
     self.assertEqual(video.get_window_position(window), (10, 10))
     video.set_window_position(window, 0, 0)
     self.assertEqual(video.get_window_position(window), (0, 0))
     video.set_window_position(window, 600, 900)
     self.assertEqual(video.get_window_position(window), (600, 900))
     video.set_window_position(window, -200, -10)
     self.assertEqual(video.get_window_position(window), (-200, -10))
     video.destroy_window(window)
Ejemplo n.º 2
0
 def test_get_window_from_id(self):
     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)
         id = video.get_window_id(window)
         window2 = video.get_window_from_id(id)
         self.assertEqual(video.get_window_id(window),
                          video.get_window_id(window2))
         self.assertEqual(video.get_window_title(window),
                          video.get_window_title(window2))
         self.assertEqual(video.get_window_position(window),
                          video.get_window_position(window2))
         self.assertEqual(video.get_window_size(window),
                          video.get_window_size(window2))
Ejemplo n.º 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)
Ejemplo n.º 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)