From b24af354ea6f05253150179467aa77e7c999611e Mon Sep 17 00:00:00 2001 From: Renato Filho Date: Tue, 20 Apr 2010 19:56:45 -0300 Subject: Fixed argument policy propagate. Reviewer: Hugo Parente Lima , Luciano Wolf --- tests/libsample/objecttype.h | 2 +- tests/libsample/objecttypelayout.h | 2 ++ tests/samplebinding/objecttypelayout_test.py | 12 +++++++++++- 3 files changed, 14 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/libsample/objecttype.h b/tests/libsample/objecttype.h index b606dd818..0515ecc98 100644 --- a/tests/libsample/objecttype.h +++ b/tests/libsample/objecttype.h @@ -75,7 +75,7 @@ public: void killChild(const Str& name); void removeChild(ObjectType* child); ObjectType* takeChild(ObjectType* child); - ObjectType* takeChild(const Str& name); + virtual ObjectType* takeChild(const Str& name); ObjectType* findChild(const Str& name); Str objectName() const; diff --git a/tests/libsample/objecttypelayout.h b/tests/libsample/objecttypelayout.h index 5662ac339..1f05b7495 100644 --- a/tests/libsample/objecttypelayout.h +++ b/tests/libsample/objecttypelayout.h @@ -49,6 +49,8 @@ public: virtual bool isLayoutType() { return true; } static ObjectTypeLayout* create() { return new ObjectTypeLayout(); } + + virtual ObjectType* takeChild(const Str& name) { return ObjectType::takeChild(name); } private: std::list m_objects; diff --git a/tests/samplebinding/objecttypelayout_test.py b/tests/samplebinding/objecttypelayout_test.py index 444ee8b5d..1e14e5a4a 100755 --- a/tests/samplebinding/objecttypelayout_test.py +++ b/tests/samplebinding/objecttypelayout_test.py @@ -35,6 +35,17 @@ from sample import * class ObjectTypeLayoutTest(unittest.TestCase): '''Test cases for ObjectTypeLayout class.''' + def testOwnershipOverride(self): + l = ObjectTypeLayout() + + o1 = ObjectType(l) + o1.setObjectName('o1') + + self.assertEqual(sys.getrefcount(o1), 3) + l.takeChild('o1') + self.assertEqual(sys.getrefcount(o1), 2) + + def testSetNullLayout(self): '''ObjectType.setLayout(0).''' o2 = ObjectType() @@ -281,7 +292,6 @@ class ObjectTypeLayoutTest(unittest.TestCase): self.assertRaises(RuntimeError, l1.objectName) self.assertRaises(RuntimeError, l2.objectName) - if __name__ == '__main__': unittest.main() -- cgit v1.2.3