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>
This commit is contained in:
parent
dfa8854cf7
commit
d04982dc84
@ -129,6 +129,7 @@ namespace QTest
|
||||
void commit(bool processEvents = true)
|
||||
{
|
||||
if (!points.isEmpty()) {
|
||||
qSleep(1);
|
||||
if (targetWindow)
|
||||
{
|
||||
qt_handleTouchEvent(targetWindow, device, points.values());
|
||||
|
Loading…
Reference in New Issue
Block a user