From 70ca6f5bba1116ce63cbdf753d041eecc72d8627 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Mon, 17 Feb 2014 23:52:21 +0100 Subject: 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 Reviewed-by: Giuseppe D'Angelo --- .../itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp | 6 ++++-- tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp | 4 +++- tests/auto/corelib/tools/qhash/tst_qhash.cpp | 4 +++- .../corelib/tools/qtextboundaryfinder/tst_qtextboundaryfinder.cpp | 4 +++- 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 +#include + 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 #endif +#include + // 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 #include +#include + class tst_QHash : public QObject { Q_OBJECT @@ -1167,7 +1169,7 @@ template QList sorted(const QList &list) { QList 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 #include +#include + class tst_QTextBoundaryFinder : public QObject { Q_OBJECT @@ -203,7 +205,7 @@ static void doTestData(const QString &testString, const QList &expectedBrea // test toPreviousBoundary() { QList expectedBreakPositionsRev = expectedBreakPositions; - qSort(expectedBreakPositionsRev.begin(), expectedBreakPositionsRev.end(), qGreater()); + std::sort(expectedBreakPositionsRev.begin(), expectedBreakPositionsRev.end(), qGreater()); QList actualBreakPositions; boundaryFinder.toEnd(); -- cgit v1.2.3