Example #1
0
    def test_get_keyboard_focus(self):
        window = keyboard.get_keyboard_focus()
        self.assertEqual(window, None)
        rwin = video.create_window("", 10, 10, 10, 10, 0)
        window = keyboard.get_keyboard_focus()
        if window:
            self.assertEqual(video.get_window_id(window),
                             video.get_window_id(rwin))
        video.destroy_window(rwin)

        window = keyboard.get_keyboard_focus()
        self.assertEqual(window, None)
Example #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))
Example #3
0
 def test_get_window_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)
         self.assertIsInstance(id, int)
         video.destroy_window(window)
         self.assertRaises(sdl.SDLError, video.get_window_id, window)