forked from qt-creator/qt-creator
Various tests: Use QList instead of QVector
Change-Id: I6a0486ddadb8d762c26d34cdf0e93e571b7e8feb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -11,8 +11,8 @@ using namespace Timeline;
|
|||||||
class DummyPassState : public TimelineRenderPass::State
|
class DummyPassState : public TimelineRenderPass::State
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
QVector<QSGNode *> m_collapsedRows;
|
QList<QSGNode *> m_collapsedRows;
|
||||||
QVector<QSGNode *> m_expandedRows;
|
QList<QSGNode *> m_expandedRows;
|
||||||
QSGNode *m_collapsedOverlay;
|
QSGNode *m_collapsedOverlay;
|
||||||
QSGNode *m_expandedOverlay;
|
QSGNode *m_expandedOverlay;
|
||||||
|
|
||||||
@@ -20,8 +20,8 @@ public:
|
|||||||
DummyPassState();
|
DummyPassState();
|
||||||
~DummyPassState();
|
~DummyPassState();
|
||||||
|
|
||||||
const QVector<QSGNode *> &expandedRows() const;
|
const QList<QSGNode *> &expandedRows() const;
|
||||||
const QVector<QSGNode *> &collapsedRows() const;
|
const QList<QSGNode *> &collapsedRows() const;
|
||||||
QSGNode *expandedOverlay() const;
|
QSGNode *expandedOverlay() const;
|
||||||
QSGNode *collapsedOverlay() const;
|
QSGNode *collapsedOverlay() const;
|
||||||
};
|
};
|
||||||
@@ -49,12 +49,12 @@ DummyPassState::~DummyPassState()
|
|||||||
qDeleteAll(m_expandedRows);
|
qDeleteAll(m_expandedRows);
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<QSGNode *> &DummyPassState::expandedRows() const
|
const QList<QSGNode *> &DummyPassState::expandedRows() const
|
||||||
{
|
{
|
||||||
return m_expandedRows;
|
return m_expandedRows;
|
||||||
}
|
}
|
||||||
|
|
||||||
const QVector<QSGNode *> &DummyPassState::collapsedRows() const
|
const QList<QSGNode *> &DummyPassState::collapsedRows() const
|
||||||
{
|
{
|
||||||
return m_collapsedRows;
|
return m_collapsedRows;
|
||||||
}
|
}
|
||||||
|
@@ -102,7 +102,7 @@ void tst_FuzzyMatcher::fuzzyMatcherMultiWord_data()
|
|||||||
QTest::newRow("inword_second_match") << "foar" << "foo bar" << -1;
|
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()
|
void tst_FuzzyMatcher::highlighting()
|
||||||
{
|
{
|
||||||
|
@@ -282,11 +282,11 @@ void CallgrindParserTests::testMultiCost()
|
|||||||
QCOMPARE(data->totalCost(1), quint64(400));
|
QCOMPARE(data->totalCost(1), quint64(400));
|
||||||
|
|
||||||
const Function *main = data->functions().at(0);
|
const Function *main = data->functions().at(0);
|
||||||
QCOMPARE(main->costItems().first()->costs(), QVector<quint64>() << 1 << 100);
|
QCOMPARE(main->costItems().first()->costs(), QList<quint64>() << 1 << 100);
|
||||||
QCOMPARE(main->costItems().first()->positions(), QVector<quint64>() << 1);
|
QCOMPARE(main->costItems().first()->positions(), QList<quint64>() << 1);
|
||||||
|
|
||||||
QVERIFY(main->costItems().last()->call());
|
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()
|
void CallgrindParserTests::testMultiPos()
|
||||||
@@ -300,11 +300,11 @@ void CallgrindParserTests::testMultiPos()
|
|||||||
QCOMPARE(data->totalCost(0), quint64(4));
|
QCOMPARE(data->totalCost(0), quint64(4));
|
||||||
|
|
||||||
const Function *main = data->functions().at(0);
|
const Function *main = data->functions().at(0);
|
||||||
QCOMPARE(main->costItems().first()->costs(), QVector<quint64>() << 1);
|
QCOMPARE(main->costItems().first()->costs(), QList<quint64>() << 1);
|
||||||
QCOMPARE(main->costItems().first()->positions(), QVector<quint64>() << 1 << 0x01);
|
QCOMPARE(main->costItems().first()->positions(), QList<quint64>() << 1 << 0x01);
|
||||||
|
|
||||||
QVERIFY(main->costItems().last()->call());
|
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()
|
void CallgrindParserTests::testMultiPosAndCost()
|
||||||
@@ -319,14 +319,14 @@ void CallgrindParserTests::testMultiPosAndCost()
|
|||||||
QCOMPARE(data->totalCost(1), quint64(400));
|
QCOMPARE(data->totalCost(1), quint64(400));
|
||||||
|
|
||||||
const Function *main = data->functions().at(0);
|
const Function *main = data->functions().at(0);
|
||||||
QCOMPARE(main->costItems().first()->costs(), QVector<quint64>() << 1 << 100);
|
QCOMPARE(main->costItems().first()->costs(), QList<quint64>() << 1 << 100);
|
||||||
QCOMPARE(main->costItems().first()->positions(), QVector<quint64>() << 1 << 0x01);
|
QCOMPARE(main->costItems().first()->positions(), QList<quint64>() << 1 << 0x01);
|
||||||
|
|
||||||
QVERIFY(main->costItems().last()->call());
|
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) {
|
for (const Function *function : haystack) {
|
||||||
if (function->name() == needle) {
|
if (function->name() == needle) {
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QPair>
|
#include <QPair>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QVector>
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
class CallgrindParserTests : public QObject
|
class CallgrindParserTests : public QObject
|
||||||
|
@@ -262,7 +262,7 @@ void MainWindow::on_actionExtTypes_triggered()
|
|||||||
{
|
{
|
||||||
QVariant v1(QLatin1String("hallo"));
|
QVariant v1(QLatin1String("hallo"));
|
||||||
QVariant v2(QStringList(QLatin1String("hallo")));
|
QVariant v2(QStringList(QLatin1String("hallo")));
|
||||||
QVector<QString> vec;
|
QList<QString> vec;
|
||||||
vec.push_back("Hallo");
|
vec.push_back("Hallo");
|
||||||
vec.push_back("Hallo2");
|
vec.push_back("Hallo2");
|
||||||
std::set<std::string> stdSet;
|
std::set<std::string> stdSet;
|
||||||
|
@@ -40,7 +40,7 @@ struct Suite
|
|||||||
QByteArray title;
|
QByteArray title;
|
||||||
int flags;
|
int flags;
|
||||||
QByteArray cmd;
|
QByteArray cmd;
|
||||||
QVector<Case> cases;
|
QList<Case> cases;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Case)
|
Q_DECLARE_METATYPE(Case)
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
#include <designsystem/dsconstants.h>
|
#include <designsystem/dsconstants.h>
|
||||||
|
|
||||||
namespace std {
|
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 << "[";
|
out << "[";
|
||||||
copy(vector.cbegin(), vector.cend(), ostream_iterator<T>(out, ", "));
|
copy(vector.cbegin(), vector.cend(), ostream_iterator<T>(out, ", "));
|
||||||
|
Reference in New Issue
Block a user