From 332fe582d1bd590b59618cc7b732be9bf7f9f475 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Tue, 29 May 2012 14:30:32 +0300 Subject: [PATCH] Do not lose timestamps in mouse press events Change-Id: Iaa7953cd2ea21f43a98f984b6aea43feb0c2fbed Reviewed-by: Martin Jones --- src/quick/items/qquickcanvas.cpp | 1 + tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 14 +++++++------- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/quick/items/qquickcanvas.cpp b/src/quick/items/qquickcanvas.cpp index e6e78b4..c2b1fe5 100644 --- a/src/quick/items/qquickcanvas.cpp +++ b/src/quick/items/qquickcanvas.cpp @@ -1124,6 +1124,7 @@ bool QQuickCanvasPrivate::deliverInitialMousePressEvent(QQuickItem *item, QMouse if (item->contains(p)) { QMouseEvent me(event->type(), p, event->windowPos(), event->screenPos(), event->button(), event->buttons(), event->modifiers()); + me.setTimestamp(event->timestamp()); me.accept(); item->grabMouse(); q->sendEvent(item, &me); diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index f767940..39d1075 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -384,6 +384,10 @@ void tst_qquickflickable::wheel() void tst_qquickflickable::movingAndDragging() { +#ifdef Q_OS_MAC + QSKIP("Producing flicks on Mac CI impossible due to timing problems"); +#endif + QQuickView *canvas = new QQuickView; canvas->setSource(testFileUrl("flickable03.qml")); canvas->show(); @@ -449,9 +453,9 @@ void tst_qquickflickable::movingAndDragging() // underlying drivers will hopefully provide a pre-calculated velocity // (based on more data than what the UI gets), thus making this use case // working even with small movements. - QTest::mousePress(canvas, Qt::LeftButton, 0, QPoint(50, 10)); - QTest::mouseMove(canvas, QPoint(50, 300), 10); - QTest::mouseRelease(canvas, Qt::LeftButton, 0, QPoint(50, 100), 10); + QTest::mousePress(canvas, Qt::LeftButton, 0, QPoint(50, 300)); + QTest::mouseMove(canvas, QPoint(50, 10), 10); + QTest::mouseRelease(canvas, Qt::LeftButton, 0, QPoint(50, 10), 10); QCOMPARE(vFlickSpy.count(), 1); @@ -504,10 +508,6 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(dragEndSpy.count(), 1); // Don't test moving because a flick could occur -#ifdef Q_OS_MAC - QSKIP("Producing flicks on Mac CI impossible due to timing problems"); -#endif - QTRY_VERIFY(!flickable->isMoving()); // Stop on a full pixel after user interaction QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX())); -- 2.7.4