Exemplo n.º 1
0
 def test_valueWithRect(self):
     rect = opy.NSRect(opy.NSPoint(3, 5), opy.NSSize(320, 480))
     value_rect = NSValue.valueWithRect_(rect)
     ret_rect = value_rect.rectValue()
     self.assertEqual(ret_rect.origin.x, 3)
     self.assertEqual(ret_rect.origin.y, 5)
     self.assertEqual(ret_rect.size.width, 320)
     self.assertEqual(ret_rect.size.height, 480)
Exemplo n.º 2
0
 def test_valueWithRectPointer(self):
     rect = opy.NSRect(opy.NSPoint(3, 5), opy.NSSize(320, 480))
     rct_ptr = NSValue.valueWithPointer_(rect)
     rect_val_ptr = rct_ptr.pointerValue()
     rect_deref = dereference(rect_val_ptr, of_type=opy.NSRect)
     self.assertEqual(rect_deref.origin.x, 3)
     self.assertEqual(rect_deref.origin.y, 5)
     self.assertEqual(rect_deref.size.width, 320)
     self.assertEqual(rect_deref.size.height, 480)
Exemplo n.º 3
0
    def test_objCType(self):
        rect = opy.NSRect(opy.NSPoint(3, 5), opy.NSSize(320, 480))
        value_rect = NSValue.valueWithRect_(rect)
        self.assertEqual(value_rect.objCType(),
                         b"{CGRect={CGPoint=dd}{CGSize=dd}}")

        range = opy.NSRange(5, 10)
        value_range = NSValue.valueWithRange_(range)
        self.assertEqual(value_range.objCType(), b"{_NSRange=QQ}")
Exemplo n.º 4
0
 def test_passing_values(self):
     car = Car.alloc().init()
     union_arg = opy.test_un_()
     rect = opy.NSRect(opy.NSPoint(20, 40), opy.NSSize(200, 400))
     union_arg.rect = rect
     self.assertTrue(car.useUnionPtrTest_(union_arg))