diff options
author | Sergio Ahumada <sahumada@blackberry.com> | 2014-02-17 23:52:21 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-22 09:51:14 +0100 |
commit | 70ca6f5bba1116ce63cbdf753d041eecc72d8627 (patch) | |
tree | 90b668b42c1b81466958b1181b14dea426f5b697 /tests/auto/corelib | |
parent | acf1cb94587513c29d05b2114d2704f236b7f1b9 (diff) |
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>
Diffstat (limited to 'tests/auto/corelib')
4 files changed, 13 insertions, 5 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp index 9788b78771..9e3457a25a 100644 --- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -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); diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 211633f888..acff6a55ba 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -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); } diff --git a/tests/auto/corelib/tools/qhash/tst_qhash.cpp b/tests/auto/corelib/tools/qhash/tst_qhash.cpp index ddb72a3c32..73f8973245 100644 --- a/tests/auto/corelib/tools/qhash/tst_qhash.cpp +++ b/tests/auto/corelib/tools/qhash/tst_qhash.cpp @@ -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; } diff --git a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp index 4245fe1418..2c0967da1c 100644 --- a/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp +++ b/tests/auto/corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp @@ -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(); |