diff options
author | Gunnar Sletta <gunnar.sletta@jollamobile.com> | 2014-04-03 11:16:42 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-05-05 16:02:45 +0200 |
commit | 6dc8f47bb05a8acb3cbcc697e0dc05356a01d4cf (patch) | |
tree | 81c7ebe9b3a55f2c8c4cdbc2fe6115024d145435 /tests/auto/quick/touchmouse | |
parent | c87ae78dd78f4a8cee040b5d27e7a6f2425f3aaf (diff) |
Compress touch events in QQuickWindow.
Instead of sending multiple touch updates per frame, we
store the last one and flush the pending events just before
we enter into the scene graph sync phase.
[ChangeLog][QtQuick] QQuickWindow will compresses touch events
and delivers at most one touch event per frame.
Done-with: Robin Burchell <robin.burchell@jollamobile.com>
Change-Id: Ia0169bc4a3f0da67709b91ca65c326934b55d372
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Diffstat (limited to 'tests/auto/quick/touchmouse')
-rw-r--r-- | tests/auto/quick/touchmouse/touchmouse.pro | 1 | ||||
-rw-r--r-- | tests/auto/quick/touchmouse/tst_touchmouse.cpp | 117 |
2 files changed, 105 insertions, 13 deletions
diff --git a/tests/auto/quick/touchmouse/touchmouse.pro b/tests/auto/quick/touchmouse/touchmouse.pro index 445bee08ae..7d23dfc0ae 100644 --- a/tests/auto/quick/touchmouse/touchmouse.pro +++ b/tests/auto/quick/touchmouse/touchmouse.pro @@ -8,6 +8,7 @@ macx:CONFIG -= app_bundle SOURCES += tst_touchmouse.cpp include (../../shared/util.pri) +include (../shared/util.pri) TESTDATA = data/* diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 5b4ad0ffa3..1d947b4d8c 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,6 +655,7 @@ 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 @@ -641,12 +672,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,6 +688,7 @@ 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); @@ -709,7 +742,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 +765,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 +775,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 +806,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 +816,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 +862,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 +890,35 @@ 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(); + QQuickTouchUtils::flush(window); pinchSequence.release(0, p1, window).release(1, p2, window).commit(); + QQuickTouchUtils::flush(window); QVERIFY(rect->scale() > 1.0); } @@ -885,17 +943,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 +972,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 +1023,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 +1048,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 +1082,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 +1103,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 +1156,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); |