Commits

Lenard Lindstrom committed 94c5357

fix bugs related to run_test.py

Comments (0)

Files changed (4)

        		
         /*check if it is a valid file, else SDL_ttf segfaults*/
         test = fopen(filename, "rb");
-        if(test == NULL) {
+        if (test == NULL) {
             PyObject *tmp = NULL;
 
             if (strcmp(filename, font_defaultname) == 0) {
-                /* filename is the default font; get it's file-like resource
+                /* filename is the default font; get it's resource
                  */
                 tmp = font_resource(font_defaultname);
             }
             }
             Py_DECREF(obj);
             obj = tmp;
+            if (Bytes_Check(obj)) {
+                filename = Bytes_AS_STRING(obj);
+                test = fopen(filename, "rb");
+                if (test == NULL) {
+                    PyErr_Format(PyExc_IOError,
+                                 "unable to read font file '%.1024s'",
+                                 filename);
+                    goto error;
+                }
+            }
         }
-        else {
+        if (Bytes_Check(obj)) {
             fclose(test);
             Py_BEGIN_ALLOW_THREADS;
             font = TTF_OpenFont(filename, fontsize);
             Py_END_ALLOW_THREADS;
-        }	
+        }
     }
     if (font == NULL)  {
 #if FONT_HAVE_RWOPS

test/font_tags.py

-#__tags__ = []
-__tags__ = ['ignore', 'subprocess_ignore']
+__tags__ = []
 
 import sys
 # Font support not fully implemented for Python 3.x.

test/font_test.py

     def test_load_default_font_filename(self):
         # In font_init, a special case is when the filename argument is
         # identical to the default font file name.
-## The Spectacularly Adequate Build Page fails here (r2924) for Windows.
-## Let it pass, so the binary can be tested directly.
-##        f = pygame.font.Font(pygame.font.get_default_font(), 20)
+        f = pygame.font.Font(pygame.font.get_default_font(), 20)
 
     def test_load_from_file_unicode(self):
         base_dir = os.path.split(pygame.__file__)[0]

test/mixer_music_test.py

         formats = ['ogg', 'wav']
 
         for f in formats:
-            umusfn = as_unicode(os.path.join(data_fname, 'house_lo.%s' % f))
+            path = os.path.join(data_fname, 'house_lo.%s' % f)
+            if os.sep == '\\':
+                path = path.replace('\\', '\\\\')
+            umusfn = as_unicode(path)
             bmusfn = filesystem_encode(umusfn) 
     
             pygame.mixer.music.load(umusfn)