diff options
author | Martin Jones <martin.jones@nokia.com> | 2012-04-20 17:02:44 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-09 00:56:16 +0200 |
commit | f67ba78760602642bd947abed261e84dadb9cfdf (patch) | |
tree | a1aedbd0ba768d7c0c85b57b76a8aabb5de82423 /tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | |
parent | c4fab1011b9de42f43a95d598743da505847e139 (diff) |
Stop flicking on a full pixel.
When the user flicks/moves the view, stop on a full pixel. This
ensures optimal presentation when static without affecting the
smoothness of animation.
Change-Id: I2d8ae084151f56d8e569fde35fb498866ad60f9c
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickflickable/tst_qquickflickable.cpp')
-rw-r--r-- | tests/auto/quick/qquickflickable/tst_qquickflickable.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index f926dbe8f0..f76794017d 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -410,8 +410,6 @@ void tst_qquickflickable::movingAndDragging() QTest::mouseMove(canvas, QPoint(50, 70)); QTest::mouseMove(canvas, QPoint(50, 60)); - QMouseEvent moveEvent(QEvent::MouseMove, QPoint(50, 80), Qt::LeftButton, Qt::LeftButton, 0); - QVERIFY(!flickable->isDraggingHorizontally()); QVERIFY(flickable->isDraggingVertically()); QVERIFY(flickable->isDragging()); @@ -441,6 +439,9 @@ void tst_qquickflickable::movingAndDragging() // wait for any motion to end QTRY_VERIFY(flickable->isMoving() == false); + // Stop on a full pixel after user interaction + QCOMPARE(flickable->contentY(), (qreal)qRound(flickable->contentY())); + // Vertical with a quick press-move-release: should cause a flick in release. QSignalSpy vFlickSpy(flickable, SIGNAL(flickingVerticallyChanged())); // Use something that generates a huge velocity just to make it testable. @@ -457,6 +458,9 @@ void tst_qquickflickable::movingAndDragging() // wait for any motion to end QTRY_VERIFY(flickable->isMoving() == false); + // Stop on a full pixel after user interaction + QCOMPARE(flickable->contentY(), (qreal)qRound(flickable->contentY())); + //Horizontal vDragSpy.clear(); hDragSpy.clear(); @@ -505,6 +509,8 @@ void tst_qquickflickable::movingAndDragging() #endif QTRY_VERIFY(!flickable->isMoving()); + // Stop on a full pixel after user interaction + QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX())); vMoveSpy.clear(); hMoveSpy.clear(); @@ -541,6 +547,8 @@ void tst_qquickflickable::movingAndDragging() QVERIFY(!flickable->isFlickingVertically()); QTRY_VERIFY(!flickable->isMoving()); QVERIFY(!flickable->isMovingVertically()); + // Stop on a full pixel after user interaction + QCOMPARE(flickable->contentX(), (qreal)qRound(flickable->contentX())); delete canvas; } |