Exemplo n.º 1
0
    def test_pygame2_sdl_video_is_mode_ok(self):

        # __doc__ (as of 2009-05-31) for pygame2.sdl.video.is_mode_ok:

        # is_mode_ok (width, height[, bpp, flags]) -> bool
        # is_mode_ok (size[, bpp, flags]) -> bool
        # 
        # Checks, whether the requested video mode is supported.
        # 
        # Checks, whether the video mode is supported for the passed size,
        # bit depth and flags. If the bit depth (bpp) argument is omitted,
        # the current screen bit depth will be used.
        # 
        # The optional flags argument is the same as for set_mode.
        self.assertRaises (pygame2.Error, video.is_mode_ok)
        video.init ()
        modes = video.list_modes ()
        for r in modes:
            self.assertTrue (video.is_mode_ok (r.size) == True)
        video.quit ()
        self.assertRaises (pygame2.Error, video.is_mode_ok)
Exemplo n.º 2
0
    def test_pygame2_sdl_video_list_modes(self):

        # __doc__ (as of 2009-05-31) for pygame2.sdl.video.list_modes:

        # list_modes ([, format, flags]) -> [rect, rect, ...]
        # 
        # Returns the supported modes for a specific format and flags.
        # 
        # Returns the supported modes for a specific format and flags.
        # The optional format argument must be a PixelFormat
        # instance with the desired mode information. The optional flags
        # argument is the same as for set_mode.
        # 
        # If both, the format and flags are omitted, all supported screen
        # resolutions for all supported formats and flags are returned.
        self.assertRaises (pygame2.Error, video.list_modes)
        video.init ()
        modes = video.list_modes()
        self.assertTrue (type (modes) == list)
        for r in modes:
            self.assertTrue (type (r) == pygame2.Rect)
        video.quit ()
        self.assertRaises (pygame2.Error, video.list_modes)