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/qquickflickable/tst_qquickflickable.cpp | |
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/qquickflickable/tst_qquickflickable.cpp')
-rw-r--r-- | tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index 8ab86bf2d3..7cc3350b05 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -100,7 +100,7 @@ private slots: void pressDelayWithLoader(); private: - void flickWithTouch(QWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to); + void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to); QQmlEngine engine; }; @@ -1349,20 +1349,18 @@ void tst_qquickflickable::flickTwiceUsingTouches() QTRY_VERIFY(contentYAfterSecondFlick > (contentYAfterFirstFlick + 80.0f)); } -void tst_qquickflickable::flickWithTouch(QWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to) +void tst_qquickflickable::flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to) { - QTest::touchEvent(window, touchDevice) - .press(0, from, window); - QTest::qWait(1); + QTest::touchEvent(window, touchDevice).press(0, from, window); + QQuickTouchUtils::flush(window); + QPoint diff = to - from; for (int i = 1; i <= 8; ++i) { - QTest::touchEvent(window, touchDevice) - .move(0, from + i*diff/8, window); - QTest::qWait(1); + QTest::touchEvent(window, touchDevice).move(0, from + i*diff/8, window); + QQuickTouchUtils::flush(window); } - QTest::touchEvent(window, touchDevice) - .release(0, to, window); - QTest::qWait(1); + QTest::touchEvent(window, touchDevice).release(0, to, window); + QQuickTouchUtils::flush(window); } void tst_qquickflickable::nestedStopAtBounds_data() |