[PyObjC-svn] r2228 - in trunk/pyobjc/pyobjc-core: . Lib/objc/test
[email protected] Thu, 21 May 2009 04:30:40 -0500
| Newsgroups | gmane.comp.python.pyobjc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: ronaldoussoren
Date: Thu May 21 04:30:40 2009
New Revision: 2228
Log:
- Install as not-zipsafe for now (will change that later)
- Move a couple of tests from the Cocoa bindings to pyobjc-core
Modified:
trunk/pyobjc/pyobjc-core/Lib/objc/test/test_regr.py
trunk/pyobjc/pyobjc-core/setup.py
Modified: trunk/pyobjc/pyobjc-core/Lib/objc/test/test_regr.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/Lib/objc/test/test_regr.py (original)
+++ trunk/pyobjc/pyobjc-core/Lib/objc/test/test_regr.py Thu May 21 04:30:40 2009
@@ -5,6 +5,13 @@
import objc, sys
from objc.test.fnd import NSObject
+rct = structargs.StructArgClass.someRect.__metadata__()['retval']['type']
+
+class ReturnAStruct (NSObject):
+ def someRectWithRect_(self, ((x, y), (h, w))):
+ return ((x,y),(h,w))
+ someRectWithRect_ = objc.selector(someRectWithRect_, signature=rct + '@:' + rct)
+
class TestRegressions(TestCase):
def testNSObjectRespondsToCommonMethods(self):
@@ -84,9 +91,8 @@
# Like AppKit.test.test_nsimage.TestNSImage.test_compositePoint
# unlike that this one doesn't crash on darwin/x86, makeing it less
# likely that libffi is at fault
- from objc.test.structargs import StructArgClass
- o = StructArgClass.alloc().init()
+ o = structargs.StructArgClass.alloc().init()
v = o.compP_aRect_anOp_((1,2), ((3,4),(5,6)), 7)
self.assertEquals(v, u"aP:{1, 2} aR:{{3, 4}, {5, 6}} anO:7")
@@ -115,6 +121,20 @@
sel = testbndl.PyObjC_TestClass4._privateMethodWithArg_
self.assertEquals(sel.signature, 'i@:f')
+ def testStructReturnPy(self):
+ o = ReturnAStruct.alloc().init()
+ p = structargs.StructArgClass.alloc().init()
+
+ v = p.someRectWithObject_X_Y_H_W_(o, 1, 2, 3, 4)
+ #self.assert_(isinstance(v, Foundation.NSRect))
+ self.assertEquals(v, ((1,2),(3,4)))
+
+ def testStructReturn(self):
+ o = structargs.StructArgClass.alloc().init()
+ v = o.someRect()
+ self.assertEquals(v, ((1,2),(3,4)))
+
+
if sys.byteorder == 'little':
# i386 has specific stack alignment requirements.
Modified: trunk/pyobjc/pyobjc-core/setup.py
==============================================================================
--- trunk/pyobjc/pyobjc-core/setup.py (original)
+++ trunk/pyobjc/pyobjc-core/setup.py Thu May 21 04:30:40 2009
@@ -298,5 +298,5 @@
license = 'MIT License',
download_url = 'http://pyobjc.sourceforge.net/software/index.php',
#test_suite='objc.test',
- zip_safe = True,
+ zip_safe = False,
)
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp asthey present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://www.creativitycat.com