From 4ad915425d804df798e12031c9b2fc13534dcb97 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Fri, 3 May 2019 14:17:19 +0200 Subject: Doc: Replace example file lists with links to code.qt.io Instead of generating .html page for each file in an example project, generate links to code.qt.io, under the correct path and branch, where the user can browse the example source. Store all URLs under QT_INSTALL_DOCS/config where other qt5 submodules can access them. The repository name appears in the URL, so we cannot define a single URL for all modules. Task-number: QTBUG-74391 Change-Id: I63d4d6d2c352877797b1ee8e057d48c0cd789bff Reviewed-by: Paul Wicking --- src/testlib/doc/qttestlib.qdocconf | 1 + 1 file changed, 1 insertion(+) (limited to 'src/testlib') diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf index 5fdf6d9415..73310221cf 100644 --- a/src/testlib/doc/qttestlib.qdocconf +++ b/src/testlib/doc/qttestlib.qdocconf @@ -1,4 +1,5 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) +include($QT_INSTALL_DOCS/config/exampleurl-qtbase.qdocconf) project = QtTestLib moduleheader = QtTest -- cgit v1.2.3 From 0d6b4b519272915c2690ee12d1834823747233ab Mon Sep 17 00:00:00 2001 From: Heikki Halmet Date: Mon, 17 Jun 2019 12:26:54 +0300 Subject: Add keyword msvc-2019 to testlib blacklisting Change-Id: Ibb1d225909e6c0c8b35f3b41aeb619784012d43b Reviewed-by: Frederik Gladhorn --- src/testlib/qtestblacklist.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestblacklist.cpp b/src/testlib/qtestblacklist.cpp index 886f1f75b9..6642699758 100644 --- a/src/testlib/qtestblacklist.cpp +++ b/src/testlib/qtestblacklist.cpp @@ -150,8 +150,10 @@ static QSet keywords() << "msvc-2013" # elif _MSC_VER <= 1900 << "msvc-2015" -# else +# elif _MSC_VER <= 1916 << "msvc-2017" +# else + << "msvc-2019" # endif #endif -- cgit v1.2.3 From fabf9239e0e6231f09d4a324bfe85ffcc529da3d Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 13 Jun 2019 11:54:29 +0200 Subject: QTestLib: Replace typedef by 'using' Apply Fixits by Qt Creator with some amendments. Task-number: QTBUG-69413 Change-Id: I366cca6e5755719e8241e76774af6be2b5312627 Reviewed-by: Lars Knoll --- src/testlib/qtestaccessible.h | 2 +- src/testlib/qtestcase.cpp | 2 +- src/testlib/qtestcase.h | 2 +- src/testlib/qtesttable.cpp | 10 ++++------ 4 files changed, 7 insertions(+), 9 deletions(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestaccessible.h b/src/testlib/qtestaccessible.h index d14dcec031..bd77ee77a1 100644 --- a/src/testlib/qtestaccessible.h +++ b/src/testlib/qtestaccessible.h @@ -65,7 +65,7 @@ QT_BEGIN_NAMESPACE class QObject; // Use pointers since we subclass QAccessibleEvent -typedef QList EventList; +using EventList = QList; bool operator==(const QAccessibleEvent &l, const QAccessibleEvent &r) { diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index ac309374e3..10477238cb 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -301,7 +301,7 @@ class TestMethods { public: Q_DISABLE_COPY_MOVE(TestMethods) - typedef std::vector MetaMethods; + using MetaMethods = std::vector; explicit TestMethods(const QObject *o, const MetaMethods &m = MetaMethods()); diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index 794283ff78..af7c0f43b9 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -336,7 +336,7 @@ namespace QTest template inline void addColumn(const char *name, T * = nullptr) { - typedef std::is_same QIsSameTConstChar; + using QIsSameTConstChar = std::is_same; Q_STATIC_ASSERT_X(!QIsSameTConstChar::value, "const char* is not allowed as a test data format."); addColumnInternal(qMetaTypeId(), name); } diff --git a/src/testlib/qtesttable.cpp b/src/testlib/qtesttable.cpp index 8d42668a5b..20e0702d44 100644 --- a/src/testlib/qtesttable.cpp +++ b/src/testlib/qtesttable.cpp @@ -65,10 +65,10 @@ public: int type; }; - typedef std::vector ElementList; + using ElementList = std::vector; ElementList elementList; - typedef std::vector DataList; + using DataList = std::vector; DataList dataList; void addColumn(int elemType, const char *elemName) { elementList.push_back(Element(elemName, elemType)); } @@ -152,14 +152,12 @@ private: int QTestTable::indexOf(const char *elementName) const { - typedef QTestTablePrivate::ElementList::const_iterator It; - QTEST_ASSERT(elementName); const QTestTablePrivate::ElementList &elementList = d->elementList; - const It it = std::find_if(elementList.begin(), elementList.end(), - NamePredicate(elementName)); + const auto it = std::find_if(elementList.begin(), elementList.end(), + NamePredicate(elementName)); return it != elementList.end() ? int(it - elementList.begin()) : -1; } -- cgit v1.2.3 From ff561baabdf2f807ba4867e11f0dbed17ad4f8bf Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Thu, 4 Jul 2019 11:26:59 +0200 Subject: Testlib: Reset the global benchmark data only if it matches You can create multiple instances of QBenchmarkGlobalData as the ctor is public. The qmltest plugin does create a static one, but only conditionally assigns it to the singleton pointer. On shutdown the plugin is removed and the QBenchmarkGlobalData::current should only be reset by the dtor if it's actually pointing to the same object. Change-Id: I616c1ccf6f7a00abf1de342094da88481510bc7b Reviewed-by: Fabian Kosmale Reviewed-by: Simon Hausmann --- src/testlib/qbenchmark.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qbenchmark.cpp b/src/testlib/qbenchmark.cpp index 8d5543a0fc..cbc009c993 100644 --- a/src/testlib/qbenchmark.cpp +++ b/src/testlib/qbenchmark.cpp @@ -66,7 +66,8 @@ QBenchmarkGlobalData::QBenchmarkGlobalData() QBenchmarkGlobalData::~QBenchmarkGlobalData() { delete measurer; - QBenchmarkGlobalData::current = 0; + if (QBenchmarkGlobalData::current == this) + QBenchmarkGlobalData::current = nullptr; } void QBenchmarkGlobalData::setMode(Mode mode) -- cgit v1.2.3 From bcd4b14026094d0077ad1069054676cc6da96251 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Arve=20S=C3=A6ther?= Date: Tue, 2 Jul 2019 17:11:20 +0200 Subject: Fix qFindTestData() to work with relative resource paths If the resource path 'base' was relative it would enter condition 3) in qFindTestData() and it would actually find the nonsensical "://data" as a viable candidate. We don't want to enter that case, but rather enter the subsequent ('Try resources') case Change-Id: I1928ba02c941e23fee4fec9052a1981e46fa59b7 Task-number: QTBUG-73512 Reviewed-by: Friedemann Kleint --- src/testlib/qtestcase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index 10477238cb..619376fd33 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2206,7 +2206,7 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co } // 3. relative to test source. - if (found.isEmpty()) { + if (found.isEmpty() && qstrncmp(file, ":/", 2) != 0) { // srcdir is the directory containing the calling source file. QFileInfo srcdir = QFileInfo(QFile::decodeName(file)).path(); -- cgit v1.2.3 From a393ea072982fa706bb6585295ed6c22e7cbca06 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Fri, 5 Jul 2019 06:13:07 +0900 Subject: Fix build without features.itemmodel Change-Id: I1235bed395a47438bc18571e2331a3432e274dec Reviewed-by: Christian Ehrlicher Reviewed-by: Shawn Rutledge --- src/testlib/qtest.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/testlib') diff --git a/src/testlib/qtest.h b/src/testlib/qtest.h index 89abc616d9..7affdcb8b4 100644 --- a/src/testlib/qtest.h +++ b/src/testlib/qtest.h @@ -51,7 +51,9 @@ #include #include #include +#if QT_CONFIG(itemmodel) #include +#endif #include #include #include @@ -129,12 +131,14 @@ template<> inline char *toString(const QChar &c) return qstrdup(qPrintable(QString::fromLatin1("QChar: '%1' (0x%2)").arg(c).arg(QString::number(static_cast(c.unicode()), 16)))); } +#if QT_CONFIG(itemmodel) template<> inline char *toString(const QModelIndex &idx) { char msg[128]; qsnprintf(msg, sizeof(msg), "QModelIndex(%d,%d,%p,%p)", idx.row(), idx.column(), idx.internalPointer(), idx.model()); return qstrdup(msg); } +#endif template<> inline char *toString(const QPoint &p) { -- cgit v1.2.3