aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/touchmouse
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-03-02 09:05:12 +0100
committerLiang Qi <liang.qi@qt.io>2017-03-02 09:05:12 +0100
commit78dd18a0cd18449e1289e428ea6eca65e28fb114 (patch)
treebbb442c218d1504adb70d49ae67ac78a9c2c42bd /tests/auto/quick/touchmouse
parent015dff255ff0f40c553b1dee43c6cff013df64eb (diff)
parent8c864e52369ee4d55a1d9345215c8153144b5939 (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Diffstat (limited to 'tests/auto/quick/touchmouse')
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 4f4fac8fa5..032e682137 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -172,6 +172,7 @@ private slots:
void touchPointDeliveryOrder();
void hoverEnabled();
+ void implicitUngrab();
protected:
bool eventFilter(QObject *, QEvent *event)
@@ -1414,6 +1415,37 @@ void tst_TouchMouse::hoverEnabled()
QVERIFY(!mouseArea2->hovered());
}
+void tst_TouchMouse::implicitUngrab()
+{
+ QScopedPointer<QQuickView> window(createView());
+ window->setSource(testFileUrl("singleitem.qml"));
+ window->show();
+ QQuickViewTestUtil::centerOnScreen(window.data());
+ QQuickViewTestUtil::moveMouseAway(window.data());
+ QVERIFY(QTest::qWaitForWindowActive(window.data()));
+
+ QQuickItem *root = window->rootObject();
+ QVERIFY(root != 0);
+ EventItem *eventItem = root->findChild<EventItem*>("eventItem1");
+ eventItem->acceptMouse = true;
+ QPoint p1(20, 20);
+ QTest::touchEvent(window.data(), device).press(0, p1);
+
+ QCOMPARE(window->mouseGrabberItem(), eventItem);
+ eventItem->eventList.clear();
+ eventItem->setEnabled(false);
+ QVERIFY(!eventItem->eventList.isEmpty());
+ QCOMPARE(eventItem->eventList.at(0).type, QEvent::UngrabMouse);
+ QTest::touchEvent(window.data(), device).release(0, p1); // clean up potential state
+
+ eventItem->setEnabled(true);
+ QTest::touchEvent(window.data(), device).press(0, p1);
+ eventItem->eventList.clear();
+ eventItem->setVisible(false);
+ QVERIFY(!eventItem->eventList.isEmpty());
+ QCOMPARE(eventItem->eventList.at(0).type, QEvent::UngrabMouse);
+ QTest::touchEvent(window.data(), device).release(0, p1); // clean up potential state
+}
QTEST_MAIN(tst_TouchMouse)
#include "tst_touchmouse.moc"