diff options
Diffstat (limited to 'tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp')
-rw-r--r-- | tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 80124230..ebdc763a 100644 --- a/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp +++ b/tests/auto/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -76,6 +76,7 @@ private slots: void focusAfterPopupClosed(); void clearFocusOnDestruction(); void layout(); + void layoutLayout(); void componentComplete(); }; @@ -862,6 +863,42 @@ void tst_QQuickApplicationWindow::layout() QCOMPARE(content->height(), qreal(window->height())); } +void tst_QQuickApplicationWindow::layoutLayout() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("layoutLayout.qml")); + QScopedPointer<QObject> object(component.create()); + QVERIFY2(!object.isNull(), qPrintable(component.errorString())); + + QQuickApplicationWindow* window = qobject_cast<QQuickApplicationWindow*>(object.data()); + QVERIFY(window); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QQuickItem *content = window->contentItem(); + QVERIFY(content); + QQuickItem *header = window->header(); + QVERIFY(header); + QQuickItem *footer = window->footer(); + QVERIFY(footer); + + QQuickItem *headerChild = header->findChild<QQuickItem*>(); + QVERIFY(headerChild); + QCOMPARE(header->x(), 0.0); + QCOMPARE(header->y(), -header->height()); + QCOMPARE(header->width(), qreal(window->width())); + QCOMPARE(headerChild->width(), qreal(window->width())); + QVERIFY(header->height() > 0); + + QQuickItem *footerChild = header->findChild<QQuickItem*>(); + QVERIFY(footerChild); + QCOMPARE(footer->x(), 0.0); + QCOMPARE(footer->y(), content->height()); + QCOMPARE(footer->width(), qreal(window->width())); + QCOMPARE(footerChild->width(), qreal(window->width())); + QVERIFY(footer->height() > 0.0); +} + class FriendlyApplicationWindow : public QQuickApplicationWindow { friend class tst_QQuickApplicationWindow; |