Remove qSort usages from core tests

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

Change-Id: I355558fe6a51d00e9aa1f8b1221c6ec0c1e6bb77
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Sergio Ahumada 2014-02-17 23:52:21 +01:00 committed by The Qt Project
parent acf1cb9458
commit 70ca6f5bba
4 changed files with 13 additions and 5 deletions

View File

@ -43,6 +43,8 @@
#include <QtGui/QtGui>
#include <algorithm>
class tst_QItemSelectionModel : public QObject
{
Q_OBJECT
@ -1833,7 +1835,7 @@ void tst_QItemSelectionModel::selectedRows()
QModelIndexList selectedRowIndexes = selectionModel.selectedRows(column);
QCOMPARE(selectedRowIndexes.count(), expectedRows.count());
qSort(selectedRowIndexes);
std::sort(selectedRowIndexes.begin(), selectedRowIndexes.end());
for (int l = 0; l < selectedRowIndexes.count(); ++l) {
QCOMPARE(selectedRowIndexes.at(l).row(), expectedRows.at(l));
QCOMPARE(selectedRowIndexes.at(l).column(), column);
@ -1893,7 +1895,7 @@ void tst_QItemSelectionModel::selectedColumns()
QModelIndexList selectedColumnIndexes = selectionModel.selectedColumns(row);
QCOMPARE(selectedColumnIndexes.count(), expectedColumns.count());
qSort(selectedColumnIndexes);
std::sort(selectedColumnIndexes.begin(), selectedColumnIndexes.end());
for (int l = 0; l < selectedColumnIndexes.count(); ++l) {
QCOMPARE(selectedColumnIndexes.at(l).column(), expectedColumns.at(l));
QCOMPARE(selectedColumnIndexes.at(l).row(), row);

View File

@ -49,6 +49,8 @@
# include <pthread.h>
#endif
#include <algorithm>
// At least these specific versions of MSVC2010 has a severe performance problem with this file,
// taking about 1 hour to compile if the portion making use of variadic macros is enabled.
#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 160030319) && (_MSC_FULL_VER <= 160040219)
@ -2153,7 +2155,7 @@ void tst_QMetaType::compareCustomType()
{
QFETCH(QVariantList, unsorted);
QFETCH(QVariantList, sorted);
qSort(unsorted);
std::sort(unsorted.begin(), unsorted.end());
QCOMPARE(unsorted, sorted);
}

View File

@ -44,6 +44,8 @@
#include <qhash.h>
#include <qmap.h>
#include <algorithm>
class tst_QHash : public QObject
{
Q_OBJECT
@ -1167,7 +1169,7 @@ template <typename T>
QList<T> sorted(const QList<T> &list)
{
QList<T> res = list;
qSort(res);
std::sort(res.begin(), res.end());
return res;
}

View File

@ -47,6 +47,8 @@
#include <qdebug.h>
#include <qlist.h>
#include <algorithm>
class tst_QTextBoundaryFinder : public QObject
{
Q_OBJECT
@ -203,7 +205,7 @@ static void doTestData(const QString &testString, const QList<int> &expectedBrea
// test toPreviousBoundary()
{
QList<int> expectedBreakPositionsRev = expectedBreakPositions;
qSort(expectedBreakPositionsRev.begin(), expectedBreakPositionsRev.end(), qGreater<int>());
std::sort(expectedBreakPositionsRev.begin(), expectedBreakPositionsRev.end(), qGreater<int>());
QList<int> actualBreakPositions;
boundaryFinder.toEnd();