diff options
author | Marc Mutz <marc.mutz@qt.io> | 2022-10-08 19:56:03 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@qt.io> | 2022-10-13 00:18:35 +0200 |
commit | 5eb52b725526c26d0efa3856b6aba1919010f8fd (patch) | |
tree | 64d1bde7a2cc624e586228c9768c7eb1ea360e6c /tests/auto/qml | |
parent | e1a0596924766d62459740ed0271114a7bb99851 (diff) |
Port from container::count() and length() to size() - V5
This is a semantic patch using ClangTidyTransformator as in
qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8, but extended to
handle typedefs and accesses through pointers, too:
const std::string o = "object";
auto hasTypeIgnoringPointer = [](auto type) { return anyOf(hasType(type), hasType(pointsTo(type))); };
auto derivedFromAnyOfClasses = [&](ArrayRef<StringRef> classes) {
auto exprOfDeclaredType = [&](auto decl) {
return expr(hasTypeIgnoringPointer(hasUnqualifiedDesugaredType(recordType(hasDeclaration(decl))))).bind(o);
};
return exprOfDeclaredType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))));
};
auto renameMethod = [&] (ArrayRef<StringRef> classes,
StringRef from, StringRef to) {
return makeRule(cxxMemberCallExpr(on(derivedFromAnyOfClasses(classes)),
callee(cxxMethodDecl(hasName(from), parameterCountIs(0)))),
changeTo(cat(access(o, cat(to)), "()")),
cat("use '", to, "' instead of '", from, "'"));
};
renameMethod(<classes>, "count", "size");
renameMethod(<classes>, "length", "size");
except that on() was replaced with a matcher that doesn't ignoreParens().
a.k.a qt-port-to-std-compatible-api V5 with config Scope: 'Container'.
Change-Id: I58e1b41b91c34d2e860dbb5847b3752edbfc6fc9
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml')
15 files changed, 121 insertions, 121 deletions
diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp index 2c9e74d24d..cc67df420c 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp @@ -562,8 +562,8 @@ typedef QList<QAbstractAnimationJob::State> StateList; static bool compareStates(const StateChangeListener& spy, const StateList &expectedStates) { bool equals = true; - for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) { - if (i >= spy.count() || i >= expectedStates.count()) { + for (int i = 0; i < qMax(expectedStates.size(), spy.count()); ++i) { + if (i >= spy.count() || i >= expectedStates.size()) { equals = false; break; } @@ -577,8 +577,8 @@ static bool compareStates(const StateChangeListener& spy, const StateList &expec if (!equals) { const char *stateStrings[] = {"Stopped", "Paused", "Running"}; QString e,a; - for (int i = 0; i < qMax(expectedStates.count(), spy.count()); ++i) { - if (i < expectedStates.count()) { + for (int i = 0; i < qMax(expectedStates.size(), spy.count()); ++i) { + if (i < expectedStates.size()) { int exp = int(expectedStates.at(i)); if (!e.isEmpty()) e += QLatin1String(", "); @@ -596,7 +596,7 @@ static bool compareStates(const StateChangeListener& spy, const StateList &expec } } - qDebug().noquote() << "\nexpected (count == " << expectedStates.count() << "): " << e + qDebug().noquote() << "\nexpected (count == " << expectedStates.size() << "): " << e << "\nactual (count == " << spy.count() << "): " << a << "\n"; } return equals; diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp index 578710a26e..ffde808bb4 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp @@ -210,7 +210,7 @@ void tst_QQmlEngineDebugService::recursiveObjectTest( qmlContext(o))); const QObjectList &children = o->children(); - for (int i=0; i<children.count(); i++) { + for (int i=0; i<children.size(); i++) { QObject *child = children[i]; if (!qmlContext(child)) continue; diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index dfe92bb80b..53971d3e8b 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -357,9 +357,9 @@ bool tst_QQmlProfilerService::verify(tst_QQmlProfilerService::MessageListType ty return false; } - if (target->length() <= expectedPosition) { + if (target->size() <= expectedPosition) { qWarning() << "Not enough events. expected position:" << expectedPosition - << "length:" << target->length(); + << "length:" << target->size(); return false; } @@ -438,7 +438,7 @@ bool tst_QQmlProfilerService::verify(tst_QQmlProfilerService::MessageListType ty } return true; - } while (++position < target->length() && target->at(position).timestamp() == timestamp); + } while (++position < target->size() && target->at(position).timestamp() == timestamp); foreach (const QString &message, warnings) qWarning() << message.toLocal8Bit().constData(); diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 23939e73fb..1b61451322 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -193,7 +193,7 @@ void tst_QmlCppCodegen::anchorsFill() QVERIFY2(!object.isNull(), component.errorString().toUtf8().constData()); QCOMPARE(object->property("width").toInt(), 234); - QCOMPARE(object->children().length(), 2); + QCOMPARE(object->children().size(), 2); QObject *child = object->children().front(); QVERIFY(child); @@ -625,7 +625,7 @@ void tst_QmlCppCodegen::conversions() QCOMPARE(object->property("doneStuff").toInt(), 19); QVariantList modulos = object->property("modulos").toList(); - QCOMPARE(modulos.length(), 7); + QCOMPARE(modulos.size(), 7); QCOMPARE(modulos[0].userType(), QMetaType::Double); QCOMPARE(modulos[0].toDouble(), 0.0); @@ -649,7 +649,7 @@ void tst_QmlCppCodegen::conversions() QVERIFY(qIsNaN(modulos[6].toDouble())); QVariantList unaryOps = object->property("unaryOps").toList(); - QCOMPARE(unaryOps.length(), 6); + QCOMPARE(unaryOps.size(), 6); QCOMPARE(unaryOps[0].userType(), QMetaType::Double); QCOMPARE(unaryOps[0].toDouble(), 1221); @@ -1790,7 +1790,7 @@ void tst_QmlCppCodegen::variantlist() QVERIFY(o); const QVariantList things = qvariant_cast<QVariantList>(o->property("things")); - QCOMPARE(things.length(), 2); + QCOMPARE(things.size(), 2); QCOMPARE(things[0].toString(), u"thing"_s); QCOMPARE(things[1].toInt(), 30); } diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 2a853ae081..2922b02643 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2854,26 +2854,26 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_ERROR("object.method_nonexistent()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_nonexistent(10, 11)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); // Insufficient arguments o->reset(); QVERIFY(EVALUATE_ERROR("object.method_int()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_intint(10)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); // Excessive arguments QTest::ignoreMessage(QtWarningMsg, qPrintable("Too many arguments, ignoring 1")); @@ -2882,7 +2882,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_int(10, 11)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(10)); QTest::ignoreMessage(QtWarningMsg, qPrintable("Too many arguments, ignoring 1")); @@ -2891,7 +2891,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intint(10, 11, 12)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 9); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(11)); @@ -2900,19 +2900,19 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_NoArgs()", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 0); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_NoArgs_int()", QV4::Primitive::fromInt32(6))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_NoArgs_real()", QV4::Primitive::fromDouble(19.75))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 2); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); { @@ -2921,7 +2921,7 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(QV4::ExecutionEngine::toVariant(ret, QMetaType {}), QVariant(QPointF(123, 4.5))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 3); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); } o->reset(); @@ -2931,14 +2931,14 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(qobjectWrapper->object(), (QObject *)o); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 4); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); } o->reset(); QVERIFY(EVALUATE_ERROR("object.method_NoArgs_unknown()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); { @@ -2947,63 +2947,63 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(ret->toQStringNoThrow(), QString("Hello world")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 6); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); } o->reset(); QVERIFY(EVALUATE_VALUE("object.method_NoArgs_QVariant()", QV4::ScopedValue(scope, scope.engine->newString("QML rocks")))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 7); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); // Test arg types o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(94)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(\"94\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(\"not a number\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_int(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 8); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_intint(122, 9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 9); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(122)); QCOMPARE(o->actuals().at(1), QVariant(9)); @@ -3011,56 +3011,56 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_real(94.3)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94.3)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(\"94.3\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(94.3)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(\"not a number\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(0)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_real(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 10); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qIsNaN(o->actuals().at(0).toDouble())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QString(\"Hello world\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant("Hello world")); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QString(19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant("19")); o->reset(); @@ -3069,7 +3069,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QString(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(expected)); } @@ -3077,71 +3077,71 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QString(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString())); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QString(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 11); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString())); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(0)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(null)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(undefined)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QPointF(object)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPointF())", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF(99.3, -10.2))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QPointF(object.method_get_QPoint())", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 12); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QPointF(9, 12))); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QObject(0)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_QObject(\"Hello world\")")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant::fromValue((QObject *)nullptr)); { @@ -3151,7 +3151,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(root); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0).value<QObject *>()->metaObject()->className(), "QQmlComponentAttached"); } @@ -3168,49 +3168,49 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QObject(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant::fromValue((QObject *)nullptr)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QObject(object)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 13); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant::fromValue((QObject *)o)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isNull()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isUndefined()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue(19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).strictlyEquals(QJSValue(19))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QScriptValue([19, 20])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 14); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(0)).isArray()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(4, null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(4)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isNull()); @@ -3218,7 +3218,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(8, undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(8)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isUndefined()); @@ -3226,7 +3226,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(3, 19)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(3)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).strictlyEquals(QJSValue(19))); @@ -3234,7 +3234,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_intQScriptValue(44, [19, 20])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 15); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(44)); QVERIFY(qvariant_cast<QJSValue>(o->actuals().at(1)).isArray()); @@ -3242,20 +3242,20 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_ERROR("object.method_overload()")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(10)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 16); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(10)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(10, 11)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 17); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(11)); @@ -3263,21 +3263,21 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_overload(\"Hello\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 18); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(QString("Hello"))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_with_enum(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 19); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(9)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_default(10)", QV4::Primitive::fromInt32(19))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 20); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(19)); @@ -3285,7 +3285,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_default(10, 13)", QV4::Primitive::fromInt32(13))); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 20); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(10)); QCOMPARE(o->actuals().at(1), QVariant(13)); @@ -3293,14 +3293,14 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_inherited(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -3); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(o->actuals().at(0), QVariant(9)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QVariant(9)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 21); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(9)); QCOMPARE(o->actuals().at(1), QVariant()); @@ -3308,7 +3308,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QVariant(\"Hello\", \"World\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 21); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(QString("Hello"))); QCOMPARE(o->actuals().at(1), QVariant(QString("World"))); @@ -3316,104 +3316,104 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_QJsonObject({foo:123})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 22); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonObject>(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonArray([123])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 23); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonArray>(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(123)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(123)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(42.35)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(42.35)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue('ciao')", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QStringLiteral("ciao"))); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(true)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(true)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(false)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(false)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Null)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QJsonValue(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 24); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Undefined)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload({foo:123})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 25); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonObject>(o->actuals().at(0)), QJsonDocument::fromJson("{\"foo\":123}").object()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload([123])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 26); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonArray>(o->actuals().at(0)), QJsonDocument::fromJson("[123]").array()); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(null)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 27); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Null)); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_overload(undefined)", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 27); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QJsonValue>(o->actuals().at(0)), QJsonValue(QJsonValue::Undefined)); o->reset(); QVERIFY(EVALUATE_ERROR("object.method_unknown(null)")); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), -1); - QCOMPARE(o->actuals().count(), 0); + QCOMPARE(o->actuals().size(), 0); o->reset(); QVERIFY(EVALUATE_VALUE("object.method_QByteArray(\"Hello\")", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 29); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QByteArray>(o->actuals().at(0)), QByteArray("Hello")); o->reset(); @@ -3422,7 +3422,7 @@ void tst_qqmlecmascript::callQtInvokables() QCOMPARE(o->invoked(), 30); QVERIFY(ret->isString()); QCOMPARE(ret->toQStringNoThrow(), QString("Hello world!")); - QCOMPARE(o->actuals().count(), 2); + QCOMPARE(o->actuals().size(), 2); QCOMPARE(o->actuals().at(0), QVariant(123)); QJSValue callback = qvariant_cast<QJSValue>(o->actuals().at(1)); QVERIFY(!callback.isNull()); @@ -3432,7 +3432,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_overload2('foo', 12, [1, 2, 3])", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 31); - QCOMPARE(o->actuals().count(), 3); + QCOMPARE(o->actuals().size(), 3); QCOMPARE(qvariant_cast<QString>(o->actuals().at(0)), QStringLiteral("foo")); QCOMPARE(qvariant_cast<int>(o->actuals().at(1)), 12); QCOMPARE(qvariant_cast<QVariantList>(o->actuals().at(2)), (QVariantList {1.0, 2.0, 3.0})); @@ -3441,7 +3441,7 @@ void tst_qqmlecmascript::callQtInvokables() QVERIFY(EVALUATE_VALUE("object.method_overload2(11, 12, {a: 1, b: 2})", QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 31); - QCOMPARE(o->actuals().count(), 3); + QCOMPARE(o->actuals().size(), 3); QCOMPARE(qvariant_cast<int>(o->actuals().at(0)), 11); QCOMPARE(qvariant_cast<int>(o->actuals().at(1)), 12); QCOMPARE(qvariant_cast<QVariantMap>(o->actuals().at(2)), @@ -3452,7 +3452,7 @@ void tst_qqmlecmascript::callQtInvokables() QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 32); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QVariantList>(o->actuals().at(0)), (QVariantList {1.0, QStringLiteral("bar"), 0.2})); @@ -3461,7 +3461,7 @@ void tst_qqmlecmascript::callQtInvokables() QV4::Primitive::undefinedValue())); QCOMPARE(o->error(), false); QCOMPARE(o->invoked(), 33); - QCOMPARE(o->actuals().count(), 1); + QCOMPARE(o->actuals().size(), 1); QCOMPARE(qvariant_cast<QVariantMap>(o->actuals().at(0)), (QVariantMap { {QStringLiteral("one"), 1.0}, diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index 6e74de7d86..8a15cf906a 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -317,7 +317,7 @@ void tst_qqmlengine::offlineStoragePath() QSignalSpy offlineStoragePathSpy(&engine, &QQmlEngine::offlineStoragePathChanged); engine.setOfflineStoragePath(QDir::homePath()); - QCOMPARE(offlineStoragePathSpy.count(), 1); + QCOMPARE(offlineStoragePathSpy.size(), 1); QCOMPARE(engine.offlineStoragePath(), QDir::homePath()); } diff --git a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp index fc5164629e..339a61f996 100644 --- a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp +++ b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp @@ -181,7 +181,7 @@ void tst_qqmlitemmodels::modelIndexList() QCOMPARE(object->property("count").toInt(), 10); const QModelIndexList &mil = object->modelIndexList(); - QCOMPARE(mil.count(), 4); + QCOMPARE(mil.size(), 4); for (int i = 0; i < 3; i++) QCOMPARE(mil.at(i), model.index(2 + i, 2 + i)); QCOMPARE(mil.at(3), QModelIndex()); // The string inserted at the end should result in an invalid index @@ -198,7 +198,7 @@ void tst_qqmlitemmodels::modelIndexList() QCOMPARE(milVariant.userType(), qMetaTypeId<QModelIndexList>()); const QModelIndexList &milProp = milVariant.value<QModelIndexList>(); - QCOMPARE(milProp.count(), mil.count()); + QCOMPARE(milProp.size(), mil.size()); QCOMPARE(milProp, mil); } } diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 254b19c9e2..904f54912c 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -779,7 +779,7 @@ void tst_qqmllanguage::simpleContainer() VERIFY_ERRORS(0); QScopedPointer<MyContainer> container(qobject_cast<MyContainer*>(component.create())); QVERIFY(container != nullptr); - QCOMPARE(container->getChildren()->count(),2); + QCOMPARE(container->getChildren()->size(),2); } void tst_qqmllanguage::interfaceProperty() @@ -798,7 +798,7 @@ void tst_qqmllanguage::interfaceQList() VERIFY_ERRORS(0); QScopedPointer<MyContainer> container(qobject_cast<MyContainer*>(component.create())); QVERIFY(container != nullptr); - QCOMPARE(container->getQListInterfaces()->count(), 2); + QCOMPARE(container->getQListInterfaces()->size(), 2); for(int ii = 0; ii < 2; ++ii) QCOMPARE(container->getQListInterfaces()->at(ii)->id, 913); } @@ -839,7 +839,7 @@ void tst_qqmllanguage::assignQmlComponent() VERIFY_ERRORS(0); QScopedPointer<MyContainer> object(qobject_cast<MyContainer *>(component.create())); QVERIFY(object != nullptr); - QCOMPARE(object->getChildren()->count(), 1); + QCOMPARE(object->getChildren()->size(), 1); QObject *child = object->getChildren()->at(0); QCOMPARE(child->property("x"), QVariant(10)); QCOMPARE(child->property("y"), QVariant(11)); @@ -1365,7 +1365,7 @@ void tst_qqmllanguage::rootAsQmlComponent() QScopedPointer<MyContainer> object(qobject_cast<MyContainer *>(component.create())); QVERIFY(object != nullptr); QCOMPARE(object->property("x"), QVariant(11)); - QCOMPARE(object->getChildren()->count(), 2); + QCOMPARE(object->getChildren()->size(), 2); } void tst_qqmllanguage::rootItemIsComponent() @@ -1397,7 +1397,7 @@ void tst_qqmllanguage::inlineQmlComponents() VERIFY_ERRORS(0); QScopedPointer<MyContainer> object(qobject_cast<MyContainer *>(component.create())); QVERIFY(object != nullptr); - QCOMPARE(object->getChildren()->count(), 1); + QCOMPARE(object->getChildren()->size(), 1); QQmlComponent *comp = qobject_cast<QQmlComponent *>(object->getChildren()->at(0)); QVERIFY(comp != nullptr); QScopedPointer<MyQmlObject> compObject(qobject_cast<MyQmlObject *>(comp->create())); @@ -1413,7 +1413,7 @@ void tst_qqmllanguage::idProperty() VERIFY_ERRORS(0); QScopedPointer<MyContainer> object(qobject_cast<MyContainer *>(component.create())); QVERIFY(object != nullptr); - QCOMPARE(object->getChildren()->count(), 2); + QCOMPARE(object->getChildren()->size(), 2); MyTypeObject *child = qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); QVERIFY(child != nullptr); @@ -2704,7 +2704,7 @@ void tst_qqmllanguage::defaultPropertyListOrder() QScopedPointer<MyContainer> container(qobject_cast<MyContainer *>(component.create())); QVERIFY(container != nullptr); - QCOMPARE(container->getChildren()->count(), 6); + QCOMPARE(container->getChildren()->size(), 6); QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0)); QCOMPARE(container->getChildren()->at(1)->property("index"), QVariant(1)); QCOMPARE(container->getChildren()->at(2)->property("index"), QVariant(2)); @@ -5144,7 +5144,7 @@ void tst_qqmllanguage::executeDeferredPropertiesOnce() QVERIFY(innerObjsAfterFirstExecute.isEmpty()); QObjectList outerObjsAfterFirstExecute = object->findChildren<QObject *>(QStringLiteral("outerobj")); // deferredListProperty.qml - QCOMPARE(outerObjsAfterFirstExecute.count(), 1); + QCOMPARE(outerObjsAfterFirstExecute.size(), 1); QCOMPARE(outerObjsAfterFirstExecute.first()->property("wasCompleted"), QVariant(true)); groupProperty = object->property("groupProperty").value<QObject *>(); @@ -6920,7 +6920,7 @@ void tst_qqmllanguage::variantListConversion() Foo *foo = qobject_cast<Foo *>(o.data()); QVERIFY(foo); const QVariantList list = foo->getList(); - QCOMPARE(list.length(), 3); + QCOMPARE(list.size(), 3); const Large l0 = qvariant_cast<Large>(list.at(0)); QCOMPARE(l0.a, 12ull); const Large l1 = qvariant_cast<Large>(list.at(1)); diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index 5550d2788e..8b07398832 100644 --- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -128,10 +128,10 @@ bool tst_qqmllistmodel::compareVariantList(const QVariantList &testList, QVarian if (model == nullptr) return false; - if (model->count() != testList.count()) + if (model->count() != testList.size()) return false; - for (int i=0 ; i < testList.count() ; ++i) { + for (int i=0 ; i < testList.size() ; ++i) { const QVariant &testVariant = testList.at(i); if (testVariant.typeId() != QMetaType::QVariantMap) return false; diff --git a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp index ae7f2ce19b..4875602314 100644 --- a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp +++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp @@ -91,10 +91,10 @@ bool tst_qqmllistmodelworkerscript::compareVariantList(const QVariantList &testL if (model == nullptr) return false; - if (model->count() != testList.count()) + if (model->count() != testList.size()) return false; - for (int i=0 ; i < testList.count() ; ++i) { + for (int i=0 ; i < testList.size() ; ++i) { const QVariant &testVariant = testList.at(i); if (testVariant.typeId() != QMetaType::QVariantMap) return false; @@ -394,7 +394,7 @@ void tst_qqmllistmodelworkerscript::dynamic_worker_sync() // execute a set of commands on the worker list model, then check the // changes are reflected in the list model in the main thread QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", - Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); + Q_ARG(QVariant, operations.mid(0, operations.size()-1)))); waitForWorker(item); QQmlExpression e(eng.rootContext(), &model, operations.last().toString()); @@ -809,7 +809,7 @@ void tst_qqmllistmodelworkerscript::dynamic_role() // execute a set of commands on the worker list model, then check the // changes are reflected in the list model in the main thread QVERIFY(QMetaObject::invokeMethod(item, "evalExpressionViaWorker", - Q_ARG(QVariant, operations.mid(0, operations.length()-1)))); + Q_ARG(QVariant, operations.mid(0, operations.size()-1)))); waitForWorker(item); QQmlExpression e(engine.rootContext(), &model, operations.last().toString()); diff --git a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp index 29b2f1d122..049ffb2d72 100644 --- a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp +++ b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp @@ -80,7 +80,7 @@ public: reinterpret_cast<QList<TestType *> *>(p->data)->append(v); } static qsizetype count(QQmlListProperty<TestType> *p) { - return reinterpret_cast<QList<TestType *> *>(p->data)->count(); + return reinterpret_cast<QList<TestType *> *>(p->data)->size(); } static TestType *at(QQmlListProperty<TestType> *p, qsizetype idx) { return reinterpret_cast<QList<TestType *> *>(p->data)->at(idx); diff --git a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp index 4cbaa76225..d007f4d024 100644 --- a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp +++ b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp @@ -15,7 +15,7 @@ private slots: static bool compareItems(QQmlObjectModel *model, const QObjectList &items) { - for (int i = 0; i < items.count(); ++i) { + for (int i = 0; i < items.size(); ++i) { if (model->get(i) != items.at(i)) return false; } diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 2cb46cc52c..fa89dda0ad 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -2095,7 +2095,7 @@ void tst_qqmlproperty::assignEmptyVariantMap() QVariantMap map; map.insert("key", "value"); o.setVariantMap(map); - QCOMPARE(o.variantMap().count(), 1); + QCOMPARE(o.variantMap().size(), 1); QCOMPARE(o.variantMap().isEmpty(), false); @@ -2104,7 +2104,7 @@ void tst_qqmlproperty::assignEmptyVariantMap() component.createWithInitialProperties({{"o", QVariant::fromValue(&o)}})); QVERIFY(obj); - QCOMPARE(o.variantMap().count(), 0); + QCOMPARE(o.variantMap().size(), 0); QCOMPARE(o.variantMap().isEmpty(), true); } diff --git a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp index 296b5ef0ff..67c44684a4 100644 --- a/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp +++ b/tests/auto/qml/qqmlsqldatabase/tst_qqmlsqldatabase.cpp @@ -52,7 +52,7 @@ void removeRecursive(const QString& dirname) { QDir dir(dirname); QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)); - for (int i = 0; i < entries.count(); ++i) + for (int i = 0; i < entries.size(); ++i) if (entries[i].isDir()) removeRecursive(entries[i].filePath()); else @@ -174,7 +174,7 @@ void tst_qqmlsqldatabase::totalDatabases() if (engine->offlineStoragePath().isEmpty()) QSKIP("offlineStoragePath is empty, skip this test."); - QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).count(), total_databases_created_by_tests*2); + QCOMPARE(QDir(dbDir()+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).size(), total_databases_created_by_tests*2); } void tst_qqmlsqldatabase::upgradeDatabase() diff --git a/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp b/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp index ce30eceb05..05b8ce605d 100644 --- a/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp +++ b/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp @@ -313,7 +313,7 @@ void tst_QQmlXmlListModel::headers() QQmlXmlListModel::Ready); // It doesn't do a network request for a local file - QCOMPARE(factory.lastSentHeaders.count(), 0); + QCOMPARE(factory.lastSentHeaders.size(), 0); model->setProperty("source", QUrl("http://localhost/filethatdoesnotexist.xml")); QTRY_COMPARE_WITH_TIMEOUT(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), @@ -322,7 +322,7 @@ void tst_QQmlXmlListModel::headers() QVariantMap expectedHeaders; expectedHeaders["Accept"] = "application/xml,*/*"; - QCOMPARE(factory.lastSentHeaders.count(), expectedHeaders.count()); + QCOMPARE(factory.lastSentHeaders.size(), expectedHeaders.size()); for (auto it = expectedHeaders.cbegin(), end = expectedHeaders.cend(); it != end; ++it) { QVERIFY(factory.lastSentHeaders.contains(it.key())); QCOMPARE(factory.lastSentHeaders[it.key()].toString(), it.value().toString()); |