Commits

Anonymous committed ba8c466

Fixed an id range issue in sdl.event.Event.
Fixed allocation issues in freetype.Font.
Fixed quitting in sdlext.scrap.
Fixed msys build for Python 3.x on Win32 platforms with newer winreg module.
Removed Python 2.4 default building tasks.
Added more unit tests.

Comments (0)

Files changed (25)

 	$(top_srcdir)/src/base \
 	$(top_srcdir)/src/freetype \
 	$(top_srcdir)/src/mask \
-	$(top_srcdir)/src/physics \
 	$(top_srcdir)/src/sdl \
 	$(top_srcdir)/src/sdlext \
 	$(top_srcdir)/src/sdlgfx \
 # purposes only!
 
 buildall: clean
-	@python2.4 setup.py build
 	@python2.5 setup.py build
 	@python2.6 setup.py build
-	@python3.0 setup.py build
 	@python3.1 setup.py build
 
 installall:
-	@python2.4 setup.py install
 	@python2.5 setup.py install
 	@python2.6 setup.py install
-	@python3.0 setup.py install
 	@python3.1 setup.py install
 
 testall:
-	@python2.4 test/run_tests.py
 	@python2.5 test/run_tests.py
 	@python2.6 test/run_tests.py
-	@python3.0 test/run_tests.py
 	@python3.1 test/run_tests.py
 
 testall2:
-	@python2.4 -c "import pygame2.test; pygame2.test.run ()"
 	@python2.5 -c "import pygame2.test; pygame2.test.run ()"
 	@python2.6 -c "import pygame2.test; pygame2.test.run ()"
-	@python3.0 -c "import pygame2.test; pygame2.test.run ()"
 	@python3.1 -c "import pygame2.test; pygame2.test.run ()"
 
 purge_installs:
-	rm -rf /usr/local/include/python2.4/pygame2*
 	rm -rf /usr/local/include/python2.5/pygame2*
 	rm -rf /usr/local/include/python2.6/pygame2*
-	rm -rf /usr/local/include/python3.0/pygame2*
 	rm -rf /usr/local/include/python3.1/pygame2*
-	rm -rf /usr/local/lib/python2.4/site-packages/pygame2*
 	rm -rf /usr/local/lib/python2.5/site-packages/pygame2*
 	rm -rf /usr/local/lib/python2.6/site-packages/pygame2*
-	rm -rf /usr/local/lib/python3.0/site-packages/pygame2*
 	rm -rf /usr/local/lib/python3.1/site-packages/pygame2*
 
 #from config.helpers import *
 from config.msysio import raw_input_ as msys_raw_input, print_ as msys_print
 from config.msysio import is_msys
+from config import helpers
 import os
 import time
 import subprocess
 import re
 import glob
 try:
-    import _winreg
+    if helpers.getversion()[0] >= 3:
+        import winreg as _winreg
+    else:
+        import _winreg
 except:
     _winreg = None
 
     try:
         key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, subkey)
         try:
-            return _winreg.QueryValueEx(key, 'Inno Setup: App Path')[0].encode()
+            output = _winreg.QueryValueEx(key, 'Inno Setup: App Path')[0].encode()
+            if helpers.getversion()[0] >= 3:
+                output = str (output, "utf-8")
+            return output 
         except WindowsError:
             raise LookupError("MSYS not found in the registry")
     finally:
 This will build and install Pygame2 in one step.
 
 You also can use the small build.bat batch script, which optionally can
-set up the VC++ include and library paths. Change it to your needs and
-then execute it using ::
+set up the VC++ include and library paths for the VC Toolkit 2003. Change it to
+your needs and then execute it using ::
 
     build.bat
 
   between two releases.
 
 * *MINOR* should be increased, whenever changes or additions to the API were
-  made. This also will cause *BUGFIX* to be set back to 0.
+  made (which do **not** break backwards compatibility). This also will cause
+  *BUGFIX* to be set back to 0.
 
 * *MAJOR* should be increased, whenever outstanding additions or changes to the
   API were made, which legitimate it.

examples/import.py

         print (sys.exc_info()[1])
 
     import pygame2.mask
-    import pygame2.physics
 
     try:
         import pygame2.sdl

src/freetype/ft_font.c

                 &text, &style, &rotation, &ptsize))
         return NULL;
 
+    if (!IsTextObj (text))
+    {
+        PyErr_SetString (PyExc_TypeError,
+            "text must be a string or unicode object");
+        return NULL;
+    }
+
     /* Build rendering mode, always anti-aliased by default */
     if (PGFT_BuildRenderMode(ft, font, &render, 
                 ptsize, style, rotation) != 0)
         PyErr_SetString(PyExc_ValueError, PGFT_GetError(ft));
         return NULL;
     }
-
-    error = PGFT_GetTextSize(ft, font, &render,text, &width, &height);
+    
+    error = PGFT_GetTextSize(ft, font, &render, text, &width, &height);
     
     if (error)
         PyErr_SetString(PyExc_RuntimeError, PGFT_GetError(ft));

src/freetype/ft_render_cb.c

             for (i = rx; i < max_x; ++i, _dst += _bpp)                  \
             {                                                           \
                 FT_UInt32 alpha = (*_src++);                            \
-                FT_UInt32 tmpa = alpha;                                 \
                 alpha = (alpha * color->a) / 255;                       \
                 if (alpha == 0xFF)                                      \
                 {                                                       \

src/freetype/ft_text.c

     {
         free(ftext->glyphs);
         ftext->glyphs = malloc((size_t)string_length * sizeof(FontGlyph *));
+        if (!ftext->glyphs)
+        {
+            free (orig_buffer);
+            _PGFT_SetError (ft, "Could not allocate memory", 0);
+            return NULL;
+        }
 
         free(ftext->advances);
         ftext->advances = malloc((size_t)string_length * sizeof(FT_Vector));
+        if (!ftext->advances)
+        {
+            free (orig_buffer);
+            _PGFT_SetError (ft, "Could not allocate memory", 0);
+            return NULL;
+        }
     }
 
     ftext->length = string_length;
         PyObject *utf_bytes;
 
         utf_bytes = PyUnicode_AsUTF16String(obj);
-        Bytes_AsStringAndSize(utf_bytes, &tmp_buffer, (int *)&len);
+        if (!utf_bytes)
+            return NULL;
+
+        if (Bytes_AsStringAndSize(utf_bytes, &tmp_buffer, (int *)&len) == -1)
+        {
+            Py_DECREF (utf_bytes);
+            return NULL;
+        }
+
         utf16_buffer = malloc(len + 2);
-
+        if (!utf16_buffer)
+        {
+            Py_DECREF (utf_bytes);
+            return NULL;
+        }
         memcpy(utf16_buffer, tmp_buffer, len);
         utf16_buffer[len / sizeof(FT_UInt16)] = 0;
 
          */
         size_t i;
 
-        Bytes_AsStringAndSize(obj, &tmp_buffer, (int *)&len);
-        utf16_buffer = malloc((size_t)(len + 1) * sizeof(FT_UInt16));
+        if (Bytes_AsStringAndSize(obj, &tmp_buffer, (int *)&len) == -1)
+            return NULL;
+
+        utf16_buffer = malloc((len + 1) * sizeof(FT_UInt16));
+        if (!utf16_buffer)
+            return NULL;
 
         for (i = 0; i < len; ++i)
             utf16_buffer[i] = (FT_UInt16)tmp_buffer[i];
-
         utf16_buffer[len] = 0;
     }
 
     if (!PyArg_ParseTuple (args, "i|O", &eventid, &dict))
         return -1;
 
+    if (eventid < 0 || eventid > 255)
+    {
+        PyErr_SetString (PyExc_ValueError,
+            "type must be an integer in the range 0-255");
+        return -1;
+    }
+
     if (dict && !PyDict_Check (dict))
     {
         PyErr_SetString (PyExc_TypeError, "dict must be a dict");

src/sdl/surface_blit.h

   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */
 
+#ifndef _PYGAME_SURFACEBLIT_H_
+#define _PYGAME_SURFACEBLIT_H_
+
 #include "surface.h"
 
 /* The structure passed to the low level blit functions */
 void blit_blend_rgba_diff (SDL_BlitInfo* info);
 void blit_blend_rgba_screen (SDL_BlitInfo* info);
 void blit_blend_rgba_avg (SDL_BlitInfo* info);
+
+#endif /* _PYGAME_SURFACEBLIT_H_ */

src/sdlext/draw.h

 
 #include <SDL.h>
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 #define LOCK_SURFACE(x,ret)                                             \
     if (SDL_MUSTLOCK (x))                                               \
     {                                                                   \
 pyg_draw_filled_polygon (SDL_Surface *surface, SDL_Rect *cliprect, Uint32 color,
     int *xpts, int *ypts, unsigned int count, SDL_Rect *area);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _PYGAME_DRAW_H_ */

src/sdlext/scrap.c

     if (!_initialized)
         return;
     _initialized = 0;
+    _scrapinfo.quit ();
 }
 
 int

src/sdlext/scrap.h

 #define SCRAP_FORMAT_PBM "image/pbm"
 
 /**
- * \brief Checks, whether the scrap module was initialized.
+ * \brief Initializes the scrap module internals. Call this before any
+ * other method.
  *
- * \return 1 if the module was initialized, 0 otherwise.
+ * \return 1 on successful initialization, 0 otherwise.
  */
 int
 pyg_scrap_init (void);
 
 /**
- * \brief Initializes the scrap module internals. Call this before any
- * other method.
+ * \brief Checks, whether the scrap module was initialized.
  *
- * \return 1 on successful initialization, 0 otherwise.
+ * \return 1 if the module was initialized, 0 otherwise.
  */
 int
 pyg_scrap_was_init (void);

src/sdlext/scrap_win.h

 
 */
 
+#ifndef _PYGAME_SCRAPWIN_H_
+#define _PYGAME_SCRAPWIN_H_
+
 #include "scrap.h"
 
 #if defined(SDL_VIDEO_DRIVER_WINDIB) || defined(SDL_VIDEO_DRIVER_DDRAW) || defined(SDL_VIDEO_DRIVER_GAPI)
 scrap_get_types_win (char** types);
 
 #endif /* SDL_VIDEO_DRIVER_WINDIB || SDL_VIDEO_DRIVER_DDRAW || SDL_VIDEO_DRIVER_GAPI */
+
+#endif /* _PYGAME_SCRAPWIN_H_ */

src/sdlext/scrap_x11.h

 
 */
 
+#ifndef _PYGAME_SCRAPX11_H_
+#define _PYGAME_SCRAPX11_H_
+
 #include "scrap.h"
 
 #ifdef SDL_VIDEO_DRIVER_X11
 scrap_get_types_x11 (char** types);
 
 #endif /* SDL_VIDEO_DRIVER_X11 */
+
+#endif /* _PYGAME_SCRAPX11_H_ */

test/font_test.py

 import pygame2.font as font
 
 class FontTest (unittest.TestCase):
+    
     def todo_test_pygame2_font_find_font(self):
 
-        # __doc__ (as of 2009-06-26) for pygame2.font.find_font:
+        # __doc__ (as of 2009-12-10) for pygame2.font.find_font:
 
-        # find_fonts(name, bold=False, italic=False, ftype=None) -> str, bool, bool
+        # find_font (name, bold=False, italic=False, ftype=None) -> str, bool, bool
         # 
         # Finds a font matching a certain family or font filename best.
         # 
         # is an optional font filetype argument to request specific font file
         # types, such as bdf or ttf fonts.
 
-        self.fail ()
+        # name, bold, italic = font.find_font ('sans')
+        self.fail() 
 
     def todo_test_pygame2_font_find_fonts(self):
 
-        # __doc__ (as of 2009-06-26) for pygame2.font.find_fonts:
+        # __doc__ (as of 2009-12-10) for pygame2.font.find_fonts:
 
         # find_fonts(name, bold=False, italic=False, ftype=None) -> [ (str, bool, bool), ... ]
         # 
 
     def todo_test_pygame2_font_get_families(self):
 
-        # __doc__ (as of 2009-06-26) for pygame2.font.get_families:
+        # __doc__ (as of 2009-12-10) for pygame2.font.get_families:
 
         # get_families () -> [str, str, str, ...]
         # 

test/freetype_font_test.py

 import pygame2.freetype as ft
 import pygame2.freetype.constants as ft_const
 
-ft.init()
-
 FONTDIR = os.path.dirname (os.path.abspath (__file__))
 
 class FreeTypeFontTest(unittest.TestCase):
-    _TEST_FONTS = {
-            # Inconsolata is an open-source font designed by Raph Levien
-            # Licensed under the Open Font License
-            # http://www.levien.com/type/myfonts/inconsolata.html
-            'fixed' : ft.Font(os.path.join (FONTDIR, 'test_fixed.otf')),
 
-            # Liberation Sans is an open-source font designed by Steve Matteson
-            # Licensed under the GNU GPL
-            # https://fedorahosted.org/liberation-fonts/
-            'sans'  : ft.Font(os.path.join (FONTDIR, 'test_sans.ttf')),
-    }
-
-    def test_pygame2_freetype_Font_init(self):
-
-        self.assertRaises(RuntimeError, ft.Font, os.path.join (FONTDIR, 'nonexistant.ttf'))
-
-        f = self._TEST_FONTS['sans']
-        self.assertTrue(isinstance(f, pygame2.base.Font))
-        self.assertTrue(isinstance(f, ft.Font))
-
-        f = self._TEST_FONTS['fixed']
-        self.assertTrue(isinstance(f, pygame2.base.Font))
-        self.assertTrue(isinstance(f, ft.Font))
-
+    def get_fixed_font (self):
+        return ft.Font(os.path.join (FONTDIR, 'test_fixed.otf'))
+    def get_sans_font (self):
+        return ft.Font(os.path.join (FONTDIR, 'test_sans.ttf'))
 
     def test_pygame2_freetype_Font_fixed_width(self):
-
-        f = self._TEST_FONTS['sans']
+        ft.init ()
+        f = self.get_sans_font ()
         self.assertFalse(f.fixed_width)
 
-        f = self._TEST_FONTS['fixed']
+        f = self.get_fixed_font ()
         self.assertFalse(f.fixed_width)
 
         # TODO: Find a real fixed width font to test with
-
+        ft.quit ()
+        
     def test_pygame2_freetype_Font_get_metrics(self):
-
-        font = self._TEST_FONTS['sans']
+        ft.init ()
+        font = self.get_sans_font ()
         
         # test for floating point values (BBOX_EXACT)
         metrics = font.get_metrics('ABCD', ptsize=24, bbmode=ft_const.BBOX_EXACT)
 
         # test for invalid string
         self.assertRaises(TypeError, font.get_metrics, 24, 24)
+        ft.quit ()
 
     def test_pygame2_freetype_Font_get_size(self):
-
-        font = self._TEST_FONTS['sans']
+        ft.init()
+        font = self.get_sans_font ()
 
         def test_size(s):
             self.assertTrue(isinstance(s, tuple))
         size_null = font.get_size("", ptsize=24)
         test_size (size_null)
         self.assertTrue (size_null[0] == size_null[1] == 0)
-        
+        ft.quit ()
+
     def test_pygame2_freetype_Font_height(self):
-
-        f = self._TEST_FONTS['sans']
+        ft.init ()
+        f = self.get_sans_font ()
         self.assertEqual(f.height, 2355)
 
-        f = self._TEST_FONTS['fixed']
+        f = self.get_fixed_font ()
         self.assertEqual(f.height, 1100)
+        ft.quit ()
         
-
     def test_pygame2_freetype_Font_name(self):
-
-        f = self._TEST_FONTS['sans']
+        ft.init ()
+        f = self.get_sans_font ()
         self.assertEqual(f.name, 'Liberation Sans')
 
-        f = self._TEST_FONTS['fixed']
+        f = self.get_fixed_font ()
         self.assertEqual(f.name, 'Inconsolata')
-
-
+        ft.quit ()
+        
     def test_pygame2_freetype_Font_render(self):
-
-        font = self._TEST_FONTS['sans']
-
+        ft.init ()
+        font = self.get_sans_font ()
+        
         pygame2.sdl.video.init()
         surf = pygame2.sdl.video.Surface(800, 600)
         color = pygame2.base.Color(0, 0, 0)
                 style=97, ptsize=24)
 
         pygame2.sdl.video.quit()
-
-
+        ft.quit ()
 
     def test_pygame2_freetype_Font_style(self):
-
-        font = self._TEST_FONTS['sans']
+        ft.init ()
+        font = self.get_sans_font ()
 
         # make sure STYLE_NORMAL is the default value
         self.assertEqual(ft_const.STYLE_NORMAL, font.style)
         # revert changes
         font.style = ft_const.STYLE_NORMAL
         self.assertEqual(ft_const.STYLE_NORMAL, font.style)
+        ft.quit ()
+        
+    def todo_test_pygame2_freetype_Font_antialiased(self):
 
+        # __doc__ (as of 2009-12-14) for pygame2.freetype.Font.antialiased:
+
+        # Gets or sets the font's antialiasing mode. This defaults to True
+        # on all fonts, which will be rendered by default antialiased.
+        # 
+        # Setting this to true will change all rendering methods to use
+        # glyph bitmaps without antialiasing, which supposes a small speed gain
+        # and a significant memory gain because of the way glyphs are cached.
+
+        self.fail() 
+
+    def todo_test_pygame2_freetype_Font_bold(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.freetype.Font.bold:
+
+        # Gets or sets whether the font will be bold when drawing text.
+        # This default style value will be used for all text rendering and
+        # size calculations unless overriden specifically in the render()
+        # or get_size() calls, via the 'style' parameter.
+
+        self.fail() 
+
+    def todo_test_pygame2_freetype_Font_italic(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.freetype.Font.italic:
+
+        # Gets or sets whether the font will be slanted when drawing text.
+        # This default style value will be used for all text rendering and
+        # size calculations unless overriden specifically in the render()
+        # or get_size() calls, via the 'style' parameter.
+
+        self.fail() 
+
+    def todo_test_pygame2_freetype_Font_render_raw(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.freetype.Font.render_raw:
+
+        # render_raw(text [, ptsize]) -> int, int, bytes
+        # 
+        # Renders a text to a byte buffer.
+        # 
+        # Renders the string *text* to a raw buffer of bytes, each byte
+        # representing the opacity of the glyph's raster image in
+        # grayscale.
+        # 
+        # The width (pitch) and height of the rendered text, together with
+        # the bytes buffer, will be returned in a tuple.
+        # 
+        # The rendering is done using the font's default size in points.
+        # Optionally you may specify another point size to use.
+
+        self.fail() 
+
+    def todo_test_pygame2_freetype_Font_underline(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.freetype.Font.underline:
+
+        # Gets or sets whether the font will be underlined when drawing text.
+        # This default style value will be used for all text rendering and
+        # size calculations unless overriden specifically in the render()
+        # or get_size() calls, via the 'style' parameter.
+
+        self.fail() 
+
+    def todo_test_pygame2_freetype_Font_vertical(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.freetype.Font.vertical:
+
+        # Gets or sets whether the font is a vertical font such as fonts
+        # representing Kanji glyphs or other styles of vertical writing.
+        # 
+        # Changing this attribute will cause the font to be rendering
+        # vertically, and affects all other methods which manage glyphs
+        # or text layouts to use vertical metrics accordingly.
+        # 
+        # Note that the FreeType library doesn't automatically detect
+        # whether a font contains glyphs which are always supposed to
+        # be drawn vertically, so this attribute must be set manually
+        # by the user.
+        # 
+        # Also note that several font formats (specially bitmap based
+        # ones) don't contain the necessary metrics to draw glyphs
+        # vertically, so drawing in those cases will give unspecified
+        # results.
+
+        self.fail() 
 
 if __name__ == '__main__':
     unittest.main()

test/sdl_base_test.py

         # pygame2.sdl.get_error().
         self.assertEqual (base.init (constants.INIT_CDROM), True)
         self.assertEqual (base.init
-                           (constants.INIT_CDROM | constants.INIT_AUDIO), True)
+                          (constants.INIT_CDROM | constants.INIT_AUDIO), True)
         base.quit ()
 
     def test_pygame2_sdl_base_init_subsystem(self):
         # or function related to the specified subsystems as they are likely
         # to fail or might give unpredictable results.
         self.assert_ (base.quit_subsystem (constants.INIT_AUDIO) == None)
-        #self.assert_ (base.quit_subsystem (constants.INIT_CDROM) == None)
+        self.assert_ (base.quit_subsystem (constants.INIT_CDROM) == None)
     
     def test_pygame2_sdl_base_was_init(self):
 

test/sdl_cdrom_test.py

+import sys
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import pgunittest as unittest
+
+import pygame2
+import pygame2.sdl.wm as wm
+import pygame2.sdl.constants as constants
+
+class SDLCDRomTest (unittest.TestCase):
+
+    def todo_test_pygame2_sdl_cdrom_CD_close(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.close:
+
+        # close () -> None
+        # 
+        # Releases the CD internals. Useful for e.g. switching CDs within
+        # the drive without the need to recreate the CD object. open
+        # will reinitialize the CD internals. You should not use any other
+        # method or attribute until a call to open.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_cur_frame(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.cur_frame:
+
+        # The current frame offset within the curent track.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_cur_track(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.cur_track:
+
+        # The current track.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_eject(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.eject:
+
+        # eject () -> None
+        # 
+        # Ejects the CD or DVD.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_index(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.index:
+
+        # The drive index as specified in the constructor.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_name(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.name:
+
+        # The system-dependent drive name (e.g. "/dev/cdrom" or "D:").
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_num_tracks(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.num_tracks:
+
+        # The total number of tracks on the CD or DVD.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_open(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.open:
+
+        # open () -> None
+        # 
+        # (Re-)Opens the CD and initialises the CD internals
+        # after a close call.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_pause(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.pause:
+
+        # pause () -> None
+        # 
+        # Pauses the actual CD playback.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_play(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.play:
+
+        # play (start, length[, asfps]) -> None
+        # 
+        # Starts playing the current CD beginning at the give *start*
+        # time for a maximum of *length* seconds. The *start* and *length*
+        # arguments are handled as seconds by default. To use an exact frame
+        # offset instead ofseconds, pass True as third *asfps* parameter.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_play_tracks(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.play_tracks:
+
+        # play_tracks ([starttrack, ntracks, start, length, asfps]) -> None
+        # 
+        # Plays a certain number of tracks beginning at the passed start
+        # track. If *start* and *length* are not 0, *start* determines the
+        # offset of *starttrack* to begin the playback at and *length*
+        # specifies the amount of seconds to play from the last track
+        # within the track list. To use an exact frame offset instead of
+        # seconds for the *start* and *length* parameters, pass True as *asfps*
+        # parameter.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_resume(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.resume:
+
+        # resume () -> None
+        # 
+        # Resumes a previously paused playback.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_status(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.status:
+
+        # Gets the current CD status.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_stop(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.stop:
+
+        # stop () -> None
+        # 
+        # Stops the current playback.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CD_tracks(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CD.tracks:
+
+        # Gets a list of CDTrack objects with the CD track
+        # information.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CDTrack_id(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CDTrack.id:
+
+        # Gets the CD track id.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CDTrack_length(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CDTrack.length:
+
+        # Gets the track length in frames.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CDTrack_minutes(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CDTrack.minutes:
+
+        # Gets the approximate track length in minutes.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CDTrack_offset(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CDTrack.offset:
+
+        # Gets the frame offset of the track on the CD.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CDTrack_seconds(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CDTrack.seconds:
+
+        # Gets the approximate track length in seconds.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CDTrack_time(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CDTrack.time:
+
+        # Gets the approximate track length in minutes and seconds as
+        # tuple.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_CDTrack_type(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.CDTrack.type:
+
+        # Gets the track type (data or audio).
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_get_name(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.get_name:
+
+        # get_name (index) -> str
+        # 
+        # Gets the name of the specified CD- or DVD-ROM drive.
+        # 
+        # Gets the system-dependent drive name (e.g. "/dev/cdrom" or "D:")
+        # for the CD- or DVD-Rom specified by the passed *index*.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_init(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.init:
+
+        # init () -> None
+        # 
+        # Initializes the CD-ROM subsystem of the SDL library.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_num_drives(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.num_drives:
+
+        # um_drives () -> int
+        # 
+        # Gets the number of accessible CD- and DVD-ROM drives for the system.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_quit(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.quit:
+
+        # quit () -> None
+        # 
+        # Shuts down the CD-ROM subsystem of the SDL library.
+        # 
+        # After calling this function, you should not invoke any class,
+        # method or function related to the CD-ROM subsystem as they are
+        # likely to fail or might give unpredictable results.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cdrom_was_init(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cdrom.was_init:
+
+        # was_init () -> bool
+        # 
+        # Returns, whether the CD-ROM subsystem of the SDL library is initialized.
+
+        self.fail() 
+
+if __name__ == "__main__":
+    unittest.main ()
+

test/sdl_cursors_test.py

+import sys
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import pgunittest as unittest
+
+import pygame2
+import pygame2.sdl.cursors as cursors
+import pygame2.sdl.constants as constants
+
+class SDLCursorsTest (unittest.TestCase):
+
+    def todo_test_pygame2_sdl_cursors_compile(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cursors.compile:
+
+        # compile(strings, black, white,xor) -> data, mask
+        # 
+        # Compile cursor strings into cursor data
+        # 
+        # This takes a set of strings with equal length and computes
+        # the binary data for that cursor. The string widths must be
+        # divisible by 8.
+        # 
+        # The black and white arguments are single letter strings that
+        # tells which characters will represent black pixels, and which
+        # characters represent white pixels. All other characters are
+        # considered clear.
+        # 
+        # This returns a tuple containing the cursor data and cursor mask
+        # data. Both these arguments are used when setting a cursor with
+        # pygame2.sdl.mouse.set_cursor().
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_cursors_load_xbm(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.cursors.load_xbm:
+
+        # load_xbm(cursorfile, maskfile) -> cursor_args
+        # 
+        # Reads a pair of XBM files into set_cursor arguments
+        # 
+        # Arguments can either be filenames or filelike objects
+        # with the readlines method. Not largely tested, but
+        # should work with typical XBM files.
+
+        self.fail() 
+
+if __name__ == "__main__":
+    unittest.main ()

test/sdl_event_test.py

+import sys
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import pgunittest as unittest
+
+import pygame2
+import pygame2.sdl.event as event
+import pygame2.sdl.constants as constants
+
+class SDLEventTest (unittest.TestCase):
+
+    def test_pygame2_sdl_event_Event (self):
+        # check argument handling
+        self.assertRaises (TypeError, event.Event)
+        self.assertRaises (TypeError, event.Event, None)
+        self.assertRaises (ValueError, event.Event, -5)
+        self.assertRaises (ValueError, event.Event, 256)
+        
+    def test_pygame2_sdl_event_Event_name(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.Event.name:
+
+        # Gets the name of the Event.
+
+        ev = event.Event (200)
+        self.assertEqual (ev.name, "Unknown")
+        
+        ev = event.Event (0)
+        self.assertEqual (ev.name, "NoEvent")
+        ev = event.Event (constants.NOEVENT)
+        self.assertEqual (ev.name, "NoEvent")
+        
+        ev = event.Event (1)
+        self.assertEqual (ev.name, "ActiveEvent")
+        ev = event.Event (constants.ACTIVEEVENT)
+        self.assertEqual (ev.name, "ActiveEvent")
+
+        ev = event.Event (2)
+        self.assertEqual (ev.name, "KeyDown")
+        ev = event.Event (constants.KEYDOWN)
+        self.assertEqual (ev.name, "KeyDown")
+        
+        ev = event.Event (3)
+        self.assertEqual (ev.name, "KeyUp")
+        ev = event.Event (constants.KEYUP)
+        self.assertEqual (ev.name, "KeyUp")
+        
+        ev = event.Event (4)
+        self.assertEqual (ev.name, "MouseMotion")
+        ev = event.Event (constants.MOUSEMOTION)
+        self.assertEqual (ev.name, "MouseMotion")
+        
+        ev = event.Event (5)
+        self.assertEqual (ev.name, "MouseButtonDown")
+        ev = event.Event (constants.MOUSEBUTTONDOWN)
+        self.assertEqual (ev.name, "MouseButtonDown")
+        
+        ev = event.Event (6)
+        self.assertEqual (ev.name, "MouseButtonUp")
+        ev = event.Event (constants.MOUSEBUTTONUP)
+        self.assertEqual (ev.name, "MouseButtonUp")
+
+        ev = event.Event (7)
+        self.assertEqual (ev.name, "JoyAxisMotion")
+        ev = event.Event (constants.JOYAXISMOTION)
+        self.assertEqual (ev.name, "JoyAxisMotion")
+
+        ev = event.Event (8)
+        self.assertEqual (ev.name, "JoyBallMotion")
+        ev = event.Event (constants.JOYBALLMOTION)
+        self.assertEqual (ev.name, "JoyBallMotion")
+
+        ev = event.Event (9)
+        self.assertEqual (ev.name, "JoyHatMotion")
+        ev = event.Event (constants.JOYHATMOTION)
+        self.assertEqual (ev.name, "JoyHatMotion")
+
+        ev = event.Event (10)
+        self.assertEqual (ev.name, "JoyButtonDown")
+        ev = event.Event (constants.JOYBUTTONDOWN)
+        self.assertEqual (ev.name, "JoyButtonDown")
+
+        ev = event.Event (11)
+        self.assertEqual (ev.name, "JoyButtonUp")
+        ev = event.Event (constants.JOYBUTTONUP)
+        self.assertEqual (ev.name, "JoyButtonUp")
+
+        ev = event.Event (12)
+        self.assertEqual (ev.name, "Quit")
+        ev = event.Event (constants.QUIT)
+        self.assertEqual (ev.name, "Quit")
+
+        ev = event.Event (13)
+        self.assertEqual (ev.name, "SysWMEvent")
+        ev = event.Event (constants.SYSWMEVENT)
+        self.assertEqual (ev.name, "SysWMEvent")
+
+        ev = event.Event (16)
+        self.assertEqual (ev.name, "VideoResize")
+        ev = event.Event (constants.VIDEORESIZE)
+        self.assertEqual (ev.name, "VideoResize")
+
+        ev = event.Event (17)
+        self.assertEqual (ev.name, "VideoExpose")
+        ev = event.Event (constants.VIDEOEXPOSE)
+        self.assertEqual (ev.name, "VideoExpose")
+
+        ev = event.Event (24)
+        self.assertEqual (ev.name, "UserEvent")
+        ev = event.Event (constants.USEREVENT)
+        self.assertEqual (ev.name, "UserEvent")
+
+    def test_pygame2_sdl_event_Event_type(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.Event.type:
+
+        # Gets the type id of the Event.
+        ev = event.Event (constants.USEREVENT)
+        self.assertEqual (ev.type, constants.USEREVENT)
+        ev = event.Event (constants.KEYUP)
+        self.assertEqual (ev.type, constants.KEYUP)
+
+        for i in range (0, 255):
+            ev = event.Event (i)
+            self.assertEqual (ev.type, i)
+            
+    def todo_test_pygame2_sdl_event_clear(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.clear:
+
+        # clear ([events]) -> None
+        # 
+        # Clears the event queue from certain event types.
+        # 
+        # Clears the event queue from certain event types. If no argument is
+        # passed, all current events are removed from the queue. Otherwise
+        # the argument can be a sequence or a bitmask combination of event
+        # types to clear.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_get(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.get:
+
+        # get ([events]) -> [Event, Event, ... ]
+        # 
+        # Gets events from the event queue.
+        # 
+        # Gets the current events from the event queue. If no argument is
+        # passed, all currently available events are received from the event
+        # queue and returned as list. Otherwise, the argument can be a
+        # sequence or a bitmask combination of event types to receive from
+        # the queue.
+        # 
+        # If no matching events are found on the queue, an empty list will be
+        # returned.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_get_app_state(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.get_app_state:
+
+        # get_app_state () -> int
+        # 
+        # Gets the current application state.
+        # 
+        # Gets the current application state. This will be a bitmask
+        # combination of the APPMOUSEFOCUS, APPINPUTFOCUS or
+        # APPACTIVE masks, indicating whether the application currently is
+        # active and has the mouse and keyboard input focus.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_get_blocked(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.get_blocked:
+
+        # get_blocked () -> [int, int, ...]
+        # 
+        # Gets a list of currently blocked event types.
+        # 
+        # Gets a list of currently blocked event types. Events having the
+        # matching type will not be processed by the event queue.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_get_filter(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.get_filter:
+
+        # get_filter () -> object
+        # 
+        # Gets the currently set filter hook method.
+        # 
+        # Gets the filter hook method set previously by :func:set_filter.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_peek(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.peek:
+
+        # peek ([events]) -> bool
+        # 
+        # Checks, whether certain event types are currently on the queue.
+        # 
+        # Checks, whether certain event types are currently on the queue. If
+        # no argument is passed, this method simply checks, if there is any
+        # event on the event queue. Otherwise, the argument can be a
+        # sequence or a bitmask combination of event types to check for. In
+        # case one event is found, which corresponds to the requested
+        # type(s), True is returned.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_peep(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.peep:
+
+        # peep (num, action, mask[, events]) -> int or [Event, ...]
+        # 
+        # Checks the event queue for events and optionally returns them.
+        # 
+        # This is an advanced event queue querying and manipulation
+        # method. It allows to inspect the event queue, to receive events
+        # from it or to add events.
+        # 
+        # TODO
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_poll(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.poll:
+
+        # poll () -> Event
+        # 
+        # Gets a single event from the event queue.
+        # 
+        # Returns a single event from the queue. If the event queue is
+        # empty, None will be returned. If an event is available and
+        # returned, it will be removed from the queue.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_pump(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.pump:
+
+        # pump () -> None
+        # 
+        # Pumps the event queue, forcing it to gather pending events from
+        # devices.
+        # 
+        # This gathers all pending events and input information from
+        # devices and places them on the event queue.
+        # 
+        # It only has to be called, if you use :func:peep or a filter hook
+        # without using another event function or no other event function at
+        # all.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_push(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.push:
+
+        # push (event) -> None
+        # 
+        # Places a new event at the end of the event queue.
+        # 
+        # This is usually used for placing user defined events on the event
+        # queue. You also can push user created device events on the queue,
+        # but this will not change the state of the device itself.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_set_blocked(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.set_blocked:
+
+        # set_blocked (type) -> None
+        # 
+        # Blocks a single or multiple event types.
+        # 
+        # This will block a single or multiple event types from being
+        # processed by the event system and thus will exactly behave like
+        # :func:state(type, IGNORE).
+        # 
+        # In case other event types are already blocked, the block for them
+        # will be reset.
+        # 
+        # To remove the block for all events, call set_blocked(None).
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_set_filter(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.set_filter:
+
+        # set_filter (filterhook) -> None
+        # 
+        # Sets up a filter hook for events.
+        # 
+        # This sets up a filter to process all events before they are posted
+        # to the event queue. In order to process events correctly, the
+        # *filterhook* must return True or False, indicating whether the event
+        # processd by it, is allowed to be placed on the event queue or not.
+        # It has to take a single argument, which will be the event to process. 
+        # 
+        # def example_filter_hook (event):
+        # if event.type == ... and ...:
+        # # The event matches a certain scheme, do not allow it.
+        # return False
+        # # Any other event may pass.
+        # return True
+        # 
+        # In case the QUITEVENT is processed by the event filter, returning
+        # True will cause the SDL window to be closed, otherwise, the window
+        # will remain open, if possible.
+        # 
+        # .. note
+        # 
+        # Events pushed onto the event queue using :func:push or :func:peep do
+        # not get passed through the filter.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_state(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.state:
+
+        # state (type, state) -> int
+        # 
+        # Sets the processing state of an event type.
+        # 
+        # This allows you to set the processing state of an event *type*.
+        # If the *state* is set to IGNORE, events matching *type* will be
+        # automatically dropped from the event queue and not be filtered. This will
+        # behave similar to :func:set_blocked. If *state* is set to
+        # ENABLE, events matching *type* will be processed normally.
+        # If *state* is set to QUERY, this will return the current
+        # processing state of the specified event type (ENABLE or
+        # IGNORE).
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_event_wait(self):
+
+        # __doc__ (as of 2009-12-12) for pygame2.sdl.event.wait:
+
+        # wait () -> Event
+        # 
+        # Waits indefinitely for the next available event.
+        # 
+        # This is a blocking method, that only returns, if an event occurs
+        # on the event queue. Once an event occurs, it will be returned to
+        # the caller and removed from the queue. While the program is
+        # waiting it will sleep in an idle state.
+
+        self.fail() 
+
+if __name__ == "__main__":
+    unittest.main ()

test/sdl_gl_test.py

+import os, sys
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import pgunittest as unittest
+
+import pygame2
+import pygame2.sdl.video as video
+import pygame2.sdl.gl as gl
+import pygame2.sdl.constants as constants
+
+class SDLGLTest (unittest.TestCase):
+
+    def _get_gllib (self):
+        gllib = ""
+        dirs = []
+        if sys.platform == "win32":
+            dirs = [ "C:\\WINDOWS\\system32", "C:\\WINDOWS\\system" ]
+            gllib = "opengl32.dll"
+        elif sys.platform == "darwin":
+            # TODO
+            return None
+        else:
+            dirs = [ "/usr/lib", "/usr/local/lib" ]
+            gllib = "libopengl.so"
+        
+        for d in dirs:
+            path = os.path.join (d, gllib)
+            if os.path.exists (path):
+                return path
+        return None
+
+    def test_pygame2_sdl_gl_get_attribute(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.gl.get_attribute:
+
+        # get_attribute (attribute) -> int
+        # 
+        # Gets an OpenGL attribute value.
+        # 
+        # Gets the current value of the specified OpenGL attribute constant.
+        gllib = self._get_gllib ()
+        if not gllib:
+            return
+        
+        # No video.
+        self.assertRaises (pygame2.Error, gl.get_attribute, constants.GL_DEPTH_SIZE)
+        
+        video.init ()
+        # No GL library
+        self.assertRaises (pygame2.Error, gl.get_attribute, constants.GL_DEPTH_SIZE)
+
+        # No screen
+        self.assertEquals (gl.load_library (gllib), None)
+        self.assertRaises (pygame2.Error, gl.get_attribute, constants.GL_DEPTH_SIZE)
+        
+        # No OpenGL screen
+        screen = video.set_mode (10, 10)
+        self.assertEquals (gl.get_attribute (constants.GL_DEPTH_SIZE), 0)
+        
+        screen = video.set_mode (10, 10, bpp=32, flags=constants.OPENGL)
+        self.assertEquals (gl.get_attribute (constants.GL_DEPTH_SIZE), 24)
+        video.quit ()
+
+    def todo_test_pygame2_sdl_gl_get_proc_address(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.gl.get_proc_address:
+
+        # get_proc_address (procname) -> CObject
+        # 
+        # Gets the proc address of a function in the loaded OpenGL libraries.
+        # 
+        # The proc address is an encapsuled function pointer and as such only
+        # useful for ctypes bindings or other C API modules.
+
+        self.fail() 
+
+    def test_pygame2_sdl_gl_load_library(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.gl.load_library:
+
+        # load_library (libraryname) -> None
+        # 
+        # Loads the desired OpenGL library.
+        # 
+        # Loads the desired OpenGL library specified by the passed full qualified
+        # path. This must be called before any first call to
+        # pygame2.sdl.video.set_mode to have any effect.
+        self.assertRaises (pygame2.Error, gl.load_library, "invalid_opengl_lib")
+        gllib = self._get_gllib ()
+        if not gllib:
+            return
+        self.assertRaises (pygame2.Error, gl.load_library, gllib)
+
+        video.init ()
+        self.assertRaises (pygame2.Error, gl.load_library, "invalid_opengl_lib")
+        self.assertEquals (gl.load_library (gllib), None)
+        video.quit ()
+        
+    def test_pygame2_sdl_gl_set_attribute(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.gl.set_attribute:
+
+        # set_attribute (attribute, value) -> None
+        # 
+        # Sets an OpenGL attribute value.
+        # 
+        # Sets the value of the specified OpenGL attribute.
+        gllib = self._get_gllib ()
+        if not gllib:
+            return
+        
+        # No video.
+        self.assertRaises (pygame2.Error, gl.set_attribute, constants.GL_RED_SIZE, 1)
+        
+        video.init ()
+
+        self.assertEquals (gl.load_library (gllib), None)
+        
+        # No OpenGL screen
+        screen = video.set_mode (10, 10)
+        self.assertEquals (gl.set_attribute (constants.GL_RED_SIZE, 1), None)
+        self.assertEquals (gl.get_attribute (constants.GL_RED_SIZE), 0)
+        
+        # TODO
+
+    def todo_test_pygame2_sdl_gl_swap_buffers(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.gl.swap_buffers:
+
+        # swap_buffers () -> None
+        # 
+        # Swap the OpenGL buffers, if double-buffering is supported.
+        gllib = self._get_gllib ()
+        if not gllib:
+            return
+        self.assertEquals (gl.load_library (gllib), None)
+
+        self.fail() 
+
+if __name__ == "__main__":
+    unittest.main ()

test/sdl_video_overlay_test.py

+import sys
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import pgunittest as unittest
+
+import pygame2
+import pygame2.sdl.video as video
+import pygame2.sdl.constants as constants
+
+class SDLVideoOverlayTest (unittest.TestCase):
+
+    def todo_test_pygame2_sdl_video_Overlay_display(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.display:
+
+        # display ([rect]) -> None
+        # 
+        # Displays the current overlay data in the SDL overlay plane.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_format(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.format:
+
+        # Gets the format of the Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_h(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.h:
+
+        # Gets the height of the Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_height(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.height:
+
+        # Gets the height of the Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_hw_overlay(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.hw_overlay:
+
+        # Gets, whether the Overlay is hardware accelerated.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_lock(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.lock:
+
+        # lock () -> None
+        # 
+        # Locks the Overlay for a direct access to its internal pixel data.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_locked(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.locked:
+
+        # Gets, whether the Overlay is currently locked.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_pitches(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.pitches:
+
+        # Gets the pitches (length in bytes) for all planes of the
+        # Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_pixels(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.pixels:
+
+        # Gets the pixel buffers for all planes of the Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_planes(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.planes:
+
+        # Get the amount of planes for the Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_size(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.size:
+
+        # Gets the width and height of the Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_unlock(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.unlock:
+
+        # unlock () -> None
+        # 
+        # Unlocks the Overlay, releasing the direct access to the pixel data.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_w(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.w:
+
+        # Gets the width of the Overlay.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_Overlay_width(self):
+
+        # __doc__ (as of 2009-12-14) for pygame2.sdl.video.Overlay.width:
+
+        # Gets the width of the Overlay.
+
+        self.fail()
+
+if __name__ == "__main__":
+    unittest.main ()

test/sdl_video_pixelformat_test.py

+import sys
+try:
+    import pygame2.test.pgunittest as unittest
+except:
+    import pgunittest as unittest
+
+import pygame2
+from pygame2.colorpalettes import CGAPALETTE
+from pygame2 import Rect, Color
+import pygame2.sdl.video as video
+import pygame2.sdl.constants as constants
+
+class SDLVideoPixelFormatTest (unittest.TestCase):
+
+    def test_pygame2_sdl_video_PixelFormat_alpha(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.alpha:
+
+        # Gets or sets the overall surface alpha value in the
+        # range [0, 255].
+
+        def _seta (fmt, a):
+            fmt.alpha = a
+        
+        format = video.PixelFormat ()
+        self.assertEqual (format.alpha, 0)
+        
+        self.assertRaises (ValueError, _seta, format, -5)
+        self.assertRaises (ValueError, _seta, format, -1)
+        self.assertRaises (ValueError, _seta, format, 256)
+        format.alpha = 255
+        self.assertEqual (format.alpha, 255)
+        format.alpha = 127
+        self.assertEqual (format.alpha, 127)
+        format.alpha = 33
+        self.assertEqual (format.alpha, 33)
+        for i in range (0, 255):
+            format.alpha = i
+            self.assertEqual (format.alpha, i)
+
+    def test_pygame2_sdl_video_PixelFormat_bits_per_pixel(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.bits_per_pixel:
+
+        # Gets or sets the bits per pixel to use for
+        # storing a RGBA value.
+        
+        def _setbpp (fmt, bpp):
+            fmt.bits_per_pixel = bpp
+        
+        format = video.PixelFormat ()
+        self.assertEqual (format.bits_per_pixel, 0)
+        self.assertEqual (format.bytes_per_pixel, 0)
+        
+        self.assertRaises (ValueError, _setbpp, format, -5)
+        self.assertRaises (ValueError, _setbpp, format, -1)
+        self.assertRaises (ValueError, _setbpp, format, 256)
+        for i in range (0, 255):
+            format.bits_per_pixel = i
+            self.assertEqual (format.bytes_per_pixel, 0)
+            self.assertEqual (format.bits_per_pixel, i)
+
+    def test_pygame2_sdl_video_PixelFormat_bytes_per_pixel(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.bytes_per_pixel:
+
+        # Gets or sets the bytes per pixel to use for
+        # storing a RGBA value.
+
+        def _setbpp (fmt, bpp):
+            fmt.bytes_per_pixel = bpp
+        
+        format = video.PixelFormat ()
+        self.assertEqual (format.bytes_per_pixel, 0)
+        self.assertEqual (format.bits_per_pixel, 0)
+        
+        self.assertRaises (ValueError, _setbpp, format, -5)
+        self.assertRaises (ValueError, _setbpp, format, -1)
+        self.assertRaises (ValueError, _setbpp, format, 256)
+        for i in range (0, 255):
+            format.bytes_per_pixel = i
+            self.assertEqual (format.bytes_per_pixel, i)
+            self.assertEqual (format.bits_per_pixel, 0)
+
+    def todo_test_pygame2_sdl_video_PixelFormat_colorkey(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.colorkey:
+
+        # Gets or sets the RGBA value of transparent pixels.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_PixelFormat_get_rgba(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.get_rgba:
+
+        # get_rgba (color) -> pygame2.Color
+        # 
+        # Gets the best matching pygame2.Color for the passed color.
+        # 
+        # Gets a color value, which fits the PixelFormat best. This means
+        # that an internal conversion is done (on demand) to match the
+        # passed color to the PixelFormat's supported value ranges. If
+        # the PixelFormat does not have alpha transparency support, the
+        # color's alpha value will be set to fully opaque (255).
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_PixelFormat_losses(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.losses:
+
+        # Gets or sets the precision loss of each RGBA color
+        # component.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_PixelFormat_map_rgba(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.map_rgba:
+
+        # map_rgba (r, g, b[, a]) -> long
+        # map_rgba (color) -> long
+        # 
+        # Converts a color to the best value matching the format.
+        # 
+        # Gets a color value, which fits the PixelFormat best. This means
+        # that an internal conversion is done (on demand) to match the
+        # passed color to the PixelFormat's supported value ranges.
+        # Instead of returning a color as in get_rgba, an integer value
+        # matching the PixelFormat's supported value ranges will be
+        # returned.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_PixelFormat_masks(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.masks:
+
+        # Gets or sets the binary masks used to retrieve individual
+        # color values.
+
+        self.fail() 
+
+    def todo_test_pygame2_sdl_video_PixelFormat_palette(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.palette:
+
+        # Gets the color palette (if any) used by the PixelFormat. If the
+        # PixelFormat does not have any palette, None will be returned.
+
+        self.fail() 
+
+    def test_pygame2_sdl_video_PixelFormat_readonly(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.readonly:
+
+        # Gets, whether the PixelFormat is read-only (this cannot be
+        # changed).
+        video.init ()
+        
+        format = video.PixelFormat ()
+        self.assertEqual (format.readonly, False)
+
+        surface = video.Surface (1, 1)
+        fmt = surface.format
+        self.assertEqual (fmt.readonly, True)
+        
+        def _setr (format, readonly):
+            format.readonly = readonly
+        
+        self.assertRaises (AttributeError, _setr, format, True)
+        self.assertRaises (AttributeError, _setr, format, False)
+        
+        video.quit ()
+
+    def todo_test_pygame2_sdl_video_PixelFormat_shifts(self):
+
+        # __doc__ (as of 2009-12-08) for pygame2.sdl.video.PixelFormat.shifts:
+
+        # Gets the binary left shift of each color component in
+        # the pixel value.
+
+        self.fail() 
+
+if __name__ == "__main__":
+    unittest.main ()

test/util/gen_stubs.py

         "-t",  "--test_names", action = 'store_true',
         help   = "list test names not stubs" )
 
-    opt_parser.add_option (
-        "-d",  "--docs", action = 'store_true',
-        help   = "get (more detailed) docs using makeref.py" )
     opt_parser.set_usage("""$ %prog ROOT\n\neg.\n\n$ %prog sprite.Sprite""")
     return opt_parser