diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2016-06-26 12:52:35 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2016-07-22 12:14:45 +0000 |
commit | 92032bee2923024d126bc20929f79abd459cae49 (patch) | |
tree | f14cd8401dc4ce9bb2b3b52e702ee21e350d35d2 /tests/auto/popup | |
parent | c0695b3911f99132e7de5df9a9fa676f2df33721 (diff) |
Fix overlay event processing order for popups
It should follow the stacking order of popups.
Change-Id: Id5664496c60e99bdf0aa4b2dc6a2c94dba2c756a
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/popup')
-rw-r--r-- | tests/auto/popup/data/applicationwindow.qml | 11 | ||||
-rw-r--r-- | tests/auto/popup/tst_popup.cpp | 34 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/popup/data/applicationwindow.qml b/tests/auto/popup/data/applicationwindow.qml index 36430609..2e868192 100644 --- a/tests/auto/popup/data/applicationwindow.qml +++ b/tests/auto/popup/data/applicationwindow.qml @@ -46,6 +46,7 @@ ApplicationWindow { height: 400 property alias popup: popup + property alias popup2: popup2 property alias button: button Button { @@ -69,4 +70,14 @@ ApplicationWindow { } } } + + Popup { + id: popup2 + y: popup.y + z: 1 + contentItem: Text { + text: "Popup2" + font.pixelSize: 36 + } + } } diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/popup/tst_popup.cpp index 39956301..7a8a6557 100644 --- a/tests/auto/popup/tst_popup.cpp +++ b/tests/auto/popup/tst_popup.cpp @@ -53,6 +53,7 @@ class tst_popup : public QQmlDataTest private slots: void visible(); void overlay(); + void zOrder(); void windowChange(); void closePolicy_data(); void closePolicy(); @@ -154,6 +155,39 @@ void tst_popup::overlay() QVERIFY(!overlay->isVisible()); } +void tst_popup::zOrder() +{ + QQuickApplicationHelper helper(this, QStringLiteral("applicationwindow.qml")); + + QQuickApplicationWindow *window = helper.window; + window->show(); + window->requestActivate(); + QVERIFY(QTest::qWaitForWindowActive(window)); + + QQuickPopup *popup = helper.window->property("popup").value<QQuickPopup*>(); + QVERIFY(popup); + popup->setModal(true); + + QQuickPopup *popup2 = helper.window->property("popup2").value<QQuickPopup*>(); + QVERIFY(popup2); + popup2->setModal(true); + + // show popups in reverse order. popup2 has higher z-order so it appears + // on top and must be closed first, even if the other popup was opened last + popup2->open(); + popup->open(); + QVERIFY(popup2->isVisible()); + QVERIFY(popup->isVisible()); + + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); + QVERIFY(!popup2->isVisible()); + QVERIFY(popup->isVisible()); + + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); + QVERIFY(!popup2->isVisible()); + QVERIFY(!popup->isVisible()); +} + void tst_popup::windowChange() { QQuickPopup popup; |