aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickwindow/tst_qquickwindow.cpp')
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 1d6547c5be..daa5e53730 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -375,6 +375,8 @@ private slots:
void testDragEventPropertyPropagation();
+ void findChild();
+
private:
QTouchDevice *touchDevice;
QTouchDevice *touchDeviceWithVelocity;
@@ -2831,6 +2833,28 @@ void tst_qquickwindow::testDragEventPropertyPropagation()
}
}
+void tst_qquickwindow::findChild()
+{
+ QQuickWindow window;
+
+ // QQuickWindow
+ // |_ QQuickWindow::contentItem
+ // | |_ QObject("contentItemChild")
+ // |_ QObject("viewChild")
+
+ QObject *windowChild = new QObject(&window);
+ windowChild->setObjectName("windowChild");
+
+ QObject *contentItemChild = new QObject(window.contentItem());
+ contentItemChild->setObjectName("contentItemChild");
+
+ QCOMPARE(window.findChild<QObject *>("windowChild"), windowChild);
+ QCOMPARE(window.findChild<QObject *>("contentItemChild"), contentItemChild);
+
+ QVERIFY(!window.contentItem()->findChild<QObject *>("viewChild")); // sibling
+ QCOMPARE(window.contentItem()->findChild<QObject *>("contentItemChild"), contentItemChild);
+}
+
QTEST_MAIN(tst_qquickwindow)
#include "tst_qquickwindow.moc"