aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquicklistview')
-rw-r--r--tests/auto/quick/qquicklistview/BLACKLIST12
-rw-r--r--tests/auto/quick/qquicklistview/CMakeLists.txt9
-rw-r--r--tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/displayMargin.qml2
-rw-r--r--tests/auto/quick/qquicklistview/data/headerCrash.qml2
-rw-r--r--tests/auto/quick/qquicklistview/data/listview-itematindex.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml2
-rw-r--r--tests/auto/quick/qquicklistview/data/qtbug48044.qml2
-rw-r--r--tests/auto/quick/qquicklistview/data/resizeAfterComponentComplete.qml2
-rw-r--r--tests/auto/quick/qquicklistview/data/sectionSnapping.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml3
-rw-r--r--tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml3
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp122
13 files changed, 98 insertions, 70 deletions
diff --git a/tests/auto/quick/qquicklistview/BLACKLIST b/tests/auto/quick/qquicklistview/BLACKLIST
index 6ef69550a4..e6b76ea247 100644
--- a/tests/auto/quick/qquicklistview/BLACKLIST
+++ b/tests/auto/quick/qquicklistview/BLACKLIST
@@ -4,11 +4,9 @@ opensuse-leap
#QTBUG-53863
[populateTransitions]
opensuse-42.1
+
+# QTBUG-103089
+[QTBUG_48044_currentItemNotVisibleAfterTransition]
+android
[contentHeightWithDelayRemove]
-macos
-#QTBUG-75960
-#QTBUG-76652
-[currentIndex]
-macos
-opensuse-leap
-ubuntu-18.04
+android
diff --git a/tests/auto/quick/qquicklistview/CMakeLists.txt b/tests/auto/quick/qquicklistview/CMakeLists.txt
index 761d515eaf..a87cc82628 100644
--- a/tests/auto/quick/qquicklistview/CMakeLists.txt
+++ b/tests/auto/quick/qquicklistview/CMakeLists.txt
@@ -12,19 +12,11 @@ list(APPEND test_data ${test_data_glob})
qt_internal_add_test(tst_qquicklistview
SOURCES
- ../../shared/util.cpp ../../shared/util.h
- ../shared/geometrytestutil.cpp ../shared/geometrytestutil.h
- ../shared/viewtestutil.cpp ../shared/viewtestutil.h
- ../shared/visualtestutil.cpp ../shared/visualtestutil.h
incrementalmodel.cpp incrementalmodel.h
proxytestinnermodel.cpp proxytestinnermodel.h
randomsortmodel.cpp randomsortmodel.h
reusemodel.h
tst_qquicklistview.cpp
- DEFINES
- QT_QMLTEST_DATADIR=\\\"${CMAKE_CURRENT_SOURCE_DIR}/data\\\"
- INCLUDE_DIRECTORIES
- ../../shared
PUBLIC_LIBRARIES
Qt::CorePrivate
Qt::Gui
@@ -33,6 +25,7 @@ qt_internal_add_test(tst_qquicklistview
Qt::QmlPrivate
Qt::QuickPrivate
Qt::QuickTest
+ Qt::QuickTestUtilsPrivate
TESTDATA ${test_data}
)
diff --git a/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml b/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml
index af35c29143..6ba6480297 100644
--- a/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml
+++ b/tests/auto/quick/qquicklistview/data/appendDuringScrollDown.qml
@@ -1,10 +1,11 @@
import QtQuick 2.6
ListView {
+ id: listView
width: 320; height: 240
focus: true
delegate: Text {
- height: 40; width: parent.width
+ height: 40; width: listView.width
text: model.text
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
diff --git a/tests/auto/quick/qquicklistview/data/displayMargin.qml b/tests/auto/quick/qquicklistview/data/displayMargin.qml
index aafbb4235f..e6ea695b49 100644
--- a/tests/auto/quick/qquicklistview/data/displayMargin.qml
+++ b/tests/auto/quick/qquicklistview/data/displayMargin.qml
@@ -44,7 +44,7 @@ Item {
model: 100
delegate: Rectangle {
objectName: "delegate"
- width: parent.width
+ width: view.width
height: 25
color: index % 2 ? "steelblue" : "lightsteelblue"
Text {
diff --git a/tests/auto/quick/qquicklistview/data/headerCrash.qml b/tests/auto/quick/qquicklistview/data/headerCrash.qml
index 124fa894f2..972ecb2906 100644
--- a/tests/auto/quick/qquicklistview/data/headerCrash.qml
+++ b/tests/auto/quick/qquicklistview/data/headerCrash.qml
@@ -12,7 +12,7 @@ ListView {
}
delegate: Rectangle {
- width: parent.width; height: 20
+ width: myList.width; height: 20
color: index % 2 ? "green" : "red"
}
diff --git a/tests/auto/quick/qquicklistview/data/listview-itematindex.qml b/tests/auto/quick/qquicklistview/data/listview-itematindex.qml
index fba8b11933..2194f1edff 100644
--- a/tests/auto/quick/qquicklistview/data/listview-itematindex.qml
+++ b/tests/auto/quick/qquicklistview/data/listview-itematindex.qml
@@ -1,13 +1,14 @@
import QtQuick 2.0
ListView {
+ id: listView
width: 400
height: 400
focus: true
model: 3
delegate: Text {
- width: parent.width
+ width: listView.width
height: 10
property int idx: index
text: index
diff --git a/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml b/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml
index e0acaf49e4..ef959b10b4 100644
--- a/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml
+++ b/tests/auto/quick/qquicklistview/data/outsideViewportChangeNotAffectingView.qml
@@ -72,7 +72,7 @@ Item {
ListElement { size: 300; }
}
delegate: Rectangle {
- width: parent.width
+ width: list.width
color: index % 2 == 0 ? "red" : "blue"
height: size
Text { anchors.centerIn: parent; text: index }
diff --git a/tests/auto/quick/qquicklistview/data/qtbug48044.qml b/tests/auto/quick/qquicklistview/data/qtbug48044.qml
index d318643c1c..368b6bd4bd 100644
--- a/tests/auto/quick/qquicklistview/data/qtbug48044.qml
+++ b/tests/auto/quick/qquicklistview/data/qtbug48044.qml
@@ -116,7 +116,7 @@ Item {
color: header ? "yellow" : "cyan"
border.color: "black"
height: 50
- width: parent.width
+ width: listView.width
Text {
anchors.centerIn: parent
diff --git a/tests/auto/quick/qquicklistview/data/resizeAfterComponentComplete.qml b/tests/auto/quick/qquicklistview/data/resizeAfterComponentComplete.qml
index 851d8f9a0c..f5be95b7cc 100644
--- a/tests/auto/quick/qquicklistview/data/resizeAfterComponentComplete.qml
+++ b/tests/auto/quick/qquicklistview/data/resizeAfterComponentComplete.qml
@@ -56,7 +56,7 @@ ListView {
anchors.fill: parent
model: 10
delegate: Rectangle {
- width: parent.width
+ width: listView.width
height: 40
border.color: "lightsteelblue"
Text {
diff --git a/tests/auto/quick/qquicklistview/data/sectionSnapping.qml b/tests/auto/quick/qquicklistview/data/sectionSnapping.qml
index 2583cc0377..48a893f88c 100644
--- a/tests/auto/quick/qquicklistview/data/sectionSnapping.qml
+++ b/tests/auto/quick/qquicklistview/data/sectionSnapping.qml
@@ -1,6 +1,7 @@
import QtQuick 2.0
ListView {
+ id: listView
width: 400
height: 400
preferredHighlightBegin: 100
@@ -17,7 +18,7 @@ ListView {
}
delegate: Rectangle {
- width: parent.width
+ width: listView.width
height: 50
color: index % 2 ? "lightsteelblue" : "steelblue"
Text {
diff --git a/tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml b/tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml
index f5b7b35d0c..1dfbfe0feb 100644
--- a/tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml
+++ b/tests/auto/quick/qquicklistview/data/snapOneItemWrongDirection.qml
@@ -1,13 +1,14 @@
import QtQuick 2.0
ListView {
+ id: listView
width: 400
height: 400
focus: true
model: 10
delegate: Rectangle {
- width: parent.width
+ width: listView.width
height: 50
color: index % 2 ? "blue" : "green"
}
diff --git a/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml
index 338af38475..16b9c72b16 100644
--- a/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml
+++ b/tests/auto/quick/qquicklistview/data/strictlyenforcerange-resize.qml
@@ -1,6 +1,7 @@
import QtQuick 2.0
ListView {
+ id: listView
width: 400
height: 400
focus: true
@@ -15,7 +16,7 @@ ListView {
model: 10
delegate: Item {
- width: parent.width
+ width: listView.width
height: ListView.isCurrentItem ? 100 : 50
Text {
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 2b017aa1fc..24196e2ba1 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -46,9 +46,9 @@
#include <QtQmlModels/private/qqmllistmodel_p.h>
#include <QtQmlModels/private/qqmldelegatemodel_p.h>
#include <qpa/qwindowsysteminterface.h>
-#include "../../shared/util.h"
-#include "../shared/viewtestutil.h"
-#include "../shared/visualtestutil.h"
+#include <QtQuickTestUtils/private/qmlutils_p.h>
+#include <QtQuickTestUtils/private/viewtestutils_p.h>
+#include <QtQuickTestUtils/private/visualtestutils_p.h>
#include "incrementalmodel.h"
#include "proxytestinnermodel.h"
#include "randomsortmodel.h"
@@ -62,8 +62,8 @@ Q_DECLARE_METATYPE(QQuickListView::Orientation)
Q_DECLARE_METATYPE(QQuickFlickable::FlickableDirection)
Q_DECLARE_METATYPE(Qt::Key)
-using namespace QQuickViewTestUtil;
-using namespace QQuickVisualTestUtil;
+using namespace QQuickViewTestUtils;
+using namespace QQuickVisualTestUtils;
#define SHARE_VIEWS
@@ -401,7 +401,9 @@ public:
int mCacheBuffer;
};
-tst_QQuickListView::tst_QQuickListView() : m_view(nullptr)
+tst_QQuickListView::tst_QQuickListView()
+ : QQmlDataTest(QT_QMLTEST_DATADIR)
+ , m_view(nullptr)
{
}
@@ -431,6 +433,9 @@ void tst_QQuickListView::cleanupTestCase()
template <class T>
void tst_QQuickListView::items(const QUrl &source)
{
+ // Make sure we outlive the view, or the context property will become null.
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
T model;
@@ -441,7 +446,6 @@ void tst_QQuickListView::items(const QUrl &source)
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(source);
@@ -512,6 +516,8 @@ void tst_QQuickListView::items(const QUrl &source)
template <class T>
void tst_QQuickListView::changed(const QUrl &source)
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
T model;
@@ -522,7 +528,6 @@ void tst_QQuickListView::changed(const QUrl &source)
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(source);
@@ -550,6 +555,8 @@ void tst_QQuickListView::changed(const QUrl &source)
template <class T>
void tst_QQuickListView::inserted(const QUrl &source)
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window.data()));
@@ -562,7 +569,6 @@ void tst_QQuickListView::inserted(const QUrl &source)
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(source);
@@ -654,11 +660,12 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -955,6 +962,8 @@ void tst_QQuickListView::insertBeforeVisible_data()
template <class T>
void tst_QQuickListView::removed(const QUrl &source, bool /* animated */)
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
T model;
@@ -964,7 +973,6 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */)
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(source);
@@ -1318,6 +1326,8 @@ void tst_QQuickListView::removed_more_data()
template <class T>
void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayoutDirection verticalLayoutDirection)
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
T model;
@@ -1327,7 +1337,6 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(source);
@@ -1850,6 +1859,8 @@ void tst_QQuickListView::multipleChanges_data()
void tst_QQuickListView::swapWithFirstItem()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
QaimModel model;
@@ -1859,7 +1870,6 @@ void tst_QQuickListView::swapWithFirstItem()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -1878,6 +1888,8 @@ void tst_QQuickListView::swapWithFirstItem()
void tst_QQuickListView::checkCountForMultiColumnModels()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
// Check that a list view will only load items for the first
// column, even if the model reports that it got several columns.
// We test this since QQmlDelegateModel has been changed to
@@ -1895,7 +1907,6 @@ void tst_QQuickListView::checkCountForMultiColumnModels()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -2032,6 +2043,8 @@ void tst_QQuickListView::enforceRange_withoutHighlight()
void tst_QQuickListView::spacing()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
QaimModel model;
@@ -2041,7 +2054,6 @@ void tst_QQuickListView::spacing()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -2309,7 +2321,7 @@ void tst_QQuickListView::sectionsDragOutsideBounds()
QFETCH(int, cacheBuffer);
QQuickView *window = getView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QQuickViewTestUtils::moveMouseAway(window);
QaimModel model;
for (int i = 0; i < 10; i++)
@@ -2962,8 +2974,8 @@ void tst_QQuickListView::keyNavigation()
for (int i = 0; i < 30; i++)
model.addItem("Item" + QString::number(i), "");
- QQuickView *window = getView();
QScopedPointer<TestObject> testObject(new TestObject);
+ QQuickView *window = getView();
window->rootContext()->setContextProperty("testModel", &model);
window->rootContext()->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -3167,6 +3179,8 @@ void tst_QQuickListView::itemListFlicker()
void tst_QQuickListView::cacheBuffer()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
QaimModel model;
@@ -3176,7 +3190,6 @@ void tst_QQuickListView::cacheBuffer()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -3269,6 +3282,8 @@ void tst_QQuickListView::cacheBuffer()
void tst_QQuickListView::positionViewAtBeginningEnd()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
QaimModel model;
@@ -3278,7 +3293,6 @@ void tst_QQuickListView::positionViewAtBeginningEnd()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->show();
window->setSource(testFileUrl("listviewtest.qml"));
@@ -3327,6 +3341,8 @@ void tst_QQuickListView::positionViewAtIndex()
QFETCH(QQuickListView::PositionMode, mode);
QFETCH(qreal, contentY);
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QQuickView *window = getView();
QaimModel model;
@@ -3336,7 +3352,6 @@ void tst_QQuickListView::positionViewAtIndex()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->show();
window->setSource(testFileUrl("listviewtest.qml"));
@@ -3676,6 +3691,8 @@ void tst_QQuickListView::manualHighlight()
void tst_QQuickListView::QTBUG_11105()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 30; i++)
@@ -3684,7 +3701,6 @@ void tst_QQuickListView::QTBUG_11105()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -4346,6 +4362,8 @@ void tst_QQuickListView::resetModel_headerFooter()
void tst_QQuickListView::resizeView()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
QaimModel model;
for (int i = 0; i < 40; i++)
@@ -4354,7 +4372,6 @@ void tst_QQuickListView::resizeView()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -4455,6 +4472,8 @@ void tst_QQuickListView::resizeViewAndRepaint()
void tst_QQuickListView::sizeLessThan1()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
QaimModel model;
@@ -4464,7 +4483,6 @@ void tst_QQuickListView::sizeLessThan1()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("sizelessthan1.qml"));
@@ -4585,6 +4603,8 @@ void tst_QQuickListView::resizeFirstDelegate()
{
// QTBUG-20712: Content Y jumps constantly if first delegate height == 0
// and other delegates have height > 0
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QScopedPointer<QQuickView> window(createView());
// bug only occurs when all items in the model are visible
@@ -4595,7 +4615,6 @@ void tst_QQuickListView::resizeFirstDelegate()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -4793,6 +4812,8 @@ void tst_QQuickListView::indexAt_itemAt()
QFETCH(qreal, y);
QFETCH(int, index);
+ QScopedPointer<TestObject> testObject(new TestObject);
+
QQuickView *window = getView();
QaimModel model;
@@ -4802,7 +4823,6 @@ void tst_QQuickListView::indexAt_itemAt()
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("testModel", &model);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("listviewtest.qml"));
@@ -5170,7 +5190,7 @@ void tst_QQuickListView::marginsResize()
QQuickView *window = getView();
window->setSource(testFileUrl("margins2.qml"));
- QQuickViewTestUtil::moveMouseAway(window);
+ QQuickViewTestUtils::moveMouseAway(window);
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));
@@ -5306,7 +5326,7 @@ void tst_QQuickListView::snapToItem()
QFETCH(qreal, startExtent);
QQuickView *window = getView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QQuickViewTestUtils::moveMouseAway(window);
window->setSource(testFileUrl("snapToItem.qml"));
window->show();
@@ -5990,7 +6010,7 @@ void tst_QQuickListView::snapOneItemResize_QTBUG_43555()
QScopedPointer<QQuickView> window(createView());
window->resize(QSize(100, 320));
window->setResizeMode(QQuickView::SizeRootObjectToView);
- QQuickViewTestUtil::moveMouseAway(window.data());
+ QQuickVisualTestUtils::moveMouseAway(window.data());
window->setSource(testFileUrl("snapOneItemResize.qml"));
window->show();
@@ -6304,7 +6324,7 @@ void tst_QQuickListView::snapOneItem()
qreal flickDuration = 180 * flickSlowdown;
QQuickView *window = getView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QQuickViewTestUtils::moveMouseAway(window);
window->setSource(testFileUrl("snapOneItem.qml"));
window->show();
@@ -6670,8 +6690,8 @@ void tst_QQuickListView::populateTransitions()
model.addItem("item" + QString::number(i), "");
}
+ QScopedPointer<TestObject> testObject(new TestObject());
QQuickView *window = getView();
- QScopedPointer<TestObject> testObject(new TestObject(window->rootContext()));
window->rootContext()->setContextProperty("testModel", &model);
window->rootContext()->setContextProperty("testObject", testObject.data());
window->rootContext()->setContextProperty("usePopulateTransition", usePopulateTransition);
@@ -6794,12 +6814,12 @@ void tst_QQuickListView::populateTransitions_data()
void tst_QQuickListView::sizeTransitions()
{
QFETCH(bool, topToBottom);
+ QScopedPointer<TestObject> testObject(new TestObject);
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
QaimModel model;
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("topToBottom", topToBottom);
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testObject", &model);
window->setSource(testFileUrl("sizeTransitions.qml"));
window->show();
@@ -6854,9 +6874,9 @@ void tst_QQuickListView::addTransitions()
QaimModel model_targetItems_transitionFrom;
QaimModel model_displacedItems_transitionVia;
+ QScopedPointer<TestObject> testObject(new TestObject);
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("model_targetItems_transitionFrom", &model_targetItems_transitionFrom);
ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
@@ -7049,9 +7069,9 @@ void tst_QQuickListView::moveTransitions()
QaimModel model_targetItems_transitionVia;
QaimModel model_displacedItems_transitionVia;
+ QScopedPointer<TestObject> testObject(new TestObject);
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("model_targetItems_transitionVia", &model_targetItems_transitionVia);
ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
@@ -7251,9 +7271,9 @@ void tst_QQuickListView::removeTransitions()
QaimModel model_targetItems_transitionTo;
QaimModel model_displacedItems_transitionVia;
+ QScopedPointer<TestObject> testObject(new TestObject);
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("model_targetItems_transitionTo", &model_targetItems_transitionTo);
ctxt->setContextProperty("model_displacedItems_transitionVia", &model_displacedItems_transitionVia);
@@ -7449,9 +7469,9 @@ void tst_QQuickListView::displacedTransitions()
QPointF moveDisplaced_transitionVia(50, -100);
QPointF removeDisplaced_transitionVia(150, 100);
+ QScopedPointer<TestObject> testObject(new TestObject());
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
- QScopedPointer<TestObject> testObject(new TestObject(window));
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testObject", testObject.data());
ctxt->setContextProperty("model_displaced_transitionVia", &model_displaced_transitionVia);
@@ -7675,9 +7695,9 @@ void tst_QQuickListView::multipleTransitions()
for (int i = 0; i < initialCount; i++)
model.addItem("Original item" + QString::number(i), "");
+ QScopedPointer<TestObject> testObject(new TestObject);
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
- QScopedPointer<TestObject> testObject(new TestObject);
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testObject", testObject.data());
ctxt->setContextProperty("addTargets_transitionFrom", addTargets_transitionFrom);
@@ -7842,9 +7862,9 @@ void tst_QQuickListView::multipleDisplaced()
for (int i = 0; i < 30; i++)
model.addItem("Original item" + QString::number(i), "");
+ QScopedPointer<TestObject> testObject(new TestObject());
QQuickView *window = getView();
QQmlContext *ctxt = window->rootContext();
- QScopedPointer<TestObject> testObject(new TestObject(window));
ctxt->setContextProperty("testModel", &model);
ctxt->setContextProperty("testObject", testObject.data());
window->setSource(testFileUrl("multipleDisplaced.qml"));
@@ -7939,7 +7959,7 @@ void tst_QQuickListView::matchItemLists(const QVariantList &itemLists, const QLi
void tst_QQuickListView::flickBeyondBounds()
{
QScopedPointer<QQuickView> window(createView());
- QQuickViewTestUtil::moveMouseAway(window.data());
+ QQuickVisualTestUtils::moveMouseAway(window.data());
window->setSource(testFileUrl("flickBeyondBoundsBug.qml"));
window->show();
@@ -7981,7 +8001,7 @@ void tst_QQuickListView::flickBothDirections()
QFETCH(QPointF, targetPos);
QQuickView *window = getView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QQuickViewTestUtils::moveMouseAway(window);
QQmlContext *ctxt = window->rootContext();
ctxt->setContextProperty("initialOrientation", initValues ? orientation : QQuickListView::Vertical);
@@ -8154,7 +8174,7 @@ void tst_QQuickListView::delayedChanges_QTBUG_30555()
void tst_QQuickListView::outsideViewportChangeNotAffectingView()
{
QScopedPointer<QQuickView> window(createView());
- QQuickViewTestUtil::moveMouseAway(window.data());
+ QQuickVisualTestUtils::moveMouseAway(window.data());
window->setSource(testFileUrl("outsideViewportChangeNotAffectingView.qml"));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
@@ -8188,7 +8208,7 @@ void tst_QQuickListView::outsideViewportChangeNotAffectingView()
void tst_QQuickListView::testProxyModelChangedAfterMove()
{
QScopedPointer<QQuickView> window(createView());
- QQuickViewTestUtil::moveMouseAway(window.data());
+ QQuickVisualTestUtils::moveMouseAway(window.data());
window->setSource(testFileUrl("proxytest.qml"));
QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>();
@@ -9463,7 +9483,7 @@ void tst_QQuickListView::QTBUG_66163_setModelViewPortSizeChange()
delegate: Rectangle {
color: index % 2 ? "green" : "orange"
- width: parent.width
+ width: view.width
height: 50
}
@@ -9515,8 +9535,8 @@ void tst_QQuickListView::itemFiltered()
QScopedPointer<QQuickView> window(createView());
window->engine()->rootContext()->setContextProperty("_model", &proxy2);
QQmlComponent component(window->engine());
- component.setData("import QtQuick 2.4; ListView { "
- "anchors.fill: parent; model: _model; delegate: Text { width: parent.width;"
+ component.setData("import QtQuick 2.4; ListView { id: listView; "
+ "anchors.fill: parent; model: _model; delegate: Text { width: listView.width;"
"text: model.display; } }",
QUrl());
window->setContent(QUrl(), &component, component.create());
@@ -9799,12 +9819,24 @@ void tst_QQuickListView::delegateWithRequiredProperties()
void tst_QQuickListView::reuse_reuseIsOffByDefault()
{
+ QScopedPointer<TestObject> testObject(new TestObject);
+
// Check that delegate recycling is off by default. The reason is that
// ListView needs to be backwards compatible with legacy applications. And
// when using delegate recycling, there are certain differences, like that
// a delegates Component.onCompleted will just be called the first time the
// item is created, and not when it's reused.
QScopedPointer<QQuickView> window(createView());
+
+ QaimModel model;
+ for (int i = 0; i < 40; i++)
+ model.addItem("Item" + QString::number(i), "");
+
+ QQmlContext *ctxt = window->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ ctxt->setContextProperty("testObject", testObject.data());
+
window->setSource(testFileUrl("listviewtest.qml"));
window->resize(640, 480);
window->show();
@@ -9918,7 +9950,7 @@ void tst_QQuickListView::reuse_checkThatItemsAreReused()
void tst_QQuickListView::dragOverFloatingHeaderOrFooter() // QTBUG-74046
{
QQuickView *window = getView();
- QQuickViewTestUtil::moveMouseAway(window);
+ QQuickViewTestUtils::moveMouseAway(window);
window->setSource(testFileUrl("qtbug63974.qml"));
window->show();
QVERIFY(QTest::qWaitForWindowExposed(window));