diff options
author | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-14 12:59:07 +0200 |
---|---|---|
committer | Alexandru Croitor <alexandru.croitor@qt.io> | 2019-06-14 16:31:09 +0200 |
commit | fe3bd212fc85b6c3a64bb8bd5beca4ff4d3493a1 (patch) | |
tree | b96dd84abfb6ac25b26539999bf2d7d427f347dd /tests/auto/corelib | |
parent | 72066a3a585b4f4fed499c64464ca5ad2ba9f71d (diff) | |
parent | ae97d11589dd03edeea0475163e6110869143b35 (diff) |
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
This changes many different CMake places to mention Qt6 instead of
Qt5.
Note that some old qt5 cmake config files in corelib are probably not
needed anymore, but I still renamed and kept them for now.
Change-Id: Ie69e81540386a5af153f76c0242e18d48211bec4
Diffstat (limited to 'tests/auto/corelib')
40 files changed, 302 insertions, 210 deletions
diff --git a/tests/auto/corelib/CMakeLists.txt b/tests/auto/corelib/CMakeLists.txt index 1625488909..987df6cb4d 100644 --- a/tests/auto/corelib/CMakeLists.txt +++ b/tests/auto/corelib/CMakeLists.txt @@ -9,4 +9,5 @@ add_subdirectory(serialization) add_subdirectory(statemachine) add_subdirectory(thread) add_subdirectory(tools) +add_subdirectory(time) diff --git a/tests/auto/corelib/corelib.pro b/tests/auto/corelib/corelib.pro index 44e1c519b0..1d76e1549b 100644 --- a/tests/auto/corelib/corelib.pro +++ b/tests/auto/corelib/corelib.pro @@ -14,4 +14,5 @@ SUBDIRS = \ serialization \ statemachine \ thread \ + time \ tools diff --git a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp index 0944ec252e..4428be08d4 100644 --- a/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp +++ b/tests/auto/corelib/io/qfileinfo/tst_qfileinfo.cpp @@ -115,7 +115,7 @@ static DWORD createSymbolicLink(const QString &symLinkName, const QString &targe reinterpret_cast<const wchar_t*>(nativeTarget.utf16()), flags) == FALSE) { result = GetLastError(); QTextStream(errorMessage) << "CreateSymbolicLink(" << nativeSymLinkName << ", " - << nativeTarget << ", 0x" << hex << flags << dec << ") failed with error " << result + << nativeTarget << ", 0x" << Qt::hex << flags << Qt::dec << ") failed with error " << result << ": " << qt_error_string(int(result)); } return result; diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 b/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test5 +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 b/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test4 +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test index e69de29bb2..e69de29bb2 100644 --- a/tests/auto/corelib/io/qfileselector/platforms/+mac/test +++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+ios/test diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+ios/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+macos/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/+macos/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/+osx/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test deleted file mode 100644 index e69de29bb2..0000000000 --- a/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+mac/test +++ /dev/null diff --git a/tests/auto/corelib/io/qfileselector/platforms/+osx/test b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test index e69de29bb2..e69de29bb2 100644 --- a/tests/auto/corelib/io/qfileselector/platforms/+osx/test +++ b/tests/auto/corelib/io/qfileselector/platforms/+unix/+darwin/+macos/test diff --git a/tests/auto/corelib/io/qfileselector/qfileselector.qrc b/tests/auto/corelib/io/qfileselector/qfileselector.qrc index 54b2e0a0e2..f3b3ede575 100644 --- a/tests/auto/corelib/io/qfileselector/qfileselector.qrc +++ b/tests/auto/corelib/io/qfileselector/qfileselector.qrc @@ -1,65 +1,51 @@ -<!DOCTYPE RCC><RCC version="1.0"> -<qresource prefix="/"> - <file>extras/test</file> - <file>extras/test2</file> - <file>extras/+custom1/test</file> - <file>extras/+custom1/test3</file> - <file>extras/+custom2/test</file> - <file>extras/+custom3/test</file> - <file>extras/+custom3/+custom2/test</file> - <file>extras/+custom3/+custom4/test</file> - <file>extras/+custom3/+custom5/test</file> - <file>extras/+custom5/+custom3/test</file> - - <!-- platforms/test: deepest possible selection --> - <file>platforms/test</file> - <file>platforms/+unix/+android/test</file> - <file>platforms/+unix/+darwin/+mac/+ios/test</file> - <file>platforms/+unix/+darwin/+mac/+osx/+macos/test</file> - <file>platforms/+unix/+darwin/+mac/+osx/test</file> - <file>platforms/+unix/+darwin/+mac/test</file> - <file>platforms/+unix/+darwin/test</file> - <file>platforms/+unix/+haiku/test</file> - <file>platforms/+unix/+linux/test</file> - <file>platforms/+unix/+qnx/test</file> - <file>platforms/+unix/test</file> - <file>platforms/+windows/+wince/test</file> - <file>platforms/+windows/+winnt/test</file> - <file>platforms/+windows/+winrt/test</file> - <file>platforms/+windows/test</file> - <file>platforms/+android/test</file> - <file>platforms/+ios/test</file> - <file>platforms/+macos/test</file> - <file>platforms/+osx/test</file> - <file>platforms/+darwin/test</file> - <file>platforms/+mac/test</file> - <file>platforms/+haiku/test</file> - <file>platforms/+linux/test</file> - <file>platforms/+qnx/test</file> - <file>platforms/+wince/test</file> - <file>platforms/+winrt/test</file> - - <!-- platforms/test2: shallow selection for the deepest selector --> - <file>platforms/test2</file> - <file>platforms/+android/test2</file> - <file>platforms/+ios/test2</file> - <file>platforms/+macos/test2</file> - <file>platforms/+haiku/test2</file> - <file>platforms/+linux/test2</file> - <file>platforms/+qnx/test2</file> - <file>platforms/+wince/test2</file> - <file>platforms/+winnt/test2</file> - <file>platforms/+winrt/test2</file> - - <!-- platforms/test3: selection for the family only --> - <file>platforms/test3</file> - <file>platforms/+windows/test3</file> - <file>platforms/+unix/test3</file> - - <!-- platforms/test4 and 5: special cases for macOS --> - <file>platforms/test4</file> - <file>platforms/+osx/test4</file> - <file>platforms/test5</file> - <file>platforms/+mac/test5</file> -</qresource> +<RCC> + <qresource prefix="/"> + <file>extras/test</file> + <file>extras/test2</file> + <file>extras/+custom1/test</file> + <file>extras/+custom1/test3</file> + <file>extras/+custom2/test</file> + <file>extras/+custom3/test</file> + <file>extras/+custom3/+custom2/test</file> + <file>extras/+custom3/+custom4/test</file> + <file>extras/+custom3/+custom5/test</file> + <file>extras/+custom5/+custom3/test</file> + <file>platforms/test</file> + <file>platforms/+unix/+android/test</file> + <file>platforms/+unix/+darwin/test</file> + <file>platforms/+unix/+haiku/test</file> + <file>platforms/+unix/+linux/test</file> + <file>platforms/+unix/+qnx/test</file> + <file>platforms/+unix/test</file> + <file>platforms/+windows/+wince/test</file> + <file>platforms/+windows/+winnt/test</file> + <file>platforms/+windows/+winrt/test</file> + <file>platforms/+windows/test</file> + <file>platforms/+android/test</file> + <file>platforms/+ios/test</file> + <file>platforms/+macos/test</file> + <file>platforms/+darwin/test</file> + <file>platforms/+haiku/test</file> + <file>platforms/+linux/test</file> + <file>platforms/+qnx/test</file> + <file>platforms/+wince/test</file> + <file>platforms/+winrt/test</file> + <file>platforms/test2</file> + <file>platforms/+android/test2</file> + <file>platforms/+ios/test2</file> + <file>platforms/+macos/test2</file> + <file>platforms/+haiku/test2</file> + <file>platforms/+linux/test2</file> + <file>platforms/+qnx/test2</file> + <file>platforms/+wince/test2</file> + <file>platforms/+winnt/test2</file> + <file>platforms/+winrt/test2</file> + <file>platforms/test3</file> + <file>platforms/+windows/test3</file> + <file>platforms/+unix/test3</file> + <file>platforms/test4</file> + <file>platforms/test5</file> + <file>platforms/+unix/+darwin/+macos/test</file> + <file>platforms/+unix/+darwin/+ios/test</file> + </qresource> </RCC> diff --git a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp index c9f1e3d9f6..b98a98df9c 100644 --- a/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp +++ b/tests/auto/corelib/io/qfileselector/tst_qfileselector.cpp @@ -126,14 +126,6 @@ void tst_QFileSelector::basicTest_data() QTest::newRow("platform3") << QString(":/platforms/test3") << QStringList() << expectedPlatform3File; -#ifdef Q_OS_MACOS - // special case for compatibility code - QTest::newRow("osx-compat") << QString(":/platforms/test4") << QStringList() - << ":/platforms/+osx/test4"; - QTest::newRow("mac-compat") << QString(":/platforms/test5") << QStringList() - << ":/platforms/+mac/test5"; -#endif - QString resourceTestPath(":/extras/test"); QString custom1("custom1"); QTest::newRow("custom1-noselector") << resourceTestPath << QStringList() diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 9c106c7f58..daaa5516cd 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -136,8 +136,8 @@ private slots: void emptyQueryOrFragment(); void hasFragment_data(); void hasFragment(); - void setEncodedFragment_data(); - void setEncodedFragment(); + void setFragment_data(); + void setFragment(); void fromEncoded(); void stripTrailingSlash_data(); void stripTrailingSlash(); @@ -350,15 +350,15 @@ void tst_QUrl::comparison() // 6.2.2.1 Make sure hexdecimal characters in percent encoding are // treated case-insensitively QUrl url5; - url5.setEncodedQuery("a=%2a"); + url5.setQuery(QLatin1String("a=%2a")); QUrl url6; - url6.setEncodedQuery("a=%2A"); + url6.setQuery(QLatin1String("a=%2A")); QCOMPARE(url5, url6); QUrl url7; - url7.setEncodedQuery("a=C"); + url7.setQuery(QLatin1String("a=C")); QUrl url8; - url8.setEncodedQuery("a=c"); + url8.setQuery(QLatin1String("a=c")); QVERIFY(url7 != url8); QVERIFY(url7 < url8); @@ -502,7 +502,7 @@ void tst_QUrl::setUrl() QVERIFY(url.isValid()); QCOMPARE(url.scheme(), QString::fromLatin1("file")); QCOMPARE(url.path(), QString::fromLatin1("/")); - QVERIFY(url.encodedQuery().isEmpty()); + QVERIFY(url.query().isEmpty()); QVERIFY(url.userInfo().isEmpty()); QVERIFY(url.authority().isEmpty()); QVERIFY(url.fragment().isEmpty()); @@ -517,7 +517,7 @@ void tst_QUrl::setUrl() QVERIFY(url.isValid()); QCOMPARE(url.scheme(), QString::fromLatin1("http")); QCOMPARE(url.path(), QString()); - QVERIFY(url.encodedQuery().isEmpty()); + QVERIFY(url.query().isEmpty()); QVERIFY(url.userInfo().isEmpty()); QVERIFY(url.fragment().isEmpty()); QCOMPARE(url.host(), QString::fromLatin1("www.foo.bar")); @@ -536,7 +536,7 @@ void tst_QUrl::setUrl() QVERIFY(url.isValid()); QCOMPARE(url.scheme(), QString::fromLatin1("http")); QCOMPARE(url.path(), QString()); - QVERIFY(url.encodedQuery().isEmpty()); + QVERIFY(url.query().isEmpty()); QCOMPARE(url.userName(), QString::fromLatin1("user:")); QCOMPARE(url.password(), QString::fromLatin1("pass@")); QCOMPARE(url.userInfo(), QString::fromLatin1("user%3A:pass@")); @@ -781,7 +781,7 @@ void tst_QUrl::setUrl() QVERIFY(url.isValid()); QCOMPARE(url.scheme(), QString("http")); QCOMPARE(url.host(), QString("1.2.3.4")); - QCOMPARE(url.encodedQuery(), QByteArray("foo")); + QCOMPARE(url.query(QUrl::FullyEncoded), QLatin1String("foo")); } { QUrl url; @@ -798,13 +798,13 @@ void tst_QUrl::setUrl() QCOMPARE(url.scheme(), QString("data")); QCOMPARE(url.host(), QString()); QCOMPARE(url.path(), QString("text/javascript,d5 = 'five\\u0027s';")); - QCOMPARE(url.encodedPath().constData(), "text/javascript,d5%20%3D%20'five%5Cu0027s'%3B"); + QCOMPARE(url.path(QUrl::FullyEncoded), QLatin1String("text/javascript,d5%20%3D%20'five%5Cu0027s'%3B")); } { // invalid port number QUrl url; - url.setEncodedUrl("foo://tel:2147483648"); + url.setUrl(QLatin1String("foo://tel:2147483648"), QUrl::StrictMode); QVERIFY(!url.isValid()); } @@ -1144,7 +1144,7 @@ void tst_QUrl::toString_constructed_data() QTest::addColumn<QString>("host"); QTest::addColumn<int>("port"); QTest::addColumn<QString>("path"); - QTest::addColumn<QByteArray>("query"); + QTest::addColumn<QString>("query"); QTest::addColumn<QString>("fragment"); QTest::addColumn<QString>("asString"); QTest::addColumn<QByteArray>("asEncoded"); @@ -1153,19 +1153,19 @@ void tst_QUrl::toString_constructed_data() QString n(""); QTest::newRow("data1") << n << n << n << QString::fromLatin1("qt-project.org") << -1 << QString::fromLatin1("/index.html") - << QByteArray() << n << QString::fromLatin1("//qt-project.org/index.html") + << QString() << n << QString::fromLatin1("//qt-project.org/index.html") << QByteArray("//qt-project.org/index.html") << 0u; - QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QByteArray() + QTest::newRow("data2") << QString::fromLatin1("file") << n << n << n << -1 << QString::fromLatin1("/root") << QString() << n << QString::fromLatin1("file:///root") << QByteArray("file:///root") << 0u; QTest::newRow("userAndPass") << QString::fromLatin1("http") << QString::fromLatin1("dfaure") << QString::fromLatin1("kde") - << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n + << "kde.org" << 443 << QString::fromLatin1("/") << QString() << n << QString::fromLatin1("http://dfaure:kde@kde.org:443/") << QByteArray("http://dfaure:kde@kde.org:443/") << 0u; QTest::newRow("PassWithoutUser") << QString::fromLatin1("http") << n << QString::fromLatin1("kde") - << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n + << "kde.org" << 443 << QString::fromLatin1("/") << QString() << n << QString::fromLatin1("http://:kde@kde.org:443/") << QByteArray("http://:kde@kde.org:443/") << 0u; QTest::newRow("PassWithoutUser-RemovePassword") << QString::fromLatin1("http") << n << QString::fromLatin1("kde") - << "kde.org" << 443 << QString::fromLatin1("/") << QByteArray() << n + << "kde.org" << 443 << QString::fromLatin1("/") << QString() << n << QString::fromLatin1("http://kde.org:443/") << QByteArray("http://kde.org:443/") << uint(QUrl::RemovePassword); } @@ -1178,7 +1178,7 @@ void tst_QUrl::toString_constructed() QFETCH(QString, host); QFETCH(int, port); QFETCH(QString, path); - QFETCH(QByteArray, query); + QFETCH(QString, query); QFETCH(QString, fragment); QFETCH(QString, asString); QFETCH(QByteArray, asEncoded); @@ -1198,7 +1198,7 @@ void tst_QUrl::toString_constructed() if (!path.isEmpty()) url.setPath(path); if (!query.isEmpty()) - url.setEncodedQuery(query); + url.setQuery(query, QUrl::StrictMode); if (!fragment.isEmpty()) url.setFragment(fragment); @@ -1757,7 +1757,7 @@ void tst_QUrl::symmetry() QCOMPARE(url.host(QUrl::EncodeUnicode | QUrl::EncodeSpaces), QString::fromUtf8("www.xn--rksmrgs-5wao1o.se")); QCOMPARE(url.path(), QString::fromLatin1("/pub")); // this will be encoded ... - QCOMPARE(url.encodedQuery().constData(), QString::fromLatin1("a=b&a=d%C3%B8&a=f").toLatin1().constData()); + QCOMPARE(url.query(QUrl::FullyEncoded), QLatin1String("a=b&a=d%C3%B8&a=f")); QCOMPARE(url.fragment(), QString::fromUtf8("vræl")); QUrl onlyHost("//qt-project.org"); @@ -2009,7 +2009,7 @@ void tst_QUrl::hasQuery() QUrl qurl(url); QCOMPARE(qurl.hasQuery(), trueFalse); - QCOMPARE(qurl.encodedQuery().isNull(), !trueFalse); + QCOMPARE(qurl.query().isNull(), !trueFalse); } void tst_QUrl::nameprep() @@ -2342,7 +2342,7 @@ void tst_QUrl::tolerantParser() QVERIFY(url.isValid()); QVERIFY(!url.toString().isEmpty()); QCOMPARE(url.path(), QString("/path with spaces.html")); - url.setEncodedUrl("http://www.example.com/path%20with spaces.html", QUrl::StrictMode); + url.setUrl(QLatin1String("http://www.example.com/path%20with spaces.html"), QUrl::StrictMode); QVERIFY(!url.isValid()); QVERIFY(url.toString().isEmpty()); } @@ -2392,36 +2392,36 @@ void tst_QUrl::tolerantParser() QCOMPARE(url.toEncoded(), QByteArray("%25hello.com/f%25")); QCOMPARE(url.toString(), QString("%25hello.com/f%25")); - url.setEncodedUrl("http://www.host.com/foo.php?P0=[2006-3-8]"); + url.setUrl(QLatin1String("http://www.host.com/foo.php?P0=[2006-3-8]"), QUrl::StrictMode); QVERIFY(url.isValid()); QVERIFY(!url.toString().isEmpty()); - url.setEncodedUrl("http://foo.bar/[image][1].jpg"); + url.setUrl(QLatin1String("http://foo.bar/[image][1].jpg"), QUrl::StrictMode); QVERIFY(url.isValid()); QCOMPARE(url.toString(QUrl::FullyEncoded), QString("http://foo.bar/[image][1].jpg")); QCOMPARE(url.toEncoded(), QByteArray("http://foo.bar/[image][1].jpg")); QCOMPARE(url.toString(), QString("http://foo.bar/[image][1].jpg")); - url.setEncodedUrl("http://foo.bar/%5Bimage%5D%5B1%5D.jpg"); + url.setUrl(QLatin1String("http://foo.bar/%5Bimage%5D%5B1%5D.jpg"), QUrl::StrictMode); QVERIFY(url.isValid()); QCOMPARE(url.toString(QUrl::FullyEncoded), QString("http://foo.bar/%5Bimage%5D%5B1%5D.jpg")); QCOMPARE(url.toEncoded(), QByteArray("http://foo.bar/%5Bimage%5D%5B1%5D.jpg")); QCOMPARE(url.toString(), QString("http://foo.bar/%5Bimage%5D%5B1%5D.jpg")); - url.setEncodedUrl("//[::56:56:56:56:56:56:56]"); + url.setUrl(QLatin1String("//[::56:56:56:56:56:56:56]"), QUrl::StrictMode); QCOMPARE(url.toString(QUrl::FullyEncoded), QString("//[0:56:56:56:56:56:56:56]")); QCOMPARE(url.toEncoded(), QByteArray("//[0:56:56:56:56:56:56:56]")); - url.setEncodedUrl("data:text/css,div%20{%20border-right:%20solid;%20}"); + url.setUrl(QLatin1String("data:text/css,div%20{%20border-right:%20solid;%20}"), QUrl::TolerantMode); QCOMPARE(url.toString(QUrl::FullyEncoded), QString("data:text/css,div%20%7B%20border-right:%20solid;%20%7D")); QCOMPARE(url.toEncoded(), QByteArray("data:text/css,div%20%7B%20border-right:%20solid;%20%7D")); QCOMPARE(url.toString(), QString("data:text/css,div %7B border-right: solid; %7D")); } { - QByteArray tsdgeos("http://google.com/c?c=Translation+%C2%BB+trunk|"); + const QString tsdgeos = QLatin1String("http://google.com/c?c=Translation+%C2%BB+trunk|"); QUrl tsdgeosQUrl; - tsdgeosQUrl.setEncodedUrl(tsdgeos, QUrl::TolerantMode); + tsdgeosQUrl.setUrl(tsdgeos, QUrl::TolerantMode); QVERIFY(tsdgeosQUrl.isValid()); // failed in Qt-4.4, works in Qt-4.5 QByteArray tsdgeosExpected("http://google.com/c?c=Translation+%C2%BB+trunk%7C"); QCOMPARE(QString(tsdgeosQUrl.toEncoded()), QString(tsdgeosExpected)); @@ -2626,31 +2626,31 @@ void tst_QUrl::emptyQueryOrFragment() // start with an empty one QUrl url("http://www.foo.bar/baz"); QVERIFY(!url.hasQuery()); - QVERIFY(url.encodedQuery().isNull()); + QVERIFY(url.query().isNull()); // add encodedQuery url.setQuery("abc=def"); QVERIFY(url.hasQuery()); QCOMPARE(url.query(), QString(QLatin1String("abc=def"))); QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?abc=def"))); - url.setEncodedQuery("abc=def"); + url.setQuery(QLatin1String("abc=def")); QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?abc=def"))); // remove encodedQuery url.setQuery(QString()); QVERIFY(!url.hasQuery()); - QVERIFY(url.encodedQuery().isNull()); + QVERIFY(url.query().isNull()); QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz"))); - url.setEncodedQuery(QByteArray()); + url.setQuery(QString()); QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz"))); // add empty encodedQuery url.setQuery(""); QVERIFY(url.hasQuery()); - QVERIFY(url.encodedQuery().isEmpty()); - QVERIFY(!url.encodedQuery().isNull()); + QVERIFY(url.query().isEmpty()); + QVERIFY(!url.query().isNull()); QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?"))); - url.setEncodedQuery(""); + url.setQuery(QLatin1String("")); QCOMPARE(url.toString(), QString(QLatin1String("http://www.foo.bar/baz?"))); } } @@ -2682,35 +2682,33 @@ void tst_QUrl::hasFragment() QCOMPARE(qurl.fragment().isNull(), !trueFalse); } -void tst_QUrl::setEncodedFragment_data() +void tst_QUrl::setFragment_data() { - QTest::addColumn<QByteArray>("base"); - QTest::addColumn<QByteArray>("fragment"); - QTest::addColumn<QByteArray>("expected"); + QTest::addColumn<QString>("base"); + QTest::addColumn<QString>("fragment"); + QTest::addColumn<QString>("expected"); - typedef QByteArray BA; - QTest::newRow("null") << BA("http://www.kde.org") << BA() << BA("http://www.kde.org"); - QTest::newRow("empty") << BA("http://www.kde.org") << BA("") << BA("http://www.kde.org#"); - QTest::newRow("basic test") << BA("http://www.kde.org") << BA("abc") << BA("http://www.kde.org#abc"); - QTest::newRow("initial url has fragment") << BA("http://www.kde.org#old") << BA("new") << BA("http://www.kde.org#new"); - QTest::newRow("encoded fragment") << BA("http://www.kde.org") << BA("a%20c") << BA("http://www.kde.org#a%20c"); - QTest::newRow("with #") << BA("http://www.kde.org") << BA("a#b") << BA("http://www.kde.org#a%23b"); // toString uses "a#b" - QTest::newRow("unicode") << BA("http://www.kde.org") << BA("\xc3\xa9") << BA("http://www.kde.org#%C3%A9"); - QTest::newRow("binary") << BA("http://www.kde.org") << BA("\x00\xc0\x80", 3) << BA("http://www.kde.org#%00%C0%80"); + QTest::newRow("null") << QString::fromLatin1("http://www.kde.org") << QString() << QString::fromLatin1("http://www.kde.org"); + QTest::newRow("empty") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("") << QString::fromLatin1("http://www.kde.org#"); + QTest::newRow("basic test") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("abc") << QString::fromLatin1("http://www.kde.org#abc"); + QTest::newRow("initial url has fragment") << QString::fromLatin1("http://www.kde.org#old") << QString::fromLatin1("new") << QString::fromLatin1("http://www.kde.org#new"); + QTest::newRow("encoded fragment") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("a%20c") << QString::fromLatin1("http://www.kde.org#a%20c"); + QTest::newRow("with #") << QString::fromLatin1("http://www.kde.org") << QString::fromLatin1("a#b") << QString::fromLatin1("http://www.kde.org#a%23b"); // toString uses "a#b" + QTest::newRow("unicode") << QString::fromLatin1("http://www.kde.org") << QString::fromUtf8("\xc3\xa9") << QString::fromLatin1("http://www.kde.org#%C3%A9"); } -void tst_QUrl::setEncodedFragment() +void tst_QUrl::setFragment() { - QFETCH(QByteArray, base); - QFETCH(QByteArray, fragment); - QFETCH(QByteArray, expected); + QFETCH(QString, base); + QFETCH(QString, fragment); + QFETCH(QString, expected); QUrl u; - u.setEncodedUrl(base, QUrl::TolerantMode); + u.setUrl(base, QUrl::TolerantMode); QVERIFY(u.isValid()); - u.setEncodedFragment(fragment); + u.setFragment(fragment); QVERIFY(u.isValid()); QCOMPARE(!fragment.isNull(), u.hasFragment()); - QCOMPARE(QString::fromLatin1(u.toEncoded()), QString::fromLatin1(expected)); + QCOMPARE(QString::fromUtf8(u.toEncoded()), expected); } void tst_QUrl::fromEncoded() @@ -3258,14 +3256,14 @@ void tst_QUrl::isEmptyForEncodedUrl() { { QUrl url; - url.setEncodedUrl("LABEL=USB_STICK", QUrl::TolerantMode); + url.setUrl(QLatin1String("LABEL=USB_STICK"), QUrl::TolerantMode); QVERIFY( url.isValid() ); QCOMPARE( url.path(), QString("LABEL=USB_STICK") ); QVERIFY( !url.isEmpty() ); } { QUrl url; - url.setEncodedUrl("LABEL=USB_STICK", QUrl::TolerantMode); + url.setUrl(QLatin1String("LABEL=USB_STICK"), QUrl::TolerantMode); QVERIFY( url.isValid() ); QVERIFY( !url.isEmpty() ); QCOMPARE( url.path(), QString("LABEL=USB_STICK") ); @@ -3277,7 +3275,7 @@ void tst_QUrl::isEmptyForEncodedUrl() void tst_QUrl::toEncodedNotUsingUninitializedPath() { QUrl url; - url.setEncodedPath("/test.txt"); + url.setPath(QLatin1String("/test.txt")); url.setHost("example.com"); QCOMPARE(url.toEncoded().constData(), "//example.com/test.txt"); @@ -3657,17 +3655,6 @@ void tst_QUrl::componentEncodings() QCOMPARE(url.toString(formatting), (((QString(toString ))))); // the weird () and space is to align the output - if (formatting == QUrl::FullyEncoded) { - QCOMPARE(url.encodedUserName(), userName.toUtf8()); - QCOMPARE(url.encodedPassword(), password.toUtf8()); - // no encodedUserInfo - QCOMPARE(url.encodedHost(), host.toUtf8()); - // no encodedAuthority - QCOMPARE(url.encodedPath(), path.toUtf8()); - QCOMPARE(url.encodedQuery(), query.toUtf8()); - QCOMPARE(url.encodedFragment(), fragment.toUtf8()); - } - // repeat with the URL we got from toString QUrl url2(toString); QCOMPARE(url2.userName(formatting), userName); diff --git a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp index 6adb393ddd..d68cefc807 100644 --- a/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp +++ b/tests/auto/corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp @@ -611,7 +611,7 @@ void tst_QCoreApplication::processEventsAlwaysSendsPostedEvents() TestApplication app(argc, argv); ProcessEventsAlwaysSendsPostedEventsObject object; - QTime t; + QElapsedTimer t; t.start(); int i = 1; do { diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp index 681a5d0146..cc67fc7884 100644 --- a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp +++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp @@ -130,7 +130,7 @@ public: QString m_value; void setValue(const QString &value) { m_value = value; } QString getValue() { return m_value; } - void resetValue() { m_value = QLatin1Literal("reset"); } + void resetValue() { m_value = QLatin1String("reset"); } }; void tst_QMetaProperty::gadget() @@ -140,7 +140,7 @@ void tst_QMetaProperty::gadget() QVERIFY(valueProp.isValid()); { MyGadget g; - QString hello = QLatin1Literal("hello"); + QString hello = QLatin1String("hello"); QVERIFY(valueProp.writeOnGadget(&g, hello)); QCOMPARE(g.m_value, QLatin1String("hello")); QCOMPARE(valueProp.readOnGadget(&g), QVariant(hello)); @@ -242,7 +242,7 @@ void tst_QMetaProperty::conversion() QCOMPARE(custom.str, QString()); // or reset resetable QVERIFY(value7P.write(this, QVariant())); - QCOMPARE(value7, QLatin1Literal("reset")); + QCOMPARE(value7, QLatin1String("reset")); } QTEST_MAIN(tst_QMetaProperty) diff --git a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp index e0394a5d25..7c9d8a476a 100644 --- a/tests/auto/corelib/kernel/qobject/tst_qobject.cpp +++ b/tests/auto/corelib/kernel/qobject/tst_qobject.cpp @@ -32,7 +32,6 @@ #include <qcoreapplication.h> #include <qpointer.h> #include <qtimer.h> -#include <qregexp.h> #include <qregularexpression.h> #include <qmetaobject.h> #include <qvariant.h> @@ -537,91 +536,91 @@ void tst_QObject::findChildren() QObject *op = 0; - op = qFindChild<QObject*>(&o, "o1"); + op = o.findChild<QObject*>("o1"); QCOMPARE(op, &o1); - op = qFindChild<QObject*>(&o, "o2"); + op = o.findChild<QObject*>("o2"); QCOMPARE(op, &o2); - op = qFindChild<QObject*>(&o, "o11"); + op = o.findChild<QObject*>("o11"); QCOMPARE(op, &o11); - op = qFindChild<QObject*>(&o, "o12"); + op = o.findChild<QObject*>("o12"); QCOMPARE(op, &o12); - op = qFindChild<QObject*>(&o, "o111"); + op = o.findChild<QObject*>("o111"); QCOMPARE(op, &o111); - op = qFindChild<QObject*>(&o, "t1"); + op = o.findChild<QObject*>("t1"); QCOMPARE(op, static_cast<QObject *>(&t1)); - op = qFindChild<QObject*>(&o, "t121"); + op = o.findChild<QObject*>("t121"); QCOMPARE(op, static_cast<QObject *>(&t121)); - op = qFindChild<QTimer*>(&o, "t1"); + op = o.findChild<QTimer*>("t1"); QCOMPARE(op, static_cast<QObject *>(&t1)); - op = qFindChild<QTimer*>(&o, "t121"); + op = o.findChild<QTimer*>("t121"); QCOMPARE(op, static_cast<QObject *>(&t121)); - op = qFindChild<QTimer*>(&o, "o12"); + op = o.findChild<QTimer*>("o12"); QCOMPARE(op, static_cast<QObject *>(0)); - op = qFindChild<QObject*>(&o, "o"); + op = o.findChild<QObject*>("o"); QCOMPARE(op, static_cast<QObject *>(0)); - op = qFindChild<QObject*>(&o, "harry"); + op = o.findChild<QObject*>("harry"); QCOMPARE(op, static_cast<QObject *>(0)); - op = qFindChild<QObject*>(&o, "o1"); + op = o.findChild<QObject*>("o1"); QCOMPARE(op, &o1); QList<QObject*> l; QList<QTimer*> tl; - l = qFindChildren<QObject*>(&o, "o1"); + l = o.findChildren<QObject*>("o1"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), &o1); - l = qFindChildren<QObject*>(&o, "o2"); + l = o.findChildren<QObject*>("o2"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), &o2); - l = qFindChildren<QObject*>(&o, "o11"); + l = o.findChildren<QObject*>("o11"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), &o11); - l = qFindChildren<QObject*>(&o, "o12"); + l = o.findChildren<QObject*>("o12"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), &o12); - l = qFindChildren<QObject*>(&o, "o111"); + l = o.findChildren<QObject*>("o111"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), &o111); - l = qFindChildren<QObject*>(&o, "t1"); + l = o.findChildren<QObject*>("t1"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), static_cast<QObject *>(&t1)); - l = qFindChildren<QObject*>(&o, "t121"); + l = o.findChildren<QObject*>("t121"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), static_cast<QObject *>(&t121)); - tl = qFindChildren<QTimer*>(&o, "t1"); + tl = o.findChildren<QTimer*>("t1"); QCOMPARE(tl.size(), 1); QCOMPARE(tl.at(0), &t1); - tl = qFindChildren<QTimer*>(&o, "t121"); + tl = o.findChildren<QTimer*>("t121"); QCOMPARE(tl.size(), 1); QCOMPARE(tl.at(0), &t121); - l = qFindChildren<QObject*>(&o, "o"); + l = o.findChildren<QObject*>("o"); QCOMPARE(l.size(), 0); - l = qFindChildren<QObject*>(&o, "harry"); + l = o.findChildren<QObject*>("harry"); QCOMPARE(l.size(), 0); - tl = qFindChildren<QTimer*>(&o, "o12"); + tl = o.findChildren<QTimer*>("o12"); QCOMPARE(tl.size(), 0); - l = qFindChildren<QObject*>(&o, "o1"); + l = o.findChildren<QObject*>("o1"); QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), &o1); - l = qFindChildren<QObject*>(&o, QRegExp("o.*")); + l = o.findChildren<QObject*>(QRegularExpression("^o.*$")); QCOMPARE(l.size(), 5); QVERIFY(l.contains(&o1)); QVERIFY(l.contains(&o2)); QVERIFY(l.contains(&o11)); QVERIFY(l.contains(&o12)); QVERIFY(l.contains(&o111)); - l = qFindChildren<QObject*>(&o, QRegExp("t.*")); + l = o.findChildren<QObject*>(QRegularExpression("t.*")); QCOMPARE(l.size(), 2); QVERIFY(l.contains(&t1)); QVERIFY(l.contains(&t121)); - tl = qFindChildren<QTimer*>(&o, QRegExp(".*")); + tl = o.findChildren<QTimer*>(QRegularExpression("^.*$")); QCOMPARE(tl.size(), 3); QVERIFY(tl.contains(&t1)); QVERIFY(tl.contains(&t121)); - tl = qFindChildren<QTimer*>(&o, QRegExp("o.*")); + tl = o.findChildren<QTimer*>(QRegularExpression("^o.*$")); QCOMPARE(tl.size(), 0); - l = qFindChildren<QObject*>(&o, QRegExp("harry")); + l = o.findChildren<QObject*>(QRegularExpression("^harry$")); QCOMPARE(l.size(), 0); l = o.findChildren<QObject*>(QRegularExpression("o.*")); @@ -645,18 +644,18 @@ void tst_QObject::findChildren() QCOMPARE(l.size(), 0); // empty and null string check - op = qFindChild<QObject*>(&o); + op = o.findChild<QObject*>(); QCOMPARE(op, &o1); - op = qFindChild<QObject*>(&o, ""); + op = o.findChild<QObject*>(""); QCOMPARE(op, &unnamed); - op = qFindChild<QObject*>(&o, "unnamed"); + op = o.findChild<QObject*>("unnamed"); QCOMPARE(op, static_cast<QObject *>(0)); - l = qFindChildren<QObject*>(&o); + l = o.findChildren<QObject*>(); QCOMPARE(l.size(), 9); - l = qFindChildren<QObject*>(&o, ""); + l = o.findChildren<QObject*>(""); QCOMPARE(l.size(), 2); - l = qFindChildren<QObject*>(&o, "unnamed"); + l = o.findChildren<QObject*>("unnamed"); QCOMPARE(l.size(), 0); tl = o.findChildren<QTimer *>("t1"); @@ -724,19 +723,19 @@ void tst_QObject::findChildren() QCOMPARE(l.size(), 1); QCOMPARE(l.at(0), &o1); - l = o.findChildren<QObject*>(QRegExp("o.*"), Qt::FindDirectChildrenOnly); + l = o.findChildren<QObject*>(QRegularExpression("^o.*$"), Qt::FindDirectChildrenOnly); QCOMPARE(l.size(), 2); QVERIFY(l.contains(&o1)); QVERIFY(l.contains(&o2)); - l = o.findChildren<QObject*>(QRegExp("t.*"), Qt::FindDirectChildrenOnly); + l = o.findChildren<QObject*>(QRegularExpression("^t.*$"), Qt::FindDirectChildrenOnly); QCOMPARE(l.size(), 1); QVERIFY(l.contains(&t1)); - tl = o.findChildren<QTimer*>(QRegExp(".*"), Qt::FindDirectChildrenOnly); + tl = o.findChildren<QTimer*>(QRegularExpression("^.*$"), Qt::FindDirectChildrenOnly); QCOMPARE(tl.size(), 2); QVERIFY(tl.contains(&t1)); - tl = o.findChildren<QTimer*>(QRegExp("o.*"), Qt::FindDirectChildrenOnly); + tl = o.findChildren<QTimer*>(QRegularExpression("^o.*$"), Qt::FindDirectChildrenOnly); QCOMPARE(tl.size(), 0); - l = o.findChildren<QObject*>(QRegExp("harry"), Qt::FindDirectChildrenOnly); + l = o.findChildren<QObject*>(QRegularExpression("^harry$"), Qt::FindDirectChildrenOnly); QCOMPARE(l.size(), 0); // empty and null string check @@ -1035,18 +1034,16 @@ public Q_SLOTS: void tst_QObject::connectNotify_connectSlotsByName() { ConnectByNameNotifyReceiverObject testObject; - QList<ConnectByNameNotifySenderObject *> senders = - qFindChildren<ConnectByNameNotifySenderObject *>(&testObject); - for (int i = 0; i < senders.size(); ++i) { - ConnectByNameNotifySenderObject *o = senders.at(i); + const QList<ConnectByNameNotifySenderObject *> senders = + testObject.findChildren<ConnectByNameNotifySenderObject *>(); + for (ConnectByNameNotifySenderObject *o : senders) { QVERIFY(o->connectedSignals.isEmpty()); QVERIFY(o->disconnectedSignals.isEmpty()); } QMetaObject::connectSlotsByName(&testObject); - for (int i = 0; i < senders.size(); ++i) { - ConnectByNameNotifySenderObject *o = senders.at(i); + for (ConnectByNameNotifySenderObject *o : senders) { QCOMPARE(o->connectedSignals.size(), 1); QCOMPARE(o->connectedSignals.at(0), QMetaMethod::fromSignal(&ConnectByNameNotifySenderObject::signal1)); QVERIFY(o->disconnectedSignals.isEmpty()); @@ -1631,7 +1628,7 @@ void tst_QObject::thread() QObject object; // thread affinity for objects with no parent should be the // current thread - QVERIFY(object.thread() != 0); + QVERIFY(object.thread() != nullptr); QCOMPARE(object.thread(), currentThread); // children inherit their parent's thread QObject child(&object); @@ -1643,7 +1640,7 @@ void tst_QObject::thread() { TestThread thr; - QVERIFY(thr.thread() != 0); + QVERIFY(thr.thread() != nullptr); QCOMPARE(thr.thread(), currentThread); thr.object = &object; @@ -1802,8 +1799,8 @@ void tst_QObject::moveToThread() QMetaObject::invokeMethod(object, "deleteLater", Qt::QueuedConnection); thread.wait(); - QVERIFY(opointer == 0); - QVERIFY(cpointer == 0); + QVERIFY(opointer == nullptr); + QVERIFY(cpointer == nullptr); } { @@ -2379,7 +2376,7 @@ void tst_QObject::testUserData() for (int i=0; i<USER_DATA_COUNT; ++i) { int id = user_data_ids[i]; CustomData *data = static_cast<CustomData *>(my_test_object.userData(id)); - QVERIFY(data != 0); + QVERIFY(data != nullptr); QCOMPARE(data->id, id); } } @@ -3627,7 +3624,7 @@ class OverloadObject : public QObject void sig(int i, int j = 12); void sig(QObject *o, QObject *p, QObject *q = 0, QObject *r = 0) const; void other(int a = 0); - void sig(QObject *o, OverloadObject *p = 0, QObject *q = 0, QObject *r = 0); + void sig(QObject *o, OverloadObject *p = 0, QObject *q = 0, QObject *r = nullptr); void sig(double r = 0.5); public slots: void slo(int i, int j = 43) @@ -5982,7 +5979,7 @@ void ConnectToPrivateSlot::test(SenderObject* obj1) { obj1->signal1(); QCOMPARE(d->receivedCount, 1); QCOMPARE(d->receivedValue, QVariant()); - obj1->signal7(666, QLatin1Literal("_")); + obj1->signal7(666, QLatin1String("_")); QCOMPARE(d->receivedCount, 2); QCOMPARE(d->receivedValue, QVariant(666)); QVERIFY(QObjectPrivate::connect(obj1, &SenderObject::signal2, d, &ConnectToPrivateSlotPrivate::thisIsAPrivateSlot, Qt::UniqueConnection)); diff --git a/tests/auto/corelib/time/CMakeLists.txt b/tests/auto/corelib/time/CMakeLists.txt new file mode 100644 index 0000000000..733f75b8af --- /dev/null +++ b/tests/auto/corelib/time/CMakeLists.txt @@ -0,0 +1,4 @@ +# Generated from time.pro. + +add_subdirectory(qdate) +add_subdirectory(qtime) diff --git a/tests/auto/corelib/tools/qdate/.gitignore b/tests/auto/corelib/time/qdate/.gitignore index 70945d4a86..70945d4a86 100644 --- a/tests/auto/corelib/tools/qdate/.gitignore +++ b/tests/auto/corelib/time/qdate/.gitignore diff --git a/tests/auto/corelib/tools/qdate/CMakeLists.txt b/tests/auto/corelib/time/qdate/CMakeLists.txt index 8514c915ad..8514c915ad 100644 --- a/tests/auto/corelib/tools/qdate/CMakeLists.txt +++ b/tests/auto/corelib/time/qdate/CMakeLists.txt diff --git a/tests/auto/corelib/tools/qdate/qdate.pro b/tests/auto/corelib/time/qdate/qdate.pro index 925c3b4c78..925c3b4c78 100644 --- a/tests/auto/corelib/tools/qdate/qdate.pro +++ b/tests/auto/corelib/time/qdate/qdate.pro diff --git a/tests/auto/corelib/tools/qdate/tst_qdate.cpp b/tests/auto/corelib/time/qdate/tst_qdate.cpp index 0ef494b229..0ef494b229 100644 --- a/tests/auto/corelib/tools/qdate/tst_qdate.cpp +++ b/tests/auto/corelib/time/qdate/tst_qdate.cpp diff --git a/tests/auto/corelib/tools/qdatetime/.gitignore b/tests/auto/corelib/time/qdatetime/.gitignore index 7784f3a3eb..7784f3a3eb 100644 --- a/tests/auto/corelib/tools/qdatetime/.gitignore +++ b/tests/auto/corelib/time/qdatetime/.gitignore diff --git a/tests/auto/corelib/tools/qdatetime/BLACKLIST b/tests/auto/corelib/time/qdatetime/BLACKLIST index 3a42ee066b..3a42ee066b 100644 --- a/tests/auto/corelib/tools/qdatetime/BLACKLIST +++ b/tests/auto/corelib/time/qdatetime/BLACKLIST diff --git a/tests/auto/corelib/tools/qdatetime/qdatetime.pro b/tests/auto/corelib/time/qdatetime/qdatetime.pro index 742eb47075..742eb47075 100644 --- a/tests/auto/corelib/tools/qdatetime/qdatetime.pro +++ b/tests/auto/corelib/time/qdatetime/qdatetime.pro diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp index 6f0aebb071..6f0aebb071 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime.cpp +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime.cpp diff --git a/tests/auto/corelib/tools/qdatetime/tst_qdatetime_mac.mm b/tests/auto/corelib/time/qdatetime/tst_qdatetime_mac.mm index f73c7b9d5d..f73c7b9d5d 100644 --- a/tests/auto/corelib/tools/qdatetime/tst_qdatetime_mac.mm +++ b/tests/auto/corelib/time/qdatetime/tst_qdatetime_mac.mm diff --git a/tests/auto/corelib/tools/qtime/.gitignore b/tests/auto/corelib/time/qtime/.gitignore index 26a4c65cc2..26a4c65cc2 100644 --- a/tests/auto/corelib/tools/qtime/.gitignore +++ b/tests/auto/corelib/time/qtime/.gitignore diff --git a/tests/auto/corelib/tools/qtime/CMakeLists.txt b/tests/auto/corelib/time/qtime/CMakeLists.txt index 0b8b4c81f3..0b8b4c81f3 100644 --- a/tests/auto/corelib/tools/qtime/CMakeLists.txt +++ b/tests/auto/corelib/time/qtime/CMakeLists.txt diff --git a/tests/auto/corelib/tools/qtime/qtime.pro b/tests/auto/corelib/time/qtime/qtime.pro index 0973b7a9ef..0973b7a9ef 100644 --- a/tests/auto/corelib/tools/qtime/qtime.pro +++ b/tests/auto/corelib/time/qtime/qtime.pro diff --git a/tests/auto/corelib/tools/qtime/tst_qtime.cpp b/tests/auto/corelib/time/qtime/tst_qtime.cpp index 3403c5bf7f..3403c5bf7f 100644 --- a/tests/auto/corelib/tools/qtime/tst_qtime.cpp +++ b/tests/auto/corelib/time/qtime/tst_qtime.cpp diff --git a/tests/auto/corelib/tools/qtimezone/BLACKLIST b/tests/auto/corelib/time/qtimezone/BLACKLIST index 840c3b1181..840c3b1181 100644 --- a/tests/auto/corelib/tools/qtimezone/BLACKLIST +++ b/tests/auto/corelib/time/qtimezone/BLACKLIST diff --git a/tests/auto/corelib/tools/qtimezone/qtimezone.pro b/tests/auto/corelib/time/qtimezone/qtimezone.pro index 5ec8d008e7..5ec8d008e7 100644 --- a/tests/auto/corelib/tools/qtimezone/qtimezone.pro +++ b/tests/auto/corelib/time/qtimezone/qtimezone.pro diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp index 9904719f7c..9904719f7c 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone.cpp +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone.cpp diff --git a/tests/auto/corelib/tools/qtimezone/tst_qtimezone_darwin.mm b/tests/auto/corelib/time/qtimezone/tst_qtimezone_darwin.mm index de801e55d0..de801e55d0 100644 --- a/tests/auto/corelib/tools/qtimezone/tst_qtimezone_darwin.mm +++ b/tests/auto/corelib/time/qtimezone/tst_qtimezone_darwin.mm diff --git a/tests/auto/corelib/time/time.pro b/tests/auto/corelib/time/time.pro new file mode 100644 index 0000000000..6f9ff038db --- /dev/null +++ b/tests/auto/corelib/time/time.pro @@ -0,0 +1,6 @@ +TEMPLATE = subdirs +SUBDIRS = \ + qdate \ + qdatetime \ + qtime \ + qtimezone diff --git a/tests/auto/corelib/tools/CMakeLists.txt b/tests/auto/corelib/tools/CMakeLists.txt index befa8e900d..2a9d149aa8 100644 --- a/tests/auto/corelib/tools/CMakeLists.txt +++ b/tests/auto/corelib/tools/CMakeLists.txt @@ -6,7 +6,6 @@ add_subdirectory(qbytedatabuffer) add_subdirectory(qcache) add_subdirectory(qcommandlineparser) add_subdirectory(qcontiguouscache) -add_subdirectory(qdate) add_subdirectory(qeasingcurve) add_subdirectory(qexplicitlyshareddatapointer) add_subdirectory(qhash) @@ -41,7 +40,6 @@ add_subdirectory(qstringiterator) add_subdirectory(qstringlist) add_subdirectory(qstringmatcher) add_subdirectory(qstringref) -add_subdirectory(qtime) add_subdirectory(qtimeline) add_subdirectory(qvarlengtharray) diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp index 7e5a855552..a74ae2eb71 100644 --- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -485,6 +485,47 @@ private Q_SLOTS: void indexOf_QStringView_QStringRef() { indexOf_impl<QStringView, QStringRef>(); } void indexOf_QStringView_QStringView_data() { indexOf_data(); } void indexOf_QStringView_QStringView() { indexOf_impl<QStringView, QStringView>(); } + +private: + template <typename Haystack, typename Needle> void contains_impl() const; + void contains_data(); + +private Q_SLOTS: + void contains_QString_QString_data() { contains_data(); } + void contains_QString_QString() { contains_impl<QString, QString>(); } + void contains_QString_QLatin1String_data() { contains_data(); } + void contains_QString_QLatin1String() { contains_impl<QString, QLatin1String>(); } + void contains_QString_QStringRef_data() { contains_data(); } + void contains_QString_QStringRef() { contains_impl<QString, QStringRef>(); } + void contains_QString_QStringView_data() { contains_data(); } + void contains_QString_QStringView() { contains_impl<QString, QStringView>(); } + + void contains_QLatin1String_QString_data() { contains_data(); } + void contains_QLatin1String_QString() { contains_impl<QLatin1String, QString>(); } + void contains_QLatin1String_QLatin1String_data() { contains_data(); } + void contains_QLatin1String_QLatin1String() { contains_impl<QLatin1String, QLatin1String>(); } + void contains_QLatin1String_QStringRef_data() { contains_data(); } + void contains_QLatin1String_QStringRef() { contains_impl<QLatin1String, QStringRef>(); } + void contains_QLatin1String_QStringView_data() { contains_data(); } + void contains_QLatin1String_QStringView() { contains_impl<QLatin1String, QStringView>(); } + + void contains_QStringRef_QString_data() { contains_data(); } + void contains_QStringRef_QString() { contains_impl<QStringRef, QString>(); } + void contains_QStringRef_QLatin1String_data() { contains_data(); } + void contains_QStringRef_QLatin1String() { contains_impl<QStringRef, QLatin1String>(); } + void contains_QStringRef_QStringRef_data() { contains_data(); } + void contains_QStringRef_QStringRef() { contains_impl<QStringRef, QStringRef>(); } + void contains_QStringRef_QStringView_data() { contains_data(); } + void contains_QStringRef_QStringView() { contains_impl<QStringRef, QStringView>(); } + + void contains_QStringView_QString_data() { contains_data(); } + void contains_QStringView_QString() { contains_impl<QStringView, QString>(); } + void contains_QStringView_QLatin1String_data() { contains_data(); } + void contains_QStringView_QLatin1String() { contains_impl<QStringView, QLatin1String>(); } + void contains_QStringView_QStringRef_data() { contains_data(); } + void contains_QStringView_QStringRef() { contains_impl<QStringView, QStringRef>(); } + void contains_QStringView_QStringView_data() { contains_data(); } + void contains_QStringView_QStringView() { contains_impl<QStringView, QStringView>(); } }; void tst_QStringApiSymmetry::compare_data(bool hasConceptOfNullAndEmpty) @@ -617,6 +658,14 @@ static QString b = QStringLiteral("b"); static QString B = QStringLiteral("B"); static QString c = QStringLiteral("c"); static QString C = QStringLiteral("C"); +static QString d = QStringLiteral("d"); +static QString D = QStringLiteral("D"); +static QString e = QStringLiteral("e"); +static QString E = QStringLiteral("E"); +static QString f = QStringLiteral("f"); +static QString F = QStringLiteral("F"); +static QString g = QStringLiteral("g"); +static QString G = QStringLiteral("G"); static QString ab = QStringLiteral("ab"); static QString aB = QStringLiteral("aB"); static QString Ab = QStringLiteral("Ab"); @@ -1501,6 +1550,81 @@ void tst_QStringApiSymmetry::indexOf_impl() const } } +static QString ABCDEFGHIEfGEFG = QStringLiteral("ABCDEFGHIEfGEFG"); +static QString EFG = QStringLiteral("EFG"); +static QString efg = QStringLiteral("efg"); +static QString asd = QStringLiteral("asd"); +static QString asdf = QStringLiteral("asdf"); +static QString Z = QStringLiteral("Z"); + +void tst_QStringApiSymmetry::contains_data() +{ + QTest::addColumn<QString>("haystackU16"); + QTest::addColumn<QLatin1String>("haystackL1"); + QTest::addColumn<QString>("needleU16"); + QTest::addColumn<QLatin1String>("needleL1"); + QTest::addColumn<bool>("resultCS"); + QTest::addColumn<bool>("resultCIS"); + + QTest::addRow("haystack: null, needle: null") << null << QLatin1String() + << null << QLatin1String() << true << true; + QTest::addRow("haystack: empty, needle: null") << empty << QLatin1String("") + << null << QLatin1String() << true << true; + QTest::addRow("haystack: a, needle: null") << a << QLatin1String("a") + << null << QLatin1String() << true << true; + QTest::addRow("haystack: null, needle: empty") << null << QLatin1String() + << empty << QLatin1String("") << true << true; + QTest::addRow("haystack: a, needle: empty") << a << QLatin1String("a") + << empty << QLatin1String("") << true << true;; + QTest::addRow("haystack: empty, needle: empty") << empty << QLatin1String("") + << empty << QLatin1String("") << true << true; + QTest::addRow("haystack: empty, needle: a") << empty << QLatin1String("") + << a << QLatin1String("a") << false << false; + QTest::addRow("haystack: null, needle: a") << null << QLatin1String() + << a << QLatin1String("a") << false << false; + +#define ROW(h, n, cs, cis) \ + QTest::addRow("haystack: %s, needle: %s", #h, #n) << h << QLatin1String(#h) \ + << n << QLatin1String(#n) \ + << cs << cis + + ROW(ABCDEFGHIEfGEFG, A, true, true); + ROW(ABCDEFGHIEfGEFG, a, false, true); + ROW(ABCDEFGHIEfGEFG, Z, false, false); + ROW(ABCDEFGHIEfGEFG, EFG, true, true); + ROW(ABCDEFGHIEfGEFG, efg, false, true); + ROW(ABCDEFGHIEfGEFG, E, true, true); + ROW(ABCDEFGHIEfGEFG, e, false, true); +#undef ROW +} + +template <typename Haystack, typename Needle> +void tst_QStringApiSymmetry::contains_impl() const +{ + QFETCH(const QString, haystackU16); + QFETCH(const QLatin1String, haystackL1); + QFETCH(const QString, needleU16); + QFETCH(const QLatin1String, needleL1); + QFETCH(const bool, resultCS); + QFETCH(const bool, resultCIS); + + const auto haystackU8 = haystackU16.toUtf8(); + const auto needleU8 = needleU16.toUtf8(); + + const auto haystack = make<Haystack>(QStringRef(&haystackU16), haystackL1, haystackU8); + const auto needle = make<Needle>(QStringRef(&needleU16), needleL1, needleU8); + + QCOMPARE(haystack.contains(needle), resultCS); + QCOMPARE(haystack.contains(needle, Qt::CaseSensitive), resultCS); + QCOMPARE(haystack.contains(needle, Qt::CaseInsensitive), resultCIS); + + if (needle.size() == 1) + { + QCOMPARE(haystack.contains(needle[0]), resultCS); + QCOMPARE(haystack.contains(needle[0], Qt::CaseSensitive), resultCS); + QCOMPARE(haystack.contains(needle[0], Qt::CaseInsensitive), resultCIS); + } +} QTEST_APPLESS_MAIN(tst_QStringApiSymmetry) diff --git a/tests/auto/corelib/tools/tools.pro b/tests/auto/corelib/tools/tools.pro index c6da33cce0..243e7e96f5 100644 --- a/tests/auto/corelib/tools/tools.pro +++ b/tests/auto/corelib/tools/tools.pro @@ -16,8 +16,6 @@ SUBDIRS=\ qcommandlineparser \ qcontiguouscache \ qcryptographichash \ - qdate \ - qdatetime \ qeasingcurve \ qexplicitlyshareddatapointer \ qfreelist \ @@ -62,8 +60,6 @@ SUBDIRS=\ qstringref \ qstringview \ qtextboundaryfinder \ - qtime \ - qtimezone \ qtimeline \ qvarlengtharray \ qvector \ |