From 333c226f7cfc53a7e55a8e4d5502788d39847342 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 21 Jul 2016 17:02:14 +0200 Subject: Don't leak hover events through modal overlays Task-number: QTBUG-53419 Change-Id: I5c1ce684cff7954f9c011e991e3924741ad44367 Reviewed-by: Mitch Curtis --- tests/auto/popup/tst_popup.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'tests/auto/popup/tst_popup.cpp') diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/popup/tst_popup.cpp index 6f4a2e2e..39956301 100644 --- a/tests/auto/popup/tst_popup.cpp +++ b/tests/auto/popup/tst_popup.cpp @@ -58,6 +58,7 @@ private slots: void closePolicy(); void activeFocusOnClose1(); void activeFocusOnClose2(); + void hover_data(); void hover(); }; @@ -331,8 +332,18 @@ void tst_popup::activeFocusOnClose2() QVERIFY(popup1->hasActiveFocus()); } +void tst_popup::hover_data() +{ + QTest::addColumn("modal"); + + QTest::newRow("modal") << true; + QTest::newRow("modeless") << false; +} + void tst_popup::hover() { + QFETCH(bool, modal); + QQuickApplicationHelper helper(this, QStringLiteral("hover.qml")); QQuickApplicationWindow *window = helper.window; window->show(); @@ -341,6 +352,7 @@ void tst_popup::hover() QQuickPopup *popup = helper.window->property("popup").value(); QVERIFY(popup); + popup->setModal(modal); QQuickButton *parentButton = helper.window->property("parentButton").value(); QVERIFY(parentButton); @@ -357,7 +369,7 @@ void tst_popup::hover() // hover the parent button outside the popup QTest::mouseMove(window, QPoint(window->width() - 1, window->height() - 1)); - QVERIFY(parentButton->isHovered()); + QCOMPARE(parentButton->isHovered(), !modal); QVERIFY(!childButton->isHovered()); // hover the popup background -- cgit v1.2.3