Various tests: Use QList instead of QVector

Change-Id: I6a0486ddadb8d762c26d34cdf0e93e571b7e8feb
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2025-04-09 13:18:36 +02:00
parent a4beed0d7d
commit 2b77ec2039
7 changed files with 20 additions and 21 deletions

View File

@@ -11,8 +11,8 @@ using namespace Timeline;
class DummyPassState : public TimelineRenderPass::State
{
private:
QVector<QSGNode *> m_collapsedRows;
QVector<QSGNode *> m_expandedRows;
QList<QSGNode *> m_collapsedRows;
QList<QSGNode *> m_expandedRows;
QSGNode *m_collapsedOverlay;
QSGNode *m_expandedOverlay;
@@ -20,8 +20,8 @@ public:
DummyPassState();
~DummyPassState();
const QVector<QSGNode *> &expandedRows() const;
const QVector<QSGNode *> &collapsedRows() const;
const QList<QSGNode *> &expandedRows() const;
const QList<QSGNode *> &collapsedRows() const;
QSGNode *expandedOverlay() const;
QSGNode *collapsedOverlay() const;
};
@@ -49,12 +49,12 @@ DummyPassState::~DummyPassState()
qDeleteAll(m_expandedRows);
}
const QVector<QSGNode *> &DummyPassState::expandedRows() const
const QList<QSGNode *> &DummyPassState::expandedRows() const
{
return m_expandedRows;
}
const QVector<QSGNode *> &DummyPassState::collapsedRows() const
const QList<QSGNode *> &DummyPassState::collapsedRows() const
{
return m_collapsedRows;
}

View File

@@ -102,7 +102,7 @@ void tst_FuzzyMatcher::fuzzyMatcherMultiWord_data()
QTest::newRow("inword_second_match") << "foar" << "foo bar" << -1;
}
typedef QVector<QPair<int, int>> Matches;
typedef QList<QPair<int, int>> Matches;
void tst_FuzzyMatcher::highlighting()
{

View File

@@ -282,11 +282,11 @@ void CallgrindParserTests::testMultiCost()
QCOMPARE(data->totalCost(1), quint64(400));
const Function *main = data->functions().at(0);
QCOMPARE(main->costItems().first()->costs(), QVector<quint64>() << 1 << 100);
QCOMPARE(main->costItems().first()->positions(), QVector<quint64>() << 1);
QCOMPARE(main->costItems().first()->costs(), QList<quint64>() << 1 << 100);
QCOMPARE(main->costItems().first()->positions(), QList<quint64>() << 1);
QVERIFY(main->costItems().last()->call());
QCOMPARE(main->costItems().last()->call()->destinations(), QVector<quint64>() << 1);
QCOMPARE(main->costItems().last()->call()->destinations(), QList<quint64>() << 1);
}
void CallgrindParserTests::testMultiPos()
@@ -300,11 +300,11 @@ void CallgrindParserTests::testMultiPos()
QCOMPARE(data->totalCost(0), quint64(4));
const Function *main = data->functions().at(0);
QCOMPARE(main->costItems().first()->costs(), QVector<quint64>() << 1);
QCOMPARE(main->costItems().first()->positions(), QVector<quint64>() << 1 << 0x01);
QCOMPARE(main->costItems().first()->costs(), QList<quint64>() << 1);
QCOMPARE(main->costItems().first()->positions(), QList<quint64>() << 1 << 0x01);
QVERIFY(main->costItems().last()->call());
QCOMPARE(main->costItems().last()->call()->destinations(), QVector<quint64>() << 1 << 0x04);
QCOMPARE(main->costItems().last()->call()->destinations(), QList<quint64>() << 1 << 0x04);
}
void CallgrindParserTests::testMultiPosAndCost()
@@ -319,14 +319,14 @@ void CallgrindParserTests::testMultiPosAndCost()
QCOMPARE(data->totalCost(1), quint64(400));
const Function *main = data->functions().at(0);
QCOMPARE(main->costItems().first()->costs(), QVector<quint64>() << 1 << 100);
QCOMPARE(main->costItems().first()->positions(), QVector<quint64>() << 1 << 0x01);
QCOMPARE(main->costItems().first()->costs(), QList<quint64>() << 1 << 100);
QCOMPARE(main->costItems().first()->positions(), QList<quint64>() << 1 << 0x01);
QVERIFY(main->costItems().last()->call());
QCOMPARE(main->costItems().last()->call()->destinations(), QVector<quint64>() << 1 << 0x04);
QCOMPARE(main->costItems().last()->call()->destinations(), QList<quint64>() << 1 << 0x04);
}
const Function *findFunction(const QString &needle, const QVector<const Function *> &haystack)
const Function *findFunction(const QString &needle, const QList<const Function *> &haystack)
{
for (const Function *function : haystack) {
if (function->name() == needle) {

View File

@@ -6,7 +6,6 @@
#include <QObject>
#include <QPair>
#include <QStringList>
#include <QVector>
#include <QDebug>
class CallgrindParserTests : public QObject

View File

@@ -262,7 +262,7 @@ void MainWindow::on_actionExtTypes_triggered()
{
QVariant v1(QLatin1String("hallo"));
QVariant v2(QStringList(QLatin1String("hallo")));
QVector<QString> vec;
QList<QString> vec;
vec.push_back("Hallo");
vec.push_back("Hallo2");
std::set<std::string> stdSet;

View File

@@ -40,7 +40,7 @@ struct Suite
QByteArray title;
int flags;
QByteArray cmd;
QVector<Case> cases;
QList<Case> cases;
};
Q_DECLARE_METATYPE(Case)

View File

@@ -29,7 +29,7 @@
#include <designsystem/dsconstants.h>
namespace std {
template <typename T> ostream &operator<<(ostream &out, const QVector<T> &vector)
template <typename T> ostream &operator<<(ostream &out, const QList<T> &vector)
{
out << "[";
copy(vector.cbegin(), vector.cend(), ostream_iterator<T>(out, ", "));