aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qtquick2
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2012-01-31 09:12:13 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-02 03:55:21 +0100
commitc1e668a96764d1a252322ebae3af72097c27dfe1 (patch)
tree8500010095c43a04170859d8bb926482bab7bb0b /tests/auto/qtquick2
parent0b575d9405972a17eebea653c422442580597263 (diff)
Multiple fast flicks with large content moves faster
Repeatedly flicking quickly in a large view moves faster than the velocity of the touch. Task-number: QTBUG-18600 Change-Id: Ie6747e0d945022e0c0c5f6c5f95bc35403a14d56 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/qtquick2')
-rw-r--r--tests/auto/qtquick2/qquickflickable/data/flickable03.qml4
-rw-r--r--tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp18
2 files changed, 19 insertions, 3 deletions
diff --git a/tests/auto/qtquick2/qquickflickable/data/flickable03.qml b/tests/auto/qtquick2/qquickflickable/data/flickable03.qml
index ebc49ba90a..719c682ee6 100644
--- a/tests/auto/qtquick2/qquickflickable/data/flickable03.qml
+++ b/tests/auto/qtquick2/qquickflickable/data/flickable03.qml
@@ -1,13 +1,13 @@
import QtQuick 2.0
Flickable {
- width: 100; height: 200
+ width: 100; height: 400
contentWidth: column.width; contentHeight: column.height
Column {
id: column
Repeater {
- model: 4
+ model: 20
Rectangle { width: 200; height: 300; color: "blue" }
}
}
diff --git a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
index 3fa822b0bf..4439d97491 100644
--- a/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/qtquick2/qquickflickable/tst_qquickflickable.cpp
@@ -44,6 +44,7 @@
#include <QtDeclarative/qdeclarativecomponent.h>
#include <QtQuick/qquickview.h>
#include <private/qquickflickable_p.h>
+#include <private/qquickflickable_p_p.h>
#include <private/qdeclarativevaluetype_p.h>
#include <math.h>
#include "../../shared/util.h"
@@ -131,7 +132,7 @@ void tst_qquickflickable::verticalViewportSize()
QVERIFY(obj != 0);
QCOMPARE(obj->contentWidth(), 200.);
- QCOMPARE(obj->contentHeight(), 1200.);
+ QCOMPARE(obj->contentHeight(), 6000.);
QCOMPARE(obj->isAtXBeginning(), true);
QCOMPARE(obj->isAtXEnd(), false);
QCOMPARE(obj->isAtYBeginning(), true);
@@ -538,6 +539,20 @@ void tst_qquickflickable::flickVelocity()
QVERIFY(flickable->verticalVelocity() < 0.0);
QTRY_VERIFY(flickable->verticalVelocity() == 0.0);
+ // Flick multiple times and verify that flick acceleration is applied.
+ QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flickable);
+ bool boosted = false;
+ for (int i = 0; i < 6; ++i) {
+ flick(canvas, QPoint(20,390), QPoint(20, 50), 200);
+ boosted |= fp->flickBoost > 1.0;
+ }
+ QVERIFY(boosted);
+
+ // Flick in opposite direction -> boost cancelled.
+ flick(canvas, QPoint(20,10), QPoint(20, 340), 200);
+ QTRY_VERIFY(flickable->verticalVelocity() < 0.0);
+ QVERIFY(fp->flickBoost == 1.0);
+
delete canvas;
}
@@ -616,6 +631,7 @@ void tst_qquickflickable::flick(QQuickView *canvas, const QPoint &from, const QP
}
QTest::mouseRelease(canvas, Qt::LeftButton, 0, to);
+ QTest::qWait(50);
}
template<typename T>