aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/examples/tst_examples.cpp1
-rw-r--r--tests/auto/quick/pointerhandlers/pointerhandlers.pro1
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/data/snapMode.qml86
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/qquickdraghandler.pro1
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp74
-rw-r--r--tests/auto/quick/pointerhandlers/qquickwheelhandler/data/nested.qml55
-rw-r--r--tests/auto/quick/pointerhandlers/qquickwheelhandler/data/rectWheel.qml45
-rw-r--r--tests/auto/quick/pointerhandlers/qquickwheelhandler/qquickwheelhandler.pro14
-rw-r--r--tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp344
-rw-r--r--tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp1
-rw-r--r--tests/auto/quick/qquickanchors/tst_qquickanchors.cpp4
-rw-r--r--tests/auto/quick/qquickanimations/qquickanimations.pro2
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp2
-rw-r--r--tests/auto/quick/qquickboundaryrule/data/dragHandler.qml23
-rw-r--r--tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro12
-rw-r--r--tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp99
-rw-r--r--tests/auto/quick/qquickgridview/qquickgridview.pro2
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp2
-rw-r--r--tests/auto/quick/qquicklistview/qquicklistview.pro2
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp6
-rw-r--r--tests/auto/quick/qquickpathview/qquickpathview.pro2
-rw-r--r--tests/auto/quick/qquickpathview/tst_qquickpathview.cpp2
-rw-r--r--tests/auto/quick/qquickrepeater/qquickrepeater.pro2
-rw-r--r--tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp14
-rw-r--r--tests/auto/quick/qquicktableview/data/syncviewsimple.qml122
-rw-r--r--tests/auto/quick/qquicktableview/qquicktableview.pro2
-rw-r--r--tests/auto/quick/qquicktableview/tst_qquicktableview.cpp623
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro2
-rw-r--r--tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp2
-rw-r--r--tests/auto/quick/quick.pro1
30 files changed, 1433 insertions, 115 deletions
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp
index 9b3fa8fd2c..fdefa855e4 100644
--- a/tests/auto/quick/examples/tst_examples.cpp
+++ b/tests/auto/quick/examples/tst_examples.cpp
@@ -74,6 +74,7 @@ tst_examples::tst_examples()
{
// Add files to exclude here
excludedFiles << "snippets/qml/listmodel/listmodel.qml"; //Just a ListModel, no root QQuickItem
+ excludedFiles << "snippets/qml/tablemodel/fruit-example-delegatechooser.qml"; // Requires QtQuick.Controls import.
// Add directories you want excluded here
excludedDirs << "shared"; //Not an example
diff --git a/tests/auto/quick/pointerhandlers/pointerhandlers.pro b/tests/auto/quick/pointerhandlers/pointerhandlers.pro
index 950d6835eb..4d6311bdb2 100644
--- a/tests/auto/quick/pointerhandlers/pointerhandlers.pro
+++ b/tests/auto/quick/pointerhandlers/pointerhandlers.pro
@@ -10,4 +10,5 @@ qtConfig(private_tests) {
qquickpointerhandler \
qquickpointhandler \
qquicktaphandler \
+ qquickwheelhandler \
}
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/data/snapMode.qml b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/snapMode.qml
new file mode 100644
index 0000000000..d6eb791700
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/data/snapMode.qml
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ id: root
+ objectName: "snapMode"
+ width: 640
+ height: 480
+
+ Rectangle {
+ id: rect1
+ objectName: "rect1"
+ width: 90
+ height: 100
+ x: 100
+ y: 100
+ color: "teal"
+
+ Rectangle {
+ width: parent.width/2
+ height: parent.width/2
+ x: width/2
+ y: -x
+ color: dragHandler1.active ? "red" : "salmon"
+
+ DragHandler {
+ id: dragHandler1
+ objectName: "dragHandler1"
+ target: rect1
+ }
+ }
+ }
+
+
+ Rectangle {
+ id: rect2
+ objectName: "rect2"
+ width: 90
+ height: 100
+ x: 200
+ y: 100
+ color: "teal"
+
+ DragHandler {
+ id: dragHandler2
+ objectName: "dragHandler2"
+ target: rect2b
+ }
+
+ Rectangle {
+ id: rect2b
+ width: parent.width/2
+ height: parent.width/2
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: -width/2
+ color: dragHandler2.active ? "red" : "salmon"
+ }
+ }
+}
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/qquickdraghandler.pro b/tests/auto/quick/pointerhandlers/qquickdraghandler/qquickdraghandler.pro
index 42c4e46c4f..6258fb9392 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/qquickdraghandler.pro
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/qquickdraghandler.pro
@@ -19,3 +19,4 @@ OTHER_FILES += data/DragAnywhereSlider.qml \
data/grabberstate.qml \
data/multipleSliders.qml \
data/reparenting.qml \
+ data/snapMode.qml \
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
index cc8c567e5c..7636bb38f1 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
@@ -56,6 +56,8 @@ private slots:
void touchDrag();
void mouseDrag();
void dragFromMargin();
+ void snapMode_data();
+ void snapMode();
void touchDragMulti();
void touchDragMultiSliders_data();
void touchDragMultiSliders();
@@ -284,6 +286,78 @@ void tst_DragHandler::dragFromMargin() // QTBUG-74966
QCOMPARE(dragHandler->centroid().pressedButtons(), Qt::NoButton);
}
+void tst_DragHandler::snapMode_data()
+{
+ const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
+ QTest::addColumn<QString>("subTree");
+ QTest::addColumn<int>("snapMode");
+ QTest::addColumn<QPoint>("startDragPos");
+ QTest::addColumn<QPoint>("dragMovement");
+ QTest::addColumn<QPoint>("expectedMovement");
+
+ struct TestEntry {
+ const char *desc;
+ const char *subTree;
+ QQuickDragHandler::SnapMode mode;
+ QPoint startDragPos;
+ QPoint dragMovement;
+ QPoint expectedMovement;
+ };
+
+ TestEntry testdata[] = {
+ {"outside the target", "rect1", QQuickDragHandler::SnapAuto, QPoint(45, -10), QPoint(dragThreshold*2, 0), QPoint(dragThreshold*2, 0)},
+ {"inside the target", "rect1", QQuickDragHandler::SnapAuto, QPoint(45, 10), QPoint(dragThreshold*2, 0), QPoint(dragThreshold*2, 0)},
+ {"outside the target", "rect1", QQuickDragHandler::SnapAlways, QPoint(45, -10), QPoint(dragThreshold*2, 0), QPoint(dragThreshold*2, -50-10)},
+ {"outside the target", "rect1", QQuickDragHandler::NoSnap, QPoint(45, -10), QPoint(dragThreshold*2, 0), QPoint(dragThreshold*2, 0)},
+ {"outside the target", "rect1", QQuickDragHandler::SnapIfPressedOutsideTarget, QPoint(45, -10), QPoint(dragThreshold*2, 0), QPoint(dragThreshold*2, -50-10)},
+ {"inside the target", "rect1", QQuickDragHandler::SnapIfPressedOutsideTarget, QPoint(45, 10), QPoint(dragThreshold*2, 0), QPoint(dragThreshold*2, 0)},
+ //targets y pos moves from -25 to (25 + dragThreshold*2) because of snapping to center:
+ {"outside target, should snap", "rect2", QQuickDragHandler::SnapAuto, QPoint(45, 50), QPoint(0, dragThreshold*2), QPoint(0, 25 + 25 + dragThreshold*2)},
+ {"inside target, shouldn't snap", "rect2", QQuickDragHandler::SnapAuto, QPoint(45, 10), QPoint(0, dragThreshold*2), QPoint(0, dragThreshold*2)}
+ };
+
+ for (const TestEntry& e : testdata) {
+ const QMetaEnum menum = QMetaEnum::fromType<QQuickDragHandler::SnapMode>();
+ const QString dataTag = QString::fromLatin1("%1, %2, %3").arg(e.subTree).arg(menum.valueToKey(e.mode)).arg(e.desc);
+ QTest::newRow(dataTag.toUtf8().constData()) << e.subTree << (int)e.mode
+ << e.startDragPos << e.dragMovement << e.expectedMovement;
+ }
+}
+
+void tst_DragHandler::snapMode()
+{
+ QFETCH(QString, subTree);
+ QFETCH(QPoint, startDragPos);
+ QFETCH(QPoint, dragMovement);
+ QFETCH(int, snapMode);
+ QFETCH(QPoint, expectedMovement);
+
+ QScopedPointer<QQuickView> windowPtr;
+ createView(windowPtr, "snapMode.qml");
+ QQuickView * window = windowPtr.data();
+
+ QQuickItem *rect1 = window->rootObject()->findChild<QQuickItem*>(subTree);
+ QVERIFY(rect1);
+ QQuickItem *rect1b = rect1->childItems().first();
+ QVERIFY(rect1b);
+ QQuickDragHandler *dragHandler1 = rect1->findChild<QQuickDragHandler*>();
+ QVERIFY(dragHandler1);
+ dragHandler1->setSnapMode((QQuickDragHandler::SnapMode)snapMode);
+ QQuickItem *dragTarget = dragHandler1->target();
+ QPointF oldTargetPos = dragTarget->position();
+
+ QPoint p1 = rect1->mapToScene(QPointF(startDragPos)).toPoint();
+ QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, p1);
+ QVERIFY(!dragHandler1->active());
+ p1 += dragMovement;
+ QTest::mouseMove(window, p1);
+ QTRY_VERIFY(dragHandler1->active());
+ QCOMPARE(dragTarget->position(), oldTargetPos + expectedMovement);
+ QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTRY_VERIFY(!dragHandler1->active());
+ QCOMPARE(dragHandler1->centroid().pressedButtons(), Qt::NoButton);
+}
+
void tst_DragHandler::touchDragMulti()
{
const int dragThreshold = QGuiApplication::styleHints()->startDragDistance();
diff --git a/tests/auto/quick/pointerhandlers/qquickwheelhandler/data/nested.qml b/tests/auto/quick/pointerhandlers/qquickwheelhandler/data/nested.qml
new file mode 100644
index 0000000000..49e44f2b1f
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquickwheelhandler/data/nested.qml
@@ -0,0 +1,55 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.14
+
+Rectangle {
+ width: 320; height: 240
+ color: "lightsteelblue"; antialiasing: true
+ border.color: outerWheelHandler.active ? "red" : "white"
+
+ WheelHandler {
+ id: outerWheelHandler
+ objectName: "outerWheelHandler"
+ property: "x"
+ }
+
+ Rectangle {
+ width: 120; height: 120; x: 100; y: 60
+ color: "beige"; antialiasing: true
+ border.color: innerWheelHandler.active ? "red" : "white"
+
+ WheelHandler {
+ id: innerWheelHandler
+ objectName: "innerWheelHandler"
+ // TODO should ideally deactivate because events go to the outer handler, not because of timeout
+ activeTimeout: 0.5
+ property: "x"
+ }
+ }
+}
diff --git a/tests/auto/quick/pointerhandlers/qquickwheelhandler/data/rectWheel.qml b/tests/auto/quick/pointerhandlers/qquickwheelhandler/data/rectWheel.qml
new file mode 100644
index 0000000000..d4875d5313
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquickwheelhandler/data/rectWheel.qml
@@ -0,0 +1,45 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.14
+
+Rectangle {
+ width: 320; height: 240
+ color: "green"; antialiasing: true
+
+ Rectangle {
+ width: 100; height: 2; anchors.centerIn: parent
+ Rectangle {
+ width: 2; height: 100; anchors.centerIn: parent
+ }
+ }
+
+ WheelHandler {
+ activeTimeout: 0.5
+ }
+}
diff --git a/tests/auto/quick/pointerhandlers/qquickwheelhandler/qquickwheelhandler.pro b/tests/auto/quick/pointerhandlers/qquickwheelhandler/qquickwheelhandler.pro
new file mode 100644
index 0000000000..7509e38dd3
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquickwheelhandler/qquickwheelhandler.pro
@@ -0,0 +1,14 @@
+CONFIG += testcase
+TARGET = tst_qquickwheelhandler
+macos:CONFIG -= app_bundle
+
+SOURCES += tst_qquickwheelhandler.cpp
+OTHER_FILES = \
+ data/rectWheel.qml \
+
+include (../../../shared/util.pri)
+include (../../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private testlib
diff --git a/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp b/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp
new file mode 100644
index 0000000000..2abf2ea8c3
--- /dev/null
+++ b/tests/auto/quick/pointerhandlers/qquickwheelhandler/tst_qquickwheelhandler.cpp
@@ -0,0 +1,344 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QtTest>
+#include <QtTest/QSignalSpy>
+#include <QtGui/QStyleHints>
+#include <qpa/qwindowsysteminterface.h>
+#include <private/qquickwheelhandler_p.h>
+#include <QtQuick/private/qquickrectangle_p.h>
+#include <QtQuick/qquickview.h>
+#include <QtQml/qqmlcontext.h>
+#include "../../../shared/util.h"
+#include "../../shared/viewtestutil.h"
+
+Q_LOGGING_CATEGORY(lcPointerTests, "qt.quick.pointer.tests")
+
+class tst_QQuickWheelHandler: public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_QQuickWheelHandler() { }
+
+private slots:
+ void singleHandler_data();
+ void singleHandler();
+ void nestedHandler_data();
+ void nestedHandler();
+
+private:
+ void sendWheelEvent(QQuickView &window, QPoint pos, QPoint angleDelta,
+ QPoint pixelDelta = QPoint(), Qt::KeyboardModifiers modifiers = Qt::NoModifier,
+ Qt::ScrollPhase phase = Qt::NoScrollPhase, bool inverted = false);
+};
+
+void tst_QQuickWheelHandler::sendWheelEvent(QQuickView &window, QPoint pos, QPoint angleDelta,
+ QPoint pixelDelta, Qt::KeyboardModifiers modifiers, Qt::ScrollPhase phase, bool inverted)
+{
+ QWheelEvent wheelEvent(pos, window.mapToGlobal(pos), pixelDelta, angleDelta,
+ Qt::NoButton, modifiers, phase, inverted);
+ QGuiApplication::sendEvent(&window, &wheelEvent);
+ qApp->processEvents();
+}
+
+void tst_QQuickWheelHandler::singleHandler_data()
+{
+ // handler properties
+ QTest::addColumn<Qt::Orientation>("orientation");
+ QTest::addColumn<bool>("invertible");
+ QTest::addColumn<int>("rotationScale");
+ QTest::addColumn<QString>("property");
+ QTest::addColumn<qreal>("targetScaleMultiplier");
+ QTest::addColumn<bool>("targetTransformAroundCursor");
+ // event
+ QTest::addColumn<QPoint>("eventPos");
+ QTest::addColumn<QPoint>("eventAngleDelta");
+ QTest::addColumn<QPoint>("eventPixelDelta");
+ QTest::addColumn<Qt::KeyboardModifiers>("eventModifiers");
+ QTest::addColumn<bool>("eventPhases");
+ QTest::addColumn<bool>("eventInverted");
+ // result
+ QTest::addColumn<QPoint>("expectedPosition");
+ QTest::addColumn<qreal>("expectedScale");
+ QTest::addColumn<int>("expectedRotation");
+
+ // move the item
+ QTest::newRow("vertical wheel angle delta to adjust x")
+ << Qt::Vertical << false << 1 << "x" << 1.5 << true
+ << QPoint(160, 120) << QPoint(-360, 120) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false
+ << QPoint(15, 0) << 1.0 << 0;
+ QTest::newRow("horizontal wheel angle delta to adjust y")
+ << Qt::Horizontal << false << 1 << "y" << 1.5 << false
+ << QPoint(160, 120) << QPoint(-360, 120) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false
+ << QPoint(0, -45) << 1.0 << 0;
+ QTest::newRow("vertical wheel angle delta to adjust y, amplified and inverted")
+ << Qt::Vertical << true << 4 << "y" << 1.5 << true
+ << QPoint(160, 120) << QPoint(60, 60) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << true
+ << QPoint(0, 30) << 1.0 << 0;
+ QTest::newRow("horizontal wheel angle delta to adjust x, amplified and reversed")
+ << Qt::Horizontal << false << -4 << "x" << 1.5 << false
+ << QPoint(160, 120) << QPoint(60, 60) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false
+ << QPoint(-30, 0) << 1.0 << 0;
+ QTest::newRow("vertical wheel pixel delta to adjust x")
+ << Qt::Vertical << false << 1 << "x" << 1.5 << true
+ << QPoint(160, 120) << QPoint(-360, 120) << QPoint(20, 20) << Qt::KeyboardModifiers(Qt::NoModifier) << true << false
+ << QPoint(20, 0) << 1.0 << 0;
+ QTest::newRow("horizontal wheel pixel delta to adjust y")
+ << Qt::Horizontal << false << 1 << "y" << 1.5 << false
+ << QPoint(160, 120) << QPoint(-360, 120) << QPoint(20, 20) << Qt::KeyboardModifiers(Qt::NoModifier) << true << false
+ << QPoint(0, 20) << 1.0 << 0;
+ QTest::newRow("vertical wheel pixel delta to adjust y, amplified and inverted")
+ << Qt::Vertical << true << 4 << "y" << 1.5 << true
+ << QPoint(160, 120) << QPoint(60, 60) << QPoint(20, 20) << Qt::KeyboardModifiers(Qt::NoModifier) << true << true
+ << QPoint(0, 80) << 1.0 << 0;
+ QTest::newRow("horizontal wheel pixel delta to adjust x, amplified and reversed")
+ << Qt::Horizontal << false << -4 << "x" << 1.5 << false
+ << QPoint(160, 120) << QPoint(60, 60) << QPoint(20, 20) << Qt::KeyboardModifiers(Qt::NoModifier) << true << false
+ << QPoint(-80, 0) << 1.0 << 0;
+
+ // scale the item
+ QTest::newRow("vertical wheel angle delta to adjust scale")
+ << Qt::Vertical << false << 1 << "scale" << 1.5 << true
+ << QPoint(50, 32) << QPoint(360, 120) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false
+ << QPoint(55, 44) << 1.5 << 0;
+ QTest::newRow("horizontal wheel angle delta to adjust scale, amplified and reversed, don't adjust position")
+ << Qt::Horizontal << false << -2 << "scale" << 1.5 << false
+ << QPoint(50, 32) << QPoint(-240, 360) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false
+ << QPoint(0, 0) << 5.0625 << 0;
+
+ // rotate the item
+ QTest::newRow("vertical wheel angle delta to adjust rotation")
+ << Qt::Vertical << false << 1 << "rotation" << 1.5 << true
+ << QPoint(50, 32) << QPoint(360, -120) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false
+ << QPoint(19, -31) << 1.0 << -15;
+ QTest::newRow("horizontal wheel angle delta to adjust rotation, amplified and reversed, don't adjust position")
+ << Qt::Horizontal << false << -2 << "rotation" << 1.5 << false
+ << QPoint(80, 80) << QPoint(240, 360) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false
+ << QPoint(0, 0) << 1.0 << -60;
+}
+
+void tst_QQuickWheelHandler::singleHandler()
+{
+ // handler properties
+ QFETCH(Qt::Orientation, orientation);
+ QFETCH(bool, invertible);
+ QFETCH(int, rotationScale);
+ QFETCH(QString, property);
+ QFETCH(qreal, targetScaleMultiplier);
+ QFETCH(bool, targetTransformAroundCursor);
+ // event
+ QFETCH(QPoint, eventPos);
+ QFETCH(QPoint, eventAngleDelta);
+ QFETCH(QPoint, eventPixelDelta);
+ QFETCH(Qt::KeyboardModifiers, eventModifiers);
+ QFETCH(bool, eventPhases);
+ QFETCH(bool, eventInverted);
+ // result
+ QFETCH(QPoint, expectedPosition);
+ QFETCH(qreal, expectedScale);
+ QFETCH(int, expectedRotation);
+
+ QQuickView window;
+ QByteArray errorMessage;
+ QVERIFY2(QQuickTest::initView(window, testFileUrl("rectWheel.qml"), true, &errorMessage), errorMessage.constData());
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ QQuickItem *rect = window.rootObject();
+ QVERIFY(rect != nullptr);
+ QQuickWheelHandler *handler = rect->findChild<QQuickWheelHandler*>();
+ QVERIFY(handler != nullptr);
+ handler->setOrientation(orientation);
+ handler->setInvertible(invertible);
+ handler->setRotationScale(rotationScale);
+ handler->setProperty(property);
+ handler->setTargetScaleMultiplier(targetScaleMultiplier);
+ handler->setTargetTransformAroundCursor(targetTransformAroundCursor);
+ QSignalSpy activeChangedSpy(handler, SIGNAL(activeChanged()));
+
+ if (eventPhases) {
+ sendWheelEvent(window, eventPos, QPoint(), QPoint(), eventModifiers, Qt::ScrollBegin, eventInverted);
+ sendWheelEvent(window, eventPos, eventAngleDelta, eventPixelDelta, eventModifiers, Qt::ScrollUpdate, eventInverted);
+ } else {
+ sendWheelEvent(window, eventPos, eventAngleDelta, eventPixelDelta, eventModifiers, Qt::NoScrollPhase, eventInverted);
+ }
+ QCOMPARE(rect->position().toPoint(), expectedPosition);
+ QCOMPARE(activeChangedSpy.count(), 1);
+ QCOMPARE(handler->active(), true);
+ QCOMPARE(rect->scale(), expectedScale);
+ QCOMPARE(rect->rotation(), expectedRotation);
+ if (!eventPhases) {
+ QTRY_COMPARE(handler->active(), false);
+ QCOMPARE(activeChangedSpy.count(), 2);
+ }
+
+ // restore by rotating backwards
+ if (eventPhases) {
+ sendWheelEvent(window, eventPos, eventAngleDelta * -1, eventPixelDelta * -1, eventModifiers, Qt::ScrollUpdate, eventInverted);
+ sendWheelEvent(window, eventPos, QPoint(), QPoint(), eventModifiers, Qt::ScrollEnd, eventInverted);
+ } else {
+ sendWheelEvent(window, eventPos, eventAngleDelta * -1, eventPixelDelta * -1, eventModifiers, Qt::NoScrollPhase, eventInverted);
+ }
+ QCOMPARE(activeChangedSpy.count(), eventPhases ? 2 : 3);
+ QCOMPARE(handler->active(), !eventPhases);
+ QCOMPARE(rect->position().toPoint(), QPoint(0, 0));
+ QCOMPARE(rect->scale(), 1);
+ QCOMPARE(rect->rotation(), 0);
+}
+
+void tst_QQuickWheelHandler::nestedHandler_data()
+{
+ // handler properties
+ QTest::addColumn<Qt::Orientation>("orientation");
+ QTest::addColumn<bool>("invertible");
+ QTest::addColumn<int>("rotationScale");
+ QTest::addColumn<QString>("property");
+ QTest::addColumn<qreal>("targetScaleMultiplier");
+ QTest::addColumn<bool>("targetTransformAroundCursor");
+ // event
+ QTest::addColumn<QPoint>("eventPos");
+ QTest::addColumn<QPoint>("eventAngleDelta");
+ QTest::addColumn<QPoint>("eventPixelDelta");
+ QTest::addColumn<Qt::KeyboardModifiers>("eventModifiers");
+ QTest::addColumn<bool>("eventPhases");
+ QTest::addColumn<bool>("eventInverted");
+ QTest::addColumn<int>("eventCount");
+ // result: inner handler
+ QTest::addColumn<QPoint>("innerPosition");
+ QTest::addColumn<qreal>("innerScale");
+ QTest::addColumn<int>("innerRotation");
+ // result: outer handler
+ QTest::addColumn<QPoint>("outerPosition");
+ QTest::addColumn<qreal>("outerScale");
+ QTest::addColumn<int>("outerRotation");
+
+ // move the item
+ QTest::newRow("vertical wheel angle delta to adjust x")
+ << Qt::Vertical << false << 1 << "x" << 1.5 << true
+ << QPoint(160, 120) << QPoint(120, 120) << QPoint() << Qt::KeyboardModifiers(Qt::NoModifier) << false << false << 10
+ << QPoint(175,60) << 1.0 << 0
+ << QPoint(75, 0) << 1.0 << 0;
+ QTest::newRow("horizontal wheel pixel delta to adjust y")
+ << Qt::Horizontal << false << 1 << "y" << 1.5 << false
+ << QPoint(160, 120) << QPoint(120, 120) << QPoint(50, 50) << Qt::KeyboardModifiers(Qt::NoModifier) << true << false << 4
+ << QPoint(100, 160) << 1.0 << 0
+ << QPoint(0, 100) << 1.0 << 0;
+}
+
+void tst_QQuickWheelHandler::nestedHandler()
+{
+ // handler properties
+ QFETCH(Qt::Orientation, orientation);
+ QFETCH(bool, invertible);
+ QFETCH(int, rotationScale);
+ QFETCH(QString, property);
+ QFETCH(qreal, targetScaleMultiplier);
+ QFETCH(bool, targetTransformAroundCursor);
+ // event
+ QFETCH(QPoint, eventPos);
+ QFETCH(QPoint, eventAngleDelta);
+ QFETCH(QPoint, eventPixelDelta);
+ QFETCH(Qt::KeyboardModifiers, eventModifiers);
+ QFETCH(bool, eventPhases);
+ QFETCH(bool, eventInverted);
+ QFETCH(int, eventCount);
+ // result: inner handler
+ QFETCH(QPoint, innerPosition);
+ QFETCH(qreal, innerScale);
+ QFETCH(int, innerRotation);
+ // result: outer handler
+ QFETCH(QPoint, outerPosition);
+ QFETCH(qreal, outerScale);
+ QFETCH(int, outerRotation);
+
+ QQuickView window;
+ QByteArray errorMessage;
+ QVERIFY2(QQuickTest::initView(window, testFileUrl("nested.qml"), true, &errorMessage), errorMessage.constData());
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+
+ QQuickItem *outerRect = window.rootObject();
+ QVERIFY(outerRect != nullptr);
+ QQuickWheelHandler *outerHandler = outerRect->findChild<QQuickWheelHandler*>("outerWheelHandler");
+ QVERIFY(outerHandler != nullptr);
+ QQuickWheelHandler *innerHandler = outerRect->findChild<QQuickWheelHandler*>("innerWheelHandler");
+ QVERIFY(innerHandler != nullptr);
+ QQuickItem *innerRect = innerHandler->parentItem();
+ QVERIFY(innerRect != nullptr);
+ innerHandler->setOrientation(orientation);
+ innerHandler->setInvertible(invertible);
+ innerHandler->setRotationScale(rotationScale);
+ innerHandler->setProperty(property);
+ innerHandler->setTargetScaleMultiplier(targetScaleMultiplier);
+ innerHandler->setTargetTransformAroundCursor(targetTransformAroundCursor);
+ outerHandler->setOrientation(orientation);
+ outerHandler->setInvertible(invertible);
+ outerHandler->setRotationScale(rotationScale);
+ outerHandler->setProperty(property);
+ outerHandler->setTargetScaleMultiplier(targetScaleMultiplier);
+ outerHandler->setTargetTransformAroundCursor(targetTransformAroundCursor);
+ QSignalSpy innerActiveChangedSpy(innerHandler, SIGNAL(activeChanged()));
+ QSignalSpy outerActiveChangedSpy(outerHandler, SIGNAL(activeChanged()));
+
+ if (eventPhases)
+ sendWheelEvent(window, eventPos, QPoint(), QPoint(), eventModifiers, Qt::ScrollBegin, eventInverted);
+ for (int i = 0; i < eventCount; ++i)
+ sendWheelEvent(window, eventPos, eventAngleDelta, eventPixelDelta, eventModifiers,
+ (eventPhases ? Qt::ScrollUpdate : Qt::NoScrollPhase), eventInverted);
+ QCOMPARE(innerRect->position().toPoint(), innerPosition);
+
+ /*
+ If outer is activated, maybe inner should be deactivated? But the event
+ doesn't get delivered to inner anymore, so it doesn't find out that
+ it's no longer getting events. It will get deactivated after the
+ timeout, just as if the user stopped scrolling.
+
+ This situation is similar to QTBUG-50199, but it's questionable whether
+ that was really so important. So far in Qt Quick, if you move the mouse
+ while wheel momentum continues, or if the item moves out from under the
+ mouse, a different item starts getting the events immediately. In
+ non-Qt applications on most OSes, that's quite normal.
+ */
+ // QCOMPARE(innerActiveChangedSpy.count(), 2);
+ // QCOMPARE(innerHandler->active(), false);
+ QCOMPARE(innerRect->scale(), innerScale);
+ QCOMPARE(innerRect->rotation(), innerRotation);
+ QCOMPARE(outerRect->position().toPoint(), outerPosition);
+ QCOMPARE(outerActiveChangedSpy.count(), 1);
+ QCOMPARE(outerHandler->active(), true);
+ QCOMPARE(outerRect->scale(), outerScale);
+ QCOMPARE(outerRect->rotation(), outerRotation);
+ if (!eventPhases) {
+ QTRY_COMPARE(outerHandler->active(), false);
+ QCOMPARE(outerActiveChangedSpy.count(), 2);
+ }
+}
+
+QTEST_MAIN(tst_QQuickWheelHandler)
+
+#include "tst_qquickwheelhandler.moc"
diff --git a/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp b/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp
index 34be4d98b4..5781a007b6 100644
--- a/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp
+++ b/tests/auto/quick/propertyrequirements/tst_propertyrequirements.cpp
@@ -28,7 +28,6 @@
#include <qtest.h>
#include <QtQml/qqmlcomponent.h>
#include <QtQml/qqmlengine.h>
-#include <QtQml/private/qhashedstring_p.h>
#include <QtQml/private/qqmlmetatype_p.h>
#include <QtCore/QDebug>
#include <QtCore/QHash>
diff --git a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
index 77fa1292c4..128a154492 100644
--- a/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
+++ b/tests/auto/quick/qquickanchors/tst_qquickanchors.cpp
@@ -364,7 +364,7 @@ void tst_qquickanchors::reset()
const QMetaObject *meta = itemPrivate->anchors()->metaObject();
QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData()));
- QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchorLine)));
+ QVERIFY(p.write(itemPrivate->anchors(), QVariant::fromValue(anchorLine)));
QCOMPARE(itemPrivate->anchors()->usedAnchors().testFlag(anchor), true);
QVERIFY(p.reset(itemPrivate->anchors()));
@@ -423,7 +423,7 @@ void tst_qquickanchors::nullItem()
QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData()));
QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML Item: Cannot anchor to a null item.");
- QVERIFY(p.write(itemPrivate->anchors(), qVariantFromValue(anchor)));
+ QVERIFY(p.write(itemPrivate->anchors(), QVariant::fromValue(anchor)));
delete item;
}
diff --git a/tests/auto/quick/qquickanimations/qquickanimations.pro b/tests/auto/quick/qquickanimations/qquickanimations.pro
index 8bb1f47af5..cd0a0fbb15 100644
--- a/tests/auto/quick/qquickanimations/qquickanimations.pro
+++ b/tests/auto/quick/qquickanimations/qquickanimations.pro
@@ -8,7 +8,7 @@ macx:CONFIG -= app_bundle
TESTDATA = data/*
-QT += core-private gui-private qml-private quick-private testlib
+QT += core-private gui-private qml-private quick-private testlib qmlmodels-private
DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0
OTHER_FILES += \
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index 961506372a..b75dc8bc6b 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -30,7 +30,7 @@
#include <QtQml/qqmlcomponent.h>
#include <QtQuick/qquickview.h>
#include <QtQml/private/qqmltimer_p.h>
-#include <QtQml/private/qqmllistmodel_p.h>
+#include <QtQmlModels/private/qqmllistmodel_p.h>
#include <QtQml/private/qanimationgroupjob_p.h>
#include <QtQuick/private/qquickrectangle_p.h>
#include <QtQuick/private/qquickitemanimation_p.h>
diff --git a/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml b/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml
new file mode 100644
index 0000000000..c66fd76ff1
--- /dev/null
+++ b/tests/auto/quick/qquickboundaryrule/data/dragHandler.qml
@@ -0,0 +1,23 @@
+import QtQuick 2.14
+import Qt.labs.animation 1.0
+
+Rectangle {
+ id: root
+ width: 240; height: 120
+ color: "green"
+
+ DragHandler {
+ id: dragHandler
+ yAxis.minimum: -1000
+ xAxis.minimum: -1000
+ onActiveChanged: if (!active) xbr.returnToBounds();
+ }
+
+ BoundaryRule on x {
+ id: xbr
+ minimum: -50
+ maximum: 100
+ minimumOvershoot: 40
+ maximumOvershoot: 40
+ }
+}
diff --git a/tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro b/tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro
new file mode 100644
index 0000000000..ef43f4526a
--- /dev/null
+++ b/tests/auto/quick/qquickboundaryrule/qquickboundaryrule.pro
@@ -0,0 +1,12 @@
+CONFIG += testcase
+TARGET = tst_qquickboundaryrule
+macx:CONFIG -= app_bundle
+
+SOURCES += tst_qquickboundaryrule.cpp
+
+include (../../shared/util.pri)
+include (../shared/util.pri)
+
+TESTDATA = data/*
+
+QT += core-private gui-private qml-private quick-private testlib
diff --git a/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp
new file mode 100644
index 0000000000..44f1c9a2f9
--- /dev/null
+++ b/tests/auto/quick/qquickboundaryrule/tst_qquickboundaryrule.cpp
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:GPL-EXCEPT$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3 as published by the Free Software
+** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include <QtTest/QtTest>
+#include <qsignalspy.h>
+#include <QtQml/qqmlengine.h>
+#include <QtQml/qqmlcomponent.h>
+#include <QtQuick/qquickview.h>
+#include <QtQuick/private/qquickboundaryrule_p.h>
+#include <QtQuick/private/qquickdraghandler_p.h>
+#include "../../shared/util.h"
+#include "../shared/viewtestutil.h"
+
+class tst_qquickboundaryrule : public QQmlDataTest
+{
+ Q_OBJECT
+public:
+ tst_qquickboundaryrule() {}
+
+private slots:
+ void init() { qApp->processEvents(); } //work around animation timer bug (QTBUG-22865)
+ void dragHandler();
+};
+
+void tst_qquickboundaryrule::dragHandler()
+{
+ QQuickView window;
+ QByteArray errorMessage;
+ QVERIFY2(QQuickTest::initView(window, testFileUrl("dragHandler.qml"), true, &errorMessage), errorMessage.constData());
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+ QQuickItem *target = window.rootObject();
+ QVERIFY(target);
+ QQuickDragHandler *dragHandler = target->findChild<QQuickDragHandler*>();
+ QVERIFY(dragHandler);
+ QQuickBoundaryRule *boundaryRule = target->findChild<QQuickBoundaryRule*>();
+ QVERIFY(boundaryRule);
+ QSignalSpy overshootChangedSpy(boundaryRule, SIGNAL(currentOvershootChanged()));
+
+ QPoint p1(10, 10);
+ QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ // unrestricted drag
+ p1 += QPoint(100, 0);
+ QTest::mouseMove(&window, p1);
+ QTRY_VERIFY(dragHandler->active());
+ QCOMPARE(target->position().x(), 100);
+ QCOMPARE(boundaryRule->currentOvershoot(), 0);
+ QCOMPARE(boundaryRule->peakOvershoot(), 0);
+ QCOMPARE(overshootChangedSpy.count(), 0);
+ // restricted drag: halfway into overshoot
+ p1 += QPoint(20, 0);
+ QTest::mouseMove(&window, p1);
+ QCOMPARE(target->position().x(), 117.5);
+ QCOMPARE(boundaryRule->currentOvershoot(), 20);
+ QCOMPARE(boundaryRule->peakOvershoot(), 20);
+ QCOMPARE(overshootChangedSpy.count(), 1);
+ // restricted drag: maximum overshoot
+ p1 += QPoint(80, 0);
+ QTest::mouseMove(&window, p1);
+ QCOMPARE(target->position().x(), 140);
+ QCOMPARE(boundaryRule->currentOvershoot(), 100);
+ QCOMPARE(boundaryRule->peakOvershoot(), 100);
+ QCOMPARE(overshootChangedSpy.count(), 2);
+ // release and let it return to bounds
+ QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p1);
+ QTRY_COMPARE(dragHandler->active(), false);
+ QTRY_COMPARE(overshootChangedSpy.count(), 3);
+ QCOMPARE(boundaryRule->currentOvershoot(), 0);
+ QCOMPARE(boundaryRule->peakOvershoot(), 0);
+ QCOMPARE(target->position().x(), 100);
+}
+
+QTEST_MAIN(tst_qquickboundaryrule)
+
+#include "tst_qquickboundaryrule.moc"
diff --git a/tests/auto/quick/qquickgridview/qquickgridview.pro b/tests/auto/quick/qquickgridview/qquickgridview.pro
index 5051f8bc62..0390637058 100644
--- a/tests/auto/quick/qquickgridview/qquickgridview.pro
+++ b/tests/auto/quick/qquickgridview/qquickgridview.pro
@@ -10,5 +10,5 @@ include (../shared/util.pri)
TESTDATA = data/*
-QT += core-private gui-private qml-private quick-private testlib qmltest
+QT += core-private gui-private qml-private quick-private testlib qmltest qmlmodels-private
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 448096720c..b65b8770b1 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -40,7 +40,7 @@
#include <QtQuick/private/qquickitemview_p_p.h>
#include <QtQuick/private/qquickgridview_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQml/private/qqmllistmodel_p.h>
+#include <QtQmlModels/private/qqmllistmodel_p.h>
#include "../../shared/util.h"
#include "../shared/viewtestutil.h"
#include "../shared/visualtestutil.h"
diff --git a/tests/auto/quick/qquicklistview/qquicklistview.pro b/tests/auto/quick/qquicklistview/qquicklistview.pro
index fd96c269a2..b08fca2b1d 100644
--- a/tests/auto/quick/qquicklistview/qquicklistview.pro
+++ b/tests/auto/quick/qquicklistview/qquicklistview.pro
@@ -18,5 +18,5 @@ include (../shared/util.pri)
TESTDATA = data/*
DISTFILES += data/*
-QT += core-private gui-private qml-private quick-private testlib qmltest
+QT += core-private gui-private qml-private quick-private testlib qmltest qmlmodels-private
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 2ea8a477a8..894a5ee16e 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -40,9 +40,9 @@
#include <QtQuick/private/qquicklistview_p.h>
#include <QtQuick/private/qquickmousearea_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQml/private/qqmlobjectmodel_p.h>
-#include <QtQml/private/qqmllistmodel_p.h>
-#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <QtQmlModels/private/qqmlobjectmodel_p.h>
+#include <QtQmlModels/private/qqmllistmodel_p.h>
+#include <QtQmlModels/private/qqmldelegatemodel_p.h>
#include "../../shared/util.h"
#include "../shared/viewtestutil.h"
#include "../shared/visualtestutil.h"
diff --git a/tests/auto/quick/qquickpathview/qquickpathview.pro b/tests/auto/quick/qquickpathview/qquickpathview.pro
index f21fb64fa4..5eb24b89bd 100644
--- a/tests/auto/quick/qquickpathview/qquickpathview.pro
+++ b/tests/auto/quick/qquickpathview/qquickpathview.pro
@@ -9,5 +9,5 @@ include (../shared/util.pri)
TESTDATA = data/*
-QT += core-private gui-private qml-private quick-private testlib qmltest
+QT += core-private gui-private qml-private quick-private testlib qmltest qmlmodels-private
qtHaveModule(widgets): QT += widgets
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
index 1a5ce39318..a1b2b64ae2 100644
--- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
+++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp
@@ -39,7 +39,7 @@
#include <QtQuick/private/qquicktext_p.h>
#include <QtQuick/private/qquickrectangle_p.h>
#include <QtQuickTest/QtQuickTest>
-#include <QtQml/private/qqmllistmodel_p.h>
+#include <QtQmlModels/private/qqmllistmodel_p.h>
#include <QtQml/private/qqmlvaluetype_p.h>
#include <QtGui/qstandarditemmodel.h>
#include <QStringListModel>
diff --git a/tests/auto/quick/qquickrepeater/qquickrepeater.pro b/tests/auto/quick/qquickrepeater/qquickrepeater.pro
index 5554342943..aed5702266 100644
--- a/tests/auto/quick/qquickrepeater/qquickrepeater.pro
+++ b/tests/auto/quick/qquickrepeater/qquickrepeater.pro
@@ -9,4 +9,4 @@ include (../shared/util.pri)
TESTDATA = data/*
-QT += core-private gui-private qml-private quick-private testlib
+QT += core-private gui-private qml-private quick-private testlib qmlmodels-private
diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
index e4b427f6ec..65e7d29595 100644
--- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
+++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp
@@ -35,8 +35,8 @@
#include <QtQml/qqmlincubator.h>
#include <private/qquickrepeater_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQml/private/qqmllistmodel_p.h>
-#include <QtQml/private/qqmlobjectmodel_p.h>
+#include <QtQmlModels/private/qqmllistmodel_p.h>
+#include <QtQmlModels/private/qqmlobjectmodel_p.h>
#include <QtGui/qstandarditemmodel.h>
#include "../../shared/util.h"
@@ -899,15 +899,15 @@ void tst_QQuickRepeater::destroyCount()
QQuickRepeater *repeater = findItem<QQuickRepeater>(rootObject, "repeater");
QVERIFY(repeater);
- repeater->setProperty("model", qVariantFromValue<int>(3));
+ repeater->setProperty("model", QVariant::fromValue<int>(3));
QCOMPARE(repeater->property("componentCount").toInt(), 3);
- repeater->setProperty("model", qVariantFromValue<int>(0));
+ repeater->setProperty("model", QVariant::fromValue<int>(0));
QCOMPARE(repeater->property("componentCount").toInt(), 0);
- repeater->setProperty("model", qVariantFromValue<int>(4));
+ repeater->setProperty("model", QVariant::fromValue<int>(4));
QCOMPARE(repeater->property("componentCount").toInt(), 4);
QStringListModel model;
- repeater->setProperty("model", qVariantFromValue<QStringListModel *>(&model));
+ repeater->setProperty("model", QVariant::fromValue<QStringListModel *>(&model));
QCOMPARE(repeater->property("componentCount").toInt(), 0);
QStringList list;
list << "1" << "2" << "3" << "4";
@@ -915,7 +915,7 @@ void tst_QQuickRepeater::destroyCount()
QCOMPARE(repeater->property("componentCount").toInt(), 4);
model.insertRows(2,1);
QModelIndex index = model.index(2);
- model.setData(index, qVariantFromValue<QString>(QStringLiteral("foobar")));
+ model.setData(index, QVariant::fromValue<QString>(QStringLiteral("foobar")));
QCOMPARE(repeater->property("componentCount").toInt(), 5);
model.removeRows(2,1);
diff --git a/tests/auto/quick/qquicktableview/data/syncviewsimple.qml b/tests/auto/quick/qquicktableview/data/syncviewsimple.qml
new file mode 100644
index 0000000000..012cceaa9d
--- /dev/null
+++ b/tests/auto/quick/qquicktableview/data/syncviewsimple.qml
@@ -0,0 +1,122 @@
+/****************************************************************************
+**
+** Copyright (C) 2019 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the QtQuick module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.14
+import QtQuick.Window 2.3
+
+Item {
+ width: 640
+ height: 450
+
+ property alias tableView: mainTableView
+ property alias tableViewH: tableViewH
+ property alias tableViewV: tableViewV
+ property alias tableViewHV: tableViewHV
+
+ Column {
+ spacing: 10
+ TableView {
+ id: tableViewH
+ objectName: "Hor"
+ width: 600
+ height: 100
+ anchors.margins: 1
+ clip: true
+ delegate: tableViewDelegate
+ syncView: mainTableView
+ syncDirection: Qt.Horizontal
+ }
+
+ TableView {
+ id: tableViewV
+ objectName: "Ver"
+ width: 600
+ height: 100
+ anchors.margins: 1
+ clip: true
+ delegate: tableViewDelegate
+ syncView: mainTableView
+ syncDirection: Qt.Vertical
+ }
+
+ TableView {
+ id: tableViewHV
+ objectName: "HorVer"
+ width: 600
+ height: 100
+ anchors.margins: 1
+ clip: true
+ delegate: tableViewDelegate
+ syncView: mainTableView
+ }
+
+ TableView {
+ id: mainTableView
+ objectName: "root"
+ width: 600
+ height: 100
+ anchors.margins: 1
+ clip: true
+ delegate: tableViewDelegate
+ columnSpacing: 1
+ rowSpacing: 1
+
+ columnWidthProvider: function(c) { return 50 + c }
+ rowHeightProvider: function(r) { return 25 + r }
+ }
+ }
+
+ Component {
+ id: tableViewDelegate
+ Rectangle {
+ objectName: "tableViewDelegate"
+ color: "lightgray"
+ border.width: 1
+ implicitWidth: 30
+ implicitHeight: 60
+
+ Text {
+ anchors.centerIn: parent
+ font.pixelSize: 10
+ text: parent.TableView.view.objectName + "\n" + column + ", " + row
+ }
+ }
+ }
+
+}
diff --git a/tests/auto/quick/qquicktableview/qquicktableview.pro b/tests/auto/quick/qquicktableview/qquicktableview.pro
index cf831ed5b5..da0c0b01d0 100644
--- a/tests/auto/quick/qquicktableview/qquicktableview.pro
+++ b/tests/auto/quick/qquicktableview/qquicktableview.pro
@@ -11,5 +11,5 @@ include (../shared/util.pri)
TESTDATA = data/*
-QT += core-private gui-private qml-private quick-private testlib
+QT += core-private gui-private qml-private quick-private testlib qmlmodels-private
diff --git a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
index 60d48bb59f..fbe56abda5 100644
--- a/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
+++ b/tests/auto/quick/qquicktableview/tst_qquicktableview.cpp
@@ -38,8 +38,8 @@
#include <QtQml/qqmlcontext.h>
#include <QtQml/qqmlexpression.h>
#include <QtQml/qqmlincubator.h>
-#include <QtQml/private/qqmlobjectmodel_p.h>
-#include <QtQml/private/qqmllistmodel_p.h>
+#include <QtQmlModels/private/qqmlobjectmodel_p.h>
+#include <QtQmlModels/private/qqmllistmodel_p.h>
#include "testmodel.h"
@@ -57,17 +57,17 @@ static const char *kModelDataBindingProp = "modelDataBinding";
Q_DECLARE_METATYPE(QMarginsF);
-#define DECLARE_TABLEVIEW_VARIABLES \
- auto tableView = view->rootObject()->property(kTableViewPropName).value<QQuickTableView *>(); \
- QVERIFY(tableView); \
- auto tableViewPrivate = QQuickTableViewPrivate::get(tableView); \
- Q_UNUSED(tableViewPrivate)
+#define GET_QML_TABLEVIEW(PROPNAME) \
+ auto PROPNAME = view->rootObject()->property(#PROPNAME).value<QQuickTableView *>(); \
+ QVERIFY(PROPNAME); \
+ auto PROPNAME ## Private = QQuickTableViewPrivate::get(PROPNAME); \
+ Q_UNUSED(PROPNAME ## Private)
#define LOAD_TABLEVIEW(fileName) \
view->setSource(testFileUrl(fileName)); \
view->show(); \
QVERIFY(QTest::qWaitForWindowActive(view)); \
- DECLARE_TABLEVIEW_VARIABLES
+ GET_QML_TABLEVIEW(tableView)
#define LOAD_TABLEVIEW_ASYNC(fileName) \
view->setSource(testFileUrl("asyncloader.qml")); \
@@ -77,11 +77,12 @@ Q_DECLARE_METATYPE(QMarginsF);
loader->setSource(QUrl::fromLocalFile("data/" fileName)); \
QTRY_VERIFY(loader->item()); \
QCOMPARE(loader->status(), QQuickLoader::Status::Ready); \
- DECLARE_TABLEVIEW_VARIABLES
+ GET_QML_TABLEVIEW(tableView)
-#define WAIT_UNTIL_POLISHED \
- QVERIFY(QQuickTest::qIsPolishScheduled(tableView)); \
- QVERIFY(QQuickTest::qWaitForItemPolished(tableView))
+#define WAIT_UNTIL_POLISHED_ARG(item) \
+ QVERIFY(QQuickTest::qIsPolishScheduled(item)); \
+ QVERIFY(QQuickTest::qWaitForItemPolished(item))
+#define WAIT_UNTIL_POLISHED WAIT_UNTIL_POLISHED_ARG(tableView)
class tst_QQuickTableView : public QQmlDataTest
{
@@ -122,6 +123,9 @@ private slots:
void checkContentWidthAndHeight();
void checkPageFlicking();
void checkExplicitContentWidthAndHeight();
+ void checkExtents_origin();
+ void checkExtents_endExtent();
+ void checkExtents_moveTableToEdge();
void checkContentXY();
void noDelegate();
void changeDelegateDuringUpdate();
@@ -162,6 +166,13 @@ private slots:
void hideRowsAndColumns_data();
void hideRowsAndColumns();
void checkThatRevisionedPropertiesCannotBeUsedInOldImports();
+ void checkSyncView_rootView_data();
+ void checkSyncView_rootView();
+ void checkSyncView_childViews_data();
+ void checkSyncView_childViews();
+ void checkSyncView_differentSizedModels();
+ void checkSyncView_connect_late_data();
+ void checkSyncView_connect_late();
};
tst_QQuickTableView::tst_QQuickTableView()
@@ -552,7 +563,7 @@ void tst_QQuickTableView::checkForceLayoutFunction()
void tst_QQuickTableView::checkContentWidthAndHeight()
{
- // Check that contentWidth/Height reports the correct size of the the
+ // Check that contentWidth/Height reports the correct size of the
// table, based on knowledge of the rows and columns that has been loaded.
LOAD_TABLEVIEW("contentwidthheight.qml");
@@ -563,11 +574,7 @@ void tst_QQuickTableView::checkContentWidthAndHeight()
const int tableSize = 100;
const int cellSizeSmall = 100;
- const int cellSizeLarge = 200;
const int spacing = 1;
- const int smallCellCount = 20;
- const int largeCellCount = tableSize - smallCellCount;
- const qreal accumulatedSpacing = ((tableSize - 1) * spacing);
auto model = TestModelAsVariant(tableSize, tableSize);
tableView->setModel(model);
@@ -580,72 +587,12 @@ void tst_QQuickTableView::checkContentWidthAndHeight()
QCOMPARE(tableViewPrivate->averageEdgeSize.width(), cellSizeSmall);
QCOMPARE(tableViewPrivate->averageEdgeSize.height(), cellSizeSmall);
- // Flick in 5 more rows and columns, but not so far that we start loading in
- // the ones that are bigger. Loading in more rows and columns of the same
- // size as the initial ones should not change the first prediction.
- qreal flickTo = ((cellSizeSmall + spacing) * 5);
- tableView->setContentX(flickTo);
- tableView->setContentY(flickTo);
+ // Flick to the end, and check that content width/height stays unchanged
+ tableView->setContentX(tableView->contentWidth() - tableView->width());
+ tableView->setContentY(tableView->contentHeight() - tableView->height());
QCOMPARE(tableView->contentWidth(), expectedSizeInit);
QCOMPARE(tableView->contentHeight(), expectedSizeInit);
- QCOMPARE(tableViewPrivate->averageEdgeSize.width(), cellSizeSmall);
- QCOMPARE(tableViewPrivate->averageEdgeSize.height(), cellSizeSmall);
-
- // Flick to row and column 20 (smallCellCount), since there the row and
- // column sizes increases with 100. Check that TableView then adjusts
- // contentWidth and contentHeight accordingly.
- flickTo = ((cellSizeSmall + spacing) * smallCellCount) - spacing;
- tableView->setContentX(flickTo);
- tableView->setContentY(flickTo);
-
- // Since we move the viewport more than a page, tableview
- // will jump to the new position and do a rebuild.
- QVERIFY(tableViewPrivate->polishScheduled);
- QVERIFY(tableViewPrivate->rebuildScheduled);
- WAIT_UNTIL_POLISHED;
-
- // Check that the average cell size is now matching the
- // large cells since they fill up the whole view.
- QCOMPARE(tableViewPrivate->averageEdgeSize.width(), cellSizeLarge);
- QCOMPARE(tableViewPrivate->averageEdgeSize.height(), cellSizeLarge);
-
- const int largeSizeCellCountInView = qCeil(tableView->width() / cellSizeLarge);
- const int columnCount = smallCellCount + largeSizeCellCountInView;
- QCOMPARE(tableViewPrivate->leftColumn(), smallCellCount);
- QCOMPARE(tableViewPrivate->rightColumn(), columnCount - 1);
-
- const qreal firstHalfLength = smallCellCount * cellSizeSmall;
- const qreal secondHalfOneScreenLength = largeSizeCellCountInView * cellSizeLarge;
- const qreal lengthAfterFlick = firstHalfLength + secondHalfOneScreenLength;
-
- // Check that loadedTableOuterRect has been calculated correct thus far
- const qreal spacingAfterFlick = (smallCellCount + largeSizeCellCountInView - 1) * spacing;
- QCOMPARE(tableViewPrivate->loadedTableOuterRect.left(), flickTo + spacing);
- QCOMPARE(tableViewPrivate->loadedTableOuterRect.right(), lengthAfterFlick + spacingAfterFlick);
- QCOMPARE(tableViewPrivate->loadedTableOuterRect.top(), flickTo + spacing);
- QCOMPARE(tableViewPrivate->loadedTableOuterRect.bottom(), lengthAfterFlick + spacingAfterFlick);
-
- // At this point, we should have the exact content width/height set, because
- // TableView knows where the large cells start in the viewport, and how many
- // columns that remain in the model. It will assume that the rest of the the
- // columns have the same average size as the ones currently inside the viewport.
- const qreal expectedContentSize = (smallCellCount * cellSizeSmall) + (largeCellCount * cellSizeLarge) + accumulatedSpacing;
- QCOMPARE(tableView->contentWidth(), expectedContentSize);
- QCOMPARE(tableView->contentHeight(), expectedContentSize);
-
- // Flick to the end (row/column 100, and overshoot a bit), and
- // check that we then end up with the exact content width/height.
- const qreal secondHalfLength = largeCellCount * cellSizeLarge;
- const qreal expectedFullSize = (firstHalfLength + secondHalfLength) + accumulatedSpacing;
- const qreal overshoot = 100;
- const qreal endPosX = expectedFullSize - tableView->width() + overshoot;
- const qreal endPosY = expectedFullSize - tableView->height() + overshoot;
- tableView->setContentX(endPosX);
- tableView->setContentY(endPosY);
-
- QCOMPARE(tableView->contentWidth(), expectedFullSize);
- QCOMPARE(tableView->contentHeight(), expectedFullSize);
// Flick back to start
tableView->setContentX(0);
@@ -654,10 +601,10 @@ void tst_QQuickTableView::checkContentWidthAndHeight()
// Since we move the viewport more than a page, tableview
// will jump to the new position and do a rebuild.
QVERIFY(tableViewPrivate->polishScheduled);
- QVERIFY(tableViewPrivate->rebuildScheduled);
+ QVERIFY(tableViewPrivate->scheduledRebuildOptions);
WAIT_UNTIL_POLISHED;
- // We should now have the same content width/height as when we started
+ // We should still have the same content width/height as when we started
QCOMPARE(tableView->contentWidth(), expectedSizeInit);
QCOMPARE(tableView->contentHeight(), expectedSizeInit);
}
@@ -689,7 +636,6 @@ void tst_QQuickTableView::checkPageFlicking()
QCOMPARE(tableViewPrivate->averageEdgeSize.width(), cellWidth);
QCOMPARE(tableViewPrivate->averageEdgeSize.height(), cellHeight);
- QVERIFY(!tableViewPrivate->rebuildScheduled);
QCOMPARE(tableViewPrivate->scheduledRebuildOptions, QQuickTableViewPrivate::RebuildOption::None);
// Flick 5000 columns to the right, and check that this triggers a
@@ -699,7 +645,6 @@ void tst_QQuickTableView::checkPageFlicking()
const qreal flickToColumnInPixels = ((cellWidth + columnSpacing) * flickToColumn) - columnSpacing;
tableView->setContentX(flickToColumnInPixels);
- QVERIFY(tableViewPrivate->rebuildScheduled);
QVERIFY(tableViewPrivate->scheduledRebuildOptions & QQuickTableViewPrivate::RebuildOption::ViewportOnly);
QVERIFY(tableViewPrivate->scheduledRebuildOptions & QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftColumn);
QVERIFY(!(tableViewPrivate->scheduledRebuildOptions & QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftRow));
@@ -721,7 +666,6 @@ void tst_QQuickTableView::checkPageFlicking()
const qreal flickToRowInPixels = ((cellHeight + rowSpacing) * flickToRow) - rowSpacing;
tableView->setContentY(flickToRowInPixels);
- QVERIFY(tableViewPrivate->rebuildScheduled);
QVERIFY(tableViewPrivate->scheduledRebuildOptions & QQuickTableViewPrivate::RebuildOption::ViewportOnly);
QVERIFY(!(tableViewPrivate->scheduledRebuildOptions & QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftColumn));
QVERIFY(tableViewPrivate->scheduledRebuildOptions & QQuickTableViewPrivate::RebuildOption::CalculateNewTopLeftRow);
@@ -756,6 +700,164 @@ void tst_QQuickTableView::checkExplicitContentWidthAndHeight()
QCOMPARE(tableView->contentHeight(), 1000);
}
+void tst_QQuickTableView::checkExtents_origin()
+{
+ // Check that if the beginning of the content view doesn't match the
+ // actual size of the table, origin will be adjusted to make it fit.
+ LOAD_TABLEVIEW("contentwidthheight.qml");
+
+ const int rows = 10;
+ const int columns = rows;
+ const qreal columnWidth = 100;
+ const qreal rowHeight = 100;
+ const qreal actualTableSize = columns * columnWidth;
+
+ // Set a content size that is far too large
+ // compared to the size of the table.
+ tableView->setContentWidth(actualTableSize * 2);
+ tableView->setContentHeight(actualTableSize * 2);
+ tableView->setRowSpacing(0);
+ tableView->setColumnSpacing(0);
+ tableView->setLeftMargin(0);
+ tableView->setRightMargin(0);
+ tableView->setTopMargin(0);
+ tableView->setBottomMargin(0);
+
+ auto model = TestModelAsVariant(rows, columns);
+ tableView->setModel(model);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Flick slowly to column 5 (to avoid rebuilds). Flick two columns at a
+ // time to ensure that we create a gap before TableView gets a chance to
+ // adjust endExtent first. This gap on the right side will make TableView
+ // move the table to move to the edge. Because of this, the table will not
+ // be aligned at the start of the content view when we next flick back again.
+ // And this will cause origin to move.
+ for (int x = 0; x <= 6; x += 2) {
+ tableView->setContentX(x * columnWidth);
+ tableView->setContentY(x * rowHeight);
+ }
+
+ // Check that the table has now been moved one column to the right
+ // (One column because that's how far outside the table we ended up flicking above).
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect.right(), actualTableSize + columnWidth);
+
+ // Flick back one column at a time so that TableView detects that the first
+ // column is not at the origin before the "table move" logic kicks in. This
+ // will make TableView adjust the origin.
+ for (int x = 6; x >= 0; x -= 1) {
+ tableView->setContentX(x * columnWidth);
+ tableView->setContentY(x * rowHeight);
+ }
+
+ // The origin will be moved with the same offset that the table was
+ // moved on the right side earlier, which is one column length.
+ QCOMPARE(tableViewPrivate->origin.x(), columnWidth);
+ QCOMPARE(tableViewPrivate->origin.y(), rowHeight);
+}
+
+void tst_QQuickTableView::checkExtents_endExtent()
+{
+ // Check that if we the content view size doesn't match the actual size
+ // of the table, endExtent will be adjusted to make it fit (so that
+ // e.g the the flicking will bounce to a stop at the edge of the table).
+ LOAD_TABLEVIEW("contentwidthheight.qml");
+
+ const int rows = 10;
+ const int columns = rows;
+ const qreal columnWidth = 100;
+ const qreal rowHeight = 100;
+ const qreal actualTableSize = columns * columnWidth;
+
+ // Set a content size that is far too large
+ // compared to the size of the table.
+ tableView->setContentWidth(actualTableSize * 2);
+ tableView->setContentHeight(actualTableSize * 2);
+ tableView->setRowSpacing(0);
+ tableView->setColumnSpacing(0);
+ tableView->setLeftMargin(0);
+ tableView->setRightMargin(0);
+ tableView->setTopMargin(0);
+ tableView->setBottomMargin(0);
+
+ auto model = TestModelAsVariant(rows, columns);
+ tableView->setModel(model);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Flick slowly to column 5 (to avoid rebuilds). This will flick the table to
+ // the last column in the model. But since there still is a lot space left in
+ // the content view, endExtent will be set accordingly to compensate.
+ for (int x = 1; x <= 5; x++)
+ tableView->setContentX(x * columnWidth);
+ QCOMPARE(tableViewPrivate->rightColumn(), columns - 1);
+ qreal expectedEndExtentWidth = actualTableSize - tableView->contentWidth();
+ QCOMPARE(tableViewPrivate->endExtent.width(), expectedEndExtentWidth);
+
+ for (int y = 1; y <= 5; y++)
+ tableView->setContentY(y * rowHeight);
+ QCOMPARE(tableViewPrivate->bottomRow(), rows - 1);
+ qreal expectedEndExtentHeight = actualTableSize - tableView->contentHeight();
+ QCOMPARE(tableViewPrivate->endExtent.height(), expectedEndExtentHeight);
+}
+
+void tst_QQuickTableView::checkExtents_moveTableToEdge()
+{
+ // Check that if we the content view size doesn't match the actual
+ // size of the table, and we fast-flick the viewport to outside
+ // the table, we end up moving the table back into the viewport to
+ // avoid any visual glitches.
+ LOAD_TABLEVIEW("contentwidthheight.qml");
+
+ const int rows = 10;
+ const int columns = rows;
+ const qreal columnWidth = 100;
+ const qreal rowHeight = 100;
+ const qreal actualTableSize = columns * columnWidth;
+
+ // Set a content size that is far to large
+ // compared to the size of the table.
+ tableView->setContentWidth(actualTableSize * 2);
+ tableView->setContentHeight(actualTableSize * 2);
+ tableView->setRowSpacing(0);
+ tableView->setColumnSpacing(0);
+ tableView->setLeftMargin(0);
+ tableView->setRightMargin(0);
+ tableView->setTopMargin(0);
+ tableView->setBottomMargin(0);
+
+ auto model = TestModelAsVariant(rows, columns);
+ tableView->setModel(model);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Flick slowly to column 5 (to avoid rebuilds). Flick two columns at a
+ // time to ensure that we create a gap before TableView gets a chance to
+ // adjust endExtent first. This gap on the right side will make TableView
+ // move the table to the edge (in addition to adjusting the extents, but that
+ // will happen in a subsequent polish, and is not for this test verify).
+ for (int x = 0; x <= 6; x += 2)
+ tableView->setContentX(x * columnWidth);
+ QCOMPARE(tableViewPrivate->rightColumn(), columns - 1);
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect, tableViewPrivate->viewportRect);
+
+ for (int y = 0; y <= 6; y += 2)
+ tableView->setContentY(y * rowHeight);
+ QCOMPARE(tableViewPrivate->bottomRow(), rows - 1);
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect, tableViewPrivate->viewportRect);
+
+ for (int x = 6; x >= 0; x -= 2)
+ tableView->setContentX(x * columnWidth);
+ QCOMPARE(tableViewPrivate->leftColumn(), 0);
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect, tableViewPrivate->viewportRect);
+
+ for (int y = 6; y >= 0; y -= 2)
+ tableView->setContentY(y * rowHeight);
+ QCOMPARE(tableViewPrivate->topRow(), 0);
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect, tableViewPrivate->viewportRect);
+}
+
void tst_QQuickTableView::checkContentXY()
{
// Check that you can bind contentX and contentY to
@@ -1138,8 +1240,11 @@ void tst_QQuickTableView::checkSpacingValues()
tableView->polish();
WAIT_UNTIL_POLISHED;
- QCOMPARE(tableView->contentWidth(), columnCount * (delegateWidth + tableView->columnSpacing()) - tableView->columnSpacing());
- QCOMPARE(tableView->contentHeight(), rowCount * (delegateHeight + tableView->rowSpacing()) - tableView->rowSpacing());
+
+ const qreal expectedInitialContentWidth = columnCount * (delegateWidth + tableView->columnSpacing()) - tableView->columnSpacing();
+ const qreal expectedInitialContentHeight = rowCount * (delegateHeight + tableView->rowSpacing()) - tableView->rowSpacing();
+ QCOMPARE(tableView->contentWidth(), expectedInitialContentWidth);
+ QCOMPARE(tableView->contentHeight(), expectedInitialContentHeight);
// Valid spacing assignment
tableView->setRowSpacing(42);
@@ -1149,8 +1254,13 @@ void tst_QQuickTableView::checkSpacingValues()
tableView->polish();
WAIT_UNTIL_POLISHED;
- QCOMPARE(tableView->contentWidth(), columnCount * (delegateWidth + tableView->columnSpacing()) - tableView->columnSpacing());
- QCOMPARE(tableView->contentHeight(), rowCount * (delegateHeight + tableView->rowSpacing()) - tableView->rowSpacing());
+
+ // Even after changing spacing, TableView will keep the initial guesstimated content size. The
+ // reason is that deciding the content size based on the currently visible row/columns/spacing
+ // will almost always be at a little bit wrong at best. So instead of pretending that TableView
+ // knows what the size of the full table is, it sticks with the first guesstimate.
+ QCOMPARE(tableView->contentWidth(), expectedInitialContentWidth);
+ QCOMPARE(tableView->contentHeight(), expectedInitialContentHeight);
// Invalid assignments (should ignore)
tableView->setRowSpacing(-1);
@@ -1942,7 +2052,7 @@ void tst_QQuickTableView::checkChangingModelFromDelegate()
// And since the QML code tried to add another row as well, we
// expect rebuildScheduled to be true, and a polish event to be pending.
- QCOMPARE(tableViewPrivate->rebuildScheduled, true);
+ QVERIFY(tableViewPrivate->scheduledRebuildOptions);
QCOMPARE(tableViewPrivate->polishScheduled, true);
WAIT_UNTIL_POLISHED;
@@ -2025,7 +2135,7 @@ void tst_QQuickTableView::checkTableviewInsideAsyncLoader()
QCOMPARE(loader->status(), QQuickLoader::Ready);
// Check that TableView has finished building
- QCOMPARE(tableViewPrivate->rebuildScheduled, false);
+ QVERIFY(!tableViewPrivate->scheduledRebuildOptions);
QCOMPARE(tableViewPrivate->rebuildState, QQuickTableViewPrivate::RebuildState::Done);
// Check that all expected delegate items have been loaded
@@ -2152,6 +2262,337 @@ void tst_QQuickTableView::checkThatRevisionedPropertiesCannotBeUsedInOldImports(
QCOMPARE(resolvedColumn, 42);
}
+void tst_QQuickTableView::checkSyncView_rootView_data()
+{
+ QTest::addColumn<qreal>("flickToPos");
+
+ QTest::newRow("pos:110") << 110.;
+ QTest::newRow("pos:2010") << 2010.;
+}
+
+void tst_QQuickTableView::checkSyncView_rootView()
+{
+ // Check that if you flick on the root tableview (the view that has
+ // no other view as syncView), all the other tableviews will sync
+ // their content view position according to their syncDirection flag.
+ QFETCH(qreal, flickToPos);
+ LOAD_TABLEVIEW("syncviewsimple.qml");
+ GET_QML_TABLEVIEW(tableViewH);
+ GET_QML_TABLEVIEW(tableViewV);
+ GET_QML_TABLEVIEW(tableViewHV);
+ QQuickTableView *views[] = {tableViewH, tableViewV, tableViewHV};
+
+ auto model = TestModelAsVariant(100, 100);
+
+ tableView->setModel(model);
+ for (auto view : views)
+ view->setModel(model);
+
+ tableView->setContentX(flickToPos);
+ tableView->setContentY(flickToPos);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Check that geometry properties are mirrored
+ QCOMPARE(tableViewH->columnSpacing(), tableView->columnSpacing());
+ QCOMPARE(tableViewH->rowSpacing(), 0);
+ QCOMPARE(tableViewH->contentWidth(), tableView->contentWidth());
+ QCOMPARE(tableViewV->columnSpacing(), 0);
+ QCOMPARE(tableViewV->rowSpacing(), tableView->rowSpacing());
+ QCOMPARE(tableViewV->contentHeight(), tableView->contentHeight());
+
+ // Check that viewport is in sync after the flick
+ QCOMPARE(tableView->contentX(), flickToPos);
+ QCOMPARE(tableView->contentY(), flickToPos);
+ QCOMPARE(tableViewH->contentX(), tableView->contentX());
+ QCOMPARE(tableViewH->contentY(), 0);
+ QCOMPARE(tableViewV->contentX(), 0);
+ QCOMPARE(tableViewV->contentY(), tableView->contentY());
+ QCOMPARE(tableViewHV->contentX(), tableView->contentX());
+ QCOMPARE(tableViewHV->contentY(), tableView->contentY());
+
+ // Check that topLeft cell is in sync after the flick
+ QCOMPARE(tableViewHPrivate->leftColumn(), tableViewPrivate->leftColumn());
+ QCOMPARE(tableViewHPrivate->rightColumn(), tableViewPrivate->rightColumn());
+ QCOMPARE(tableViewHPrivate->topRow(), 0);
+ QCOMPARE(tableViewVPrivate->leftColumn(), 0);
+ QCOMPARE(tableViewVPrivate->topRow(), tableViewPrivate->topRow());
+ QCOMPARE(tableViewHVPrivate->leftColumn(), tableViewPrivate->leftColumn());
+ QCOMPARE(tableViewHVPrivate->topRow(), tableViewPrivate->topRow());
+
+ // Check that the geometry of the tables are in sync after the flick
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.left(), tableViewPrivate->loadedTableOuterRect.left());
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.right(), tableViewPrivate->loadedTableOuterRect.right());
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.top(), 0);
+
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.top(), tableViewPrivate->loadedTableOuterRect.top());
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.bottom(), tableViewPrivate->loadedTableOuterRect.bottom());
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.left(), 0);
+
+ QCOMPARE(tableViewHVPrivate->loadedTableOuterRect, tableViewPrivate->loadedTableOuterRect);
+}
+
+void tst_QQuickTableView::checkSyncView_childViews_data()
+{
+ QTest::addColumn<int>("viewIndexToFlick");
+ QTest::addColumn<qreal>("flickToPos");
+
+ QTest::newRow("tableViewH, pos:100") << 0 << 100.;
+ QTest::newRow("tableViewV, pos:100") << 1 << 100.;
+ QTest::newRow("tableViewHV, pos:100") << 2 << 100.;
+ QTest::newRow("tableViewH, pos:2000") << 0 << 2000.;
+ QTest::newRow("tableViewV, pos:2000") << 1 << 2000.;
+ QTest::newRow("tableViewHV, pos:2000") << 2 << 2000.;
+}
+
+void tst_QQuickTableView::checkSyncView_childViews()
+{
+ // Check that if you flick on a tableview that has a syncView, the
+ // syncView will move to the new position as well, which will also
+ // recursivly move all other connected child views of the syncView.
+ QFETCH(int, viewIndexToFlick);
+ QFETCH(qreal, flickToPos);
+ LOAD_TABLEVIEW("syncviewsimple.qml");
+ GET_QML_TABLEVIEW(tableViewH);
+ GET_QML_TABLEVIEW(tableViewV);
+ GET_QML_TABLEVIEW(tableViewHV);
+ QQuickTableView *views[] = {tableViewH, tableViewV, tableViewHV};
+ QQuickTableView *viewToFlick = views[viewIndexToFlick];
+ QQuickTableViewPrivate *viewToFlickPrivate = QQuickTableViewPrivate::get(viewToFlick);
+
+ auto model = TestModelAsVariant(100, 100);
+
+ tableView->setModel(model);
+ for (auto view : views)
+ view->setModel(model);
+
+ viewToFlick->setContentX(flickToPos);
+ viewToFlick->setContentY(flickToPos);
+
+ WAIT_UNTIL_POLISHED;
+
+ // The view the user flicks on can always be flicked in both directions
+ // (unless is has a flickingDirection set, which is not the case here).
+ QCOMPARE(viewToFlick->contentX(), flickToPos);
+ QCOMPARE(viewToFlick->contentY(), flickToPos);
+
+ // The root view (tableView) will move in sync according
+ // to the syncDirection of the view being flicked.
+ if (viewToFlick->syncDirection() & Qt::Horizontal) {
+ QCOMPARE(tableView->contentX(), flickToPos);
+ QCOMPARE(tableViewPrivate->leftColumn(), viewToFlickPrivate->leftColumn());
+ QCOMPARE(tableViewPrivate->rightColumn(), viewToFlickPrivate->rightColumn());
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect.left(), viewToFlickPrivate->loadedTableOuterRect.left());
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect.right(), viewToFlickPrivate->loadedTableOuterRect.right());
+ } else {
+ QCOMPARE(tableView->contentX(), 0);
+ QCOMPARE(tableViewPrivate->leftColumn(), 0);
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect.left(), 0);
+ }
+
+ if (viewToFlick->syncDirection() & Qt::Vertical) {
+ QCOMPARE(tableView->contentY(), flickToPos);
+ QCOMPARE(tableViewPrivate->topRow(), viewToFlickPrivate->topRow());
+ QCOMPARE(tableViewPrivate->bottomRow(), viewToFlickPrivate->bottomRow());
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect.top(), viewToFlickPrivate->loadedTableOuterRect.top());
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect.bottom(), viewToFlickPrivate->loadedTableOuterRect.bottom());
+ } else {
+ QCOMPARE(tableView->contentY(), 0);
+ QCOMPARE(tableViewPrivate->topRow(), 0);
+ QCOMPARE(tableViewPrivate->loadedTableOuterRect.top(), 0);
+ }
+
+ // The other views should continue to stay in sync with
+ // the root view, unless it was the view being flicked.
+ if (viewToFlick != tableViewH) {
+ QCOMPARE(tableViewH->contentX(), tableView->contentX());
+ QCOMPARE(tableViewH->contentY(), 0);
+ QCOMPARE(tableViewHPrivate->leftColumn(), tableViewPrivate->leftColumn());
+ QCOMPARE(tableViewHPrivate->rightColumn(), tableViewPrivate->rightColumn());
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.left(), tableViewPrivate->loadedTableOuterRect.left());
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.right(), tableViewPrivate->loadedTableOuterRect.right());
+ QCOMPARE(tableViewHPrivate->topRow(), 0);
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.top(), 0);
+ }
+
+ if (viewToFlick != tableViewV) {
+ QCOMPARE(tableViewV->contentX(), 0);
+ QCOMPARE(tableViewV->contentY(), tableView->contentY());
+ QCOMPARE(tableViewVPrivate->topRow(), tableViewPrivate->topRow());
+ QCOMPARE(tableViewVPrivate->bottomRow(), tableViewPrivate->bottomRow());
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.top(), tableViewPrivate->loadedTableOuterRect.top());
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.bottom(), tableViewPrivate->loadedTableOuterRect.bottom());
+ QCOMPARE(tableViewVPrivate->leftColumn(), 0);
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.left(), 0);
+ }
+
+ if (viewToFlick != tableViewHV) {
+ QCOMPARE(tableViewHV->contentX(), tableView->contentX());
+ QCOMPARE(tableViewHV->contentY(), tableView->contentY());
+ QCOMPARE(tableViewHVPrivate->leftColumn(), tableViewPrivate->leftColumn());
+ QCOMPARE(tableViewHVPrivate->rightColumn(), tableViewPrivate->rightColumn());
+ QCOMPARE(tableViewHVPrivate->topRow(), tableViewPrivate->topRow());
+ QCOMPARE(tableViewHVPrivate->bottomRow(), tableViewPrivate->bottomRow());
+ QCOMPARE(tableViewHVPrivate->loadedTableOuterRect, tableViewPrivate->loadedTableOuterRect);
+ }
+}
+
+void tst_QQuickTableView::checkSyncView_differentSizedModels()
+{
+ // Check that you can have two tables in a syncView relation, where
+ // the sync "child" has fewer rows/columns than the syncView. In that
+ // case, it will be possible to flick the syncView further out than
+ // the child have rows/columns to follow. This causes some extra
+ // challenges for TableView to ensure that they are still kept in
+ // sync once you later flick the syncView back to a point where both
+ // tables ends up visible. This test will check this sitiation.
+ LOAD_TABLEVIEW("syncviewsimple.qml");
+ GET_QML_TABLEVIEW(tableViewH);
+ GET_QML_TABLEVIEW(tableViewV);
+ GET_QML_TABLEVIEW(tableViewHV);
+
+ auto tableViewModel = TestModelAsVariant(100, 100);
+ auto tableViewHModel = TestModelAsVariant(100, 50);
+ auto tableViewVModel = TestModelAsVariant(50, 100);
+ auto tableViewHVModel = TestModelAsVariant(5, 5);
+
+ tableView->setModel(tableViewModel);
+ tableViewH->setModel(tableViewHModel);
+ tableViewV->setModel(tableViewVModel);
+ tableViewHV->setModel(tableViewHVModel);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Flick far out, beyond the smaller tables, which will
+ // also force a rebuild (and as such, cause layout properties
+ // like average cell width to be temporarily out of sync).
+ tableView->setContentX(5000);
+ QVERIFY(tableViewPrivate->scheduledRebuildOptions);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Check that the smaller tables are now flicked out of view
+ qreal leftEdge = tableViewPrivate->loadedTableOuterRect.left();
+ QVERIFY(tableViewHPrivate->loadedTableOuterRect.right() < leftEdge);
+ QVERIFY(tableViewHVPrivate->loadedTableOuterRect.right() < leftEdge);
+
+ // Flick slowly back so that we don't trigger a rebuild (since
+ // we want to check that we stay in sync also when not rebuilding).
+ while (tableView->contentX() > 200) {
+ tableView->setContentX(tableView->contentX() - 200);
+ QVERIFY(!tableViewPrivate->rebuildOptions);
+ QVERIFY(!tableViewPrivate->polishScheduled);
+ }
+
+ leftEdge = tableViewPrivate->loadedTableOuterRect.left();
+ const int leftColumn = tableViewPrivate->leftColumn();
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.left(), leftEdge);
+ QCOMPARE(tableViewHPrivate->leftColumn(), leftColumn);
+
+ // Because the tableView was fast flicked and then slowly flicked back, the
+ // left column is now 49, which is actually far too high, since we're almost
+ // at the beginning of the content view. But this "miscalculation" is expected
+ // when the column widths are increasing for each column, like they do in this
+ // test. In that case, the algorithm that predicts where each column should end
+ // up gets slightly confused. Anyway, check that tableViewHV, that has only
+ // 5 columns, is not showing any columns, since it should always stay in sync with
+ // syncView regardless of the content view position.
+ QVERIFY(tableViewHVPrivate->loadedColumns.isEmpty());
+}
+
+void tst_QQuickTableView::checkSyncView_connect_late_data()
+{
+ QTest::addColumn<qreal>("flickToPos");
+
+ QTest::newRow("pos:110") << 110.;
+ QTest::newRow("pos:2010") << 2010.;
+}
+
+void tst_QQuickTableView::checkSyncView_connect_late()
+{
+ // Check that if you assign a syncView to a TableView late, and
+ // after the views have been flicked around, they will still end up in sync.
+ QFETCH(qreal, flickToPos);
+ LOAD_TABLEVIEW("syncviewsimple.qml");
+ GET_QML_TABLEVIEW(tableViewH);
+ GET_QML_TABLEVIEW(tableViewV);
+ GET_QML_TABLEVIEW(tableViewHV);
+ QQuickTableView *views[] = {tableViewH, tableViewV, tableViewHV};
+
+ auto model = TestModelAsVariant(100, 100);
+
+ tableView->setModel(model);
+
+ // Start with no syncView connections
+ for (auto view : views) {
+ view->setSyncView(nullptr);
+ view->setModel(model);
+ }
+
+ WAIT_UNTIL_POLISHED;
+
+ tableView->setContentX(flickToPos);
+ tableView->setContentY(flickToPos);
+
+ WAIT_UNTIL_POLISHED;
+
+ // Check that viewport is not in sync after the flick
+ QCOMPARE(tableView->contentX(), flickToPos);
+ QCOMPARE(tableView->contentY(), flickToPos);
+ QCOMPARE(tableViewH->contentX(), 0);
+ QCOMPARE(tableViewH->contentY(), 0);
+ QCOMPARE(tableViewV->contentX(), 0);
+ QCOMPARE(tableViewV->contentY(), 0);
+ QCOMPARE(tableViewHV->contentX(), 0);
+ QCOMPARE(tableViewHV->contentY(), 0);
+
+ // Assign the syncView late. This should make
+ // all the views end up in sync.
+ for (auto view : views) {
+ view->setSyncView(tableView);
+ WAIT_UNTIL_POLISHED_ARG(view);
+ }
+
+ // Check that geometry properties are mirrored
+ QCOMPARE(tableViewH->columnSpacing(), tableView->columnSpacing());
+ QCOMPARE(tableViewH->rowSpacing(), 0);
+ QCOMPARE(tableViewH->contentWidth(), tableView->contentWidth());
+ QCOMPARE(tableViewV->columnSpacing(), 0);
+ QCOMPARE(tableViewV->rowSpacing(), tableView->rowSpacing());
+ QCOMPARE(tableViewV->contentHeight(), tableView->contentHeight());
+
+ // Check that viewport is in sync after the flick
+ QCOMPARE(tableView->contentX(), flickToPos);
+ QCOMPARE(tableView->contentY(), flickToPos);
+ QCOMPARE(tableViewH->contentX(), tableView->contentX());
+ QCOMPARE(tableViewH->contentY(), 0);
+ QCOMPARE(tableViewV->contentX(), 0);
+ QCOMPARE(tableViewV->contentY(), tableView->contentY());
+ QCOMPARE(tableViewHV->contentX(), tableView->contentX());
+ QCOMPARE(tableViewHV->contentY(), tableView->contentY());
+
+ // Check that topLeft cell is in sync after the flick
+ QCOMPARE(tableViewHPrivate->leftColumn(), tableViewPrivate->leftColumn());
+ QCOMPARE(tableViewHPrivate->rightColumn(), tableViewPrivate->rightColumn());
+ QCOMPARE(tableViewHPrivate->topRow(), 0);
+ QCOMPARE(tableViewVPrivate->leftColumn(), 0);
+ QCOMPARE(tableViewVPrivate->topRow(), tableViewPrivate->topRow());
+ QCOMPARE(tableViewHVPrivate->leftColumn(), tableViewPrivate->leftColumn());
+ QCOMPARE(tableViewHVPrivate->topRow(), tableViewPrivate->topRow());
+
+ // Check that the geometry of the tables are in sync after the flick
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.left(), tableViewPrivate->loadedTableOuterRect.left());
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.right(), tableViewPrivate->loadedTableOuterRect.right());
+ QCOMPARE(tableViewHPrivate->loadedTableOuterRect.top(), 0);
+
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.top(), tableViewPrivate->loadedTableOuterRect.top());
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.bottom(), tableViewPrivate->loadedTableOuterRect.bottom());
+ QCOMPARE(tableViewVPrivate->loadedTableOuterRect.left(), 0);
+
+ QCOMPARE(tableViewHVPrivate->loadedTableOuterRect, tableViewPrivate->loadedTableOuterRect);
+
+}
+
QTEST_MAIN(tst_QQuickTableView)
#include "tst_qquicktableview.moc"
diff --git a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro
index 9222e39477..5445f6768d 100644
--- a/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro
+++ b/tests/auto/quick/qquickvisualdatamodel/qquickvisualdatamodel.pro
@@ -9,5 +9,5 @@ include (../shared/util.pri)
TESTDATA = data/*
-QT += core-private gui-private qml-private quick-private testlib
+QT += core-private gui-private qml-private quick-private testlib qmlmodels-private
qtHaveModule(widgets): QT += widgets
diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
index fac8283e2c..32008f675a 100644
--- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
+++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp
@@ -39,7 +39,7 @@
#include <QtQuick/qquickview.h>
#include <private/qquicklistview_p.h>
#include <QtQuick/private/qquicktext_p.h>
-#include <QtQml/private/qqmldelegatemodel_p.h>
+#include <QtQmlModels/private/qqmldelegatemodel_p.h>
#include <private/qqmlvaluetype_p.h>
#include <private/qqmlchangeset_p.h>
#include <private/qqmlengine_p.h>
diff --git a/tests/auto/quick/quick.pro b/tests/auto/quick/quick.pro
index 7257a99d2a..b6ffdc0f7e 100644
--- a/tests/auto/quick/quick.pro
+++ b/tests/auto/quick/quick.pro
@@ -29,6 +29,7 @@ PRIVATETESTS += \
qquickanimations \
qquickapplication \
qquickbehaviors \
+ qquickboundaryrule \
qquickfontloader \
qquickfontloader_static \
qquickfontmetrics \