From e310dadef779b28845b41fb091634cd001cda9de Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 6 Aug 2021 12:27:35 +0200 Subject: 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 --- tests/auto/qml/qqmllistmodel/CMakeLists.txt | 4 +--- tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'tests/auto/qml/qqmllistmodel') diff --git a/tests/auto/qml/qqmllistmodel/CMakeLists.txt b/tests/auto/qml/qqmllistmodel/CMakeLists.txt index d583dc3b0e..18c247f5b9 100644 --- a/tests/auto/qml/qqmllistmodel/CMakeLists.txt +++ b/tests/auto/qml/qqmllistmodel/CMakeLists.txt @@ -12,10 +12,7 @@ list(APPEND test_data ${test_data_glob}) qt_internal_add_test(tst_qqmllistmodel SOURCES - ../../shared/util.cpp ../../shared/util.h tst_qqmllistmodel.cpp - INCLUDE_DIRECTORIES - ../../shared PUBLIC_LIBRARIES Qt::CorePrivate Qt::Gui @@ -23,6 +20,7 @@ qt_internal_add_test(tst_qqmllistmodel Qt::QmlModelsPrivate Qt::QmlPrivate Qt::QuickPrivate + Qt::QuickTestUtilsPrivate TESTDATA ${test_data} ) diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index 6896965eea..37b0f6f1fe 100644 --- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -39,7 +39,7 @@ #include #include -#include "../../shared/util.h" +#include Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) @@ -74,6 +74,7 @@ class tst_qqmllistmodel : public QQmlDataTest Q_OBJECT public: tst_qqmllistmodel() + : QQmlDataTest(QT_QMLTEST_DATADIR) { qRegisterMetaType >(); } -- cgit v1.2.3