From 989fca660c3556fa957ed9a3f7cd3b948a4166a2 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 6 Jul 2020 16:15:23 +0200 Subject: Use QList instead of QVector in corelib tests Task-number: QTBUG-84469 Change-Id: Ic80fde5517aed363f17d0da55cadcc958c3c8895 Reviewed-by: Friedemann Kleint --- .../qpropertyanimation/tst_qpropertyanimation.cpp | 2 +- .../tst_qsequentialanimationgroup.cpp | 2 +- tests/auto/corelib/global/qglobal/tst_qglobal.cpp | 4 +- tests/auto/corelib/global/qhooks/tst_qhooks.cpp | 2 +- .../qrandomgenerator/tst_qrandomgenerator.cpp | 4 +- tests/auto/corelib/io/largefile/tst_largefile.cpp | 2 +- tests/auto/corelib/io/qdir/tst_qdir.cpp | 4 +- tests/auto/corelib/io/qprocess/tst_qprocess.cpp | 2 +- tests/auto/corelib/io/qurl/tst_qurl.cpp | 2 +- .../qabstractitemmodel/tst_qabstractitemmodel.cpp | 24 ++-- .../tst_qidentityproxymodel.cpp | 6 +- .../tst_qsortfilterproxymodel.cpp | 20 +-- .../qstringlistmodel/tst_qstringlistmodel.cpp | 14 +- .../tst_qtransposeproxymodel.cpp | 10 +- .../corelib/kernel/qmetamethod/tst_qmetamethod.cpp | 2 +- .../corelib/kernel/qmetaobject/tst_qmetaobject.cpp | 4 +- .../corelib/kernel/qmetatype/tst_qmetatype.cpp | 79 +++++------ .../corelib/kernel/qproperty/tst_qproperty.cpp | 14 +- .../qsystemsemaphore/tst_qsystemsemaphore.cpp | 4 +- tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp | 10 +- .../auto/corelib/kernel/qvariant/tst_qvariant.cpp | 13 +- .../qwineventnotifier/tst_qwineventnotifier.cpp | 6 +- tests/auto/corelib/plugin/quuid/tst_quuid.cpp | 2 +- .../serialization/qcborvalue/tst_qcborvalue.cpp | 2 +- .../serialization/qdatastream/tst_qdatastream.cpp | 4 +- .../serialization/qxmlstream/tst_qxmlstream.cpp | 6 +- .../qstatemachine/tst_qstatemachine.cpp | 6 +- .../qregularexpression/tst_qregularexpression.cpp | 16 +-- tests/auto/corelib/text/qstring/tst_qstring.cpp | 28 ++-- .../qstringapisymmetry/tst_qstringapisymmetry.cpp | 21 ++- .../text/qstringconverter/tst_qstringconverter.cpp | 2 +- .../corelib/text/qstringlist/tst_qstringlist.cpp | 4 +- .../corelib/text/qstringref/tst_qstringref.cpp | 14 +- .../text/qstringtokenizer/tst_qstringtokenizer.cpp | 4 +- .../corelib/text/qstringview/tst_qstringview.cpp | 10 +- tests/auto/corelib/thread/qfuture/tst_qfuture.cpp | 6 +- .../corelib/thread/qpromise/snippet_qpromise.cpp | 2 +- .../thread/qresultstore/tst_qresultstore.cpp | 8 +- .../corelib/thread/qsemaphore/tst_qsemaphore.cpp | 4 +- tests/auto/corelib/thread/qthread/tst_qthread.cpp | 4 +- .../corelib/tools/collections/tst_collections.cpp | 93 ++++++------- .../tst_containerapisymmetry.cpp | 15 +- .../corelib/tools/qalgorithms/tst_qalgorithms.cpp | 113 +++++++-------- .../corelib/tools/qarraydata/tst_qarraydata.cpp | 40 +++--- .../tools/qeasingcurve/tst_qeasingcurve.cpp | 2 +- tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp | 1 - tests/auto/corelib/tools/qlist/tst_qlist.cpp | 2 +- .../corelib/tools/qringbuffer/tst_qringbuffer.cpp | 4 +- .../tools/qsharedpointer/tst_qsharedpointer.cpp | 4 +- .../tools/qversionnumber/tst_qversionnumber.cpp | 154 ++++++++++----------- 50 files changed, 375 insertions(+), 426 deletions(-) (limited to 'tests/auto') diff --git a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp index e569b49f7c..55ac71c8c7 100644 --- a/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/corelib/animation/qpropertyanimation/tst_qpropertyanimation.cpp @@ -508,7 +508,7 @@ public: void setOle(int v) { o = v; values << v; } int o; - QVector values; + QList values; }; void tst_QPropertyAnimation::noStartValue() diff --git a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index d6607dc813..aae2d1b7d0 100644 --- a/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/corelib/animation/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -563,7 +563,7 @@ void tst_QSequentialAnimationGroup::seekingBackwards() QCOMPARE(a1_s_o3->state(), QAnimationGroup::Stopped); } -typedef QVector StateList; +using StateList = QList; static bool compareStates(const QSignalSpy& spy, const StateList &expectedStates) { diff --git a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp index 4cfbdbde37..3c4bd3840e 100644 --- a/tests/auto/corelib/global/qglobal/tst_qglobal.cpp +++ b/tests/auto/corelib/global/qglobal/tst_qglobal.cpp @@ -93,7 +93,7 @@ void tst_QGlobal::qIsNull() void tst_QGlobal::for_each() { - QVector list; + QList list; list << 0 << 1 << 2 << 3 << 4 << 5; int counter = 0; @@ -112,7 +112,7 @@ void tst_QGlobal::for_each() // check whether we can pass a constructor as container argument counter = 0; - foreach (int i, QVector(list)) { + foreach (int i, QList(list)) { QCOMPARE(i, counter++); } QCOMPARE(counter, list.count()); diff --git a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp index 5fa7566e86..c06b9e7e3d 100644 --- a/tests/auto/corelib/global/qhooks/tst_qhooks.cpp +++ b/tests/auto/corelib/global/qhooks/tst_qhooks.cpp @@ -81,7 +81,7 @@ void tst_QHooks::testAddRemoveObject() QCOMPARE(objectCount, 0); } -static QVector hookOrder; +static QList hookOrder; static QHooks::AddQObjectCallback existingAddHook = 0; static QHooks::RemoveQObjectCallback existingRemoveHook = 0; diff --git a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp index 1c6e013adb..da0accad69 100644 --- a/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp +++ b/tests/auto/corelib/global/qrandomgenerator/tst_qrandomgenerator.cpp @@ -27,9 +27,9 @@ ****************************************************************************/ #include +#include #include #include -#include #include #include @@ -621,7 +621,7 @@ void tst_QRandomGenerator::boundedQuality() { // test the quality of the generator - QVector buffer(BufferCount, 0xcdcdcdcd); + QList buffer(BufferCount, 0xcdcdcdcd); generate(buffer.begin(), buffer.end(), [&] { return rng.bounded(Bound); }); for (quint32 value : qAsConst(buffer)) { diff --git a/tests/auto/corelib/io/largefile/tst_largefile.cpp b/tests/auto/corelib/io/largefile/tst_largefile.cpp index 33d7ea1da3..98bb985c02 100644 --- a/tests/auto/corelib/io/largefile/tst_largefile.cpp +++ b/tests/auto/corelib/io/largefile/tst_largefile.cpp @@ -127,7 +127,7 @@ private: QFile largeFile; - QVector generatedBlocks; + QByteArrayList generatedBlocks; int fd_; FILE *stream_; diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 56b19bc4c0..16f0ffdb79 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -886,14 +886,14 @@ void tst_QDir::entryListWithTestFiles() #if defined(Q_OS_WIN) // ### Sadly, this is a platform difference right now. // Note we are using capital L in entryList on one side here, to test case-insensitivity - const QVector > symLinks = + const QList > symLinks = { {m_dataPath + "/entryList/file", entrylistPath + "linktofile.lnk"}, {m_dataPath + "/entryList/directory", entrylistPath + "linktodirectory.lnk"}, {m_dataPath + "/entryList/nothing", entrylistPath + "brokenlink.lnk"} }; #else - const QVector > symLinks = + const QList > symLinks = { {"file", entrylistPath + "linktofile.lnk"}, {"directory", entrylistPath + "linktodirectory.lnk"}, diff --git a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp index f0316de945..a7ecf6cae4 100644 --- a/tests/auto/corelib/io/qprocess/tst_qprocess.cpp +++ b/tests/auto/corelib/io/qprocess/tst_qprocess.cpp @@ -1231,7 +1231,7 @@ void tst_QProcess::processesInMultipleThreads() if (i > 7) threadCount = qMax(threadCount, QThread::idealThreadCount() + 2); - QVector threads(threadCount); + QList threads(threadCount); for (int j = 0; j < threadCount; ++j) threads[j] = new TestThread; for (int j = 0; j < threadCount; ++j) diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index bcf6c51f73..540e663b2e 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -4048,7 +4048,7 @@ public: for (int i = 0 ; i < m_urls.size(); ++i) m_urls[i] = QUrl::fromEncoded("http://www.kde.org", QUrl::StrictMode); } - QVector m_urls; + QList m_urls; }; static const UrlStorage * s_urlStorage = nullptr; diff --git a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp index 20255b996e..bf4f33fbd1 100644 --- a/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp +++ b/tests/auto/corelib/itemmodels/qabstractitemmodel/tst_qabstractitemmodel.cpp @@ -122,7 +122,7 @@ class QtTestModel: public QAbstractItemModel { public: QtTestModel(int rows, int columns, QObject *parent = 0); - QtTestModel(const QVector > tbl, QObject *parent = 0); + QtTestModel(const QList > tbl, QObject *parent = 0); QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const; QModelIndex parent(const QModelIndex &) const; int rowCount(const QModelIndex &parent) const; @@ -146,7 +146,7 @@ public: int cCount, rCount; mutable bool wrongIndex; - QVector > table; + QList > table; }; Q_DECLARE_METATYPE(QAbstractItemModel::LayoutChangeHint); @@ -163,7 +163,7 @@ QtTestModel::QtTestModel(int rows, int columns, QObject *parent) } } -QtTestModel::QtTestModel(const QVector > tbl, QObject *parent) +QtTestModel::QtTestModel(const QList > tbl, QObject *parent) : QAbstractItemModel(parent), wrongIndex(false) { table = tbl; @@ -201,7 +201,7 @@ bool QtTestModel::insertRows(int row, int count, const QModelIndex &parent) { QAbstractItemModel::beginInsertRows(parent, row, row + count - 1); int cc = columnCount(parent); - table.insert(row, count, QVector(cc)); + table.insert(row, count, QList(cc)); rCount = table.count(); QAbstractItemModel::endInsertRows(); return true; @@ -256,7 +256,7 @@ bool QtTestModel::moveRows(const QModelIndex &sourceParent, int src, int cnt, destinationParent, dst)) return false; - QVector buf; + QList buf; if (dst < src) { for (int i = 0; i < cnt; ++i) { buf.swap(table[src + i]); @@ -489,9 +489,9 @@ void tst_QAbstractItemModel::match() } typedef QPair Position; -typedef QVector > Selection; -typedef QVector > StringTable; -typedef QVector StringTableRow; +typedef QList > Selection; +typedef QList > StringTable; +typedef QList StringTableRow; static StringTableRow qStringTableRow(const QString &s1, const QString &s2, const QString &s3) { @@ -1940,8 +1940,8 @@ public: const QModelIndex bottom = index(2, 0); emit dataChanged(top, bottom); - emit dataChanged(top, bottom, QVector() << Qt::ToolTipRole); - emit dataChanged(top, bottom, QVector() << Qt::ToolTipRole << Custom1); + emit dataChanged(top, bottom, QList() << Qt::ToolTipRole); + emit dataChanged(top, bottom, QList() << Qt::ToolTipRole << Custom1); } }; @@ -1963,8 +1963,8 @@ void tst_QAbstractItemModel::testDataChanged() const QVariantList secondEmission = withRoles.at(1); const QVariantList thirdEmission = withRoles.at(2); - const QVector secondRoles = secondEmission.at(2).value >(); - const QVector thirdRoles = thirdEmission.at(2).value >(); + const QList secondRoles = secondEmission.at(2).value >(); + const QList thirdRoles = thirdEmission.at(2).value >(); QCOMPARE(secondRoles.size(), 1); QVERIFY(secondRoles.contains(Qt::ToolTipRole)); diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp index 149d272594..95743ddb9e 100644 --- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp @@ -50,7 +50,7 @@ public: void changeData() { const QModelIndex idx = index(0, 0, QModelIndex()); - Q_EMIT dataChanged(idx, idx, QVector() << 1); + Q_EMIT dataChanged(idx, idx, QList() << 1); } }; @@ -94,7 +94,7 @@ tst_QIdentityProxyModel::tst_QIdentityProxyModel() void tst_QIdentityProxyModel::initTestCase() { - qRegisterMetaType >(); + qRegisterMetaType >(); m_model = new QStandardItemModel(0, 1); m_proxy = new QIdentityProxyModel(); m_modelTest = new QAbstractItemModelTester(m_proxy, this); @@ -389,7 +389,7 @@ void tst_QIdentityProxyModel::dataChanged() model.changeData(); - QCOMPARE(modelSpy.first().at(2).value >(), QVector() << 1); + QCOMPARE(modelSpy.first().at(2).value >(), QList() << 1); QCOMPARE(modelSpy.first().at(2), proxySpy.first().at(2)); verifyIdentity(&model); diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp index 2d8813050b..66a9e85dff 100644 --- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_common/tst_qsortfilterproxymodel.cpp @@ -41,8 +41,8 @@ Q_LOGGING_CATEGORY(lcItemModels, "qt.corelib.tests.itemmodels") using IntPair = QPair; -using IntList = QVector; -using IntPairList = QVector; +using IntList = QList; +using IntPairList = QList; // Testing get/set functions void tst_QSortFilterProxyModel::getSetCheck() @@ -1462,8 +1462,8 @@ void tst_QSortFilterProxyModel::changeSourceLayout() QSortFilterProxyModel proxy; proxy.setSourceModel(&model); - QVector persistentSourceIndexes; - QVector persistentProxyIndexes; + QList persistentSourceIndexes; + QList persistentProxyIndexes; for (int row = 0; row < model.rowCount(); ++row) { persistentSourceIndexes.append(model.index(row, 0)); persistentProxyIndexes.append(proxy.index(row, 0)); @@ -2146,7 +2146,7 @@ void tst_QSortFilterProxyModel::changeSourceDataForwardsRoles_qtbug35440() // QStringListModel doesn't distinguish between edit and display roles, // so changing one always changes the other, too. - QVector expectedChangedRoles; + QList expectedChangedRoles; expectedChangedRoles.append(Qt::DisplayRole); expectedChangedRoles.append(Qt::EditRole); @@ -2154,13 +2154,13 @@ void tst_QSortFilterProxyModel::changeSourceDataForwardsRoles_qtbug35440() QVERIFY(index.isValid()); model.setData(index, QStringLiteral("teststring"), Qt::DisplayRole); QCOMPARE(spy.length(), 1); - QCOMPARE(spy.at(0).at(2).value >(), expectedChangedRoles); + QCOMPARE(spy.at(0).at(2).value >(), expectedChangedRoles); index = model.index(1, 0); QVERIFY(index.isValid()); model.setData(index, QStringLiteral("teststring2"), Qt::EditRole); QCOMPARE(spy.length(), 2); - QCOMPARE(spy.at(1).at(2).value >(), expectedChangedRoles); + QCOMPARE(spy.at(1).at(2).value >(), expectedChangedRoles); } void tst_QSortFilterProxyModel::sortFilterRole() @@ -2170,12 +2170,12 @@ void tst_QSortFilterProxyModel::sortFilterRole() proxy.setSourceModel(&model); model.insertColumns(0, 1); - const QVector> + const QList> sourceItems({QPair("b", 3), QPair("c", 2), QPair("a", 1)}); - const QVector orderedItems({2, 1}); + const QList orderedItems({2, 1}); model.insertRows(0, sourceItems.count()); for (int i = 0; i < sourceItems.count(); ++i) { @@ -4947,7 +4947,7 @@ public: return QVariant(); return m_data[index.row()][index.column()]; } - QVector> m_data; + QList> m_data; }; class SortFilterProxyModel final : public QSortFilterProxyModel diff --git a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp index 7182553f27..5585587717 100644 --- a/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp +++ b/tests/auto/corelib/itemmodels/qstringlistmodel/tst_qstringlistmodel.cpp @@ -340,7 +340,7 @@ void tst_QStringListModel::setData_emits_both_roles() QFETCH(int, role); QStringListModel model(QStringList() << "one" << "two"); - QVector expected; + QList expected; expected.reserve(2); expected.append(Qt::DisplayRole); expected.append(Qt::EditRole); @@ -349,7 +349,7 @@ void tst_QStringListModel::setData_emits_both_roles() QVERIFY(spy.isValid()); model.setData(model.index(row, 0), data, role); QCOMPARE(spy.size(), 1); - QCOMPARE(sorted(spy.at(0).at(2).value >()), + QCOMPARE(sorted(spy.at(0).at(2).value >()), expected); } @@ -380,7 +380,7 @@ void tst_QStringListModel::setItemData() }}; QSignalSpy dataChangedSpy(&testModel, &QAbstractItemModel::dataChanged); QModelIndex changeIndex = testModel.index(1, 0); - const QVector changeRoles{Qt::DisplayRole, Qt::EditRole}; + const QList changeRoles{Qt::DisplayRole, Qt::EditRole}; const QString changedString("Changed"); QMap newItemData{std::make_pair(Qt::DisplayRole, changedString)}; // invalid index does nothing and returns false @@ -393,7 +393,7 @@ void tst_QStringListModel::setItemData() QVariantList dataChangedArguments = dataChangedSpy.takeFirst(); QCOMPARE(dataChangedArguments.at(0).value(), changeIndex); QCOMPARE(dataChangedArguments.at(1).value(), changeIndex); - QCOMPARE(dataChangedArguments.at(2).value >(), changeRoles); + QCOMPARE(dataChangedArguments.at(2).value >(), changeRoles); // Unsupported roles do nothing return false newItemData.clear(); newItemData.insert(Qt::UserRole, changedString); @@ -418,7 +418,7 @@ void tst_QStringListModel::setItemData() dataChangedArguments = dataChangedSpy.takeFirst(); QCOMPARE(dataChangedArguments.at(0).value(), changeIndex); QCOMPARE(dataChangedArguments.at(1).value(), changeIndex); - QCOMPARE(dataChangedArguments.at(2).value >(), changeRoles); + QCOMPARE(dataChangedArguments.at(2).value >(), changeRoles); } void tst_QStringListModel::setData_emits_on_change_only() @@ -433,8 +433,8 @@ void tst_QStringListModel::setData_emits_on_change_only() const QList spyList = dataChangedSpy.takeFirst(); QCOMPARE(spyList.at(0).value(), modelIdx); QCOMPARE(spyList.at(1).value(), modelIdx); - const QVector expectedRoles{Qt::DisplayRole, Qt::EditRole}; - QCOMPARE(spyList.at(2).value >(), expectedRoles); + const QList expectedRoles{Qt::DisplayRole, Qt::EditRole}; + QCOMPARE(spyList.at(2).value >(), expectedRoles); QVERIFY(model.setData(modelIdx, newStringData)); QVERIFY(dataChangedSpy.isEmpty()); } diff --git a/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp index a30ac46571..ea44980657 100644 --- a/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp +++ b/tests/auto/corelib/itemmodels/qtransposeproxymodel/tst_qtransposeproxymodel.cpp @@ -769,15 +769,15 @@ void tst_QTransposeProxyModel::setItemData() auto signalData = proxyDataChangeSpy.takeFirst(); QCOMPARE(signalData.at(0).value(), idx); QCOMPARE(signalData.at(1).value(), idx); - const QVector expectedRoles{Qt::DisplayRole, Qt::UserRole, Qt::EditRole, Qt::UserRole + 1}; - QVector receivedRoles = signalData.at(2).value >(); + const QList expectedRoles{Qt::DisplayRole, Qt::UserRole, Qt::EditRole, Qt::UserRole + 1}; + QList receivedRoles = signalData.at(2).value >(); QCOMPARE(receivedRoles.size(), expectedRoles.size()); for (int role : expectedRoles) QVERIFY(receivedRoles.contains(role)); signalData = sourceDataChangeSpy.takeFirst(); QCOMPARE(signalData.at(0).value(), proxy.mapToSource(idx)); QCOMPARE(signalData.at(1).value(), proxy.mapToSource(idx)); - receivedRoles = signalData.at(2).value >(); + receivedRoles = signalData.at(2).value >(); QCOMPARE(receivedRoles.size(), expectedRoles.size()); for (int role : expectedRoles) QVERIFY(receivedRoles.contains(role)); @@ -793,14 +793,14 @@ void tst_QTransposeProxyModel::setItemData() signalData = proxyDataChangeSpy.takeFirst(); QCOMPARE(signalData.at(0).value(), idx); QCOMPARE(signalData.at(1).value(), idx); - receivedRoles = signalData.at(2).value >(); + receivedRoles = signalData.at(2).value >(); QCOMPARE(receivedRoles.size(), expectedRoles.size()); for (int role : expectedRoles) QVERIFY(receivedRoles.contains(role)); signalData = sourceDataChangeSpy.takeFirst(); QCOMPARE(signalData.at(0).value(), proxy.mapToSource(idx)); QCOMPARE(signalData.at(1).value(), proxy.mapToSource(idx)); - receivedRoles = signalData.at(2).value >(); + receivedRoles = signalData.at(2).value >(); QCOMPARE(receivedRoles.size(), expectedRoles.size()); for (int role : expectedRoles) QVERIFY(receivedRoles.contains(role)); diff --git a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp index dbc0716463..057f61e6c1 100644 --- a/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp +++ b/tests/auto/corelib/kernel/qmetamethod/tst_qmetamethod.cpp @@ -648,7 +648,7 @@ void tst_QMetaMethod::method() QCOMPARE(method.parameterType(i), parameterTypes.at(i)); { - QVector actualParameterTypes(parameterTypes.size()); + QList actualParameterTypes(parameterTypes.size()); method.getParameterTypes(actualParameterTypes.data()); for (int i = 0; i < parameterTypes.size(); ++i) QCOMPARE(actualParameterTypes.at(i), parameterTypes.at(i)); diff --git a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp index a8f6914115..4711e5999b 100644 --- a/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp +++ b/tests/auto/corelib/kernel/qmetaobject/tst_qmetaobject.cpp @@ -518,7 +518,7 @@ public slots: void slotWithRegistrableArgument(QtTestObject *o1, QPointer o2, QSharedPointer o3, QWeakPointer o4, - QVector o5, QList o6) + QList o5, QList o6) { slotResult = QLatin1String("slotWithRegistrableArgument:") + o1->slotResult + o2->slotResult + o3->slotResult + o4.toStrongRef()->slotResult + QString::number(o5.size()) @@ -1297,7 +1297,7 @@ void tst_QMetaObject::invokeQueuedAutoRegister() &obj, "slotWithRegistrableArgument", Qt::QueuedConnection, Q_ARG(QtTestObject *, shared.data()), Q_ARG(QPointer, shared.data()), Q_ARG(QSharedPointer, shared), Q_ARG(QWeakPointer, shared), - Q_ARG(QVector, QVector()), + Q_ARG(QList, QList()), Q_ARG(QList, QList()))); QVERIFY(obj.slotResult.isEmpty()); qApp->processEvents(QEventLoop::AllEvents); diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 48b46dd98f..8d4cc05eb9 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -66,7 +66,7 @@ public: void setProp(const QList &list) { propList = list; } private: - void registerGadget(const char * name, const QVector &gadgetProperties); + void registerGadget(const char * name, const QList &gadgetProperties); QList propList; private slots: @@ -183,7 +183,7 @@ struct GenericGadgetType : BaseGenericType for (auto &prop : properties) in >> prop; } - QVector properties; + QList properties; }; struct GenericPODType : BaseGenericType @@ -287,7 +287,7 @@ class GadgetDerivedAndTyped : public CustomGadget {}; Q_DECLARE_METATYPE(GadgetDerivedAndTyped) Q_DECLARE_METATYPE(GadgetDerivedAndTyped*) -void tst_QMetaType::registerGadget(const char *name, const QVector &gadgetProperties) +void tst_QMetaType::registerGadget(const char *name, const QList &gadgetProperties) { QMetaObjectBuilder gadgetBuilder; gadgetBuilder.setClassName(name); @@ -581,13 +581,13 @@ void tst_QMetaType::typeName_data() QTest::newRow("124125534") << 124125534 << QString(); // automatic registration - QTest::newRow("QHash") << ::qMetaTypeId >() << QString::fromLatin1("QHash"); - QTest::newRow("QMap") << ::qMetaTypeId >() << QString::fromLatin1("QMap"); - QTest::newRow("QVector>") << ::qMetaTypeId > >() << QString::fromLatin1("QList>"); + QTest::newRow("QHash") << ::qMetaTypeId>() << QString::fromLatin1("QHash"); + QTest::newRow("QMap") << ::qMetaTypeId>() << QString::fromLatin1("QMap"); + QTest::newRow("QList>") << ::qMetaTypeId>>() << QString::fromLatin1("QList>"); - // automatic registration with automatic QList to QVector aliasing - QTest::newRow("QList") << ::qMetaTypeId >() << QString::fromLatin1("QList"); - QTest::newRow("QVector>") << ::qMetaTypeId > >() << QString::fromLatin1("QList>"); + // automatic registration with automatic QList to QList aliasing + QTest::newRow("QList") << ::qMetaTypeId>() << QString::fromLatin1("QList"); + QTest::newRow("QList>") << ::qMetaTypeId>>() << QString::fromLatin1("QList>"); QTest::newRow("CustomQObject*") << ::qMetaTypeId() << QString::fromLatin1("CustomQObject*"); QTest::newRow("CustomGadget") << ::qMetaTypeId() << QString::fromLatin1("CustomGadget"); @@ -1109,7 +1109,7 @@ FOR_EACH_CORE_METATYPE(RETURN_CONSTRUCT_FUNCTION) void tst_QMetaType::typedConstruct() { - auto testMetaObjectWriteOnGadget = [](QVariant &gadget, const QVector &properties) + auto testMetaObjectWriteOnGadget = [](QVariant &gadget, const QList &properties) { auto metaObject = QMetaType::metaObjectForType(gadget.userType()); QVERIFY(metaObject != nullptr); @@ -1123,7 +1123,7 @@ void tst_QMetaType::typedConstruct() } }; - auto testMetaObjectReadOnGadget = [](QVariant gadget, const QVector &properties) + auto testMetaObjectReadOnGadget = [](QVariant gadget, const QList &properties) { auto metaObject = QMetaType::metaObjectForType(gadget.userType()); QVERIFY(metaObject != nullptr); @@ -1138,7 +1138,7 @@ void tst_QMetaType::typedConstruct() } }; - QVector dynamicGadget1 = { + QList dynamicGadget1 = { {"int", "int_prop", 34526}, {"float", "float_prop", 1.23f}, {"QString", "string_prop", QString{"Test QString"}} @@ -1150,7 +1150,7 @@ void tst_QMetaType::typedConstruct() testMetaObjectReadOnGadget(testGadget1, dynamicGadget1); - QVector dynamicGadget2 = { + QList dynamicGadget2 = { {"int", "int_prop", 512}, {"double", "double_prop", 4.56}, {"QString", "string_prop", QString{"Another String"}}, @@ -1510,9 +1510,9 @@ void tst_QMetaType::automaticTemplateRegistration() CONTAINER innerContainer; \ innerContainer.push_back(42); \ QVERIFY(*QVariant::fromValue(innerContainer).value >().begin() == 42); \ - QVector > outerContainer; \ + QList > outerContainer; \ outerContainer << innerContainer; \ - QVERIFY(*QVariant::fromValue(outerContainer).value > >().first().begin() == 42); \ + QVERIFY(*QVariant::fromValue(outerContainer).value > >().first().begin() == 42); \ } TEST_SEQUENTIAL_CONTAINER(QList, int) @@ -1524,19 +1524,19 @@ void tst_QMetaType::automaticTemplateRegistration() vecbool.push_back(true); vecbool.push_back(false); vecbool.push_back(true); - QVERIFY(QVariant::fromValue(vecbool).value >().front() == true); - QVector > vectorList; + QVERIFY(QVariant::fromValue(vecbool).value>().front() == true); + QList> vectorList; vectorList << vecbool; - QVERIFY(QVariant::fromValue(vectorList).value > >().first().front() == true); + QVERIFY(QVariant::fromValue(vectorList).value>>().first().front() == true); } { QList unsignedList; unsignedList << 123; - QVERIFY(QVariant::fromValue(unsignedList).value >().first() == 123); - QVector > vectorList; + QVERIFY(QVariant::fromValue(unsignedList).value>().first() == 123); + QList> vectorList; vectorList << unsignedList; - QVERIFY(QVariant::fromValue(vectorList).value > >().first().first() == 123); + QVERIFY(QVariant::fromValue(vectorList).value>>().first().first() == 123); } QCOMPARE(::qMetaTypeId(), (int)QMetaType::QVariantList); @@ -1550,10 +1550,10 @@ void tst_QMetaType::automaticTemplateRegistration() QList > sharedPointerList; QObject *testObject = new QObject; sharedPointerList << QSharedPointer(testObject); - QVERIFY(QVariant::fromValue(sharedPointerList).value > >().first() == testObject); - QVector > > vectorList; + QVERIFY(QVariant::fromValue(sharedPointerList).value>>().first() == testObject); + QList>> vectorList; vectorList << sharedPointerList; - QVERIFY(QVariant::fromValue(vectorList).value > > >().first().first() == testObject); + QVERIFY(QVariant::fromValue(vectorList).value>>>().first().first() == testObject); } { IntIntHash intIntHash; @@ -1714,9 +1714,6 @@ void tst_QMetaType::automaticTemplateRegistration() #define FOR_EACH_1ARG_TEMPLATE_TYPE(F, TYPE) \ F(QList, TYPE) \ - F(QVector, TYPE) \ - F(QVector, TYPE) \ - F(QVector, TYPE) \ F(QQueue, TYPE) \ F(QStack, TYPE) \ F(QSet, TYPE) @@ -1736,7 +1733,7 @@ void tst_QMetaType::automaticTemplateRegistration() FOR_EACH_STATIC_PRIMITIVE_TYPE2(PRINT_2ARG_TEMPLATE_INTERNAL, RealName) #define REGISTER_TYPEDEF(TYPE, ARG1, ARG2) \ - qRegisterMetaType >(#TYPE "<" #ARG1 "," #ARG2 ">"); + qRegisterMetaType>(#TYPE "<" #ARG1 "," #ARG2 ">"); REGISTER_TYPEDEF(QHash, int, uint) REGISTER_TYPEDEF(QMap, int, uint) @@ -1749,9 +1746,9 @@ void tst_QMetaType::automaticTemplateRegistration() PRINT_2ARG_TEMPLATE ) - CREATE_AND_VERIFY_CONTAINER(QList, QList > > >) - CREATE_AND_VERIFY_CONTAINER(QVector, void*) - CREATE_AND_VERIFY_CONTAINER(QVector, const void*) + CREATE_AND_VERIFY_CONTAINER(QList, QList>>>) + CREATE_AND_VERIFY_CONTAINER(QList, void*) + CREATE_AND_VERIFY_CONTAINER(QList, const void*) CREATE_AND_VERIFY_CONTAINER(QList, void*) CREATE_AND_VERIFY_CONTAINER(std::pair, void*, void*) CREATE_AND_VERIFY_CONTAINER(QHash, void*, void*) @@ -2548,16 +2545,16 @@ void tst_QMetaType::operatorEq_data() QTest::newRow("String") << QMetaType(QMetaType::QString) << QMetaType::fromType() << true; - QTest::newRow("void1") << QMetaType(QMetaType::UnknownType) << QMetaType::fromType() - << false; - QTest::newRow("void2") << QMetaType::fromType() << QMetaType::fromType() - << true; - QTest::newRow("vec1") << QMetaType::fromType>() - << QMetaType::fromType>() << true; - QTest::newRow("vec2") << QMetaType::fromType>() - << QMetaType::fromType>() << false; - QTest::newRow("char1") << QMetaType::fromType'>>() - << QMetaType::fromType', void>>() << true; + QTest::newRow("void1") << QMetaType(QMetaType::UnknownType) << QMetaType::fromType() + << false; + QTest::newRow("void2") << QMetaType::fromType() << QMetaType::fromType() + << true; + QTest::newRow("list1") << QMetaType::fromType>() + << QMetaType::fromType>() << true; + QTest::newRow("list2") << QMetaType::fromType>() + << QMetaType::fromType>() << false; + QTest::newRow("char1") << QMetaType::fromType'>>() + << QMetaType::fromType', void>>() << true; QTest::newRow("annon1") << QMetaType::fromType'>::x)>() << QMetaType::fromType'>::x)>() << true; QTest::newRow("annon2") << QMetaType::fromType'>::x)>() diff --git a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp index cafc193257..96cf6da4bb 100644 --- a/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp +++ b/tests/auto/corelib/kernel/qproperty/tst_qproperty.cpp @@ -381,7 +381,7 @@ void tst_QProperty::moveCtor() void tst_QProperty::changeHandler() { QProperty testProperty(0); - QVector recordedValues; + QList recordedValues; { auto handler = testProperty.onValueChanged([&]() { @@ -424,7 +424,7 @@ void tst_QProperty::propertyChangeHandlerApi() void tst_QProperty::subscribe() { QProperty testProperty(42); - QVector recordedValues; + QList recordedValues; { auto handler = testProperty.subscribe([&]() { @@ -754,7 +754,7 @@ void tst_QProperty::propertyAlias() struct ClassWithNotifiedProperty { - QVector recordedValues; + QList recordedValues; void callback() { recordedValues << property.value(); } @@ -763,7 +763,7 @@ struct ClassWithNotifiedProperty struct ClassWithNotifiedProperty2 { - QVector recordedValues; + QList recordedValues; void callback(int oldValue) { recordedValues << oldValue; } @@ -852,7 +852,7 @@ void tst_QProperty::notifiedPropertyWithOldValueCallback() instance.property.setBinding(&instance, [](){return 2;}); instance.property.setBinding(&instance, [](){return 3;}); instance.property.setValue(&instance, 4); - QVector expected {0, 1, 2, 3}; + QList expected {0, 1, 2, 3}; QCOMPARE(instance.recordedValues, expected); QCOMPARE(instance.property.value(), 4); } @@ -860,7 +860,7 @@ void tst_QProperty::notifiedPropertyWithOldValueCallback() struct ClassWithNotifiedPropertyWithGuard { using This = ClassWithNotifiedPropertyWithGuard; - QVector recordedValues; + QList recordedValues; void callback() { recordedValues << property.value(); } void callback2() { recordedValues << property2.value(); } @@ -968,7 +968,7 @@ void tst_QProperty::notifiedPropertyWithGuard() // properties' value. At that point we then evaluate the binding, and // notice that the value is in fact disallowed. Thus we return the old // value. - QVector expected {1, 1, 2, 3}; + QList expected {1, 1, 2, 3}; QCOMPARE(instance2.recordedValues, expected); } diff --git a/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp b/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp index 5f010ae3d1..496e214b8f 100644 --- a/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp +++ b/tests/auto/corelib/kernel/qsystemsemaphore/tst_qsystemsemaphore.cpp @@ -27,8 +27,8 @@ ****************************************************************************/ #include +#include #include -#include #include #define EXISTING_SHARE "existing" @@ -207,7 +207,7 @@ void tst_QSystemSemaphore::processes() QSystemSemaphore sem("store", 1, QSystemSemaphore::Create); QFETCH(int, processes); - QVector scripts(processes, "acquirerelease"); + QList scripts(processes, "acquirerelease"); QList consumers; for (int i = 0; i < scripts.count(); ++i) { diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index 1bd27cd0ce..ae61075169 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -1055,7 +1055,7 @@ public: FunctorNoCtx }; Q_ENUM(CallType) - QVector calls; + QList calls; void triggerCall(CallType callType) { @@ -1087,7 +1087,7 @@ Q_DECLARE_METATYPE(OrderHelper::CallType) void tst_QTimer::timerOrder() { - QFETCH(QVector, calls); + QFETCH(QList, calls); OrderHelper helper; @@ -1099,9 +1099,9 @@ void tst_QTimer::timerOrder() void tst_QTimer::timerOrder_data() { - QTest::addColumn>("calls"); + QTest::addColumn>("calls"); - QVector calls = { + QList calls = { OrderHelper::String, OrderHelper::PMF, OrderHelper::Functor, OrderHelper::FunctorNoCtx }; @@ -1135,7 +1135,7 @@ struct StaticSingleShotUser } OrderHelper helper; - static QVector calls() + static QList calls() { return {OrderHelper::String, OrderHelper::PMF, OrderHelper::Functor, OrderHelper::FunctorNoCtx}; diff --git a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp index c9a60c44e6..192a75d7ae 100644 --- a/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp +++ b/tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp @@ -285,7 +285,7 @@ private: void saveQVariantFromDataStream(QDataStream::Version version); CustomNonQObject *customNonQObjectPointer; - QVector objectPointerTestData; + QList objectPointerTestData; }; const qlonglong intMax1 = (qlonglong)INT_MAX + 1; @@ -3472,9 +3472,9 @@ void tst_QVariant::moreCustomTypes() } { - QList > data; + QList > data; PLAY_WITH_VARIANT(data, false, QString(), 0, false); - data << (QVector() << 42); + data << (QList() << 42); PLAY_WITH_VARIANT(data, false, QString(), 0, false); } @@ -4173,9 +4173,6 @@ void tst_QVariant::iterateContainerElements() TEST_SEQUENTIAL_ITERATION_ON_FULL_NAME(CONTAINER ) - TEST_SEQUENTIAL_ITERATION(QVector, int) - TEST_SEQUENTIAL_ITERATION(QVector, QVariant) - TEST_SEQUENTIAL_ITERATION(QVector, QString) TEST_SEQUENTIAL_ITERATION(QQueue, int) TEST_SEQUENTIAL_ITERATION(QQueue, QVariant) TEST_SEQUENTIAL_ITERATION(QQueue, QString) @@ -4668,14 +4665,14 @@ void tst_QVariant::sequentialIterableEndianessSanityCheck() void tst_QVariant::sequentialIterableAppend() { { - QVector container {1, 2}; + QList container { 1, 2 }; auto variant = QVariant::fromValue(container); QVERIFY(variant.canConvert()); auto asIterable = variant.value(); const int i = 3, j = 4; asIterable.append(&i); asIterable.append(&j); - QCOMPARE(variant.value>(), QVector ({1, 2, 3, 4})); + QCOMPARE(variant.value>(), QList ({ 1, 2, 3, 4 })); } { QSet container { QByteArray{"hello"}, QByteArray{"world"} }; diff --git a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp index ac8aaa1327..cd9268d736 100644 --- a/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp +++ b/tests/auto/corelib/kernel/qwineventnotifier/tst_qwineventnotifier.cpp @@ -27,10 +27,10 @@ ****************************************************************************/ #include -#include +#include #include #include -#include +#include #include #include @@ -208,7 +208,7 @@ void tst_QWinEventNotifier::manyNotifiers() })); } -using Indices = QVector; +using Indices = QList; void tst_QWinEventNotifier::disableNotifiersInActivatedSlot_data() { diff --git a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp index 7abe7ebdc6..02dbdff157 100644 --- a/tests/auto/corelib/plugin/quuid/tst_quuid.cpp +++ b/tests/auto/corelib/plugin/quuid/tst_quuid.cpp @@ -388,7 +388,7 @@ public: void tst_QUuid::threadUniqueness() { - QVector threads(qMax(2, QThread::idealThreadCount())); + QList threads(qMax(2, QThread::idealThreadCount())); for (int i = 0; i < threads.count(); ++i) threads[i] = new UuidThread; for (int i = 0; i < threads.count(); ++i) diff --git a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp index eb9941868e..8679fb7702 100644 --- a/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp +++ b/tests/auto/corelib/serialization/qcborvalue/tst_qcborvalue.cpp @@ -2013,7 +2013,7 @@ void tst_QCborValue::validation_data() // error. QCborValue internally uses 16 bytes per element, so we get to 2 // GB at 2^27 elements (32-bit) or, theoretically, 2^63 bytes at 2^59 // elements (64-bit). - if (sizeof(QVector::size_type) == sizeof(int)) { + if (sizeof(QList::size_type) == sizeof(int)) { // 32-bit sizes (Qt 5 and 32-bit platforms) QTest::addRow("very-large-array-no-overflow") << raw("\x9a\x07\xff\xff\xff" "\0\0") << 0 << CborErrorUnexpectedEOF; QTest::addRow("very-large-array-overflow1") << raw("\x9a\x40\0\0\0" "\0\0") << 0 << CborErrorUnexpectedEOF; diff --git a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp index 0687ce0ead..932c4d25d2 100644 --- a/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/serialization/qdatastream/tst_qdatastream.cpp @@ -3128,7 +3128,7 @@ void tst_QDataStream::status_QHash_QMap() void tst_QDataStream::status_QList_QVector() { typedef QList List; - typedef QVector Vector; + typedef QList Vector; List list; Vector vector; @@ -3292,7 +3292,7 @@ void tst_QDataStream::streamRealDataTypes() stream >> rect; QCOMPARE(rect, QRectF(-1, -2, 3, 4)); stream >> polygon; - QCOMPARE((QVector &)polygon, (QPolygonF() << QPointF(0, 0) << QPointF(1, 2))); + QCOMPARE((QList &)polygon, (QPolygonF() << QPointF(0, 0) << QPointF(1, 2))); auto matrix = transform.asAffineMatrix(); stream >> matrix; QCOMPARE(transform, QTransform().rotate(90).scale(2, 2)); diff --git a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp index ad5a8352a6..5cace2c36b 100644 --- a/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/serialization/qxmlstream/tst_qxmlstream.cpp @@ -241,7 +241,7 @@ public: class MissedBaseline { friend class QList; - MissedBaseline() {} // for QVector, don't use + MissedBaseline() {} // for QList, don't use public: MissedBaseline(const QString &aId, const QByteArray &aExpected, @@ -265,8 +265,8 @@ public: QByteArray output; }; - QVector failures; - QVector missedBaselines; + QList failures; + QList missedBaselines; /** * The count of how many tests that were run. diff --git a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp index b1f6090585..d898d37bda 100644 --- a/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp +++ b/tests/auto/corelib/statemachine/qstatemachine/tst_qstatemachine.cpp @@ -272,7 +272,7 @@ public: TestState(ChildMode mode, const QString &objectName = QString()) : QState(mode) { setObjectName(objectName); } - QVector > events; + QList > events; protected: virtual void onEntry(QEvent *) { events.append(qMakePair(globalTick++, Entry)); @@ -288,7 +288,7 @@ public: TestTransition(QAbstractState *target, const QString &objectName = QString()) : QAbstractTransition() { setTargetState(target); setObjectName(objectName); } - QVector triggers; + QList triggers; protected: virtual bool eventTest(QEvent *) { return true; @@ -4876,7 +4876,7 @@ public: signalList.append(signal); } - QVector signalList; + QList signalList; }; void tst_QStateMachine::testIncrementReceivers() diff --git a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp index ad973f73fc..98cbd0b4a5 100644 --- a/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp +++ b/tests/auto/corelib/text/qregularexpression/tst_qregularexpression.cpp @@ -167,7 +167,7 @@ bool operator!=(const Match &m, const QRegularExpressionMatch &rem) } -bool operator==(const QRegularExpressionMatchIterator &iterator, const QVector &expectedMatchList) +bool operator==(const QRegularExpressionMatchIterator &iterator, const QList &expectedMatchList) { QRegularExpressionMatchIterator i = iterator; @@ -186,17 +186,17 @@ bool operator==(const QRegularExpressionMatchIterator &iterator, const QVector &expectedMatchList, const QRegularExpressionMatchIterator &iterator) +bool operator==(const QList &expectedMatchList, const QRegularExpressionMatchIterator &iterator) { return operator==(iterator, expectedMatchList); } -bool operator!=(const QRegularExpressionMatchIterator &iterator, const QVector &expectedMatchList) +bool operator!=(const QRegularExpressionMatchIterator &iterator, const QList &expectedMatchList) { return !operator==(iterator, expectedMatchList); } -bool operator!=(const QVector &expectedMatchList, const QRegularExpressionMatchIterator &iterator) +bool operator!=(const QList &expectedMatchList, const QRegularExpressionMatchIterator &iterator) { return !operator==(expectedMatchList, iterator); } @@ -1150,9 +1150,9 @@ void tst_QRegularExpression::globalMatch_data() QTest::addColumn("offset"); QTest::addColumn("matchType"); QTest::addColumn("matchOptions"); - QTest::addColumn >("matchList"); + QTest::addColumn >("matchList"); - QVector matchList; + QList matchList; Match m; matchList.clear(); @@ -1408,7 +1408,7 @@ void tst_QRegularExpression::globalMatch() QFETCH(int, offset); QFETCH(QRegularExpression::MatchType, matchType); QFETCH(QRegularExpression::MatchOptions, matchOptions); - QFETCH(QVector, matchList); + QFETCH(QList, matchList); testMatch(regexp, static_cast(&QRegularExpression::globalMatch), @@ -2136,7 +2136,7 @@ void tst_QRegularExpression::threadSafety() for (int threadSafetyIteration = 0; threadSafetyIteration < THREAD_SAFETY_ITERATIONS && time.elapsed() < 2000; ++threadSafetyIteration) { QRegularExpression re(pattern); - QVector threads; + QList threads; for (int i = 0; i < threadCount; ++i) { MatcherThread *thread = new MatcherThread(re, subject); thread->start(); diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp index e1857e31ee..376a4cb5dc 100644 --- a/tests/auto/corelib/text/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp @@ -667,7 +667,7 @@ QString verifyZeroTermination(const QString &str) } while (0) \ /**/ -typedef QVector IntList; +typedef QList IntList; tst_QString::tst_QString() { @@ -4627,7 +4627,7 @@ void tst_QString::fromUcs4() void tst_QString::toUcs4() { QString s; - QVector ucs4; + QList ucs4; QCOMPARE( s.toUcs4().size(), 0 ); static const QChar bmp = QLatin1Char('a'); @@ -5683,9 +5683,9 @@ template<> struct StringSplitWrapper template<> struct StringSplitWrapper { const QString &string; - QVector split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return string.splitRef(sep, behavior, cs); } - QVector split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return string.splitRef(sep, behavior, cs); } - QVector split(const QRegularExpression &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const { return string.splitRef(sep, behavior); } + QList split(const QString &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return string.splitRef(sep, behavior, cs); } + QList split(QChar sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts, Qt::CaseSensitivity cs = Qt::CaseSensitive) const { return string.splitRef(sep, behavior, cs); } + QList split(const QRegularExpression &sep, Qt::SplitBehavior behavior = Qt::KeepEmptyParts) const { return string.splitRef(sep, behavior); } }; template<> struct StringSplitWrapper @@ -5710,20 +5710,14 @@ static bool operator==(const QList &result, const QStringList &expe } -static bool operator ==(const QStringList &left, const QVector &right) +static bool operator ==(const QStringList &left, const QList &right) { if (left.size() != right.size()) return false; - QStringList::const_iterator iLeft = left.constBegin(); - QVector::const_iterator iRight = right.constBegin(); - for (; iLeft != left.end(); ++iLeft, ++iRight) { - if (*iLeft != *iRight) - return false; - } - return true; + return std::equal(left.constBegin(), left.constEnd(), right.constBegin()); } -static inline bool operator ==(const QVector &left, const QStringList &right) { return right == left; } +static inline bool operator ==(const QList &left, const QStringList &right) { return right == left; } template void tst_QString::split(const QString &string, const QString &sep, QStringList result) @@ -5771,7 +5765,7 @@ void tst_QString::split() QFETCH(QString, sep); QFETCH(QStringList, result); split(str, sep, result); - split>(str, sep, result); + split>(str, sep, result); } void tst_QString::splitRef_data() @@ -5784,7 +5778,7 @@ void tst_QString::splitRef() QFETCH(QString, str); QFETCH(QString, sep); QFETCH(QStringList, result); - split >(str, sep, result); + split >(str, sep, result); } void tst_QString::split_regularexpression_data() @@ -5840,7 +5834,7 @@ void tst_QString::splitRef_regularexpression() QFETCH(QString, string); QFETCH(QString, pattern); QFETCH(QStringList, result); - split_regexp, QRegularExpression>(string, pattern, result); + split_regexp, QRegularExpression>(string, pattern, result); } void tst_QString::fromUtf16_data() diff --git a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp index 69ad52c08b..3e1f10cc11 100644 --- a/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp +++ b/tests/auto/corelib/text/qstringapisymmetry/tst_qstringapisymmetry.cpp @@ -31,15 +31,14 @@ #undef QT_NO_CAST_TO_ASCII #undef QT_ASCII_CAST_WARNINGS -#include -#include -#include #include +#include +#include #include +#include #include -#include -#include - +#include +#include #include Q_DECLARE_METATYPE(QLatin1String) @@ -2304,12 +2303,12 @@ void tst_QStringApiSymmetry::toUtf8_impl() void tst_QStringApiSymmetry::toUcs4_data() { QTest::addColumn("unicode"); - QTest::addColumn>("ucs4"); + QTest::addColumn>("ucs4"); auto add = [](const char *l1) { const QByteArray ba(l1); QString s; - QVector ucs4; + QList ucs4; for (char c : ba) { s += QLatin1Char(c); ucs4.append(uint(uchar(c))); @@ -2317,8 +2316,8 @@ void tst_QStringApiSymmetry::toUcs4_data() QTest::newRow(rowName(ba).constData()) << s << ucs4; }; - QTest::addRow("null") << QString() << QVector(); - QTest::addRow("empty") << QString("") << QVector(); + QTest::addRow("null") << QString() << QList(); + QTest::addRow("empty") << QString("") << QList(); add("M\xF6" "bius"); add(LONG_STRING_256); @@ -2328,7 +2327,7 @@ template void tst_QStringApiSymmetry::toUcs4_impl() { QFETCH(const QString, unicode); - QFETCH(const QVector, ucs4); + QFETCH(const QList, ucs4); const auto str = make(unicode); diff --git a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp index bf3f30bb82..5de3beff77 100644 --- a/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp +++ b/tests/auto/corelib/text/qstringconverter/tst_qstringconverter.cpp @@ -1839,7 +1839,7 @@ void tst_QStringConverter::threadSafety() { QThreadPool::globalInstance()->setMaxThreadCount(12); - QVector res; + QList res; res.resize(QStringConverter::LastEncoding + 1); for (int i = 0; i < QStringConverter::LastEncoding + 1; ++i) { QThreadPool::globalInstance()->start(new LoadAndConvert(QStringConverter::Encoding(i), &res[i])); diff --git a/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp b/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp index 16720a1d40..aaaf31593a 100644 --- a/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp +++ b/tests/auto/corelib/text/qstringlist/tst_qstringlist.cpp @@ -27,9 +27,9 @@ ****************************************************************************/ #include +#include #include #include -#include #include @@ -88,7 +88,7 @@ void tst_QStringList::constructors() QCOMPARE(list.at(2), "c"); } { - const QVector reference{ "a", "b", "c" }; + const QList reference{ "a", "b", "c" }; QCOMPARE(reference.size(), 3); QStringList list(reference.cbegin(), reference.cend()); diff --git a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp index 021e7f2967..3e05d7af4f 100644 --- a/tests/auto/corelib/text/qstringref/tst_qstringref.cpp +++ b/tests/auto/corelib/text/qstringref/tst_qstringref.cpp @@ -2081,20 +2081,14 @@ void tst_QStringRef::mid() QVERIFY(emptyRef.mid(-10, 3).isEmpty()); } -static bool operator ==(const QStringList &left, const QVector &right) +static bool operator ==(const QStringList &left, const QList &right) { if (left.size() != right.size()) return false; - QStringList::const_iterator iLeft = left.constBegin(); - QVector::const_iterator iRight = right.constBegin(); - for (; iLeft != left.end(); ++iLeft, ++iRight) { - if (*iLeft != *iRight) - return false; - } - return true; + return std::equal(left.constBegin(), left.constEnd(), right.constBegin()); } -static inline bool operator ==(const QVector &left, const QStringList &right) { return right == left; } +static inline bool operator ==(const QList &left, const QStringList &right) { return right == left; } void tst_QStringRef::split_data() { @@ -2124,7 +2118,7 @@ void tst_QStringRef::split() QFETCH(QString, sep); QFETCH(QStringList, result); - QVector list; + QList list; // we construct a bigger valid string to check // if ref.split is using the right size QString source = str + str + str; diff --git a/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp b/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp index 0f50c389b4..1d2658c38f 100644 --- a/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp +++ b/tests/auto/corelib/text/qstringtokenizer/tst_qstringtokenizer.cpp @@ -137,13 +137,13 @@ void tst_QStringTokenizer::toContainer() const { auto tok = qTokenize(u"a,b,c", u','); auto v = tok.toContainer(); - QVERIFY((std::is_same_v>)); + QVERIFY((std::is_same_v>)); } // QLatin1String value_type { auto tok = qTokenize(QLatin1String{"a,b,c"}, u','); auto v = tok.toContainer(); - QVERIFY((std::is_same_v>)); + QVERIFY((std::is_same_v>)); } } diff --git a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp index 83bb372490..55e23570d7 100644 --- a/tests/auto/corelib/text/qstringview/tst_qstringview.cpp +++ b/tests/auto/corelib/text/qstringview/tst_qstringview.cpp @@ -32,7 +32,7 @@ #include #include #include -#include +#include #include @@ -89,7 +89,7 @@ static_assert(CanConvert::value); static_assert(CanConvert< ushort*>::value); static_assert(CanConvert::value); -static_assert(CanConvert>::value); +static_assert(CanConvert>::value); static_assert(CanConvert>::value); static_assert(CanConvert>::value); static_assert(CanConvert>::value); @@ -115,7 +115,7 @@ static_assert(CanConvert::value); static_assert(CanConvert< std::u16string_view&>::value); static_assert(CanConvert::value); -static_assert(CanConvert>::value); +static_assert(CanConvert>::value); static_assert(CanConvert>::value); static_assert(CanConvert>::value); static_assert(CanConvert>::value); @@ -149,7 +149,7 @@ static_assert(CanConvert::value == CanConvertFromWChar static_assert(CanConvert< std::wstring_view&>::value == CanConvertFromWCharT); static_assert(CanConvert::value == CanConvertFromWCharT); -static_assert(CanConvert>::value == CanConvertFromWCharT); +static_assert(CanConvert>::value == CanConvertFromWCharT); static_assert(CanConvert>::value == CanConvertFromWCharT); static_assert(CanConvert>::value == CanConvertFromWCharT); static_assert(CanConvert>::value == CanConvertFromWCharT); @@ -732,7 +732,7 @@ void tst_QStringView::fromContainer() const template void tst_QStringView::fromContainers() const { - fromContainer>(); + fromContainer>(); fromContainer>(); fromContainer>(); } diff --git a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp index 7a94908f6b..40abe3d762 100644 --- a/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/thread/qfuture/tst_qfuture.cpp @@ -191,8 +191,8 @@ void tst_QFuture::resultStore() QVERIFY(it == store.end()); } - QVector vec0 = QVector() << 2 << 3; - QVector vec1 = QVector() << 4 << 5; + QList vec0 = QList() << 2 << 3; + QList vec1 = QList() << 4 << 5; { ResultStoreInt store; @@ -1728,7 +1728,7 @@ void tst_QFuture::nonGlobalThreadPool() const int numTasks = QThread::idealThreadCount(); - QVector > futures; + QList> futures; futures.reserve(numTasks); for (int i = 0; i < numTasks; ++i) diff --git a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp index 4825ee80d5..571078feba 100644 --- a/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp +++ b/tests/auto/corelib/thread/qpromise/snippet_qpromise.cpp @@ -194,7 +194,7 @@ void snippet_QPromise::suspendExample() thread->wait(); QCOMPARE(future.resultCount(), 100); - QVector expected(100); + QList expected(100); std::iota(expected.begin(), expected.end(), 0); QCOMPARE(future.results(), expected); } diff --git a/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp b/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp index fba617e34d..5b545fe37a 100644 --- a/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp +++ b/tests/auto/corelib/thread/qresultstore/tst_qresultstore.cpp @@ -57,8 +57,8 @@ private: int int0; int int1; int int2; - QVector vec0; - QVector vec1; + QList vec0; + QList vec1; }; void tst_QtConcurrentResultStore::init() @@ -66,8 +66,8 @@ void tst_QtConcurrentResultStore::init() int0 = 0; int1 = 1; int2 = 2; - vec0 = QVector() << 2 << 3; - vec1 = QVector() << 4 << 5; + vec0 = QList { 2, 3 }; + vec1 = QList { 4, 5 }; } void tst_QtConcurrentResultStore::construction() diff --git a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp index b7134d0454..7654d0e74b 100644 --- a/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp +++ b/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp @@ -166,7 +166,7 @@ void tst_QSemaphore::multiRelease() }; QSemaphore sem; - QVector threads; + QList threads; threads.resize(4); for (Thread *&t : threads) @@ -200,7 +200,7 @@ void tst_QSemaphore::multiAcquireRelease() }; QSemaphore sem; - QVector threads; + QList threads; threads.resize(4); for (Thread *&t : threads) diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index b5520ac9bb..f72fec0362 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -883,7 +883,7 @@ void tst_QThread::adoptMultipleThreads() #else const int numThreads = 5; #endif - QVector nativeThreads; + QList nativeThreads; SignalRecorder recorder; @@ -915,7 +915,7 @@ void tst_QThread::adoptMultipleThreadsOverlap() #else const int numThreads = 5; #endif - QVector nativeThreads; + QList nativeThreads; SignalRecorder recorder; diff --git a/tests/auto/corelib/tools/collections/tst_collections.cpp b/tests/auto/corelib/tools/collections/tst_collections.cpp index f7b6f478cf..61a0db26de 100644 --- a/tests/auto/corelib/tools/collections/tst_collections.cpp +++ b/tests/auto/corelib/tools/collections/tst_collections.cpp @@ -42,7 +42,7 @@ static QSet *setX; static QStack *stackX; static QVarLengthArray *varLengthArrayX; static QVarLengthArray *varLengthArrayY; -static QVector *vectorX; +static QList *vectorX; void foo() { @@ -78,7 +78,6 @@ void foo() #include "qstring.h" #include "qstringlist.h" #include "qvarlengtharray.h" -#include "qvector.h" #include "qqueue.h" class tst_Collections : public QObject @@ -470,7 +469,7 @@ void tst_Collections::list() } { - QVector vector(5); + QList vector(5); vector[0] = "99"; vector[4] ="100"; QList list = vector.toList(); @@ -726,7 +725,7 @@ void tst_Collections::list() void tst_Collections::vector() { - QVector v1; + QList v1; v1 << 1 << 2 << 3; QVector v2; v2 << 4 << 5; @@ -2495,13 +2494,12 @@ void testMapLikeStlIterators() void tst_Collections::constAndNonConstStlIterators() { - testListLikeStlIterators >(); - testListLikeStlIterators(); - testListLikeStlIterators >(); - testMapLikeStlIterators >(); - testMapLikeStlIterators >(); - testMapLikeStlIterators >(); - testMapLikeStlIterators >(); + testListLikeStlIterators>(); + testListLikeStlIterators(); + testMapLikeStlIterators>(); + testMapLikeStlIterators>(); + testMapLikeStlIterators>(); + testMapLikeStlIterators>(); } void tst_Collections::vector_stl_data() @@ -2518,7 +2516,7 @@ void tst_Collections::vector_stl() { QFETCH(QStringList, elements); - QVector vector; + QList vector; for (int i = 0; i < elements.count(); ++i) vector << elements.at(i); @@ -2534,9 +2532,9 @@ void tst_Collections::vector_stl() QCOMPARE(*it, vector[j]); #if QT_VERSION < QT_VERSION_CHECK(6,0,0) - QCOMPARE(QVector::fromStdVector(stdVector), vector); + QCOMPARE(QList::fromStdVector(stdVector), vector); #endif - QCOMPARE(QVector(stdVector.begin(), stdVector.end()), vector); + QCOMPARE(QList(stdVector.begin(), stdVector.end()), vector); } void tst_Collections::list_stl_data() @@ -2789,10 +2787,6 @@ void tst_Collections::containerInstantiation() list.removeAll(value); } - //Instantiate QVector member functions. - typedef QVector Vector; - instantiateRandomAccess(); - //Instantiate QQueue member functions. typedef QQueue Queue; instantiateRandomAccess(); @@ -2883,7 +2877,6 @@ void testSetContainerTypedefs(Container container) */ void tst_Collections::containerTypedefs() { - testContainerTypedefs(QVector()); testContainerTypedefs(QStack()); testContainerTypedefs(QList()); testContainerTypedefs(QQueue()); @@ -3032,18 +3025,18 @@ void testAssociativeContainerAlignment() void tst_Collections::alignment() { - testVectorAlignment >(); - testVectorAlignment >(); - testContiguousCacheAlignment >(); - testContiguousCacheAlignment >(); - testAssociativeContainerAlignment >(); - testAssociativeContainerAlignment >(); - testAssociativeContainerAlignment >(); - testAssociativeContainerAlignment >(); - testAssociativeContainerAlignment >(); - testAssociativeContainerAlignment >(); - testAssociativeContainerAlignment >(); - testAssociativeContainerAlignment >(); + testVectorAlignment>(); + testVectorAlignment>(); + testContiguousCacheAlignment>(); + testContiguousCacheAlignment>(); + testAssociativeContainerAlignment>(); + testAssociativeContainerAlignment>(); + testAssociativeContainerAlignment>(); + testAssociativeContainerAlignment>(); + testAssociativeContainerAlignment>(); + testAssociativeContainerAlignment>(); + testAssociativeContainerAlignment>(); + testAssociativeContainerAlignment>(); } #ifndef QT_NO_TEMPLATE_TEMPLATE_PARAMETERS @@ -3327,25 +3320,25 @@ using ExtList = QList; void tst_Collections::insert_remove_loop() { - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); - insert_remove_loop_impl >(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); + insert_remove_loop_impl>(); } diff --git a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp index 558c15d441..a7fa5094c5 100644 --- a/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp +++ b/tests/auto/corelib/tools/containerapisymmetry/tst_containerapisymmetry.cpp @@ -29,12 +29,11 @@ #include #include "qbytearray.h" +#include "qdebug.h" +#include "qhash.h" #include "qlist.h" #include "qstring.h" #include "qvarlengtharray.h" -#include "qvector.h" -#include "qhash.h" -#include "qdebug.h" #include #include @@ -269,19 +268,14 @@ private Q_SLOTS: void ranged_ctor_std_vector_Complex() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_std_vector_duplicates_strategy() { non_associative_container_duplicates_strategy(); } - void ranged_ctor_QVector_int() { ranged_ctor_non_associative_impl>(); } - void ranged_ctor_QVector_char() { ranged_ctor_non_associative_impl>(); } - void ranged_ctor_QVector_QChar() { ranged_ctor_non_associative_impl>(); } - void ranged_ctor_QVector_Movable() { ranged_ctor_non_associative_impl>(); } - void ranged_ctor_QVector_Complex() { ranged_ctor_non_associative_impl>(); } - void ranged_ctor_QVector_duplicates_strategy() { non_associative_container_duplicates_strategy(); } - void ranged_ctor_QVarLengthArray_int() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_QVarLengthArray_Movable() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_QVarLengthArray_Complex() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_QVarLengthArray_duplicates_strategy() { non_associative_container_duplicates_strategy(); } // note the VarLengthArray passed void ranged_ctor_QList_int() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_QList_char() { ranged_ctor_non_associative_impl>(); } + void ranged_ctor_QList_QChar() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_QList_Movable() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_QList_Complex() { ranged_ctor_non_associative_impl>(); } void ranged_ctor_QList_duplicates_strategy() { non_associative_container_duplicates_strategy(); } @@ -474,7 +468,6 @@ private: private Q_SLOTS: void front_back_std_vector() { front_back_impl>(); } - void front_back_QVector() { front_back_impl>(); } void front_back_QList() { front_back_impl>(); } void front_back_QVarLengthArray() { front_back_impl>(); } void front_back_QString() { front_back_impl(); } diff --git a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp index aac429043d..078351f388 100644 --- a/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp +++ b/tests/auto/corelib/tools/qalgorithms/tst_qalgorithms.cpp @@ -35,10 +35,10 @@ #include #include #include -#include -#include +#include #include -#include +#include +#include #define Q_TEST_PERFORMANCE 0 @@ -137,9 +137,9 @@ QStringList dataSetTypes = QStringList() << "Random" << "Ascending" << "Descending" << "Equal" << "Duplicates" << "Almost Sorted" ; template -QVector generateData(QString dataSetType, const int length) +QList generateData(QString dataSetType, const int length) { - QVector container; + QList container; if (dataSetType == "Random") { for (int i = 0; i < length; ++i) container.append(QRandomGenerator::global()->generate()); @@ -236,7 +236,7 @@ QList testAlgorithm(Algorithm &algorithm, QStringList dataSetTypes, { QList results; foreach(QString dataSetType, dataSetTypes) { - QVector container = generateData(dataSetType, size); + QList container = generateData(dataSetType, size); results.append(testRun(container, algorithm, time)); if (!isSorted(container)) qWarning("%s: container is not sorted after test", Q_FUNC_INFO); @@ -534,22 +534,6 @@ void tst_QAlgorithms::qBinaryFindOneEntry() void tst_QAlgorithms::sortAPItest() { - QVector testVector = generateData("Random", 101); - qSort(testVector); - QVERIFY(isSorted(testVector)); - qSort(testVector.begin(), testVector.end()); - QVERIFY(isSorted(testVector)); - qSort(testVector.begin(), testVector.end(), qLess()); - QVERIFY(isSorted(testVector)); - - testVector = generateData("Random", 71); - qStableSort(testVector); - QVERIFY(isSorted(testVector)); - qStableSort(testVector.begin(), testVector.end()); - QVERIFY(isSorted(testVector)); - qStableSort(testVector.begin(), testVector.end(), qLess()); - QVERIFY(isSorted(testVector)); - QList testList = generateData("Random", 101).toList(); qSort(testList); QVERIFY(isSorted(testList)); @@ -582,15 +566,14 @@ int Minor; ostream &operator<<(ostream &out, const StableSortTest& obj) { out << obj.Major << "-" << obj.Minor; return out; } -QVector createStableTestVector() +QList createStableTestList() { - QVector stableTestVector; - for (int i=500; i>=0; --i) { - for (int j=0; j<10; ++j) { - stableTestVector.append(StableSortTest(i, j)); - } + QList stableTestList; + for (int i = 500; i >= 0; --i) { + for (int j = 0; j < 10; ++j) + stableTestList.append(StableSortTest(i, j)); } - return stableTestVector; + return stableTestList; } template @@ -614,52 +597,52 @@ void tst_QAlgorithms::stableSortTest() { // Selftests: { - QVector stableTestVector = createStableTestVector(); - qSort(stableTestVector.begin(), stableTestVector.end(), qLess()); - QVERIFY(isSorted(stableTestVector, qLess())); - QVERIFY(!isStableSorted(stableTestVector, qLess())); + QList stableTestList = createStableTestList(); + qSort(stableTestList.begin(), stableTestList.end(), qLess()); + QVERIFY(isSorted(stableTestList, qLess())); + QVERIFY(!isStableSorted(stableTestList, qLess())); } { - QVector stableTestVector = createStableTestVector(); - qSort(stableTestVector.begin(), stableTestVector.end(), qGreater()); - QVERIFY(isSorted(stableTestVector, qGreater())); - QVERIFY(!isStableSorted(stableTestVector, qGreater())); + QList stableTestList = createStableTestList(); + qSort(stableTestList.begin(), stableTestList.end(), qGreater()); + QVERIFY(isSorted(stableTestList, qGreater())); + QVERIFY(!isStableSorted(stableTestList, qGreater())); } { - QVector stableTestVector = createStableTestVector(); - qSort(stableTestVector.begin(), stableTestVector.end(), qGreater()); - QVERIFY(!isSorted(stableTestVector, qLess())); - QVERIFY(!isStableSorted(stableTestVector, qGreater())); + QList stableTestList = createStableTestList(); + qSort(stableTestList.begin(), stableTestList.end(), qGreater()); + QVERIFY(!isSorted(stableTestList, qLess())); + QVERIFY(!isStableSorted(stableTestList, qGreater())); } // Stable sort with qLess { - QVector stableTestVector = createStableTestVector(); - std::stable_sort(stableTestVector.begin(), stableTestVector.end(), qLess()); - QVERIFY(isSorted(stableTestVector, qLess())); - QVERIFY(isStableSorted(stableTestVector, qLess())); + QList stableTestList = createStableTestList(); + std::stable_sort(stableTestList.begin(), stableTestList.end(), qLess()); + QVERIFY(isSorted(stableTestList, qLess())); + QVERIFY(isStableSorted(stableTestList, qLess())); } { - QVector stableTestVector = createStableTestVector(); - qStableSort(stableTestVector.begin(), stableTestVector.end(), qLess()); - QVERIFY(isSorted(stableTestVector, qLess())); - QVERIFY(isStableSorted(stableTestVector, qLess())); + QList stableTestList = createStableTestList(); + qStableSort(stableTestList.begin(), stableTestList.end(), qLess()); + QVERIFY(isSorted(stableTestList, qLess())); + QVERIFY(isStableSorted(stableTestList, qLess())); } // Stable sort with qGreater { - QVector stableTestVector = createStableTestVector(); - std::stable_sort(stableTestVector.begin(), stableTestVector.end(), qGreater()); - QVERIFY(isSorted(stableTestVector, qGreater())); - QVERIFY(isStableSorted(stableTestVector, qGreater())); + QList stableTestList = createStableTestList(); + std::stable_sort(stableTestList.begin(), stableTestList.end(), qGreater()); + QVERIFY(isSorted(stableTestList, qGreater())); + QVERIFY(isStableSorted(stableTestList, qGreater())); } { - QVector stableTestVector = createStableTestVector(); - qStableSort(stableTestVector.begin(), stableTestVector.end(), qGreater()); - QVERIFY(isSorted(stableTestVector, qGreater())); - QVERIFY(isStableSorted(stableTestVector, qGreater())); + QList stableTestList = createStableTestList(); + qStableSort(stableTestList.begin(), stableTestList.end(), qGreater()); + QVERIFY(isSorted(stableTestList, qGreater())); + QVERIFY(isStableSorted(stableTestList, qGreater())); } } @@ -667,8 +650,8 @@ void tst_QAlgorithms::stableSortTest() void tst_QAlgorithms::stableSortCorrectnessTest_data() { const int dataSize = 1000; - QTest::addColumn >("unsorted"); - QTest::newRow("From documentation") << (QVector() << 33 << 12 << 68 << 6 << 12); + QTest::addColumn>("unsorted"); + QTest::newRow("From documentation") << (QList() << 33 << 12 << 68 << 6 << 12); QTest::newRow("Equal") << (generateData("Equal", dataSize)); QTest::newRow("Ascending") << (generateData("Ascending", dataSize)); QTest::newRow("Descending") << (generateData("Descending", dataSize)); @@ -679,9 +662,9 @@ void tst_QAlgorithms::stableSortCorrectnessTest_data() void tst_QAlgorithms::stableSortCorrectnessTest() { - QFETCH(QVector, unsorted); + QFETCH(QList, unsorted); - QVector sorted = unsorted; + QList sorted = unsorted; qStableSort(sorted.begin(), sorted.end()); // Verify that sorted contains the same numbers as unsorted. @@ -743,7 +726,7 @@ template class QuickSortHelper { public: - void operator()(QVector list) + void operator()(QList list) { ::qSort(list); } @@ -753,7 +736,7 @@ template class StableSortHelper { public: - void operator()(QVector list) + void operator()(QList list) { ::qStableSort(list); } @@ -763,7 +746,7 @@ template class StlSortHelper { public: - void operator()(QVector list) + void operator()(QList list) { std::sort(list.begin(), list.end()); } @@ -773,7 +756,7 @@ template class StlStableSortHelper { public: - void operator()(QVector list) + void operator()(QList list) { std::stable_sort(list.begin(), list.end()); } diff --git a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp index 9ebcda4cef..c7f20ec6a4 100644 --- a/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp +++ b/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp @@ -417,7 +417,7 @@ struct Deallocator size_t objectSize; size_t alignment; - QVector headers; + QList headers; }; Q_DECLARE_METATYPE(const QArrayData *) @@ -652,7 +652,7 @@ void tst_QArrayData::gccBug43247() { // This test tries to verify QArrayData is not affected by GCC optimizer // bug #43247. - // Reported on GCC 4.4.3, Linux, affects QVector + // Reported on GCC 4.4.3, Linux, affects QList QTest::ignoreMessage(QtDebugMsg, "GCC Optimization bug #43247 not triggered (3)"); QTest::ignoreMessage(QtDebugMsg, "GCC Optimization bug #43247 not triggered (4)"); @@ -661,7 +661,7 @@ void tst_QArrayData::gccBug43247() QTest::ignoreMessage(QtDebugMsg, "GCC Optimization bug #43247 not triggered (7)"); SimpleVector array(10, 0); - // QVector vector(10, 0); + // QList list(10, 0); for (int i = 0; i < 10; ++i) { if (i >= 3 && i < 8) @@ -671,7 +671,7 @@ void tst_QArrayData::gccBug43247() // line lets the compiler assume i == 0, and the conditional above is // skipped. QVERIFY(array.at(i) == 0); - // QVERIFY(vector.at(i) == 0); + // QVERIFY(list.at(i) == 0); } } @@ -1141,18 +1141,18 @@ void tst_QArrayData::literals() } { - QVector v(Q_ARRAY_LITERAL(char, "ABCDEFGHIJ")); - QCOMPARE(v.size(), 11); - QCOMPARE(v.capacity(), 0); + QList l(Q_ARRAY_LITERAL(char, "ABCDEFGHIJ")); + QCOMPARE(l.size(), 11); + QCOMPARE(l.capacity(), 0); for (int i = 0; i < 10; ++i) - QCOMPARE(v.at(i), char('A' + i)); + QCOMPARE(l.at(i), char('A' + i)); - (void)v.begin(); // "detach" + (void)l.begin(); // "detach" - QCOMPARE(v.size(), 11); - QVERIFY(v.capacity() >= v.size()); + QCOMPARE(l.size(), 11); + QVERIFY(l.capacity() >= l.size()); for (int i = 0; i < 10; ++i) - QCOMPARE(v[i], char('A' + i)); + QCOMPARE(l[i], char('A' + i)); } { @@ -1176,18 +1176,18 @@ void tst_QArrayData::literals() } { - QVector v(Q_ARRAY_LITERAL(LiteralType, LiteralType(0), LiteralType(1), LiteralType(2))); - QCOMPARE(v.size(), 3); - QCOMPARE(v.capacity(), 0); + QList l(Q_ARRAY_LITERAL(LiteralType, LiteralType(0), LiteralType(1), LiteralType(2))); + QCOMPARE(l.size(), 3); + QCOMPARE(l.capacity(), 0); for (int i = 0; i < 3; ++i) - QCOMPARE(v.at(i).value, i); + QCOMPARE(l.at(i).value, i); - (void)v.begin(); // "detach" + (void)l.begin(); // "detach" - QCOMPARE(v.size(), 3); - QVERIFY(v.capacity() >= v.size()); + QCOMPARE(l.size(), 3); + QVERIFY(l.capacity() >= l.size()); for (int i = 0; i < 3; ++i) - QCOMPARE(v[i].value, i); + QCOMPARE(l[i].value, i); } } diff --git a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp index 898ac86874..9b32d3a797 100644 --- a/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/corelib/tools/qeasingcurve/tst_qeasingcurve.cpp @@ -602,7 +602,7 @@ static inline void setupBezierSpline(QEasingCurve *easingCurve, const QString &s { QStringList pointStr = string.split(QLatin1Char(' ')); - QVector points; + QList points; foreach (const QString &str, pointStr) { QStringList coordStr = str.split(QLatin1Char(',')); QPointF point(coordStr.first().toDouble(), coordStr.last().toDouble()); diff --git a/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp index a5ae6f5f44..dbde140d70 100644 --- a/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp +++ b/tests/auto/corelib/tools/qflatmap/tst_qflatmap.cpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include diff --git a/tests/auto/corelib/tools/qlist/tst_qlist.cpp b/tests/auto/corelib/tools/qlist/tst_qlist.cpp index fbd5cf6402..e2044288d2 100644 --- a/tests/auto/corelib/tools/qlist/tst_qlist.cpp +++ b/tests/auto/corelib/tools/qlist/tst_qlist.cpp @@ -2826,7 +2826,7 @@ void tst_QList::emplaceConsistentWithStdVectorImpl() const vecEq(qVec, stdVec); T t; - // while QVector is safe with regards to emplacing elements moved form itself, it's UB + // while QList is safe with regards to emplacing elements moved form itself, it's UB // for std::vector, so do the moving in two steps there. qVec.emplaceBack(std::move(qVec[0])); stdVec.emplace_back(std::move(t = std::move(stdVec[0]))); diff --git a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp index e355a7fcfb..10e6294b48 100644 --- a/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp +++ b/tests/auto/corelib/tools/qringbuffer/tst_qringbuffer.cpp @@ -29,7 +29,7 @@ #include #include -#include +#include class tst_QRingBuffer : public QObject { @@ -82,7 +82,7 @@ void tst_QRingBuffer::constructing() void tst_QRingBuffer::usingInVector() { QRingBuffer ringBuffer; - QVector buffers; + QList buffers; ringBuffer.reserve(5); buffers.append(ringBuffer); diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index cfc1f13cb2..ccbae61c06 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -31,9 +31,9 @@ #include "qsharedpointer.h" #include #include +#include #include #include -#include #include "externaltests.h" #include "forwarddeclared.h" @@ -2114,7 +2114,7 @@ void tst_QSharedPointer::threadStressTest() memset(guard2, 0, sizeof guard2); for (int r = 0; r < 5; ++r) { - QVector allThreads(6 * qMax(strongThreadCount, weakThreadCount) + 3, 0); + QList allThreads(6 * qMax(strongThreadCount, weakThreadCount) + 3, 0); QSharedPointer base = QSharedPointer(new ThreadData(&counter)); counter.storeRelaxed(0); diff --git a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp index 928bd365fd..291fcca88c 100644 --- a/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp +++ b/tests/auto/corelib/tools/qversionnumber/tst_qversionnumber.cpp @@ -89,56 +89,56 @@ private slots: void tst_QVersionNumber::singleInstanceData() { - QTest::addColumn >("segments"); + QTest::addColumn>("segments"); QTest::addColumn("expectedVersion"); QTest::addColumn("expectedString"); QTest::addColumn("constructionString"); QTest::addColumn("suffixIndex"); QTest::addColumn("isNull"); - // segments expectedVersion expectedString constructionString suffixIndex null - QTest::newRow("null") << QVector() << QVersionNumber(QVector()) << QString() << QString() << 0 << true; - QTest::newRow("text") << QVector() << QVersionNumber(QVector()) << QString() << QStringLiteral("text") << 0 << true; - QTest::newRow(" text") << QVector() << QVersionNumber(QVector()) << QString() << QStringLiteral(" text") << 0 << true; - QTest::newRow("Empty String") << QVector() << QVersionNumber(QVector()) << QString() << QStringLiteral("Empty String") << 0 << true; - QTest::newRow("-1.-2") << (QVector()) << QVersionNumber() << QStringLiteral("") << QStringLiteral("-1.-2") << 0 << true; - QTest::newRow("1.-2-3") << (QVector() << 1) << QVersionNumber(QVector() << 1) << QStringLiteral("1") << QStringLiteral("1.-2-3") << 1 << false; - QTest::newRow("1.2-3") << (QVector() << 1 << 2) << QVersionNumber(QVector() << 1 << 2) << QStringLiteral("1.2") << QStringLiteral("1.2-3") << 3 << false; - QTest::newRow("0") << (QVector() << 0) << QVersionNumber(QVector() << 0) << QStringLiteral("0") << QStringLiteral("0") << 1 << false; - QTest::newRow("0.1") << (QVector() << 0 << 1) << QVersionNumber(QVector() << 0 << 1) << QStringLiteral("0.1") << QStringLiteral("0.1") << 3 << false; - QTest::newRow("0.1.2") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2") << 5 << false; - QTest::newRow("0.1.2alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2alpha") << 5 << false; - QTest::newRow("0.1.2-alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2-alpha") << 5 << false; - QTest::newRow("0.1.2.alpha") << (QVector() << 0 << 1 << 2) << QVersionNumber(0, 1, 2) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2.alpha") << 5 << false; - QTest::newRow("0.1.2.3alpha") << (QVector() << 0 << 1 << 2 << 3) << QVersionNumber(QVector() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3alpha") << 7 << false; - QTest::newRow("0.1.2.3.alpha") << (QVector() << 0 << 1 << 2 << 3) << QVersionNumber(QVector() << 0 << 1 << 2 << 3) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3.alpha") << 7 << false; - QTest::newRow("0.1.2.3.4.alpha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4.alpha") << 9 << false; - QTest::newRow("0.1.2.3.4 alpha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alpha") << 9 << false; - QTest::newRow("0.1.2.3.4 alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alp ha") << 9 << false; - QTest::newRow("0.1.2.3.4alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alp ha") << 9 << false; - QTest::newRow("0.1.2.3.4alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alpha ") << 9 << false; - QTest::newRow("0.1.2.3.4.5alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5) << QStringLiteral("0.1.2.3.4.5") << QStringLiteral("0.1.2.3.4.5alpha ") << 11 << false; - QTest::newRow("0.1.2.3.4.5.6alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6) << QStringLiteral("0.1.2.3.4.5.6") << QStringLiteral("0.1.2.3.4.5.6alpha ") << 13 << false; - QTest::newRow("0.1.2.3.4.5.6.7alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7) << QStringLiteral("0.1.2.3.4.5.6.7") << QStringLiteral("0.1.2.3.4.5.6.7alpha ") << 15 << false; - QTest::newRow("0.1.2.3.4.5.6.7.8alpha ") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alpha ") << 17 << false; - QTest::newRow("0.1.2.3.4.5.6.7.8.alpha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8.alpha") << 17 << false; - QTest::newRow("0.1.2.3.4.5.6.7.8 alpha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alpha") << 17 << false; - QTest::newRow("0.1.2.3.4.5.6.7.8 alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alp ha") << 17 << false; - QTest::newRow("0.1.2.3.4.5.6.7.8alp ha") << (QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QVersionNumber(QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6 << 7 << 8) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alp ha") << 17 << false; - QTest::newRow("10.09") << (QVector() << 10 << 9) << QVersionNumber(QVector() << 10 << 9) << QStringLiteral("10.9") << QStringLiteral("10.09") << 5 << false; - QTest::newRow("10.0x") << (QVector() << 10 << 0) << QVersionNumber(QVector() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0x") << 4 << false; - QTest::newRow("10.0xTest") << (QVector() << 10 << 0) << QVersionNumber(QVector() << 10 << 0) << QStringLiteral("10.0") << QStringLiteral("10.0xTest") << 4 << false; - QTest::newRow("127.09") << (QVector() << 127 << 9) << QVersionNumber(QVector() << 127 << 9) << QStringLiteral("127.9") << QStringLiteral("127.09") << 6 << false; - QTest::newRow("127.0x") << (QVector() << 127 << 0) << QVersionNumber(QVector() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0x") << 5 << false; - QTest::newRow("127.0xTest") << (QVector() << 127 << 0) << QVersionNumber(QVector() << 127 << 0) << QStringLiteral("127.0") << QStringLiteral("127.0xTest") << 5 << false; - QTest::newRow("128.09") << (QVector() << 128 << 9) << QVersionNumber(QVector() << 128 << 9) << QStringLiteral("128.9") << QStringLiteral("128.09") << 6 << false; - QTest::newRow("128.0x") << (QVector() << 128 << 0) << QVersionNumber(QVector() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0x") << 5 << false; - QTest::newRow("128.0xTest") << (QVector() << 128 << 0) << QVersionNumber(QVector() << 128 << 0) << QStringLiteral("128.0") << QStringLiteral("128.0xTest") << 5 << false; + // segments expectedVersion expectedString constructionString suffixIndex null + QTest::newRow("null") << QList() << QVersionNumber() << QString() << QString() << 0 << true; + QTest::newRow("text") << QList() << QVersionNumber() << QString() << QStringLiteral("text") << 0 << true; + QTest::newRow(" text") << QList() << QVersionNumber() << QString() << QStringLiteral(" text") << 0 << true; + QTest::newRow("Empty String") << QList() << QVersionNumber() << QString() << QStringLiteral("Empty String") << 0 << true; + QTest::newRow("-1.-2") << QList() << QVersionNumber() << QStringLiteral("") << QStringLiteral("-1.-2") << 0 << true; + QTest::newRow("1.-2-3") << QList { 1 } << QVersionNumber(QList { 1 }) << QStringLiteral("1") << QStringLiteral("1.-2-3") << 1 << false; + QTest::newRow("1.2-3") << QList { 1, 2 } << QVersionNumber(QList { 1, 2 }) << QStringLiteral("1.2") << QStringLiteral("1.2-3") << 3 << false; + QTest::newRow("0") << QList { 0 } << QVersionNumber(QList { 0 }) << QStringLiteral("0") << QStringLiteral("0") << 1 << false; + QTest::newRow("0.1") << QList { 0, 1 } << QVersionNumber(QList { 0, 1 }) << QStringLiteral("0.1") << QStringLiteral("0.1") << 3 << false; + QTest::newRow("0.1.2") << QList { 0, 1, 2 } << QVersionNumber(QList { 0, 1, 2 }) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2") << 5 << false; + QTest::newRow("0.1.2alpha") << QList { 0, 1, 2 } << QVersionNumber(QList { 0, 1, 2 }) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2alpha") << 5 << false; + QTest::newRow("0.1.2-alpha") << QList { 0, 1, 2 } << QVersionNumber(QList { 0, 1, 2 }) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2-alpha") << 5 << false; + QTest::newRow("0.1.2.alpha") << QList { 0, 1, 2 } << QVersionNumber(QList { 0, 1, 2 }) << QStringLiteral("0.1.2") << QStringLiteral("0.1.2.alpha") << 5 << false; + QTest::newRow("0.1.2.3alpha") << QList { 0, 1, 2, 3 } << QVersionNumber(QList { 0, 1, 2, 3 }) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3alpha") << 7 << false; + QTest::newRow("0.1.2.3.alpha") << QList { 0, 1, 2, 3 } << QVersionNumber(QList { 0, 1, 2, 3 }) << QStringLiteral("0.1.2.3") << QStringLiteral("0.1.2.3.alpha") << 7 << false; + QTest::newRow("0.1.2.3.4.alpha") << QList { 0, 1, 2, 3, 4 } << QVersionNumber(QList { 0, 1, 2, 3, 4 }) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4.alpha") << 9 << false; + QTest::newRow("0.1.2.3.4 alpha") << QList { 0, 1, 2, 3, 4 } << QVersionNumber(QList { 0, 1, 2, 3, 4 }) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alpha") << 9 << false; + QTest::newRow("0.1.2.3.4 alp ha") << QList { 0, 1, 2, 3, 4 } << QVersionNumber(QList { 0, 1, 2, 3, 4 }) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4 alp ha") << 9 << false; + QTest::newRow("0.1.2.3.4alp ha") << QList { 0, 1, 2, 3, 4 } << QVersionNumber(QList { 0, 1, 2, 3, 4 }) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alp ha") << 9 << false; + QTest::newRow("0.1.2.3.4alpha ") << QList { 0, 1, 2, 3, 4 } << QVersionNumber(QList { 0, 1, 2, 3, 4 }) << QStringLiteral("0.1.2.3.4") << QStringLiteral("0.1.2.3.4alpha ") << 9 << false; + QTest::newRow("0.1.2.3.4.5alpha ") << QList { 0, 1, 2, 3, 4, 5 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5 }) << QStringLiteral("0.1.2.3.4.5") << QStringLiteral("0.1.2.3.4.5alpha ") << 11 << false; + QTest::newRow("0.1.2.3.4.5.6alpha ") << QList { 0, 1, 2, 3, 4, 5, 6 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5, 6 }) << QStringLiteral("0.1.2.3.4.5.6") << QStringLiteral("0.1.2.3.4.5.6alpha ") << 13 << false; + QTest::newRow("0.1.2.3.4.5.6.7alpha ") << QList { 0, 1, 2, 3, 4, 5, 6, 7 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5, 6, 7 }) << QStringLiteral("0.1.2.3.4.5.6.7") << QStringLiteral("0.1.2.3.4.5.6.7alpha ") << 15 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8alpha ") << QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alpha ") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8.alpha") << QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8.alpha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8 alpha") << QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alpha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8 alp ha") << QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8 alp ha") << 17 << false; + QTest::newRow("0.1.2.3.4.5.6.7.8alp ha") << QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 } << QVersionNumber(QList { 0, 1, 2, 3, 4, 5, 6, 7, 8 }) << QStringLiteral("0.1.2.3.4.5.6.7.8") << QStringLiteral("0.1.2.3.4.5.6.7.8alp ha") << 17 << false; + QTest::newRow("10.09") << QList { 10, 9 } << QVersionNumber(QList { 10, 9 }) << QStringLiteral("10.9") << QStringLiteral("10.09") << 5 << false; + QTest::newRow("10.0x") << QList { 10, 0 } << QVersionNumber(QList { 10, 0 }) << QStringLiteral("10.0") << QStringLiteral("10.0x") << 4 << false; + QTest::newRow("10.0xTest") << QList { 10, 0 } << QVersionNumber(QList { 10, 0 }) << QStringLiteral("10.0") << QStringLiteral("10.0xTest") << 4 << false; + QTest::newRow("127.09") << QList { 127, 9 } << QVersionNumber(QList { 127, 9 }) << QStringLiteral("127.9") << QStringLiteral("127.09") << 6 << false; + QTest::newRow("127.0x") << QList { 127, 0 } << QVersionNumber(QList { 127, 0 }) << QStringLiteral("127.0") << QStringLiteral("127.0x") << 5 << false; + QTest::newRow("127.0xTest") << QList { 127, 0 } << QVersionNumber(QList { 127, 0 }) << QStringLiteral("127.0") << QStringLiteral("127.0xTest") << 5 << false; + QTest::newRow("128.09") << QList { 128, 9 } << QVersionNumber(QList { 128, 9 }) << QStringLiteral("128.9") << QStringLiteral("128.09") << 6 << false; + QTest::newRow("128.0x") << QList { 128, 0 } << QVersionNumber(QList { 128, 0 }) << QStringLiteral("128.0") << QStringLiteral("128.0x") << 5 << false; + QTest::newRow("128.0xTest") << QList { 128, 0 } << QVersionNumber(QList { 128, 0 }) << QStringLiteral("128.0") << QStringLiteral("128.0xTest") << 5 << false; } namespace UglyOperator { // ugh, but the alternative (operator <<) is even worse... -static inline QVector operator+(QVector v, int i) { v.push_back(i); return v; } +static inline QList operator+(QList v, int i) { v.push_back(i); return v; } } void tst_QVersionNumber::comparisonData() @@ -200,7 +200,7 @@ void tst_QVersionNumber::comparisonData() QTest::newRow("0.-129, 0") << QVersionNumber(0, -129) << QVersionNumber(0) << false << true << true << true << false << false << -129 << false << QVersionNumber(0); QTest::newRow("0, 0.-129") << QVersionNumber(0) << QVersionNumber(0, -129) << false << true << false << false << true << true << 129 << true << QVersionNumber(0); - const QVector common = QVector() << 0 << 1 << 2 << 3 << 4 << 5 << 6; + const QList common = QList({ 0, 1, 2, 3, 4, 5, 6 }); using namespace UglyOperator; QTest::newRow("0.1.2.3.4.5.6.0.1.2, 0.1.2.3.4.5.6.0.1") << QVersionNumber(common + 0 + 1 + 2) << QVersionNumber(common + 0 + 1) << false << true << false << false << true << true << 2 << false << QVersionNumber(common + 0 + 1); QTest::newRow("0.1.2.3.4.5.6.0.1, 0.1.2.3.4.5.6.0.1.2") << QVersionNumber(common + 0 + 1) << QVersionNumber(common + 0 + 1 + 2) << false << true << true << true << false << false << -2 << true << QVersionNumber(common + 0 + 1); @@ -217,7 +217,7 @@ void tst_QVersionNumber::comparisonData() void tst_QVersionNumber::initTestCase() { - qRegisterMetaType >(); + qRegisterMetaType>(); } void tst_QVersionNumber::constructorDefault() @@ -227,7 +227,7 @@ void tst_QVersionNumber::constructorDefault() QCOMPARE(version.majorVersion(), 0); QCOMPARE(version.minorVersion(), 0); QCOMPARE(version.microVersion(), 0); - QCOMPARE(version.segments(), QVector()); + QCOMPARE(version.segments(), QList()); } void tst_QVersionNumber::constructorVersioned_data() @@ -237,7 +237,7 @@ void tst_QVersionNumber::constructorVersioned_data() void tst_QVersionNumber::constructorVersioned() { - QFETCH(QVector, segments); + QFETCH(QList, segments); QFETCH(QVersionNumber, expectedVersion); QVersionNumber version(segments); @@ -250,17 +250,17 @@ void tst_QVersionNumber::constructorVersioned() void tst_QVersionNumber::constructorExplicit() { QVersionNumber v1(1); - QVersionNumber v2(QVector() << 1); + QVersionNumber v2(QList({ 1 })); QCOMPARE(v1.segments(), v2.segments()); QVersionNumber v3(1, 2); - QVersionNumber v4(QVector() << 1 << 2); + QVersionNumber v4(QList({ 1, 2 })); QCOMPARE(v3.segments(), v4.segments()); QVersionNumber v5(1, 2, 3); - QVersionNumber v6(QVector() << 1 << 2 << 3); + QVersionNumber v6(QList({ 1, 2, 3 })); QCOMPARE(v5.segments(), v6.segments()); @@ -277,7 +277,7 @@ void tst_QVersionNumber::constructorCopy_data() void tst_QVersionNumber::constructorCopy() { - QFETCH(QVector, segments); + QFETCH(QList, segments); QFETCH(QVersionNumber, expectedVersion); QVersionNumber original(segments); @@ -422,14 +422,14 @@ void tst_QVersionNumber::normalized_data() QTest::addColumn("version"); QTest::addColumn("expected"); - QTest::newRow("0") << QVersionNumber(0) << QVersionNumber(); - QTest::newRow("1") << QVersionNumber(1) << QVersionNumber(1); - QTest::newRow("1.2") << QVersionNumber(1, 2) << QVersionNumber(1, 2); - QTest::newRow("1.0") << QVersionNumber(1, 0) << QVersionNumber(1); - QTest::newRow("1.0.0") << QVersionNumber(1, 0, 0) << QVersionNumber(1); - QTest::newRow("1.0.1") << QVersionNumber(1, 0, 1) << QVersionNumber(1, 0, 1); - QTest::newRow("1.0.1.0") << QVersionNumber(QVector() << 1 << 0 << 1 << 0) << QVersionNumber(1, 0, 1); - QTest::newRow("0.0.1.0") << QVersionNumber(QVector() << 0 << 0 << 1 << 0) << QVersionNumber(0, 0, 1); + QTest::newRow("0") << QVersionNumber(0) << QVersionNumber(); + QTest::newRow("1") << QVersionNumber(1) << QVersionNumber(1); + QTest::newRow("1.2") << QVersionNumber(1, 2) << QVersionNumber(1, 2); + QTest::newRow("1.0") << QVersionNumber(1, 0) << QVersionNumber(1); + QTest::newRow("1.0.0") << QVersionNumber(1, 0, 0) << QVersionNumber(1); + QTest::newRow("1.0.1") << QVersionNumber(1, 0, 1) << QVersionNumber(1, 0, 1); + QTest::newRow("1.0.1.0") << QVersionNumber(QList({ 1, 0, 1, 0 })) << QVersionNumber(1, 0, 1); + QTest::newRow("0.0.1.0") << QVersionNumber(QList({ 0, 0, 1, 0 })) << QVersionNumber(0, 0, 1); } void tst_QVersionNumber::normalized() @@ -446,13 +446,13 @@ void tst_QVersionNumber::isNormalized_data() QTest::addColumn("version"); QTest::addColumn("expected"); - QTest::newRow("null") << QVersionNumber() << true; - QTest::newRow("0") << QVersionNumber(0) << false; - QTest::newRow("1") << QVersionNumber(1) << true; - QTest::newRow("1.2") << QVersionNumber(1, 2) << true; - QTest::newRow("1.0") << QVersionNumber(1, 0) << false; - QTest::newRow("1.0.0") << QVersionNumber(1, 0, 0) << false; - QTest::newRow("1.0.1") << QVersionNumber(1, 0, 1) << true; + QTest::newRow("null") << QVersionNumber() << true; + QTest::newRow("0") << QVersionNumber(0) << false; + QTest::newRow("1") << QVersionNumber(1) << true; + QTest::newRow("1.2") << QVersionNumber(1, 2) << true; + QTest::newRow("1.0") << QVersionNumber(1, 0) << false; + QTest::newRow("1.0.0") << QVersionNumber(1, 0, 0) << false; + QTest::newRow("1.0.1") << QVersionNumber(1, 0, 1) << true; } void tst_QVersionNumber::isNormalized() @@ -470,7 +470,7 @@ void tst_QVersionNumber::assignment_data() void tst_QVersionNumber::assignment() { - QFETCH(QVector, segments); + QFETCH(QList, segments); QFETCH(QVersionNumber, expectedVersion); QVersionNumber original(segments); @@ -492,17 +492,17 @@ void tst_QVersionNumber::fromString_data() const QString largerThanIntCanHoldString1 = "0." + QString::number(largerThanIntCanHold); QTest::newRow(qPrintable(largerThanIntCanHoldString0)) - << QVector() << QVersionNumber() << QString() << largerThanIntCanHoldString0 << 0 << true; + << QList() << QVersionNumber() << QString() << largerThanIntCanHoldString0 << 0 << true; QTest::newRow(qPrintable(largerThanIntCanHoldString1)) - << QVector(0) << QVersionNumber(0) << QStringLiteral("0") << largerThanIntCanHoldString1 << 1 << true; + << QList(0) << QVersionNumber(0) << QStringLiteral("0") << largerThanIntCanHoldString1 << 1 << true; const QString largerThanULongLongCanHoldString0 = QString::number(std::numeric_limits::max()) + "0.0"; // 10x ULLONG_MAX const QString largerThanULongLongCanHoldString1 = "0." + QString::number(std::numeric_limits::max()) + '0'; // 10x ULLONG_MAX QTest::newRow(qPrintable(largerThanULongLongCanHoldString0)) - << QVector() << QVersionNumber() << QString() << largerThanULongLongCanHoldString0 << 0 << true; + << QList() << QVersionNumber() << QString() << largerThanULongLongCanHoldString0 << 0 << true; QTest::newRow(qPrintable(largerThanULongLongCanHoldString1)) - << QVector(0) << QVersionNumber(0) << QStringLiteral("0") << largerThanULongLongCanHoldString1 << 1 << true; + << QList(0) << QVersionNumber(0) << QStringLiteral("0") << largerThanULongLongCanHoldString1 << 1 << true; } void tst_QVersionNumber::fromString() @@ -529,10 +529,10 @@ void tst_QVersionNumber::toString_data() { singleInstanceData(); - // segments expectedVersion expectedString constructionString suffixIndex null - QTest::newRow("-1") << (QVector() << -1) << QVersionNumber(-1) << QString("-1") << QString() << 0 << true; - QTest::newRow("-1.0") << (QVector() << -1 << 0) << QVersionNumber(-1, 0) << QString("-1.0") << QString() << 0 << true; - QTest::newRow("1.-2") << (QVector() << 1 << -2) << QVersionNumber(1, -2) << QString("1.-2") << QString() << 0 << true; + // segments expectedVersion expectedString constructionString suffixIndex null + QTest::newRow("-1") << (QList({ -1 })) << QVersionNumber(-1) << QString("-1") << QString() << 0 << true; + QTest::newRow("-1.0") << (QList({ -1, 0 })) << QVersionNumber(-1, 0) << QString("-1.0") << QString() << 0 << true; + QTest::newRow("1.-2") << (QList({ 1, -2 })) << QVersionNumber(1, -2) << QString("1.-2") << QString() << 0 << true; } void tst_QVersionNumber::toString() @@ -550,7 +550,7 @@ void tst_QVersionNumber::isNull_data() void tst_QVersionNumber::isNull() { - QFETCH(QVector, segments); + QFETCH(QList, segments); QFETCH(bool, isNull); QVersionNumber version(segments); @@ -565,7 +565,7 @@ void tst_QVersionNumber::serialize_data() void tst_QVersionNumber::serialize() { - QFETCH(QVector, segments); + QFETCH(QList, segments); QVersionNumber original(segments); QVersionNumber version; @@ -601,9 +601,9 @@ void tst_QVersionNumber::moveSemantics() v2 = std::move(v1); QCOMPARE(v2, QVersionNumber(1, 2, 3)); } - // QVersionNumber(QVector &&) + // QVersionNumber(QList &&) { - QVector segments = QVector() << 1 << 2 << 3; + QList segments = QList({ 1, 2, 3}); QVersionNumber v1(segments); QVersionNumber v2(std::move(segments)); QVERIFY(!v1.isNull()); @@ -628,7 +628,7 @@ void tst_QVersionNumber::moveSemantics() { QVersionNumber v(1, 2, 3); QVERIFY(!v.isNull()); - QVector segments; + QList segments; segments = v.segments(); QVERIFY(!v.isNull()); QVERIFY(!segments.empty()); -- cgit v1.2.3