diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2021-08-06 12:27:35 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2021-09-13 21:17:04 +0200 |
commit | e310dadef779b28845b41fb091634cd001cda9de (patch) | |
tree | 610be234e82cc53752f58521ae3beba4693ff78f /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | |
parent | de0c1c8a4c834dcc080d1b374186a82cd86921ca (diff) |
Consolidate test helpers into private libraries
Previously each test would include and build sources from the shared
folder. Now we make those sources a library, build it once, then have
each test link to it instead.
We also take the opportunity to move some helpers that qtquickcontrols2
had added into the quicktestutils library where it makes sense, and
for the helpers that don't make sense to be there, move them into
quickcontrolstestutils.
We add the libraries to src/ so that they are internal modules built as
part of Qt, rather than tests. That way we can use them in a standalone
test outside of qtdeclarative.
Task-number: QTBUG-95621
Pick-to: 6.2
Change-Id: I0a2ab3976fdbff2e4414df7bdc0808f16453b80a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 2f2b922371..6975fa2dbd 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 @@ -402,7 +402,9 @@ public: int mCacheBuffer; }; -tst_QQuickListView::tst_QQuickListView() : m_view(nullptr) +tst_QQuickListView::tst_QQuickListView() + : QQmlDataTest(QT_QMLTEST_DATADIR) + , m_view(nullptr) { } @@ -2310,7 +2312,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++) @@ -5171,7 +5173,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)); @@ -5307,7 +5309,7 @@ void tst_QQuickListView::snapToItem() QFETCH(qreal, startExtent); QQuickView *window = getView(); - QQuickViewTestUtil::moveMouseAway(window); + QQuickViewTestUtils::moveMouseAway(window); window->setSource(testFileUrl("snapToItem.qml")); window->show(); @@ -5991,7 +5993,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(); @@ -6305,7 +6307,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(); @@ -7940,7 +7942,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(); @@ -7982,7 +7984,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); @@ -8155,7 +8157,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*>(); @@ -8189,7 +8191,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*>(); @@ -9919,7 +9921,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)); |