aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/popup/tst_popup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/popup/tst_popup.cpp')
-rw-r--r--tests/auto/popup/tst_popup.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/popup/tst_popup.cpp
index 25904003..ab96869a 100644
--- a/tests/auto/popup/tst_popup.cpp
+++ b/tests/auto/popup/tst_popup.cpp
@@ -72,6 +72,7 @@ private slots:
void parentDestroyed();
void nested();
void grabber();
+ void cursorShape();
};
void tst_popup::visible_data()
@@ -721,6 +722,38 @@ void tst_popup::grabber()
QCOMPARE(combo->isVisible(), false);
}
+void tst_popup::cursorShape()
+{
+ // Ensure that the mouse cursor has the correct shape when over a popup
+ // which is itself over an item with a different shape.
+ QQuickApplicationHelper helper(this, QStringLiteral("cursor.qml"));
+ QQuickApplicationWindow *window = helper.appWindow;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickPopup *popup = helper.appWindow->property("popup").value<QQuickPopup*>();
+ QVERIFY(popup);
+
+ popup->open();
+ QVERIFY(popup->isVisible());
+
+ QQuickItem *textField = helper.appWindow->property("textField").value<QQuickItem*>();
+ QVERIFY(textField);
+
+ // Move the mouse over the text field.
+ const QPoint textFieldPos(popup->x() - 10, popup->y() + popup->height() / 2);
+ QTest::mouseMove(window, textFieldPos);
+ QCOMPARE(window->cursor().shape(), textField->cursor().shape());
+
+ // Move the mouse over the popup where it overlaps with the text field.
+ const QPoint textFieldOverlapPos(popup->x() + 10, popup->y() + popup->height() / 2);
+ QTest::mouseMove(window, textFieldOverlapPos);
+ QCOMPARE(window->cursor().shape(), popup->popupItem()->cursor().shape());
+
+ popup->close();
+ QTRY_VERIFY(!popup->isVisible());
+}
+
QTEST_MAIN(tst_popup)
#include "tst_popup.moc"