Remove qSort usages from tests

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

Change-Id: I4c48db80533802e37771d3967fa10bfb7000cb9a
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
This commit is contained in:
Sergio Ahumada 2014-02-18 09:33:36 +01:00 committed by The Qt Project
parent ac127a8c09
commit a01b7dad50
4 changed files with 15 additions and 7 deletions

View File

@ -50,6 +50,8 @@
#include <QOpenGLPaintDevice>
#endif
#include <algorithm>
class tst_Lancelot : public QObject
{
Q_OBJECT
@ -114,7 +116,7 @@ void tst_Lancelot::initTestCase()
QSKIP("Aborted due to errors.");
}
qSort(qpsFiles);
std::sort(qpsFiles.begin(), qpsFiles.end());
foreach (const QString& fileName, qpsFiles) {
QFile file(scriptsDir + fileName);
file.open(QFile::ReadOnly);

View File

@ -73,6 +73,8 @@
#include "QtTest/qtestaccessible.h"
#include <algorithm>
// Make a widget frameless to prevent size constraints of title bars
// from interfering (Windows).
static inline void setFrameless(QWidget *w)
@ -2192,7 +2194,7 @@ void tst_QAccessibility::dialogButtonBoxTest()
for (int i = 0; i < iface->childCount(); ++i)
buttons << iface->child(i);
qSort(buttons.begin(), buttons.end(), accessibleInterfaceLeftOf);
std::sort(buttons.begin(), buttons.end(), accessibleInterfaceLeftOf);
for (int i = 0; i < buttons.count(); ++i)
actualOrder << buttons.at(i)->text(QAccessible::Name);
@ -2243,7 +2245,7 @@ void tst_QAccessibility::dialogButtonBoxTest()
for (int i = 0; i < iface->childCount(); ++i)
buttons << iface->child(i);
qSort(buttons.begin(), buttons.end(), accessibleInterfaceAbove);
std::sort(buttons.begin(), buttons.end(), accessibleInterfaceAbove);
for (int i = 0; i < buttons.count(); ++i)
actualOrder << buttons.at(i)->text(QAccessible::Name);

View File

@ -44,6 +44,8 @@
#include <QtAlgorithms>
#include <QtPrintSupport/qprinterinfo.h>
#include <algorithm>
#ifdef Q_OS_UNIX
# include <unistd.h>
# include <sys/types.h>
@ -246,8 +248,8 @@ void tst_QPrinterInfo::testForPrinters()
for (int i = 0; i < printers.size(); ++i)
qtPrinters.append(printers.at(i).printerName());
qSort(testPrinters);
qSort(qtPrinters);
std::sort(testPrinters.begin(), testPrinters.end());
std::sort(qtPrinters.begin(), qtPrinters.end());
qDebug() << "Test believes Available Printers = " << testPrinters;
qDebug() << "QPrinterInfo::availablePrinters() believes Available Printers = " << qtPrinters;

View File

@ -54,6 +54,8 @@
#include <QtCore/QLocale>
#include <QtCore/QtGlobal>
#include <algorithm>
typedef QMap<QString, QString> QStringMap;
Q_DECLARE_METATYPE(QStringMap)
@ -325,8 +327,8 @@ void tst_rcc::binary()
}
// check that we have all (and only) the expected files
qSort(filesFound);
qSort(expectedFileNames);
std::sort(filesFound.begin(), filesFound.end());
std::sort(expectedFileNames.begin(), expectedFileNames.end());
QCOMPARE(filesFound, expectedFileNames);
// now actually check the file contents