aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/touchmouse
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2012-11-08 17:43:46 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-21 11:58:16 +0100
commit7b2e2117162594a2d0234bb02408f5b5a446488b (patch)
tree39986fa636ea3b44b31f50af51582b7529994b27 /tests/auto/quick/touchmouse
parent3f86278a77cf4918a2698aae317a9766d9b63505 (diff)
Ungrab mouse upon leave event.
The event signals that the mouse has left the window. This happens also when a popup is shown (overlapping the original window). Before a mouse area would still think it was in pressed state when the popup (QWindow/QMenu) was shown and even after the popup was closed. Change-Id: I6d32571f5a473610f60e9476850989ff665edb93 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Diffstat (limited to 'tests/auto/quick/touchmouse')
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 4a681e270e..0590bd89eb 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -823,7 +823,10 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
window->setSource(testFileUrl("mouseonflickableonpinch.qml"));
window->show();
window->requestActivate();
+ QVERIFY(QTest::qWaitForWindowActive(window));
QVERIFY(window->rootObject() != 0);
+ QRect windowRect = QRect(window->position(), window->size());
+ QCursor::setPos(windowRect.center());
QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea");
QVERIFY(pinchArea);
@@ -841,14 +844,11 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
QTest::touchEvent(window, device).move(0, p, window);
p -= QPoint(10, 0);
QTest::touchEvent(window, device).move(0, p, window);
-
- QTest::qWait(1000);
-
+ QGuiApplication::processEvents();
p -= QPoint(10, 0);
QTest::touchEvent(window, device).move(0, p, window);
QTest::touchEvent(window, device).release(0, p, window);
-
- QTest::qWait(1000);
+ QGuiApplication::processEvents();
//QVERIFY(flickable->isMovingHorizontally());
qDebug() << "Pos: " << rect->pos();
@@ -890,13 +890,13 @@ void tst_TouchMouse::mouseOnFlickableOnPinch()
pinchSequence.move(0, p, window).commit();
p -= QPoint(10, 0);
pinchSequence.move(0, p, window).commit();
- QTest::qWait(1000);
+ QGuiApplication::processEvents();
p -= QPoint(10, 0);
pinchSequence.move(0, p, window).commit();
QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window);
- QCOMPARE(windowPriv->mouseGrabberItem, flickable);
qDebug() << "Mouse Grabber: " << windowPriv->mouseGrabberItem << " itemForTouchPointId: " << windowPriv->itemForTouchPointId;
+ QCOMPARE(windowPriv->mouseGrabberItem, flickable);
// Add a second finger, this should lead to stealing
p1 = QPoint(40, 100);