Exemple #1
0
    def testDir(self):
        obj = ClassWithVariables.alloc().init()

        # Note: cannot check the exact contents of dir(), who knows
        # what NSObject defines...
        v = objc.listInstanceVariables(obj)
        self.assertIn(('charValue', objc._C_CHR), v)
        self.assertIn(('intValue', objc._C_INT), v)
        self.assertIn(('isa', objc._C_CLASS), v)
Exemple #2
0
    def testDir(self):
        obj = ClassWithVariables.alloc().init()

        # Note: cannot check the exact contents of dir(), who knows
        # what NSObject defines...
        v = objc.listInstanceVariables(obj)
        self.assertIn(("charValue", objc._C_CHR), v)
        self.assertIn(("intValue", objc._C_INT), v)
        self.assertIn(("isa", objc._C_CLASS), v)
Exemple #3
0
    def testNamedOutlet(self):
        class NamedOutlet (NSObject):
            outlet1 = objc.IBOutlet()
            outlet2 = objc.IBOutlet("my_outlet")

        all_outlets = {}

        for name, tp in objc.listInstanceVariables(NamedOutlet):
            all_outlets[name] = tp

        self.assertEqual(all_outlets['outlet1'], objc._C_ID)
        self.assertEqual(all_outlets['my_outlet'], objc._C_ID)

        o = NamedOutlet.alloc().init()
        self.assertTrue(hasattr(o, 'outlet1'))
        self.assertTrue(hasattr(o, 'outlet2'))
Exemple #4
0
    def testNamedOutlet(self):
        class NamedOutlet(NSObject):
            outlet1 = objc.IBOutlet()
            outlet2 = objc.IBOutlet("my_outlet")

        all_outlets = {}

        for name, tp in objc.listInstanceVariables(NamedOutlet):
            all_outlets[name] = tp

        self.assertEqual(all_outlets["outlet1"], objc._C_ID)
        self.assertEqual(all_outlets["my_outlet"], objc._C_ID)

        o = NamedOutlet.alloc().init()
        self.assertTrue(hasattr(o, "outlet1"))
        self.assertTrue(hasattr(o, "outlet2"))