From d04982dc84d66bec92b4b3767538676cf925ef17 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 11 Aug 2016 11:16:47 +0200 Subject: 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 --- src/testlib/qtesttouch.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/testlib/qtesttouch.h') 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()); -- cgit v1.2.3