From e721ec269e972ea2754cb9bd27fb73b72ed53c7b Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Mon, 22 Jun 2020 15:34:48 +0200 Subject: Use QList instead of QVector in other tests Task-number: QTBUG-84469 Change-Id: I656c9f73bd2364be39ee67747524e7c4a25c0935 Reviewed-by: Lars Knoll --- tests/auto/other/compiler/tst_compiler.cpp | 27 +++++----------------- tests/auto/other/lancelot/paintcommands.cpp | 2 +- tests/auto/other/lancelot/paintcommands.h | 8 +++++-- .../other/qaccessibility/tst_qaccessibility.cpp | 11 +++++---- tests/auto/other/qcomplextext/tst_qcomplextext.cpp | 11 +++++---- 5 files changed, 25 insertions(+), 34 deletions(-) (limited to 'tests') diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp index 4d19debd06..435bd42faf 100644 --- a/tests/auto/other/compiler/tst_compiler.cpp +++ b/tests/auto/other/compiler/tst_compiler.cpp @@ -58,7 +58,6 @@ private slots: void detectEnums(); void overrideCFunction(); void stdSortQList(); - void stdSortQVector(); void templateCallOrder(); void virtualFunctionNoLongerPureVirtual(); void charSignedness() const; @@ -422,21 +421,6 @@ void tst_Compiler::stdSortQList() QCOMPARE(slist.value(0), QString("a")); QCOMPARE(slist.value(1), QString("b")); } - -void tst_Compiler::stdSortQVector() -{ - QVector vector; - vector << 4 << 2; - std::sort(vector.begin(), vector.end()); - QCOMPARE(vector.value(0), 2); - QCOMPARE(vector.value(1), 4); - - QVector strvec; - strvec << "b" << "a"; - std::sort(strvec.begin(), strvec.end()); - QCOMPARE(strvec.value(0), QString("a")); - QCOMPARE(strvec.value(1), QString("b")); -} #else void tst_Compiler::stdSortQList() { QSKIP("Compiler's STL broken"); } @@ -1063,15 +1047,16 @@ void tst_Compiler::cxx11_nullptr() namespace SomeNamespace { class AdlOnly { - QVector v; + QList v; + public: AdlOnly() : v(5) { std::fill_n(v.begin(), v.size(), 42); } private: - friend QVector::const_iterator begin(const AdlOnly &x) { return x.v.begin(); } - friend QVector::const_iterator end(const AdlOnly &x) { return x.v.end(); } - friend QVector::iterator begin(AdlOnly &x) { return x.v.begin(); } - friend QVector::iterator end(AdlOnly &x) { return x.v.end(); } + friend QList::const_iterator begin(const AdlOnly &x) { return x.v.begin(); } + friend QList::const_iterator end(const AdlOnly &x) { return x.v.end(); } + friend QList::iterator begin(AdlOnly &x) { return x.v.begin(); } + friend QList::iterator end(AdlOnly &x) { return x.v.end(); } }; } diff --git a/tests/auto/other/lancelot/paintcommands.cpp b/tests/auto/other/lancelot/paintcommands.cpp index 2f6bd2872f..f2839d57e1 100644 --- a/tests/auto/other/lancelot/paintcommands.cpp +++ b/tests/auto/other/lancelot/paintcommands.cpp @@ -2733,7 +2733,7 @@ void PaintCommands::command_pen_setDashPattern(QRegularExpressionMatch re) QString cap = caps.at(1); QStringList numbers = cap.split(separators, Qt::SkipEmptyParts); - QVector pattern; + QList pattern; for (int i=0; i &points) { staticInit(); m_controlPoints = points; } + void setControlPoints(const QList &points) + { + staticInit(); + m_controlPoints = points; + } void setVerboseMode(bool v) { staticInit(); m_verboseMode = v; } void insertAt(int commandIndex, const QStringList &newCommands); void setShouldDrawText(bool drawText) { m_shouldDrawText = drawText; } @@ -279,7 +283,7 @@ private: bool m_checkers_background; bool m_shouldDrawText; - QVector m_controlPoints; + QList m_controlPoints; #ifndef QT_NO_OPENGL QOpenGLContext *m_default_glcontext; diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 07cccde0c8..b3ac7489b7 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -2499,7 +2499,8 @@ void tst_QAccessibility::groupBoxTest() QCOMPARE(iface->role(), QAccessible::Grouping); QCOMPARE(iface->text(QAccessible::Name), QLatin1String("Test QGroupBox")); QCOMPARE(iface->text(QAccessible::Description), QLatin1String("This group box will be used to test accessibility")); - QVector > relations = rButtonIface->relations(); + QList> relations = + rButtonIface->relations(); QCOMPARE(relations.size(), 1); QPair relation = relations.first(); QCOMPARE(relation.first->object(), groupBox); @@ -2572,7 +2573,7 @@ void tst_QAccessibility::dialogButtonBoxTest() child = iface->child(0); QCOMPARE(child->role(), QAccessible::PushButton); - QVector buttons; + QList buttons; for (int i = 0; i < iface->childCount(); ++i) buttons << iface->child(i); @@ -2624,7 +2625,7 @@ void tst_QAccessibility::dialogButtonBoxTest() QApplication::processEvents(); QStringList actualOrder; - QVector buttons; + QList buttons; for (int i = 0; i < iface->childCount(); ++i) buttons << iface->child(i); @@ -3672,7 +3673,7 @@ void tst_QAccessibility::labelTest() QCOMPARE(acc_label->state().focusable, false); QCOMPARE(acc_label->state().readOnly, true); - QVector > rels = acc_label->relations(); + QList> rels = acc_label->relations(); QCOMPARE(rels.count(), 1); QAccessibleInterface *iface = rels.first().first; QAccessible::Relation rel = rels.first().second; @@ -4014,7 +4015,7 @@ public: } private: - QVector m_children; + QList m_children; }; void tst_QAccessibility::focusChild() diff --git a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp index 9ca61a69b4..1ba211aa0a 100644 --- a/tests/auto/other/qcomplextext/tst_qcomplextext.cpp +++ b/tests/auto/other/qcomplextext/tst_qcomplextext.cpp @@ -288,7 +288,8 @@ void tst_QComplexText::bidiCursor_PDF() QVERIFY(line.cursorToX(size) == line.cursorToX(size - 1)); } -static void testBidiString(const QString &data, int paragraphDirection, const QVector &resolvedLevels, const QVector &visualOrder) +static void testBidiString(const QString &data, int paragraphDirection, + const QList &resolvedLevels, const QList &visualOrder) { Q_UNUSED(resolvedLevels); @@ -398,7 +399,7 @@ void tst_QComplexText::bidiCharacterTest() int paragraphDirection = parts.at(1).toInt(); // int resolvedParagraphLevel = parts.at(2).toInt(); - QVector resolvedLevels; + QList resolvedLevels; QList levelParts = parts.at(3).split(' '); for (const auto &p : levelParts) { if (p == "x") { @@ -410,7 +411,7 @@ void tst_QComplexText::bidiCharacterTest() } } - QVector visualOrder; + QList visualOrder; QList orderParts = parts.at(4).split(' '); for (const auto &p : orderParts) { bool ok; @@ -470,8 +471,8 @@ void tst_QComplexText::bidiTest() f.open(QIODevice::ReadOnly); int linenum = 0; - QVector resolvedLevels; - QVector visualOrder; + QList resolvedLevels; + QList visualOrder; while (!f.atEnd()) { linenum++; -- cgit v1.2.3