Do not lose timestamps in mouse press events
authorLaszlo Agocs <laszlo.p.agocs@nokia.com>
Tue, 29 May 2012 11:30:32 +0000 (14:30 +0300)
committerQt by Nokia <qt-info@nokia.com>
Tue, 5 Jun 2012 05:46:25 +0000 (07:46 +0200)
Change-Id: Iaa7953cd2ea21f43a98f984b6aea43feb0c2fbed
Reviewed-by: Martin Jones <martin.jones@nokia.com>
src/quick/items/qquickcanvas.cpp
tests/auto/quick/qquickflickable/tst_qquickflickable.cpp

index e6e78b4..c2b1fe5 100644 (file)
@@ -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);
index f767940..39d1075 100644 (file)
@@ -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()));