Commits

Ronald Oussoren committed fd5785f

Ensure test pass on OSX 10.8

The change to _callbacks.m fixes a real bug in the Quartz bindings

Comments (0)

Files changed (4)

pyobjc-framework-Quartz/Modules/_callbacks.m

 
 	PyObject* result = PyObject_CallFunction(
 			PyTuple_GET_ITEM(info, 0), 
-#if PY_VERSION_MAJOR == 2
+#if PY_MAJOR_VERSION == 2
 			"Os#l",
 #else
 			"Oy#l",
 #endif
-			PyTuple_GET_ITEM(info, 2), buffer, count, count);
+			PyTuple_GET_ITEM(info, 2), buffer, (Py_ssize_t)count, (Py_ssize_t)count);
 	if (result == NULL) {
+		printf("%s\n", PyObject_REPR(PyTuple_GET_ITEM(info, 2)));
+		printf("%p\n", buffer);
 		PyObjCErr_ToObjCWithGILState(&state);
 	}
 
 
 	PyGILState_STATE   state = PyGILState_Ensure();
 
-#if PY_VERSION_MAJOR == 2
+#if PY_MAJOR_VERSION == 2
 	tag = PyInt_AsLong(PyTuple_GET_ITEM(info, 2));
 #else
 	tag = PyLong_AsLong(PyTuple_GET_ITEM(info, 2));
 
 	PyGILState_STATE   state = PyGILState_Ensure();
 
-#if PY_VERSION_MAJOR == 2
+#if PY_MAJOR_VERSION == 2
 	domdim = PyInt_AsLong(PyTuple_GET_ITEM(info, 2));
 	rangedim = PyInt_AsLong(PyTuple_GET_ITEM(info, 3));
 #else

pyobjc-framework-Quartz/PyObjCTest/test_cgcolorspace.py

                 provider, CGColorSpaceCreateDeviceRGB())
         self.assertIsInstance(spc, CGColorSpaceRef)
         
-        dta= CGColorSpaceCopyICCProfile(spc)
+        dta= CGColorSpaceCopyICCProfile(csp)
         self.assertIsInstance(dta, CFDataRef)
 
         spc = CGColorSpaceCreateIndexed(CGColorSpaceCreateDeviceRGB(), 10,

pyobjc-framework-Quartz/PyObjCTest/test_cgimage.py

 from PyObjCTools.TestSupport import *
 from Quartz.CoreGraphics import *
 import sys
+import os
 
 import sys
 
         v = CGImageCreateWithJPEGDataProvider(provider, None, True, kCGRenderingIntentDefault)
         self.assertIsInstance(v, CGImageRef)
 
-        with open('/System/Library//CoreServices/Installer.app/Contents/PlugIns/Summary.bundle/Contents/Resources/Success.png', 'rb') as fp:
+        fname = '/System/Library//CoreServices/Installer.app/Contents/PlugIns/Summary.bundle/Contents/Resources/Success.png'
+        if not os.path.exists(fname):
+            fname = '/System/Library//Frameworks/Automator.framework/Versions/A/Resources/GearActionDisabled.png'
+        if not os.path.exists(fname):
+            self.fail("test image doesn't exist")
+        with open(fname, 'rb') as fp:
             data = fp.read()
         provider = CGDataProviderCreateWithCFData(buffer(data))
         self.assertResultIsCFRetained(CGImageCreateWithPNGDataProvider)

pyobjc-framework-Quartz/PyObjCTest/test_cgimagedestination.py

         image_path = "/System/Library//ColorSync/Calibrators/Display Calibrator.app/Contents/Resources/bullet.tif"
         if not os.path.exists(image_path):
             image_path = "/System/Library//ColorSync/Calibrators/Display Calibrator.app/Contents/Resources/brightness.png"
+        if not os.path.exists(image_path):
+            image_path = "/System/Library//ColorSync/Calibrators/Display Calibrator.app/Contents/Resources/brightness.tiff"
         url = CFURLCreateWithFileSystemPath(None,
             image_path,
             kCFURLPOSIXPathStyle, False)
         self.assertResultHasType(CGImageDestinationFinalize, objc._C_BOOL)
         v = CGImageDestinationFinalize(dest)
         self.assertIsInstance(v, bool)
-        self.assertTrue(v is True)
+        self.assertIs(v, True)
 
         dta = NSMutableData.alloc().init()
         cons = CGDataConsumerCreateWithCFData(dta)