aboutsummaryrefslogtreecommitdiffstats
path: root/tests/QtCore/qobject_parent_test.py
diff options
context:
space:
mode:
authorLauro Neto <lauro.neto@openbossa.org>2010-10-06 19:18:19 -0300
committerLauro Neto <lauro.neto@openbossa.org>2010-10-07 15:10:11 -0300
commit04180e1f1d9e5dc2b8e8e856f6fde0587074284a (patch)
tree7fe9c7b0d3ec6d7c4e277ae892bee71b0ad1d187 /tests/QtCore/qobject_parent_test.py
parent3c7f55855b45168818ef6fc5e58b30f1c7e4d133 (diff)
Add default name for QObject.findChild(type, name)
Plus test. Should return a child of the given type.
Diffstat (limited to 'tests/QtCore/qobject_parent_test.py')
-rw-r--r--tests/QtCore/qobject_parent_test.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/QtCore/qobject_parent_test.py b/tests/QtCore/qobject_parent_test.py
index 4699fc60c..eb8cae2d8 100644
--- a/tests/QtCore/qobject_parent_test.py
+++ b/tests/QtCore/qobject_parent_test.py
@@ -71,6 +71,17 @@ class ParentCase(unittest.TestCase):
for i, child in enumerate(children):
self.assertEqual(child, parent.findChild(QObject, name % i))
+ def testFindChildWithoutName(self):
+ parent = QObject()
+ name = 'object%d'
+ children = [QObject(parent) for i in range(20)]
+
+ for i, child in enumerate(children):
+ child.setObjectName(name % i)
+
+ child = parent.findChild(QObject)
+ self.assert_(isinstance(child, QObject))
+
def testFindChildren(self):
#QObject.findChildren() with all QObject
parent = QObject()