Use QList instead of QVector in other tests

Task-number: QTBUG-84469
Change-Id: I656c9f73bd2364be39ee67747524e7c4a25c0935
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
Jarek Kobus 2020-06-22 15:34:48 +02:00
parent b62f32a4dd
commit e721ec269e
5 changed files with 25 additions and 34 deletions

View File

@ -58,7 +58,6 @@ private slots:
void detectEnums(); void detectEnums();
void overrideCFunction(); void overrideCFunction();
void stdSortQList(); void stdSortQList();
void stdSortQVector();
void templateCallOrder(); void templateCallOrder();
void virtualFunctionNoLongerPureVirtual(); void virtualFunctionNoLongerPureVirtual();
void charSignedness() const; void charSignedness() const;
@ -422,21 +421,6 @@ void tst_Compiler::stdSortQList()
QCOMPARE(slist.value(0), QString("a")); QCOMPARE(slist.value(0), QString("a"));
QCOMPARE(slist.value(1), QString("b")); QCOMPARE(slist.value(1), QString("b"));
} }
void tst_Compiler::stdSortQVector()
{
QVector<int> vector;
vector << 4 << 2;
std::sort(vector.begin(), vector.end());
QCOMPARE(vector.value(0), 2);
QCOMPARE(vector.value(1), 4);
QVector<QString> strvec;
strvec << "b" << "a";
std::sort(strvec.begin(), strvec.end());
QCOMPARE(strvec.value(0), QString("a"));
QCOMPARE(strvec.value(1), QString("b"));
}
#else #else
void tst_Compiler::stdSortQList() void tst_Compiler::stdSortQList()
{ QSKIP("Compiler's STL broken"); } { QSKIP("Compiler's STL broken"); }
@ -1063,15 +1047,16 @@ void tst_Compiler::cxx11_nullptr()
namespace SomeNamespace { namespace SomeNamespace {
class AdlOnly { class AdlOnly {
QVector<int> v; QList<int> v;
public: public:
AdlOnly() : v(5) { std::fill_n(v.begin(), v.size(), 42); } AdlOnly() : v(5) { std::fill_n(v.begin(), v.size(), 42); }
private: private:
friend QVector<int>::const_iterator begin(const AdlOnly &x) { return x.v.begin(); } friend QList<int>::const_iterator begin(const AdlOnly &x) { return x.v.begin(); }
friend QVector<int>::const_iterator end(const AdlOnly &x) { return x.v.end(); } friend QList<int>::const_iterator end(const AdlOnly &x) { return x.v.end(); }
friend QVector<int>::iterator begin(AdlOnly &x) { return x.v.begin(); } friend QList<int>::iterator begin(AdlOnly &x) { return x.v.begin(); }
friend QVector<int>::iterator end(AdlOnly &x) { return x.v.end(); } friend QList<int>::iterator end(AdlOnly &x) { return x.v.end(); }
}; };
} }

View File

@ -2733,7 +2733,7 @@ void PaintCommands::command_pen_setDashPattern(QRegularExpressionMatch re)
QString cap = caps.at(1); QString cap = caps.at(1);
QStringList numbers = cap.split(separators, Qt::SkipEmptyParts); QStringList numbers = cap.split(separators, Qt::SkipEmptyParts);
QVector<qreal> pattern; QList<qreal> pattern;
for (int i=0; i<numbers.size(); ++i) for (int i=0; i<numbers.size(); ++i)
pattern.append(convertToDouble(numbers.at(i))); pattern.append(convertToDouble(numbers.at(i)));

View File

@ -109,7 +109,11 @@ public:
void setPainter(QPainter *pt) { staticInit(); m_painter = pt; } void setPainter(QPainter *pt) { staticInit(); m_painter = pt; }
void setType(DeviceType t) { staticInit(); m_type = t; } void setType(DeviceType t) { staticInit(); m_type = t; }
void setFilePath(const QString &path) { staticInit(); m_filepath = path; } void setFilePath(const QString &path) { staticInit(); m_filepath = path; }
void setControlPoints(const QVector<QPointF> &points) { staticInit(); m_controlPoints = points; } void setControlPoints(const QList<QPointF> &points)
{
staticInit();
m_controlPoints = points;
}
void setVerboseMode(bool v) { staticInit(); m_verboseMode = v; } void setVerboseMode(bool v) { staticInit(); m_verboseMode = v; }
void insertAt(int commandIndex, const QStringList &newCommands); void insertAt(int commandIndex, const QStringList &newCommands);
void setShouldDrawText(bool drawText) { m_shouldDrawText = drawText; } void setShouldDrawText(bool drawText) { m_shouldDrawText = drawText; }
@ -279,7 +283,7 @@ private:
bool m_checkers_background; bool m_checkers_background;
bool m_shouldDrawText; bool m_shouldDrawText;
QVector<QPointF> m_controlPoints; QList<QPointF> m_controlPoints;
#ifndef QT_NO_OPENGL #ifndef QT_NO_OPENGL
QOpenGLContext *m_default_glcontext; QOpenGLContext *m_default_glcontext;

View File

@ -2499,7 +2499,8 @@ void tst_QAccessibility::groupBoxTest()
QCOMPARE(iface->role(), QAccessible::Grouping); QCOMPARE(iface->role(), QAccessible::Grouping);
QCOMPARE(iface->text(QAccessible::Name), QLatin1String("Test QGroupBox")); QCOMPARE(iface->text(QAccessible::Name), QLatin1String("Test QGroupBox"));
QCOMPARE(iface->text(QAccessible::Description), QLatin1String("This group box will be used to test accessibility")); QCOMPARE(iface->text(QAccessible::Description), QLatin1String("This group box will be used to test accessibility"));
QVector<QPair<QAccessibleInterface*, QAccessible::Relation> > relations = rButtonIface->relations(); QList<QPair<QAccessibleInterface *, QAccessible::Relation>> relations =
rButtonIface->relations();
QCOMPARE(relations.size(), 1); QCOMPARE(relations.size(), 1);
QPair<QAccessibleInterface*, QAccessible::Relation> relation = relations.first(); QPair<QAccessibleInterface*, QAccessible::Relation> relation = relations.first();
QCOMPARE(relation.first->object(), groupBox); QCOMPARE(relation.first->object(), groupBox);
@ -2572,7 +2573,7 @@ void tst_QAccessibility::dialogButtonBoxTest()
child = iface->child(0); child = iface->child(0);
QCOMPARE(child->role(), QAccessible::PushButton); QCOMPARE(child->role(), QAccessible::PushButton);
QVector<QAccessibleInterface *> buttons; QList<QAccessibleInterface *> buttons;
for (int i = 0; i < iface->childCount(); ++i) for (int i = 0; i < iface->childCount(); ++i)
buttons << iface->child(i); buttons << iface->child(i);
@ -2624,7 +2625,7 @@ void tst_QAccessibility::dialogButtonBoxTest()
QApplication::processEvents(); QApplication::processEvents();
QStringList actualOrder; QStringList actualOrder;
QVector<QAccessibleInterface *> buttons; QList<QAccessibleInterface *> buttons;
for (int i = 0; i < iface->childCount(); ++i) for (int i = 0; i < iface->childCount(); ++i)
buttons << iface->child(i); buttons << iface->child(i);
@ -3672,7 +3673,7 @@ void tst_QAccessibility::labelTest()
QCOMPARE(acc_label->state().focusable, false); QCOMPARE(acc_label->state().focusable, false);
QCOMPARE(acc_label->state().readOnly, true); QCOMPARE(acc_label->state().readOnly, true);
QVector<QPair<QAccessibleInterface *, QAccessible::Relation> > rels = acc_label->relations(); QList<QPair<QAccessibleInterface *, QAccessible::Relation>> rels = acc_label->relations();
QCOMPARE(rels.count(), 1); QCOMPARE(rels.count(), 1);
QAccessibleInterface *iface = rels.first().first; QAccessibleInterface *iface = rels.first().first;
QAccessible::Relation rel = rels.first().second; QAccessible::Relation rel = rels.first().second;
@ -4014,7 +4015,7 @@ public:
} }
private: private:
QVector<QAccessibleInterface *> m_children; QList<QAccessibleInterface *> m_children;
}; };
void tst_QAccessibility::focusChild() void tst_QAccessibility::focusChild()

View File

@ -288,7 +288,8 @@ void tst_QComplexText::bidiCursor_PDF()
QVERIFY(line.cursorToX(size) == line.cursorToX(size - 1)); QVERIFY(line.cursorToX(size) == line.cursorToX(size - 1));
} }
static void testBidiString(const QString &data, int paragraphDirection, const QVector<int> &resolvedLevels, const QVector<int> &visualOrder) static void testBidiString(const QString &data, int paragraphDirection,
const QList<int> &resolvedLevels, const QList<int> &visualOrder)
{ {
Q_UNUSED(resolvedLevels); Q_UNUSED(resolvedLevels);
@ -398,7 +399,7 @@ void tst_QComplexText::bidiCharacterTest()
int paragraphDirection = parts.at(1).toInt(); int paragraphDirection = parts.at(1).toInt();
// int resolvedParagraphLevel = parts.at(2).toInt(); // int resolvedParagraphLevel = parts.at(2).toInt();
QVector<int> resolvedLevels; QList<int> resolvedLevels;
QList<QByteArray> levelParts = parts.at(3).split(' '); QList<QByteArray> levelParts = parts.at(3).split(' ');
for (const auto &p : levelParts) { for (const auto &p : levelParts) {
if (p == "x") { if (p == "x") {
@ -410,7 +411,7 @@ void tst_QComplexText::bidiCharacterTest()
} }
} }
QVector<int> visualOrder; QList<int> visualOrder;
QList<QByteArray> orderParts = parts.at(4).split(' '); QList<QByteArray> orderParts = parts.at(4).split(' ');
for (const auto &p : orderParts) { for (const auto &p : orderParts) {
bool ok; bool ok;
@ -470,8 +471,8 @@ void tst_QComplexText::bidiTest()
f.open(QIODevice::ReadOnly); f.open(QIODevice::ReadOnly);
int linenum = 0; int linenum = 0;
QVector<int> resolvedLevels; QList<int> resolvedLevels;
QVector<int> visualOrder; QList<int> visualOrder;
while (!f.atEnd()) { while (!f.atEnd()) {
linenum++; linenum++;