aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRenato Filho <renato.filho@openbossa.org>2010-04-20 19:56:45 -0300
committerRenato Filho <renato.filho@openbossa.org>2010-04-22 18:20:04 -0300
commitb24af354ea6f05253150179467aa77e7c999611e (patch)
treede838af180926b7bdfd9e912d515842410b06491 /tests
parentf0f1aa01139a073430eb2c5feb767dedc45d3b4f (diff)
Fixed argument policy propagate.
Reviewer: Hugo Parente Lima <hugo.lima@openbossa.org>, Luciano Wolf <luciano.wolf@openbossa.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/libsample/objecttype.h2
-rw-r--r--tests/libsample/objecttypelayout.h2
-rwxr-xr-xtests/samplebinding/objecttypelayout_test.py12
3 files changed, 14 insertions, 2 deletions
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<ObjectType*> 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()