diff options
author | Shawn Rutledge <shawn.rutledge@theqtcompany.com> | 2016-08-11 11:16:47 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-08-12 19:03:33 +0000 |
commit | d04982dc84d66bec92b4b3767538676cf925ef17 (patch) | |
tree | 2e6272a9d33c973b4e5463bd5714d2eeade9f2e5 | |
parent | dfa8854cf7e00705e0122cf7022ff1ea4f8e5a74 (diff) |
QTest::QTouchEventSequence: add a sleep before each touch movement
In any code (such as QtQuick Flickable) which calculates velocity as
distance / time, it's unrealistic to simulate instantaneous touchpoint
movements. So, force a slight delay before each event, so that
the touchpoint can only move very fast, but not infinitely fast.
We use qSleep() rather than qWait() because qWait() has a minimum
qSleep(10), and also processes events. commit() also conditionally
calls processEvents(), and we don't want to make that unconditional.
Change-Id: I3cee890f8951d7ecb8837a6abe216c5a8e0a6e34
Reviewed-by: Liang Qi <liang.qi@qt.io>
-rw-r--r-- | src/testlib/qtesttouch.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h index bdc964389e..2c57bf0420 100644 --- a/src/testlib/qtesttouch.h +++ b/src/testlib/qtesttouch.h @@ -129,6 +129,7 @@ namespace QTest void commit(bool processEvents = true) { if (!points.isEmpty()) { + qSleep(1); if (targetWindow) { qt_handleTouchEvent(targetWindow, device, points.values()); |