diff options
Diffstat (limited to 'tests/auto/quick/touchmouse/tst_touchmouse.cpp')
-rw-r--r-- | tests/auto/quick/touchmouse/tst_touchmouse.cpp | 124 |
1 files changed, 109 insertions, 15 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 5b4ad0ffa3..f39a22e131 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -58,6 +58,7 @@ #include <QtQml/qqmlproperty.h> #include "../../shared/util.h" +#include "../shared/viewtestutil.h" struct Event { @@ -221,12 +222,15 @@ void tst_TouchMouse::simpleTouchEvent() QPoint p1; p1 = QPoint(20, 20); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 1); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); p1 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 1); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 1); eventItem1->eventList.clear(); @@ -234,11 +238,14 @@ void tst_TouchMouse::simpleTouchEvent() eventItem1->acceptTouch = true; p1 = QPoint(20, 20); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 1); p1 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 3); eventItem1->eventList.clear(); @@ -251,6 +258,7 @@ void tst_TouchMouse::simpleTouchEvent() eventItem1->setAcceptedMouseButtons(Qt::LeftButton); p1 = QPoint(20, 20); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress); @@ -268,10 +276,12 @@ void tst_TouchMouse::simpleTouchEvent() p1 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 4); QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchUpdate); QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseMove); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 6); QCOMPARE(eventItem1->eventList.at(4).type, QEvent::TouchEnd); QCOMPARE(eventItem1->eventList.at(5).type, QEvent::MouseButtonRelease); @@ -286,13 +296,16 @@ void tst_TouchMouse::simpleTouchEvent() eventItem1->setAcceptedMouseButtons(Qt::LeftButton); p1 = QPoint(20, 20); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress); p1 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); eventItem1->eventList.clear(); @@ -304,13 +317,16 @@ void tst_TouchMouse::simpleTouchEvent() eventItem1->setAcceptedMouseButtons(Qt::LeftButton); p1 = QPoint(20, 20); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 1); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); p1 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::TouchUpdate); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 3); QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd); eventItem1->eventList.clear(); @@ -376,6 +392,7 @@ void tst_TouchMouse::mouse() // item 2 doesn't accept anything, thus it sees a touch pass by QPoint p1 = QPoint(30, 30); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); @@ -412,14 +429,17 @@ void tst_TouchMouse::touchOverMouse() QCOMPARE(eventItem1->eventList.size(), 0); QPoint p1 = QPoint(20, 20); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 0); QCOMPARE(eventItem2->eventList.size(), 1); QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin); p1 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem2->eventList.size(), 2); QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchUpdate); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem2->eventList.size(), 3); QCOMPARE(eventItem2->eventList.at(2).type, QEvent::TouchEnd); eventItem2->eventList.clear(); @@ -456,6 +476,7 @@ void tst_TouchMouse::mouseOverTouch() QPoint p1 = QPoint(20, 20); QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 10); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 0); QCOMPARE(eventItem2->eventList.size(), 2); QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin); @@ -510,10 +531,12 @@ void tst_TouchMouse::buttonOnFlickable() QCOMPARE(eventItem1->eventList.size(), 0); QPoint p1 = QPoint(20, 130); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QTRY_COMPARE(eventItem1->eventList.size(), 2); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 4); QCOMPARE(eventItem1->eventList.at(2).type, QEvent::TouchEnd); QCOMPARE(eventItem1->eventList.at(3).type, QEvent::MouseButtonRelease); @@ -522,9 +545,11 @@ void tst_TouchMouse::buttonOnFlickable() // touch button p1 = QPoint(10, 310); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem2->eventList.size(), 1); QCOMPARE(eventItem2->eventList.at(0).type, QEvent::TouchBegin); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem2->eventList.size(), 2); QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchEnd); QCOMPARE(eventItem1->eventList.size(), 0); @@ -536,8 +561,10 @@ void tst_TouchMouse::buttonOnFlickable() // click above button, no events please p1 = QPoint(10, 90); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 0); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 0); eventItem1->eventList.clear(); @@ -548,6 +575,7 @@ void tst_TouchMouse::buttonOnFlickable() QCOMPARE(eventItem1->eventList.size(), 0); p1 = QPoint(10, 110); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 2); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress); @@ -560,12 +588,13 @@ void tst_TouchMouse::buttonOnFlickable() p1 += QPoint(0, -10); QPoint p2 = p1 + QPoint(0, -10); QPoint p3 = p2 + QPoint(0, -10); - QTest::qWait(10); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).move(0, p1, window); - QTest::qWait(10); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).move(0, p2, window); - QTest::qWait(10); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).move(0, p3, window); + QQuickTouchUtils::flush(window); // we cannot really know when the events get grabbed away QVERIFY(eventItem1->eventList.size() >= 4); @@ -578,6 +607,7 @@ void tst_TouchMouse::buttonOnFlickable() QVERIFY(flickable->isMovingVertically()); QTest::touchEvent(window, device).release(0, p3, window); + QQuickTouchUtils::flush(window); delete window; } @@ -625,11 +655,13 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() QCOMPARE(eventItem1->eventList.size(), 0); QPoint p1 = QPoint(10, 110); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); // Flickable initially steals events QCOMPARE(eventItem1->eventList.size(), 0); // but we'll get the delayed mouse press after a delay QTRY_COMPARE(eventItem1->eventList.size(), 1); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress); + QCOMPARE(filteredEventList.count(), 1); // eventItem1 should have the mouse grab, and have moved the itemForTouchPointId // for the touchMouseId to the new grabber. @@ -641,12 +673,13 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() p1 += QPoint(0, -10); QPoint p2 = p1 + QPoint(0, -10); QPoint p3 = p2 + QPoint(0, -10); - QTest::qWait(10); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).move(0, p1, window); - QTest::qWait(10); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).move(0, p2, window); - QTest::qWait(10); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).move(0, p3, window); + QQuickTouchUtils::flush(window); QVERIFY(flickable->isMovingVertically()); // flickable should have the mouse grab, and have moved the itemForTouchPointId @@ -656,9 +689,11 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() QCOMPARE(windowPriv->itemForTouchPointId[0], flickable); QTest::touchEvent(window, device).release(0, p3, window); + QQuickTouchUtils::flush(window); - // We should not have received any synthesised mouse events from Qt gui. - QCOMPARE(filteredEventList.count(), 0); + // We should not have received any synthesised mouse events from Qt gui, + // just the delayed press. + QCOMPARE(filteredEventList.count(), 1); delete window; } @@ -709,7 +744,9 @@ void tst_TouchMouse::buttonOnTouch() // Normal touch click QPoint p1 = QPoint(10, 110); QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(eventItem1->eventList.size(), 4); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonPress); @@ -730,7 +767,9 @@ void tst_TouchMouse::buttonOnTouch() // Start the events after each other QTest::touchEvent(window, device).press(0, p1, window); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).stationary(0).press(1, p2, window); + QQuickTouchUtils::flush(window); QCOMPARE(button1->scale(), 1.0); @@ -738,20 +777,24 @@ void tst_TouchMouse::buttonOnTouch() p1 -= QPoint(10, 0); p2 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window); + QQuickTouchUtils::flush(window); // QCOMPARE(button1->scale(), 1.5); qDebug() << "Button scale: " << button1->scale(); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window); + QQuickTouchUtils::flush(window); // QCOMPARE(button1->scale(), 2.0); qDebug() << "Button scale: " << button1->scale(); QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window); + QQuickTouchUtils::flush(window); // QVERIFY(eventItem1->eventList.isEmpty()); // QCOMPARE(button1->scale(), 2.0); qDebug() << "Button scale: " << button1->scale(); @@ -765,6 +808,7 @@ void tst_TouchMouse::buttonOnTouch() p1 = QPoint(40, 110); p2 = QPoint(60, 110); QTest::touchEvent(window, device).press(0, p1, window).press(1, p2, window); + QQuickTouchUtils::flush(window); QCOMPARE(button1->scale(), 1.0); QCOMPARE(eventItem1->eventList.count(), 2); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::TouchBegin); @@ -774,20 +818,24 @@ void tst_TouchMouse::buttonOnTouch() p1 -= QPoint(10, 0); p2 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window); + QQuickTouchUtils::flush(window); //QCOMPARE(button1->scale(), 1.5); qDebug() << button1->scale(); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); QTest::touchEvent(window, device).move(0, p1, window).move(1, p2, window); + QQuickTouchUtils::flush(window); qDebug() << button1->scale(); //QCOMPARE(button1->scale(), 2.0); QTest::touchEvent(window, device).release(0, p1, window).release(1, p2, window); + QQuickTouchUtils::flush(window); // QCOMPARE(eventItem1->eventList.size(), 99); qDebug() << button1->scale(); //QCOMPARE(button1->scale(), 2.0); @@ -816,18 +864,22 @@ void tst_TouchMouse::pinchOnFlickable() QVERIFY(flickable->contentX() == 0.0); QPoint p = QPoint(100, 100); QTest::touchEvent(window, device).press(0, p, window); + QQuickTouchUtils::flush(window); QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); + QQuickTouchUtils::flush(window); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); - QTest::qWait(10); + QQuickTouchUtils::flush(window); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); - QTest::qWait(10); + QQuickTouchUtils::flush(window); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).release(0, p, window); + QQuickTouchUtils::flush(window); QGuiApplication::processEvents(); QTest::qWait(10); @@ -840,27 +892,36 @@ void tst_TouchMouse::pinchOnFlickable() QPoint p2 = QPoint(60, 20); QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device); + QQuickTouchUtils::flush(window); pinchSequence.press(0, p1, window).commit(); + QQuickTouchUtils::flush(window); // In order for the stationary point to remember its previous position, // we have to reuse the same pinchSequence object. Otherwise if we let it // be destroyed and then start a new sequence, point 0 will default to being // stationary at 0, 0, and PinchArea will filter out that touchpoint because // it is outside its bounds. pinchSequence.stationary(0).press(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10,10); p2 += QPoint(10,10); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QCOMPARE(rect->scale(), 1.0); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QVERIFY(!flickable->isDragging()); + QQuickTouchUtils::flush(window); pinchSequence.release(0, p1, window).release(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QVERIFY(rect->scale() > 1.0); } @@ -885,17 +946,22 @@ void tst_TouchMouse::flickableOnPinch() QVERIFY(flickable->contentX() == 0.0); QPoint p = QPoint(100, 100); QTest::touchEvent(window, device).press(0, p, window); + QQuickTouchUtils::flush(window); QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); + QQuickTouchUtils::flush(window); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); + QQuickTouchUtils::flush(window); QTest::qWait(1000); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).release(0, p, window); + QQuickTouchUtils::flush(window); QTest::qWait(1000); @@ -909,26 +975,33 @@ void tst_TouchMouse::flickableOnPinch() QPoint p2 = QPoint(60, 20); QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device); pinchSequence.press(0, p1, window).commit(); + QQuickTouchUtils::flush(window); // In order for the stationary point to remember its previous position, // we have to reuse the same pinchSequence object. Otherwise if we let it // be destroyed and then start a new sequence, point 0 will default to being // stationary at 0, 0, and PinchArea will filter out that touchpoint because // it is outside its bounds. pinchSequence.stationary(0).press(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10,10); p2 += QPoint(10,10); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QCOMPARE(rect->scale(), 1.0); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); pinchSequence.release(0, p1, window).release(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QVERIFY(rect->scale() > 1.0); } @@ -953,16 +1026,19 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() QVERIFY(flickable->contentX() == 0.0); QPoint p = QPoint(100, 100); QTest::touchEvent(window, device).press(0, p, window); + QQuickTouchUtils::flush(window); QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); + QQuickTouchUtils::flush(window); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); - QGuiApplication::processEvents(); + QQuickTouchUtils::flush(window); p -= QPoint(10, 0); QTest::touchEvent(window, device).move(0, p, window); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).release(0, p, window); - QGuiApplication::processEvents(); + QQuickTouchUtils::flush(window); //QVERIFY(flickable->isMovingHorizontally()); @@ -975,26 +1051,33 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() QPoint p2 = QPoint(60, 20); QTest::QTouchEventSequence pinchSequence = QTest::touchEvent(window, device); pinchSequence.press(0, p1, window).commit(); + QQuickTouchUtils::flush(window); // In order for the stationary point to remember its previous position, // we have to reuse the same pinchSequence object. Otherwise if we let it // be destroyed and then start a new sequence, point 0 will default to being // stationary at 0, 0, and PinchArea will filter out that touchpoint because // it is outside its bounds. pinchSequence.stationary(0).press(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10,10); p2 += QPoint(10,10); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QCOMPARE(rect->scale(), 1.0); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(10, 0); p2 += QPoint(10, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); pinchSequence.release(0, p1, window).release(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QVERIFY(rect->scale() > 1.0); // PinchArea should steal the event after flicking started @@ -1002,14 +1085,18 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() flickable->setContentX(0.0); p = QPoint(100, 100); pinchSequence.press(0, p, window).commit(); + QQuickTouchUtils::flush(window); QCOMPARE(rect->position(), QPointF(200.0, 200.0)); p -= QPoint(10, 0); pinchSequence.move(0, p, window).commit(); + QQuickTouchUtils::flush(window); p -= QPoint(10, 0); pinchSequence.move(0, p, window).commit(); + QQuickTouchUtils::flush(window); QGuiApplication::processEvents(); p -= QPoint(10, 0); pinchSequence.move(0, p, window).commit(); + QQuickTouchUtils::flush(window); QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window); qDebug() << "Mouse Grabber: " << windowPriv->mouseGrabberItem << " itemForTouchPointId: " << windowPriv->itemForTouchPointId; @@ -1019,20 +1106,26 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() p1 = QPoint(40, 100); p2 = QPoint(60, 100); pinchSequence.stationary(0).press(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QCOMPARE(rect->scale(), 1.0); p1 -= QPoint(5, 0); p2 += QPoint(5, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(5, 0); p2 += QPoint(5, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); p1 -= QPoint(5, 0); p2 += QPoint(5, 0); pinchSequence.move(0, p1, window).move(1, p2, window).commit(); + QQuickTouchUtils::flush(window); pinchSequence.release(0, p1, window).release(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QVERIFY(rect->scale() > 1.0); pinchSequence.release(0, p, window).commit(); + QQuickTouchUtils::flush(window); } /* @@ -1066,16 +1159,17 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne() // tap the front mouse area (see qml file) QPoint p1(20, 20); QTest::touchEvent(window, device).press(0, p1, window); - QTest::qWait(1); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(bottomClickedSpy.count(), 1); QCOMPARE(bottomDoubleClickedSpy.count(), 0); - QTest::qWait(15); QTest::touchEvent(window, device).press(0, p1, window); - QTest::qWait(1); + QQuickTouchUtils::flush(window); QTest::touchEvent(window, device).release(0, p1, window); + QQuickTouchUtils::flush(window); QCOMPARE(bottomClickedSpy.count(), 1); QCOMPARE(bottomDoubleClickedSpy.count(), 1); |