summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/kernel
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <dangelog@gmail.com>2012-03-13 05:30:17 +0000
committerQt by Nokia <qt-info@nokia.com>2012-03-21 11:43:38 +0100
commitcb32450c47e6bd6169c9f514a2e950729f82756f (patch)
tree6b6b411335bba2d6e00196d7899f22d26cbec711 /tests/auto/corelib/kernel
parent865949520252d7c0e5a78f4bb2c195f090f1f601 (diff)
QRegularExpression: add QObject::findChildren overload
This actually involved tiding up QObject sources a little bit to clearly separate QString / QRegExp overloads of findChildren. The corresponding qFindChildren overload for MSVC 6 compatibiltiy was *not* added. Change-Id: I84826b3df9275a9bda03608a5b66756890eda6f8 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r--tests/auto/corelib/kernel/qobject/tst_qobject.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
index c6667ff2a8..c2ded70d80 100644
--- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
+++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp
@@ -45,6 +45,7 @@
#include <qpointer.h>
#include <qtimer.h>
#include <qregexp.h>
+#include <qregularexpression.h>
#include <qmetaobject.h>
#include <qvariant.h>
#include <QTcpServer>
@@ -656,6 +657,26 @@ void tst_QObject::findChildren()
l = qFindChildren<QObject*>(&o, QRegExp("harry"));
QCOMPARE(l.size(), 0);
+ l = o.findChildren<QObject*>(QRegularExpression("o.*"));
+ QCOMPARE(l.size(), 5);
+ QVERIFY(l.contains(&o1));
+ QVERIFY(l.contains(&o2));
+ QVERIFY(l.contains(&o11));
+ QVERIFY(l.contains(&o12));
+ QVERIFY(l.contains(&o111));
+ l = o.findChildren<QObject*>(QRegularExpression("t.*"));
+ QCOMPARE(l.size(), 2);
+ QVERIFY(l.contains(&t1));
+ QVERIFY(l.contains(&t121));
+ tl = o.findChildren<QTimer*>(QRegularExpression(".*"));
+ QCOMPARE(tl.size(), 3);
+ QVERIFY(tl.contains(&t1));
+ QVERIFY(tl.contains(&t121));
+ tl = o.findChildren<QTimer*>(QRegularExpression("o.*"));
+ QCOMPARE(tl.size(), 0);
+ l = o.findChildren<QObject*>(QRegularExpression("harry"));
+ QCOMPARE(l.size(), 0);
+
// empty and null string check
op = qFindChild<QObject*>(&o);
QCOMPARE(op, &o1);