aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickflickable
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2017-04-13 20:56:01 +0200
committerShawn Rutledge <shawn.rutledge@qt.io>2017-04-13 20:56:01 +0200
commit1fb1c6c4f8769250dffa375e3941738eb1fcc885 (patch)
tree4f4c4afae97b54a793a0589f8ca53b7c919de728 /tests/auto/quick/qquickflickable
parentd0ce320646b7f852a24f6e0a9e9621ddcedef554 (diff)
parent9c1c471e54bb12e8740b76d1c048f2f916a6ab59 (diff)
Merge remote-tracking branch 'origin/dev' into wip/pointerhandler
Diffstat (limited to 'tests/auto/quick/qquickflickable')
-rw-r--r--tests/auto/quick/qquickflickable/BLACKLIST2
-rw-r--r--tests/auto/quick/qquickflickable/data/nestedSlider.qml36
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp328
3 files changed, 300 insertions, 66 deletions
diff --git a/tests/auto/quick/qquickflickable/BLACKLIST b/tests/auto/quick/qquickflickable/BLACKLIST
index 647bf819a5..f35397f119 100644
--- a/tests/auto/quick/qquickflickable/BLACKLIST
+++ b/tests/auto/quick/qquickflickable/BLACKLIST
@@ -17,3 +17,5 @@ osx
osx-10.10
[flickVelocity]
osx-10.10
+[nestedSliderUsingTouch:keepNeither]
+ubuntu-16.04
diff --git a/tests/auto/quick/qquickflickable/data/nestedSlider.qml b/tests/auto/quick/qquickflickable/data/nestedSlider.qml
new file mode 100644
index 0000000000..2fd0cbfcc8
--- /dev/null
+++ b/tests/auto/quick/qquickflickable/data/nestedSlider.qml
@@ -0,0 +1,36 @@
+import QtQuick 2.0
+import Test 1.0
+
+Flickable {
+ width: 240
+ height: 320
+ contentWidth: width * 1.5
+ contentHeight: height * 1.5
+ contentY: height * 0.25
+
+ Rectangle {
+ id: slider
+ width: 50
+ height: 200
+ color: "lightgray"
+ border.color: drag.active ? "green" : "black"
+ anchors.centerIn: parent
+ radius: 4
+
+ TouchDragArea {
+ id: drag
+ objectName: "drag"
+ anchors.fill: parent
+ }
+
+ Rectangle {
+ width: parent.width - 2
+ height: 20
+ radius: 5
+ color: "darkgray"
+ border.color: "black"
+ x: 1
+ y: Math.min(slider.height - height, Math.max(0, drag.pos.y - height / 2))
+ }
+ }
+}
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 9ead271bfe..ef6e444580 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -46,12 +46,107 @@
using namespace QQuickViewTestUtil;
using namespace QQuickVisualTestUtil;
+// an abstract Slider which only handles touch events
+class TouchDragArea : public QQuickItem
+{
+ Q_OBJECT
+ Q_PROPERTY(QPointF pos READ pos NOTIFY posChanged)
+ Q_PROPERTY(bool active READ active NOTIFY activeChanged)
+ Q_PROPERTY(bool keepMouseGrab READ keepMouseGrab WRITE setKeepMouseGrab NOTIFY keepMouseGrabChanged)
+ Q_PROPERTY(bool keepTouchGrab READ keepTouchGrab WRITE setKeepTouchGrab NOTIFY keepTouchGrabChanged)
+
+public:
+ TouchDragArea(QQuickItem *parent = 0)
+ : QQuickItem(parent)
+ , touchEvents(0)
+ , touchUpdates(0)
+ , touchReleases(0)
+ , ungrabs(0)
+ , m_active(false)
+ { }
+
+ QPointF pos() const { return m_pos; }
+
+ bool active() const { return m_active; }
+
+ void setKeepMouseGrab(bool keepMouseGrab)
+ {
+ QQuickItem::setKeepMouseGrab(keepMouseGrab);
+ emit keepMouseGrabChanged();
+ }
+
+ void setKeepTouchGrab(bool keepTouchGrab)
+ {
+ QQuickItem::setKeepTouchGrab(keepTouchGrab);
+ emit keepTouchGrabChanged();
+ }
+
+ int touchEvents;
+ int touchUpdates;
+ int touchReleases;
+ int ungrabs;
+ QVector<Qt::TouchPointState> touchPointStates;
+
+protected:
+ void touchEvent(QTouchEvent *ev) override
+ {
+ QCOMPARE(ev->touchPoints().count(), 1);
+ auto touchpoint = ev->touchPoints().first();
+ switch (touchpoint.state()) {
+ case Qt::TouchPointPressed:
+ QVERIFY(!m_active);
+ m_active = true;
+ emit activeChanged();
+ grabTouchPoints(QVector<int>() << touchpoint.id());
+ break;
+ case Qt::TouchPointMoved:
+ ++touchUpdates;
+ break;
+ case Qt::TouchPointReleased:
+ QVERIFY(m_active);
+ m_active = false;
+ ++touchReleases;
+ emit activeChanged();
+ case Qt::TouchPointStationary:
+ break;
+ }
+ touchPointStates << touchpoint.state();
+ ++touchEvents;
+ m_pos = touchpoint.pos();
+ emit posChanged();
+ }
+
+ void touchUngrabEvent() override
+ {
+ ++ungrabs;
+ QVERIFY(m_active);
+ emit ungrabbed();
+ m_active = false;
+ emit activeChanged();
+ }
+
+signals:
+ void ungrabbed();
+ void posChanged();
+ void keepMouseGrabChanged();
+ void keepTouchGrabChanged();
+ void activeChanged();
+
+private:
+ QPointF m_pos;
+ bool m_active;
+};
+
class tst_qquickflickable : public QQmlDataTest
{
Q_OBJECT
public:
+ tst_qquickflickable()
+ : touchDevice(QTest::createTouchDevice())
+ {}
private slots:
+ void initTestCase() override;
void create();
void horizontalViewportSize();
void verticalViewportSize();
@@ -89,6 +184,8 @@ private slots:
void stopAtBounds();
void stopAtBounds_data();
void nestedMouseAreaUsingTouch();
+ void nestedSliderUsingTouch();
+ void nestedSliderUsingTouch_data();
void pressDelayWithLoader();
void movementFromProgrammaticFlick();
void cleanup();
@@ -101,9 +198,16 @@ private slots:
void overshoot_reentrant();
private:
- void flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to);
+ void flickWithTouch(QQuickWindow *window, const QPoint &from, const QPoint &to);
+ QTouchDevice *touchDevice;
};
+void tst_qquickflickable::initTestCase()
+{
+ QQmlDataTest::initTestCase();
+ qmlRegisterType<TouchDragArea>("Test",1,0,"TouchDragArea");
+}
+
void tst_qquickflickable::cleanup()
{
QVERIFY(QGuiApplication::topLevelWindows().isEmpty());
@@ -1530,12 +1634,6 @@ void tst_qquickflickable::clickAndDragWhenTransformed()
void tst_qquickflickable::flickTwiceUsingTouches()
{
- QTouchDevice *touchDevice = new QTouchDevice;
- touchDevice->setName("Fake Touchscreen");
- touchDevice->setType(QTouchDevice::TouchScreen);
- touchDevice->setCapabilities(QTouchDevice::Position);
- QWindowSystemInterface::registerTouchDevice(touchDevice);
-
QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("longList.qml"));
QTRY_COMPARE(window->status(), QQuickView::Ready);
@@ -1548,7 +1646,7 @@ void tst_qquickflickable::flickTwiceUsingTouches()
QVERIFY(flickable != 0);
QCOMPARE(flickable->contentY(), 0.0f);
- flickWithTouch(window.data(), touchDevice, QPoint(100, 400), QPoint(100, 240));
+ flickWithTouch(window.data(), QPoint(100, 400), QPoint(100, 240));
qreal contentYAfterFirstFlick = flickable->contentY();
qDebug() << "contentYAfterFirstFlick " << contentYAfterFirstFlick;
@@ -1556,7 +1654,7 @@ void tst_qquickflickable::flickTwiceUsingTouches()
// Wait until view stops moving
QTRY_VERIFY(!flickable->isMoving());
- flickWithTouch(window.data(), touchDevice, QPoint(100, 400), QPoint(100, 240));
+ flickWithTouch(window.data(), QPoint(100, 400), QPoint(100, 240));
// In the original bug, that second flick would cause Flickable to halt immediately
qreal contentYAfterSecondFlick = flickable->contentY();
@@ -1564,7 +1662,7 @@ void tst_qquickflickable::flickTwiceUsingTouches()
QTRY_VERIFY(contentYAfterSecondFlick > (contentYAfterFirstFlick + 80.0f));
}
-void tst_qquickflickable::flickWithTouch(QQuickWindow *window, QTouchDevice *touchDevice, const QPoint &from, const QPoint &to)
+void tst_qquickflickable::flickWithTouch(QQuickWindow *window, const QPoint &from, const QPoint &to)
{
QTest::touchEvent(window, touchDevice).press(0, from, window);
QQuickTouchUtils::flush(window);
@@ -1869,12 +1967,6 @@ void tst_qquickflickable::stopAtBounds()
void tst_qquickflickable::nestedMouseAreaUsingTouch()
{
- QTouchDevice *touchDevice = new QTouchDevice;
- touchDevice->setName("Fake Touchscreen");
- touchDevice->setType(QTouchDevice::TouchScreen);
- touchDevice->setCapabilities(QTouchDevice::Position);
- QWindowSystemInterface::registerTouchDevice(touchDevice);
-
QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("nestedmousearea.qml"));
QTRY_COMPARE(window->status(), QQuickView::Ready);
@@ -1887,7 +1979,7 @@ void tst_qquickflickable::nestedMouseAreaUsingTouch()
QVERIFY(flickable != 0);
QCOMPARE(flickable->contentY(), 50.0f);
- flickWithTouch(window.data(), touchDevice, QPoint(100, 300), QPoint(100, 200));
+ flickWithTouch(window.data(), QPoint(100, 300), QPoint(100, 200));
// flickable should not have moved
QCOMPARE(flickable->contentY(), 50.0);
@@ -1897,6 +1989,65 @@ void tst_qquickflickable::nestedMouseAreaUsingTouch()
QVERIFY(nested->y() < 100.0);
}
+void tst_qquickflickable::nestedSliderUsingTouch_data()
+{
+ QTest::addColumn<bool>("keepMouseGrab");
+ QTest::addColumn<bool>("keepTouchGrab");
+ QTest::addColumn<int>("updates");
+ QTest::addColumn<int>("releases");
+ QTest::addColumn<int>("ungrabs");
+
+ QTest::newRow("keepBoth") << true << true << 8 << 1 << 0;
+ QTest::newRow("keepMouse") << true << false << 8 << 1 << 0;
+ QTest::newRow("keepTouch") << false << true << 8 << 1 << 0;
+ QTest::newRow("keepNeither") << false << false << 6 << 0 << 1;
+}
+
+void tst_qquickflickable::nestedSliderUsingTouch()
+{
+ QFETCH(bool, keepMouseGrab);
+ QFETCH(bool, keepTouchGrab);
+ QFETCH(int, updates);
+ QFETCH(int, releases);
+ QFETCH(int, ungrabs);
+
+ QQuickView *window = new QQuickView;
+ QScopedPointer<QQuickView> windowPtr(window);
+ windowPtr->setSource(testFileUrl("nestedSlider.qml"));
+ QTRY_COMPARE(window->status(), QQuickView::Ready);
+ QQuickViewTestUtil::centerOnScreen(window);
+ QQuickViewTestUtil::moveMouseAway(window);
+ window->show();
+ QVERIFY(QTest::qWaitForWindowActive(window));
+ QVERIFY(window->rootObject() != 0);
+
+ QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject());
+ QVERIFY(flickable);
+
+ TouchDragArea *tda = flickable->findChild<TouchDragArea*>("drag");
+ QVERIFY(tda);
+
+ // Drag down and a little to the right: flickable will steal the grab only if tda allows it
+ const int dragThreshold = qApp->styleHints()->startDragDistance();
+ tda->setKeepMouseGrab(keepMouseGrab);
+ tda->setKeepTouchGrab(keepTouchGrab);
+ QPoint p0 = tda->mapToScene(QPoint(20, 20)).toPoint();
+ QTest::touchEvent(window, touchDevice).press(0, p0, window);
+ QQuickTouchUtils::flush(window);
+ for (int i = 0; i < 8; ++i) {
+ p0 += QPoint(dragThreshold / 6, dragThreshold / 4);
+ QTest::touchEvent(window, touchDevice).move(0, p0, window);
+ QQuickTouchUtils::flush(window);
+ }
+ QCOMPARE(tda->active(), !ungrabs);
+ QTest::touchEvent(window, touchDevice).release(0, p0, window);
+ QQuickTouchUtils::flush(window);
+ QTRY_COMPARE(tda->touchPointStates.first(), Qt::TouchPointPressed);
+ QTRY_COMPARE(tda->touchUpdates, updates);
+ QTRY_COMPARE(tda->touchReleases, releases);
+ QTRY_COMPARE(tda->ungrabs, ungrabs);
+}
+
// QTBUG-31328
void tst_qquickflickable::pressDelayWithLoader()
{
@@ -2065,6 +2216,7 @@ Q_DECLARE_METATYPE(QQuickFlickable::BoundsBehavior)
void tst_qquickflickable::overshoot()
{
QFETCH(QQuickFlickable::BoundsBehavior, boundsBehavior);
+ QFETCH(int, boundsMovement);
QScopedPointer<QQuickView> window(new QQuickView);
window->setSource(testFileUrl("overshoot.qml"));
@@ -2081,6 +2233,7 @@ void tst_qquickflickable::overshoot()
QCOMPARE(flickable->contentHeight(), 400.0);
flickable->setBoundsBehavior(boundsBehavior);
+ flickable->setBoundsMovement(QQuickFlickable::BoundsMovement(boundsMovement));
// drag past the beginning
QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
@@ -2089,23 +2242,30 @@ void tst_qquickflickable::overshoot()
QTest::mouseMove(window.data(), QPoint(40, 40));
QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 50));
+ if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::DragOverBounds)) {
+ QVERIFY(flickable->property("minContentX").toReal() < 0.0);
+ QVERIFY(flickable->property("minContentY").toReal() < 0.0);
+ } else {
+ QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
+ }
if (boundsBehavior & QQuickFlickable::DragOverBounds) {
- QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
QVERIFY(flickable->property("minHorizontalOvershoot").toReal() < 0.0);
- QCOMPARE(flickable->property("minContentY").toReal(),
- flickable->property("minVerticalOvershoot").toReal());
- QCOMPARE(flickable->property("minContentX").toReal(),
- flickable->property("minHorizontalOvershoot").toReal());
+ QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
} else {
- QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
- QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
- QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ }
+ if (bool(boundsMovement == QQuickFlickable::FollowBoundsBehavior) == bool(boundsBehavior & QQuickFlickable::DragOverBounds)) {
+ QCOMPARE(flickable->property("minContentX").toReal(),
+ flickable->property("minHorizontalOvershoot").toReal());
+ QCOMPARE(flickable->property("minContentY").toReal(),
+ flickable->property("minVerticalOvershoot").toReal());
}
- QCOMPARE(flickable->property("maxContentY").toReal(), 0.0);
QCOMPARE(flickable->property("maxContentX").toReal(), 0.0);
- QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxContentY").toReal(), 0.0);
QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
flickable->setContentX(20.0);
flickable->setContentY(20.0);
@@ -2115,23 +2275,30 @@ void tst_qquickflickable::overshoot()
flick(window.data(), QPoint(10, 10), QPoint(50, 50), 100);
QTRY_VERIFY(!flickable->property("flicking").toBool());
+ if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::OvershootBounds)) {
+ QVERIFY(flickable->property("minContentX").toReal() < 0.0);
+ QVERIFY(flickable->property("minContentY").toReal() < 0.0);
+ } else {
+ QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
+ }
if (boundsBehavior & QQuickFlickable::OvershootBounds) {
- QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
QVERIFY(flickable->property("minHorizontalOvershoot").toReal() < 0.0);
- QCOMPARE(flickable->property("minContentY").toReal(),
- flickable->property("minVerticalOvershoot").toReal());
- QCOMPARE(flickable->property("minContentX").toReal(),
- flickable->property("minHorizontalOvershoot").toReal());
+ QVERIFY(flickable->property("minVerticalOvershoot").toReal() < 0.0);
} else {
- QCOMPARE(flickable->property("minContentY").toReal(), 0.0);
- QCOMPARE(flickable->property("minContentX").toReal(), 0.0);
- QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ }
+ if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) == (boundsBehavior & QQuickFlickable::OvershootBounds)) {
+ QCOMPARE(flickable->property("minContentX").toReal(),
+ flickable->property("minHorizontalOvershoot").toReal());
+ QCOMPARE(flickable->property("minContentY").toReal(),
+ flickable->property("minVerticalOvershoot").toReal());
}
- QCOMPARE(flickable->property("maxContentY").toReal(), 20.0);
QCOMPARE(flickable->property("maxContentX").toReal(), 20.0);
- QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxContentY").toReal(), 20.0);
QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
flickable->setContentX(200.0);
flickable->setContentY(200.0);
@@ -2144,23 +2311,30 @@ void tst_qquickflickable::overshoot()
QTest::mouseMove(window.data(), QPoint(20, 20));
QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10, 10));
+ if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::DragOverBounds)) {
+ QVERIFY(flickable->property("maxContentX").toReal() > 200.0);
+ QVERIFY(flickable->property("maxContentX").toReal() > 200.0);
+ } else {
+ QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
+ }
if (boundsBehavior & QQuickFlickable::DragOverBounds) {
- QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
QVERIFY(flickable->property("maxHorizontalOvershoot").toReal() > 0.0);
- QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
- flickable->property("maxVerticalOvershoot").toReal());
- QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
- flickable->property("maxHorizontalOvershoot").toReal());
+ QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
} else {
- QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
- QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
- QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ }
+ if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) == (boundsBehavior & QQuickFlickable::DragOverBounds)) {
+ QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
+ flickable->property("maxHorizontalOvershoot").toReal());
+ QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
+ flickable->property("maxVerticalOvershoot").toReal());
}
- QCOMPARE(flickable->property("minContentY").toReal(), 200.0);
QCOMPARE(flickable->property("minContentX").toReal(), 200.0);
- QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(), 200.0);
QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
flickable->setContentX(180.0);
flickable->setContentY(180.0);
@@ -2170,37 +2344,59 @@ void tst_qquickflickable::overshoot()
flick(window.data(), QPoint(50, 50), QPoint(10, 10), 100);
QTRY_VERIFY(!flickable->property("flicking").toBool());
+ if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::OvershootBounds)) {
+ QVERIFY(flickable->property("maxContentX").toReal() > 200.0);
+ QVERIFY(flickable->property("maxContentY").toReal() > 200.0);
+ } else {
+ QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
+ QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
+ }
if (boundsBehavior & QQuickFlickable::OvershootBounds) {
- QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
QVERIFY(flickable->property("maxHorizontalOvershoot").toReal() > 0.0);
- QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
- flickable->property("maxVerticalOvershoot").toReal());
- QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
- flickable->property("maxHorizontalOvershoot").toReal());
+ QVERIFY(flickable->property("maxVerticalOvershoot").toReal() > 0.0);
} else {
- QCOMPARE(flickable->property("maxContentY").toReal(), 200.0);
- QCOMPARE(flickable->property("maxContentX").toReal(), 200.0);
- QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
QCOMPARE(flickable->property("maxHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("maxVerticalOvershoot").toReal(), 0.0);
+ }
+ if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) == (boundsBehavior & QQuickFlickable::OvershootBounds)) {
+ QCOMPARE(flickable->property("maxContentX").toReal() - 200.0,
+ flickable->property("maxHorizontalOvershoot").toReal());
+ QCOMPARE(flickable->property("maxContentY").toReal() - 200.0,
+ flickable->property("maxVerticalOvershoot").toReal());
}
- QCOMPARE(flickable->property("minContentY").toReal(), 180.0);
QCOMPARE(flickable->property("minContentX").toReal(), 180.0);
- QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minContentY").toReal(), 180.0);
QCOMPARE(flickable->property("minHorizontalOvershoot").toReal(), 0.0);
+ QCOMPARE(flickable->property("minVerticalOvershoot").toReal(), 0.0);
}
void tst_qquickflickable::overshoot_data()
{
QTest::addColumn<QQuickFlickable::BoundsBehavior>("boundsBehavior");
-
- QTest::newRow("StopAtBounds")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds);
- QTest::newRow("DragOverBounds")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds);
- QTest::newRow("OvershootBounds")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds);
- QTest::newRow("DragAndOvershootBounds")
- << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds);
+ QTest::addColumn<int>("boundsMovement");
+
+ QTest::newRow("StopAtBounds,FollowBoundsBehavior")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::StopAtBounds)
+ << int(QQuickFlickable::FollowBoundsBehavior);
+ QTest::newRow("DragOverBounds,FollowBoundsBehavior")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds)
+ << int(QQuickFlickable::FollowBoundsBehavior);
+ QTest::newRow("OvershootBounds,FollowBoundsBehavior")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds)
+ << int(QQuickFlickable::FollowBoundsBehavior);
+ QTest::newRow("DragAndOvershootBounds,FollowBoundsBehavior")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds)
+ << int(QQuickFlickable::FollowBoundsBehavior);
+
+ QTest::newRow("DragOverBounds,StopAtBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragOverBounds)
+ << int(QQuickFlickable::StopAtBounds);
+ QTest::newRow("OvershootBounds,StopAtBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::OvershootBounds)
+ << int(QQuickFlickable::StopAtBounds);
+ QTest::newRow("DragAndOvershootBounds,StopAtBounds")
+ << QQuickFlickable::BoundsBehavior(QQuickFlickable::DragAndOvershootBounds)
+ << int(QQuickFlickable::StopAtBounds);
}
void tst_qquickflickable::overshoot_reentrant()