Remove qSort usages from network tests

QtAlgorithms is getting deprecated,
see http://www.mail-archive.com/development@qt-project.org/msg01603.html

Change-Id: I31a701d8e17673edcb9bb7c32e6e6a87812a7fbc
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Sergio Ahumada 2014-02-17 16:56:37 +01:00 committed by The Qt Project
parent ce46593e25
commit 817c4be91f
2 changed files with 10 additions and 5 deletions

View File

@ -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);
}

View File

@ -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));