diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-18 14:19:36 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2014-02-18 14:19:36 +0100 |
commit | 6aa09bbce59828d028f6d1e81d2bfc6ba537aae1 (patch) | |
tree | 9ba857247c0862fa6636766fad9cdab146c9c19b /tests | |
parent | f4044e853cdb66a7f7f7e61df78434243b85b03d (diff) | |
parent | 21fbca97a8ee284ff6ffaff64c180700cc5537ab (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/plugins/platforms/android/qandroidplatformtheme.h
Change-Id: I541bd3069df3ab54c7942d5f4a9e155e3b6566a0
Diffstat (limited to 'tests')
4 files changed, 53 insertions, 16 deletions
diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index 12b9159bf2..92dbb96817 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -169,6 +169,7 @@ private slots: void fileName(); void isEmptyForEncodedUrl(); void toEncodedNotUsingUninitializedPath(); + void emptyAuthorityRemovesExistingAuthority_data(); void emptyAuthorityRemovesExistingAuthority(); void acceptEmptyAuthoritySegments(); void lowercasesScheme(); @@ -3033,31 +3034,56 @@ void tst_QUrl::resolvedWithAbsoluteSchemes_data() const << QUrl::fromEncoded("http://andreas:hemmelig@www.vg.no/?my=query&your=query#yougotfragged"); } +void tst_QUrl::emptyAuthorityRemovesExistingAuthority_data() +{ + QTest::addColumn<QString>("input"); + QTest::addColumn<QString>("expected"); + QTest::newRow("regular") << "foo://example.com/something" << "foo:/something"; + QTest::newRow("empty") << "foo:///something" << "foo:/something"; +} + void tst_QUrl::emptyAuthorityRemovesExistingAuthority() { - QUrl url("http://example.com/something"); + QFETCH(QString, input); + QFETCH(QString, expected); + QUrl url(input); + QUrl orig = url; + url.setAuthority(QString()); QCOMPARE(url.authority(), QString()); + QVERIFY(url != orig); + QCOMPARE(url.toString(), expected); + QCOMPARE(url, QUrl(expected)); } void tst_QUrl::acceptEmptyAuthoritySegments() { QCOMPARE(QUrl("remote://").toString(), QString::fromLatin1("remote://")); - // Verify that foo:///bar is not mangled to foo:/bar + // Verify that foo:///bar is not mangled to foo:/bar nor vice-versa QString foo_triple_bar("foo:///bar"), foo_uni_bar("foo:/bar"); - QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar).toString()); - QCOMPARE(foo_triple_bar, QString::fromUtf8(QUrl(foo_triple_bar).toEncoded())); + QVERIFY(QUrl(foo_triple_bar) != QUrl(foo_uni_bar)); + + QCOMPARE(QUrl(foo_triple_bar).toString(), foo_triple_bar); + QCOMPARE(QUrl(foo_triple_bar).toEncoded(), foo_triple_bar.toLatin1()); + + QCOMPARE(QUrl(foo_uni_bar).toString(), foo_uni_bar); + QCOMPARE(QUrl(foo_uni_bar).toEncoded(), foo_uni_bar.toLatin1()); + + QCOMPARE(QUrl(foo_triple_bar, QUrl::StrictMode).toString(), foo_triple_bar); + QCOMPARE(QUrl(foo_triple_bar, QUrl::StrictMode).toEncoded(), foo_triple_bar.toLatin1()); + + QCOMPARE(QUrl(foo_uni_bar, QUrl::StrictMode).toString(), foo_uni_bar); + QCOMPARE(QUrl(foo_uni_bar, QUrl::StrictMode).toEncoded(), foo_uni_bar.toLatin1()); - QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar).toString()); - QCOMPARE(foo_uni_bar, QString::fromUtf8(QUrl(foo_uni_bar).toEncoded())); + // However, file:/bar is the same as file:///bar + QString file_triple_bar("file:///bar"), file_uni_bar("file:/bar"); - QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar, QUrl::StrictMode).toString()); - QCOMPARE(foo_triple_bar, QString::fromUtf8(QUrl(foo_triple_bar, QUrl::StrictMode).toEncoded())); + QVERIFY(QUrl(file_triple_bar) == QUrl(file_uni_bar)); - QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString()); - QCOMPARE(foo_uni_bar, QString::fromUtf8(QUrl(foo_uni_bar, QUrl::StrictMode).toEncoded())); + QCOMPARE(QUrl(file_uni_bar).toString(), file_triple_bar); + QCOMPARE(QUrl(file_uni_bar, QUrl::StrictMode).toString(), file_triple_bar); } void tst_QUrl::effectiveTLDs_data() @@ -3434,6 +3460,12 @@ void tst_QUrl::setComponents_data() QTest::newRow("host-empty") << QUrl("foo://example.com/path") << int(Host) << "" << Tolerant << true << PrettyDecoded << QString() << "foo:///path"; + QTest::newRow("authority-null") << QUrl("foo://example.com/path") + << int(Authority) << QString() << Tolerant << true + << PrettyDecoded << QString() << "foo:/path"; + QTest::newRow("authority-empty") << QUrl("foo://example.com/path") + << int(Authority) << "" << Tolerant << true + << PrettyDecoded << QString() << "foo:///path"; QTest::newRow("query-null") << QUrl("http://example.com/?q=foo") << int(Query) << QString() << Tolerant << true << PrettyDecoded << QString() << "http://example.com/"; diff --git a/tests/auto/gui/text/qfont/tst_qfont.cpp b/tests/auto/gui/text/qfont/tst_qfont.cpp index a7248869ed..dde4e54a8e 100644 --- a/tests/auto/gui/text/qfont/tst_qfont.cpp +++ b/tests/auto/gui/text/qfont/tst_qfont.cpp @@ -646,7 +646,7 @@ QString getPlatformGenericFont(const char* genericName) static inline QByteArray msgNotAcceptableFont(const QString &defaultFamily, const QStringList &acceptableFamilies) { - QString res = QString::fromLatin1("Font family '%1' is not one of the following accaptable results: ").arg(defaultFamily); + QString res = QString::fromLatin1("Font family '%1' is not one of the following acceptable results: ").arg(defaultFamily); Q_FOREACH (const QString &family, acceptableFamilies) res += QString::fromLatin1("\n %1").arg(family); return res.toLocal8Bit(); diff --git a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp index 53b367c872..da86a2d14d 100644 --- a/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp +++ b/tests/auto/network/access/qabstractnetworkcache/tst_qabstractnetworkcache.cpp @@ -50,6 +50,8 @@ #include <QtNetwork/qnetworksession.h> #endif +#include <algorithm> + #define TESTFILE QString("http://%1/qtest/cgi-bin/").arg(QtNetworkSettings::serverName()) class tst_QAbstractNetworkCache : public QObject @@ -334,8 +336,8 @@ void tst_QAbstractNetworkCache::runTest() if (fetchFromCache) { QList<QByteArray> rawHeaderList = reply->rawHeaderList(); QList<QByteArray> rawHeaderList2 = reply2->rawHeaderList(); - qSort(rawHeaderList); - qSort(rawHeaderList2); + std::sort(rawHeaderList.begin(), rawHeaderList.end()); + std::sort(rawHeaderList2.begin(), rawHeaderList2.end()); } QCOMPARE(diskCache->gotData, fetchFromCache); } @@ -388,8 +390,8 @@ void tst_QAbstractNetworkCache::checkSynchronous() if (fetchFromCache) { QList<QByteArray> rawHeaderList = reply->rawHeaderList(); QList<QByteArray> rawHeaderList2 = reply2->rawHeaderList(); - qSort(rawHeaderList); - qSort(rawHeaderList2); + std::sort(rawHeaderList.begin(), rawHeaderList.end()); + std::sort(rawHeaderList2.begin(), rawHeaderList2.end()); } QCOMPARE(diskCache->gotData, fetchFromCache); } diff --git a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp index 54b560cc1b..44edcc66c0 100644 --- a/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp +++ b/tests/auto/network/access/qnetworkdiskcache/tst_qnetworkdiskcache.cpp @@ -43,6 +43,9 @@ #include <QtTest/QtTest> #include <QtNetwork/QtNetwork> #include <qnetworkdiskcache.h> + +#include <algorithm> + #define EXAMPLE_URL "http://user:pass@www.example.com/#foo" //cached objects are organized into these many subdirs #define NUM_SUBDIRECTORIES 16 @@ -464,7 +467,7 @@ void tst_QNetworkDiskCache::expire() cacheList.append(metaData.url().toString()); } } - qSort(cacheList); + std::sort(cacheList.begin(), cacheList.end()); for (int i = 0; i < cacheList.count(); ++i) { QString fileName = cacheList[i]; QCOMPARE(fileName, QString("http://www.foo.com/%1").arg(i + 6)); |