diff options
Diffstat (limited to 'tests/auto/qml')
64 files changed, 539 insertions, 539 deletions
diff --git a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp index 0a17d75387..cac9581803 100644 --- a/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qanimationgroupjob/tst_qanimationgroupjob.cpp @@ -81,7 +81,7 @@ public: int count() { - return states.count(); + return states.size(); } QList<QAbstractAnimationJob::State> states; diff --git a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp index f8665eac0a..a11ae75033 100644 --- a/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qparallelanimationgroupjob/tst_qparallelanimationgroupjob.cpp @@ -99,7 +99,7 @@ public: } void clear() { states.clear(); } - int count() { return states.count(); } + int count() { return states.size(); } QList<QAbstractAnimationJob::State> states; }; diff --git a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp index 03d207e49b..2c9e74d24d 100644 --- a/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp +++ b/tests/auto/qml/animation/qsequentialanimationgroupjob/tst_qsequentialanimationgroupjob.cpp @@ -116,7 +116,7 @@ public: } void clear() { states.clear(); } - int count() const { return states.count(); } + int count() const { return states.size(); } QList<QAbstractAnimationJob::State> states; bool beEvil = false; diff --git a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp index 1efc48e07d..81d8694406 100644 --- a/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/qml/debugger/qpacketprotocol/tst_qpacketprotocol.cpp @@ -45,8 +45,8 @@ void tst_QPacketProtocol::init() m_client->connectToHost(m_server->serverAddress(), m_server->serverPort()); - QVERIFY(clientSpy.count() > 0 || clientSpy.wait()); - QVERIFY(serverSpy.count() > 0 || serverSpy.wait()); + QVERIFY(clientSpy.size() > 0 || clientSpy.wait()); + QVERIFY(serverSpy.size() > 0 || serverSpy.wait()); m_serverConn = m_server->nextPendingConnection(); } diff --git a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp index 9f51b65c7f..ac607df0a0 100644 --- a/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp +++ b/tests/auto/qml/debugger/qqmldebugjs/tst_qqmldebugjs.cpp @@ -853,15 +853,15 @@ void tst_QQmlDebugJS::evaluateInContext() QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result()))); - QVERIFY(engineClient->engines().count()); + QVERIFY(engineClient->engines().size()); engineClient->queryRootContexts(engineClient->engines()[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result()))); auto contexts = engineClient->rootContext().contexts; - QCOMPARE(contexts.count(), 1); + QCOMPARE(contexts.size(), 1); auto objects = contexts[0].objects; - QCOMPARE(objects.count(), 1); + QCOMPARE(objects.size(), 1); engineClient->queryObjectRecursive(objects[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(engineClient.data(), SIGNAL(result()))); @@ -874,7 +874,7 @@ void tst_QQmlDebugJS::evaluateInContext() QTRY_COMPARE(responseBody(m_client).value("value").toInt(), 20); auto childObjects = object.children; - QVERIFY(childObjects.count() > 0); // QQmlComponentAttached is also in there + QVERIFY(childObjects.size() > 0); // QQmlComponentAttached is also in there QCOMPARE(childObjects[0].className, QString::fromLatin1("Item")); // "b" accessible in context of surrounding (child) object @@ -1065,7 +1065,7 @@ void tst_QQmlDebugJS::letConstLocals() for (const auto prop : props) { const auto propObj = prop.toObject(); QString name = propObj.value(QStringLiteral("name")).toString(); - QVERIFY(name.length() == 1); + QVERIFY(name.size() == 1); auto i = expectedMembers.indexOf(name.at(0)); QVERIFY(i != -1); expectedMembers.remove(i, 1); diff --git a/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp b/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp index 48396aefea..0e0340b672 100644 --- a/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp +++ b/tests/auto/qml/debugger/qqmldebugtranslationservice/tst_qqmldebugtranslationservice.cpp @@ -63,7 +63,7 @@ private slots: changeLanguage("ru"); auto translationIssues = getTranslationIssues(); - QCOMPARE(translationIssues.length(), getTranslatableTextOccurrences().count()); + QCOMPARE(translationIssues.size(), getTranslatableTextOccurrences().size()); QCOMPARE(translationIssues.at(0).language, "ru-Cyrl-RU ru-RU ru"); } @@ -73,18 +73,18 @@ private slots: auto translationIssues = getTranslationIssues(); - QCOMPARE(translationIssues.length(), 3); + QCOMPARE(translationIssues.size(), 3); QCOMPARE(translationIssues.at(0).language, "fr-Latn-FR fr-FR fr"); } void verifyCorrectNumberOfTranslatableTextOccurrences() { - QCOMPARE(getTranslatableTextOccurrences().length(), 5); + QCOMPARE(getTranslatableTextOccurrences().size(), 5); } void verifyCorrectNumberOfStates() { - QCOMPARE(getStates().length(), 2); + QCOMPARE(getStates().size(), 2); } void getElideWarnings() @@ -128,9 +128,9 @@ private slots: { QVector<QmlState> stateList = getStates(); - QCOMPARE(stateList.length(), 2); + QCOMPARE(stateList.size(), 2); - for (int i = 0; i < stateList.count(); i++) { + for (int i = 0; i < stateList.size(); i++) { auto stateName = stateList.at(i).name; QVersionedPacket<QQmlDebugConnector> packet; sendMessageToService(createChangeStateRequest(packet, stateName)); diff --git a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp index 78d80405f4..890f4eeef6 100644 --- a/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebuginspectorintegrationtest/tst_qqmlenginedebuginspectorintegration.cpp @@ -55,7 +55,7 @@ QQmlEngineDebugObjectReference tst_QQmlEngineDebugInspectorIntegration::findRoot if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))) return QQmlEngineDebugObjectReference(); - int count = m_engineDebugClient->rootContext().contexts.count(); + int count = m_engineDebugClient->rootContext().contexts.size(); m_engineDebugClient->queryObject( m_engineDebugClient->rootContext().contexts[count - 1].objects[0], &success); if (!QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))) @@ -156,7 +156,7 @@ void tst_QQmlEngineDebugInspectorIntegration::createObject() QQmlEngineDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 2); + QCOMPARE(rootObject.children.size(), 2); int requestId = m_inspectorClient->createObject( qml, rootObject.debugId, QStringList() << QLatin1String("import QtQuick 2.0"), @@ -166,7 +166,7 @@ void tst_QQmlEngineDebugInspectorIntegration::createObject() rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 3); + QCOMPARE(rootObject.children.size(), 3); QCOMPARE(rootObject.children[2].idString, QLatin1String("xxxyxxx")); } @@ -177,7 +177,7 @@ void tst_QQmlEngineDebugInspectorIntegration::moveObject() QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QQmlEngineDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 2); + QCOMPARE(rootObject.children.size(), 2); int childId = rootObject.children[0].debugId; int requestId = m_inspectorClient->moveObject(childId, rootObject.children[1].debugId); @@ -186,12 +186,12 @@ void tst_QQmlEngineDebugInspectorIntegration::moveObject() rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 1); + QCOMPARE(rootObject.children.size(), 1); bool success = false; m_engineDebugClient->queryObject(rootObject.children[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))); - QCOMPARE(m_engineDebugClient->object().children.length(), 1); + QCOMPARE(m_engineDebugClient->object().children.size(), 1); QCOMPARE(m_engineDebugClient->object().children[0].debugId, childId); } @@ -202,7 +202,7 @@ void tst_QQmlEngineDebugInspectorIntegration::destroyObject() QCOMPARE(m_inspectorClient->state(), QQmlDebugClient::Enabled); QQmlEngineDebugObjectReference rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 2); + QCOMPARE(rootObject.children.size(), 2); int requestId = m_inspectorClient->destroyObject(rootObject.children[0].debugId); QTRY_COMPARE(m_recipient->lastResponseId, requestId); @@ -210,12 +210,12 @@ void tst_QQmlEngineDebugInspectorIntegration::destroyObject() rootObject = findRootObject(); QVERIFY(rootObject.debugId != -1); - QCOMPARE(rootObject.children.length(), 1); + QCOMPARE(rootObject.children.size(), 1); bool success = false; m_engineDebugClient->queryObject(rootObject.children[0], &success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_engineDebugClient, SIGNAL(result()))); - QCOMPARE(m_engineDebugClient->object().children.length(), 0); + QCOMPARE(m_engineDebugClient->object().children.size(), 0); } QTEST_MAIN(tst_QQmlEngineDebugInspectorIntegration) diff --git a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp index 49fe5948d5..578710a26e 100644 --- a/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp +++ b/tests/auto/qml/debugger/qqmlenginedebugservice/tst_qqmlenginedebugservice.cpp @@ -171,14 +171,14 @@ QQmlEngineDebugObjectReference tst_QQmlEngineDebugService::findRootObject( QVERIFYOBJECT(success); QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QVERIFYOBJECT(m_dbg->engines().count()); + QVERIFYOBJECT(m_dbg->engines().size()); m_dbg->queryRootContexts(m_dbg->engines()[0], &success); QVERIFYOBJECT(success); QVERIFYOBJECT(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QVERIFYOBJECT(m_dbg->rootContext().contexts.count()); - QVERIFYOBJECT(m_dbg->rootContext().contexts.last().objects.count()); - int count = m_dbg->rootContext().contexts.count(); + QVERIFYOBJECT(m_dbg->rootContext().contexts.size()); + QVERIFYOBJECT(m_dbg->rootContext().contexts.last().objects.size()); + int count = m_dbg->rootContext().contexts.size(); recursive ? m_dbg->queryObjectRecursive(m_dbg->rootContext().contexts[count - context - 1].objects[0], &success) : m_dbg->queryObject(m_dbg->rootContext().contexts[count - context - 1].objects[0], &success); @@ -235,7 +235,7 @@ void tst_QQmlEngineDebugService::recursiveObjectTest( QCOMPARE(p.objectDebugId, QQmlDebugService::idForObject(o)); // signal properties are fake - they are generated from QQmlAbstractBoundSignal children - if (p.name.startsWith("on") && p.name.length() > 2 && p.name[2].isUpper()) { + if (p.name.startsWith("on") && p.name.size() > 2 && p.name[2].isUpper()) { QString signal = p.value.toString(); QQmlBoundSignalExpression *expr = QQmlPropertyPrivate::signalExpression(QQmlProperty(o, p.name)); QVERIFY(expr && expr->expression() == signal); @@ -299,7 +299,7 @@ void tst_QQmlEngineDebugService::getContexts() QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); QList<QQmlEngineDebugEngineReference> engines = m_dbg->engines(); - QCOMPARE(engines.count(), 1); + QCOMPARE(engines.size(), 1); m_dbg->queryRootContexts(engines.first(), &success); QVERIFY(success); @@ -438,7 +438,7 @@ void tst_QQmlEngineDebugService::watch_property() m_rootItem->setProperty("width", origWidth*2); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant)))); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); m_dbg->removeWatch(id, &success); QVERIFY(success); @@ -448,7 +448,7 @@ void tst_QQmlEngineDebugService::watch_property() // restore original value and verify spy doesn't get additional signal since watch has been removed m_rootItem->setProperty("width", origWidth); QTest::qWait(100); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QCOMPARE(spy.at(0).at(0).value<QByteArray>(), prop.name.toUtf8()); QCOMPARE(spy.at(0).at(1).value<QVariant>(), QVariant::fromValue(origWidth*2)); @@ -486,11 +486,11 @@ void tst_QQmlEngineDebugService::watch_object() m_rootItem->setProperty("height", origHeight*2); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(valueChanged(QByteArray,QVariant)))); - QVERIFY(spy.count() > 0); + QVERIFY(spy.size() > 0); int newWidth = -1; int newHeight = -1; - for (int i=0; i<spy.count(); i++) { + for (int i=0; i<spy.size(); i++) { const QVariantList &values = spy[i]; if (values[0].value<QByteArray>() == "width") newWidth = values[1].value<QVariant>().toInt(); @@ -509,7 +509,7 @@ void tst_QQmlEngineDebugService::watch_object() m_rootItem->setProperty("width", origWidth); m_rootItem->setProperty("height", origHeight); QTest::qWait(100); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); QCOMPARE(newWidth, origWidth * 2); QCOMPARE(newHeight, origHeight * 2); @@ -562,10 +562,10 @@ void tst_QQmlEngineDebugService::watch_expression() // restore original value and verify spy doesn't get a signal since watch has been removed m_rootItem->setProperty("width", origWidth); QTest::qWait(100); - QCOMPARE(spy.count(), incrementCount); + QCOMPARE(spy.size(), incrementCount); width = origWidth + increment; - for (int i=0; i<spy.count(); i++) { + for (int i=0; i<spy.size(); i++) { width += increment; QCOMPARE(spy.at(i).at(1).value<QVariant>().toInt(), width); } @@ -614,7 +614,7 @@ void tst_QQmlEngineDebugService::queryAvailableEngines() // TODO test multiple engines QList<QQmlEngineDebugEngineReference> engines = m_dbg->engines(); - QCOMPARE(engines.count(), 1); + QCOMPARE(engines.size(), 1); foreach (const QQmlEngineDebugEngineReference &e, engines) { QCOMPARE(e.debugId, QQmlDebugService::idForObject(m_engine)); @@ -628,7 +628,7 @@ void tst_QQmlEngineDebugService::queryRootContexts() m_dbg->queryAvailableEngines(&success); QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QVERIFY(m_dbg->engines().count()); + QVERIFY(m_dbg->engines().size()); const QQmlEngineDebugEngineReference engine = m_dbg->engines()[0]; QQmlEngineDebugClient *unconnected = new QQmlEngineDebugClient(nullptr); @@ -647,8 +647,8 @@ void tst_QQmlEngineDebugService::queryRootContexts() // root context query sends only root object data - it doesn't fill in // the children or property info - QCOMPARE(context.objects.count(), 0); - QCOMPARE(context.contexts.count(), 8); + QCOMPARE(context.objects.size(), 0); + QCOMPARE(context.contexts.size(), 8); QVERIFY(context.contexts[0].debugId >= 0); QCOMPARE(context.contexts[0].name, QString("tst_QQmlDebug_childContext")); } @@ -686,7 +686,7 @@ void tst_QQmlEngineDebugService::queryObject() if (recursive) { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QVERIFY(child.properties.count() > 0); + QVERIFY(child.properties.size() > 0); } QQmlEngineDebugObjectReference rect; @@ -708,7 +708,7 @@ void tst_QQmlEngineDebugService::queryObject() } else { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QCOMPARE(child.properties.count(), 0); + QCOMPARE(child.properties.size(), 0); } } } @@ -749,7 +749,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() QVERIFY(success); QVERIFY(QQmlDebugTest::waitForSignal(m_dbg, SIGNAL(result()))); - QCOMPARE(m_dbg->objects().count(), 1); + QCOMPARE(m_dbg->objects().size(), 1); QQmlEngineDebugObjectReference obj = m_dbg->objects().first(); QVERIFY(!obj.className.isEmpty()); @@ -765,7 +765,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() if (recursive) { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QVERIFY(child.properties.count() > 0); + QVERIFY(child.properties.size() > 0); } QQmlEngineDebugObjectReference rect; @@ -789,7 +789,7 @@ void tst_QQmlEngineDebugService::queryObjectsForLocation() } else { foreach (const QQmlEngineDebugObjectReference &child, obj.children) { QVERIFY(!child.className.isEmpty()); - QCOMPARE(child.properties.count(), 0); + QCOMPARE(child.properties.size(), 0); } } } @@ -1134,7 +1134,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() QQmlEngineDebugObjectReference obj = findRootObject(sourceIndex); QVERIFY(!obj.className.isEmpty()); QVERIFY(obj.debugId != -1); - QVERIFY(obj.children.count() >= 2); + QVERIFY(obj.children.size() >= 2); bool success; // We are going to switch state a couple of times, we need to get rid of the transition before m_dbg->queryExpressionResult(obj.debugId,QString("transitions = []"), &success); @@ -1166,7 +1166,7 @@ void tst_QQmlEngineDebugService::setBindingInStates() // change the binding QQmlEngineDebugObjectReference state = obj.children[1]; QCOMPARE(state.className, QString("State")); - QVERIFY(state.children.count() > 0); + QVERIFY(state.children.size() > 0); QQmlEngineDebugObjectReference propertyChange = state.children[0]; QVERIFY(!propertyChange.className.isEmpty()); @@ -1250,12 +1250,12 @@ void tst_QQmlEngineDebugService::queryObjectTree() QQmlEngineDebugObjectReference obj = findRootObject(sourceIndex, true); QVERIFY(!obj.className.isEmpty()); QVERIFY(obj.debugId != -1); - QVERIFY(obj.children.count() >= 2); + QVERIFY(obj.children.size() >= 2); // check state QQmlEngineDebugObjectReference state = obj.children[1]; QCOMPARE(state.className, QString("State")); - QVERIFY(state.children.count() > 0); + QVERIFY(state.children.size() > 0); QQmlEngineDebugObjectReference propertyChange = state.children[0]; QVERIFY(!propertyChange.className.isEmpty()); @@ -1274,7 +1274,7 @@ void tst_QQmlEngineDebugService::queryObjectTree() QCOMPARE(transition.className, QString("Transition")); QCOMPARE(findProperty(transition.properties,"from").value.toString(), QString("*")); QCOMPARE(findProperty(transition.properties,"to").value, findProperty(state.properties,"name").value); - QVERIFY(transition.children.count() > 0); + QVERIFY(transition.children.size() > 0); QQmlEngineDebugObjectReference animation = transition.children[0]; QVERIFY(!animation.className.isEmpty()); @@ -1321,18 +1321,18 @@ void tst_QQmlEngineDebugService::asynchronousCreate() { void tst_QQmlEngineDebugService::invalidContexts() { getContexts(); - const int base = m_dbg->rootContext().contexts.count(); + const int base = m_dbg->rootContext().contexts.size(); QQmlContext context(m_engine); getContexts(); - QCOMPARE(m_dbg->rootContext().contexts.count(), base + 1); + QCOMPARE(m_dbg->rootContext().contexts.size(), base + 1); QQmlRefPointer<QQmlContextData> contextData = QQmlContextData::get(&context); contextData->invalidate(); getContexts(); - QCOMPARE(m_dbg->rootContext().contexts.count(), base); + QCOMPARE(m_dbg->rootContext().contexts.size(), base); QQmlRefPointer<QQmlContextData> rootData = QQmlContextData::get(m_engine->rootContext()); rootData->invalidate(); getContexts(); - QCOMPARE(m_dbg->rootContext().contexts.count(), 0); + QCOMPARE(m_dbg->rootContext().contexts.size(), 0); } void tst_QQmlEngineDebugService::createObjectOnDestruction() @@ -1351,11 +1351,11 @@ void tst_QQmlEngineDebugService::createObjectOnDestruction() "}", QUrl::fromLocalFile("x.qml")); QVERIFY(component.isReady()); QVERIFY(component.create()); - QTRY_COMPARE(spy.count(), 2); + QTRY_COMPARE(spy.size(), 2); } // Doesn't crash and doesn't give us another signal for the object created on destruction. QTest::qWait(500); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.size(), 2); } void tst_QQmlEngineDebugService::debuggerCrashOnAttach() { diff --git a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp index f389fb8f9f..897d8c8688 100644 --- a/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp +++ b/tests/auto/qml/debugger/qqmlinspector/tst_qqmlinspector.cpp @@ -64,7 +64,7 @@ void tst_QQmlInspector::checkAnimationSpeed(int targetMillisPerDegree) for (int i = 0; i < 10; ++i) { QString output = m_process->output(); - int position = output.length(); + int position = output.size(); do { QVERIFY(QQmlDebugTest::waitForSignal(m_process, SIGNAL(readyReadStandardOutput()))); output = m_process->output(); diff --git a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp index 90ababb67e..0c4fd568a9 100644 --- a/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp +++ b/tests/auto/qml/debugger/qqmlpreview/tst_qqmlpreview.cpp @@ -266,14 +266,14 @@ void tst_QQmlPreview::error() QCOMPARE(startQmlProcess("window.qml"), ConnectSuccess); QVERIFY(m_client); m_client->triggerLoad(testFileUrl("broken.qml")); - QTRY_COMPARE_WITH_TIMEOUT(m_serviceErrors.count(), 1, 10000); + QTRY_COMPARE_WITH_TIMEOUT(m_serviceErrors.size(), 1, 10000); QVERIFY(m_serviceErrors.first().contains("broken.qml:7 Expected token `}'")); } static float parseZoomFactor(const QString &output) { const QString prefix("zoom "); - const int start = output.lastIndexOf(prefix) + prefix.length(); + const int start = output.lastIndexOf(prefix) + prefix.size(); if (start < 0) return -1; const int end = output.indexOf('\n', start); diff --git a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp index ce92728ee4..2e457cad8f 100644 --- a/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp +++ b/tests/auto/qml/debugger/qqmlprofilerservice/tst_qqmlprofilerservice.cpp @@ -52,20 +52,20 @@ private: void QQmlProfilerTestClient::startTrace(qint64 timestamp, const QList<int> &engineIds) { types.append(QQmlProfilerEventType(Event, MaximumRangeType, StartTrace)); - asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.length() - 1, + asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.size() - 1, engineIds.toVector())); } void QQmlProfilerTestClient::endTrace(qint64 timestamp, const QList<int> &engineIds) { types.append(QQmlProfilerEventType(Event, MaximumRangeType, EndTrace)); - asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.length() - 1, + asynchronousMessages.append(QQmlProfilerEvent(timestamp, types.size() - 1, engineIds.toVector())); } int QQmlProfilerTestClient::numLoadedEventTypes() const { - return types.length(); + return types.size(); } void QQmlProfilerTestClient::addEventType(const QQmlProfilerEventType &type) @@ -76,7 +76,7 @@ void QQmlProfilerTestClient::addEventType(const QQmlProfilerEventType &type) void QQmlProfilerTestClient::addEvent(const QQmlProfilerEvent &event) { const int typeIndex = event.typeIndex(); - QVERIFY(typeIndex < types.length()); + QVERIFY(typeIndex < types.size()); const QQmlProfilerEventType &type = types[typeIndex]; @@ -272,14 +272,14 @@ void tst_QQmlProfilerService::checkTraceReceived() // must end with "EndTrace" expected = QQmlProfilerEventType(Event, MaximumRangeType, EndTrace); - VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.length() - 1, expected, + VERIFY(MessageListAsynchronous, m_client->asynchronousMessages.size() - 1, expected, CheckMessageType | CheckDetailType, numbers); } void tst_QQmlProfilerService::checkJsHeap() { QVERIFY(m_client); - QVERIFY2(m_client->jsHeapMessages.count() > 0, "no JavaScript heap messages received"); + QVERIFY2(m_client->jsHeapMessages.size() > 0, "no JavaScript heap messages received"); bool seen_alloc = false; bool seen_small = false; @@ -467,32 +467,32 @@ void tst_QQmlProfilerService::cleanup() }; if (m_client && QTest::currentTestFailed()) { - qDebug() << "QML Messages:" << m_client->qmlMessages.count(); + qDebug() << "QML Messages:" << m_client->qmlMessages.size(); int i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->qmlMessages)) log(data, i++); qDebug() << " "; - qDebug() << "JavaScript Messages:" << m_client->javascriptMessages.count(); + qDebug() << "JavaScript Messages:" << m_client->javascriptMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->javascriptMessages)) log(data, i++); qDebug() << " "; - qDebug() << "Asynchronous Messages:" << m_client->asynchronousMessages.count(); + qDebug() << "Asynchronous Messages:" << m_client->asynchronousMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->asynchronousMessages)) log(data, i++); qDebug() << " "; - qDebug() << "Pixmap Cache Messages:" << m_client->pixmapMessages.count(); + qDebug() << "Pixmap Cache Messages:" << m_client->pixmapMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->pixmapMessages)) log(data, i++); qDebug() << " "; - qDebug() << "Javascript Heap Messages:" << m_client->jsHeapMessages.count(); + qDebug() << "Javascript Heap Messages:" << m_client->jsHeapMessages.size(); i = 0; for (const QQmlProfilerEvent &data : qAsConst(m_client->jsHeapMessages)) log(data, i++); @@ -677,9 +677,9 @@ void tst_QQmlProfilerService::flushInterval() QCOMPARE(connectTo(true, "timer.qml", true, 1), ConnectSuccess); // Make sure we get multiple messages - QTRY_VERIFY(m_client->qmlMessages.length() > 0); - QVERIFY(m_client->qmlMessages.length() < 100); - QTRY_VERIFY(m_client->qmlMessages.length() > 100); + QTRY_VERIFY(m_client->qmlMessages.size() > 0); + QVERIFY(m_client->qmlMessages.size() < 100); + QTRY_VERIFY(m_client->qmlMessages.size() > 100); m_client->client->setRecording(false); checkTraceReceived(); @@ -783,7 +783,7 @@ void tst_QQmlProfilerService::multiEngine() QTRY_COMPARE(m_process->state(), QProcess::NotRunning); QCOMPARE(m_process->exitStatus(), QProcess::NormalExit); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_QQmlProfilerService::batchOverflow() diff --git a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp index d7a79f446b..cdb7b1dee0 100644 --- a/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp +++ b/tests/auto/qml/debugger/qv4debugger/tst_qv4debugger.cpp @@ -370,7 +370,7 @@ void tst_qv4debugger::pendingBreakpoint() debugger()->addBreakPoint("testfile", 2); evaluateJavaScript(script, "testfile"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 1); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("testfile")); QCOMPARE(state.lineNumber, 2); @@ -386,7 +386,7 @@ void tst_qv4debugger::liveBreakPoint() debugger()->pause(); evaluateJavaScript(script, "liveBreakPoint"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 2); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(1); QCOMPARE(state.fileName, QString("liveBreakPoint")); QCOMPARE(state.lineNumber, 3); @@ -414,7 +414,7 @@ void tst_qv4debugger::addBreakPointWhilePaused() m_debuggerAgent->m_breakPointsToAddWhenPaused << TestAgent::TestBreakPoint("addBreakPointWhilePaused", 2); evaluateJavaScript(script, "addBreakPointWhilePaused"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 2); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 2); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(0); QCOMPARE(state.fileName, QString("addBreakPointWhilePaused")); @@ -461,7 +461,7 @@ void tst_qv4debugger::conditionalBreakPoint() debugger()->addBreakPoint("conditionalBreakPoint", 3, QStringLiteral("i > 10")); evaluateJavaScript(script, "conditionalBreakPoint"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 4); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 4); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("conditionalBreakPoint")); QCOMPARE(state.lineNumber, 3); @@ -495,7 +495,7 @@ void tst_qv4debugger::conditionalBreakPointInQml() QScopedPointer<QObject> obj(component.create()); QCOMPARE(obj->property("success").toBool(), true); - QCOMPARE(debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(debuggerAgent->m_statesWhenPaused.size(), 1); QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).fileName, qmlFileName); QCOMPARE(debuggerAgent->m_statesWhenPaused.at(0).lineNumber, 7); @@ -699,7 +699,7 @@ void tst_qv4debugger::breakInCatch() evaluateJavaScript(script, "breakInCatch"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 1); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("breakInCatch")); QCOMPARE(state.lineNumber, 4); @@ -716,7 +716,7 @@ void tst_qv4debugger::breakInWith() evaluateJavaScript(script, "breakInWith"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::BreakPointHit); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 1); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 1); QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(state.fileName, QString("breakInWith")); QCOMPARE(state.lineNumber, 2); @@ -752,7 +752,7 @@ void tst_qv4debugger::evaluateExpression() evaluateJavaScript(script, "evaluateExpression"); - QCOMPARE(m_debuggerAgent->m_expressionResults.count(), 4); + QCOMPARE(m_debuggerAgent->m_expressionResults.size(), 4); QJsonObject result0 = m_debuggerAgent->m_expressionResults[0]; QCOMPARE(result0.value("type").toString(), QStringLiteral("number")); QCOMPARE(result0.value("value").toInt(), 10); @@ -776,7 +776,7 @@ void tst_qv4debugger::stepToEndOfScript() evaluateJavaScript(script, "toEnd"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::Step); - QCOMPARE(m_debuggerAgent->m_statesWhenPaused.count(), 5); + QCOMPARE(m_debuggerAgent->m_statesWhenPaused.size(), 5); for (int i = 0; i < 4; ++i) { QV4Debugger::ExecutionState state = m_debuggerAgent->m_statesWhenPaused.at(i); QCOMPARE(state.fileName, QString("toEnd")); @@ -846,7 +846,7 @@ void tst_qv4debugger::lastLineOfConditional() evaluateJavaScript(script, "trueBranch"); QVERIFY(m_debuggerAgent->m_wasPaused); QCOMPARE(m_debuggerAgent->m_pauseReason, QV4Debugger::Step); - QVERIFY(m_debuggerAgent->m_statesWhenPaused.count() > 1); + QVERIFY(m_debuggerAgent->m_statesWhenPaused.size() > 1); QV4Debugger::ExecutionState firstState = m_debuggerAgent->m_statesWhenPaused.first(); QCOMPARE(firstState.fileName, QString("trueBranch")); QCOMPARE(firstState.lineNumber, breakPoint); @@ -873,7 +873,7 @@ void tst_qv4debugger::readThis() evaluateJavaScript(script, "applyThis"); QVERIFY(m_debuggerAgent->m_wasPaused); - QCOMPARE(m_debuggerAgent->m_expressionResults.count(), 1); + QCOMPARE(m_debuggerAgent->m_expressionResults.size(), 1); QJsonObject result0 = m_debuggerAgent->m_expressionResults[0]; QCOMPARE(result0.value("type").toString(), QStringLiteral("object")); QCOMPARE(result0.value("value").toInt(), 1); diff --git a/tests/auto/qml/debugger/shared/debugutil.cpp b/tests/auto/qml/debugger/shared/debugutil.cpp index bc15af706d..bce2c28378 100644 --- a/tests/auto/qml/debugger/shared/debugutil.cpp +++ b/tests/auto/qml/debugger/shared/debugutil.cpp @@ -20,7 +20,7 @@ bool QQmlDebugTest::waitForSignal(QObject *sender, const char *member, int timeo QSignalSpy spy(sender, member); // Do not use spy.wait(). We want to avoid nested event loops. - if (QTest::qWaitFor([&]() { return spy.count() > 0; }, timeout)) + if (QTest::qWaitFor([&]() { return spy.size() > 0; }, timeout)) return true; qWarning("waitForSignal %s timed out after %d ms", member, timeout); @@ -132,7 +132,7 @@ QQmlDebugTest::ConnectResult QQmlDebugTest::connectTo( QSignalSpy okSpy(&stateHandler, &ClientStateHandler::allOk); QSignalSpy disconnectSpy(m_connection, &QQmlDebugConnection::disconnected); m_connection->connectToHost(QLatin1String("127.0.0.1"), m_process->debugPort()); - if (!QTest::qWaitFor([&](){ return okSpy.count() > 0 || disconnectSpy.count() > 0; }, 5000)) + if (!QTest::qWaitFor([&](){ return okSpy.size() > 0 || disconnectSpy.size() > 0; }, 5000)) return ConnectionTimeout; if (!stateHandler.allEnabled()) @@ -231,7 +231,7 @@ QString debugJsServerPath(const QString &selfPath) static const char *debugserver = "qqmldebugjsserver"; QString appPath = QCoreApplication::applicationDirPath(); const int position = appPath.lastIndexOf(selfPath); - return (position == -1 ? appPath : appPath.replace(position, selfPath.length(), debugserver)) + return (position == -1 ? appPath : appPath.replace(position, selfPath.size(), debugserver)) + "/" + debugserver; } diff --git a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp index 0a1edfdc34..79f27aee9c 100644 --- a/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp +++ b/tests/auto/qml/ecmascripttests/qjstest/test262runner.cpp @@ -209,7 +209,7 @@ bool Test262Runner::loadTests() QString harness = "harness"; QString intl402 = "intl402"; - int pathlen = dir.path().length() + 1; + int pathlen = dir.path().size() + 1; QDirIterator it(dir, QDirIterator::Subdirectories); while (it.hasNext()) { QString file = it.next().mid(pathlen); @@ -502,7 +502,7 @@ static TestCase::Result executeTest(const QByteArray &data, bool runAsModule = f QFile f(url.toLocalFile()); if (f.open(QIODevice::ReadOnly)) { QByteArray content = harnessForModules + f.readAll(); - module = vm.compileModule(url.toString(), QString::fromUtf8(content.constData(), content.length()), QFileInfo(f).lastModified()); + module = vm.compileModule(url.toString(), QString::fromUtf8(content.constData(), content.size()), QFileInfo(f).lastModified()); if (vm.hasException) break; vm.injectCompiledModule(module); @@ -743,7 +743,7 @@ YamlSection::YamlSection(const QByteArray &yaml, const char *sectionName) start += static_cast<int>(strlen(sectionName)); int end = yaml.indexOf('\n', start + 1); if (end < 0) - end = yaml.length(); + end = yaml.size(); int s = yaml.indexOf('[', start); if (s > 0 && s < end) { diff --git a/tests/auto/qml/parserstress/tst_parserstress.cpp b/tests/auto/qml/parserstress/tst_parserstress.cpp index 7fb2787d31..99af0247a8 100644 --- a/tests/auto/qml/parserstress/tst_parserstress.cpp +++ b/tests/auto/qml/parserstress/tst_parserstress.cpp @@ -126,7 +126,7 @@ void tst_parserstress::ecmascript() if (fileInfo.fileName() == QLatin1String("regress-352044-02-n.js")) { QVERIFY(component.isError()); - QCOMPARE(component.errors().length(), 2); + QCOMPARE(component.errors().size(), 2); QCOMPARE(component.errors().at(0).description(), QString("Expected token `;'")); QCOMPARE(component.errors().at(0).line(), 66); diff --git a/tests/auto/qml/qjsengine/tst_qjsengine.cpp b/tests/auto/qml/qjsengine/tst_qjsengine.cpp index 5d4bf9be43..02ef7b7f6d 100644 --- a/tests/auto/qml/qjsengine/tst_qjsengine.cpp +++ b/tests/auto/qml/qjsengine/tst_qjsengine.cpp @@ -327,14 +327,14 @@ void tst_QJSEngine::callQObjectSlot() { QSignalSpy spy(&dummy, SIGNAL(slotWithoutArgCalled())); eng.evaluate("dummy.slotToCall();"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } { QSignalSpy spy(&dummy, SIGNAL(slotWithSingleArgCalled(QString))); eng.evaluate("dummy.slotToCall('arg');"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toString(), QString("arg")); } @@ -342,7 +342,7 @@ void tst_QJSEngine::callQObjectSlot() { QSignalSpy spy(&dummy, SIGNAL(slotWithArgumentsCalled(QString, QString, QString))); eng.evaluate("dummy.slotToCall('arg', 'arg2');"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toString(), QString("arg")); @@ -353,7 +353,7 @@ void tst_QJSEngine::callQObjectSlot() { QSignalSpy spy(&dummy, SIGNAL(slotWithArgumentsCalled(QString, QString, QString))); eng.evaluate("dummy.slotToCall('arg', 'arg2', 'arg3');"); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const QList<QVariant> arguments = spy.takeFirst(); QCOMPARE(arguments.at(0).toString(), QString("arg")); @@ -364,7 +364,7 @@ void tst_QJSEngine::callQObjectSlot() { QSignalSpy spy(&dummy, SIGNAL(slotWithOverloadedArgumentsCalled(QString, Qt::KeyboardModifier, Qt::KeyboardModifiers))); eng.evaluate(QStringLiteral("dummy.slotToCall('arg', %1);").arg(QString::number(Qt::ControlModifier))); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const QList<QVariant> arguments = spy.first(); QCOMPARE(arguments.at(0).toString(), QString("arg")); @@ -376,7 +376,7 @@ void tst_QJSEngine::callQObjectSlot() { QSignalSpy spy(&dummy, SIGNAL(slotWithTwoOverloadedArgumentsCalled(QString, Qt::KeyboardModifiers, Qt::KeyboardModifier))); QJSValue v = eng.evaluate(QStringLiteral("dummy.slotToCallTwoDefault('arg', %1);").arg(QString::number(Qt::MetaModifier | Qt::KeypadModifier))); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const QList<QVariant> arguments = spy.first(); QCOMPARE(arguments.at(0).toString(), QString("arg")); @@ -397,7 +397,7 @@ void tst_QJSEngine::callQObjectSlot() { QSignalSpy spy(&dummy, SIGNAL(slotWithOverloadedArgumentsCalled(QString, Qt::KeyboardModifier, Qt::KeyboardModifiers))); QJSValue v = eng.evaluate(QStringLiteral("dummy.slotToCall('arg', Qt.ControlModifier);")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const QList<QVariant> arguments = spy.first(); QCOMPARE(arguments.at(0).toString(), QString("arg")); @@ -408,7 +408,7 @@ void tst_QJSEngine::callQObjectSlot() { QSignalSpy spy(&dummy, SIGNAL(slotWithTwoOverloadedArgumentsCalled(QString, Qt::KeyboardModifiers, Qt::KeyboardModifier))); QJSValue v = eng.evaluate(QStringLiteral("dummy.slotToCallTwoDefault('arg', Qt.MetaModifier | Qt.KeypadModifier);")); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); const QList<QVariant> arguments = spy.first(); QCOMPARE(arguments.at(0).toString(), QString("arg")); @@ -968,7 +968,7 @@ void tst_QJSEngine::newQObject_deletedEngine() object = engine.newQObject(ptr); engine.globalObject().setProperty("obj", object); } - QTRY_VERIFY(spy.count()); + QTRY_VERIFY(spy.size()); } class TestQMetaObject : public QObject { @@ -2667,8 +2667,8 @@ void tst_QJSEngine::stringObjects() // in C++ { QJSValue obj = eng.evaluate(QString::fromLatin1("new String('%0')").arg(str)); - QCOMPARE(obj.property("length").toInt(), str.length()); - for (int i = 0; i < str.length(); ++i) { + QCOMPARE(obj.property("length").toInt(), str.size()); + for (int i = 0; i < str.size(); ++i) { QString pname = QString::number(i); QVERIFY(obj.property(pname).isString()); QCOMPARE(obj.property(pname).toString(), QString(str.at(i))); @@ -2678,7 +2678,7 @@ void tst_QJSEngine::stringObjects() QCOMPARE(obj.property(pname).toString(), QString(str.at(i))); } QVERIFY(obj.property("-1").isUndefined()); - QVERIFY(obj.property(QString::number(str.length())).isUndefined()); + QVERIFY(obj.property(QString::number(str.size())).isUndefined()); QJSValue val = eng.toScriptValue(123); obj.setProperty("-1", val); @@ -2691,13 +2691,13 @@ void tst_QJSEngine::stringObjects() QJSValue ret = eng.evaluate("s = new String('ciao'); r = []; for (var p in s) r.push(p); r"); QVERIFY(ret.isArray()); QStringList lst = qjsvalue_cast<QStringList>(ret); - QCOMPARE(lst.size(), str.length()); - for (int i = 0; i < str.length(); ++i) + QCOMPARE(lst.size(), str.size()); + for (int i = 0; i < str.size(); ++i) QCOMPARE(lst.at(i), QString::number(i)); QJSValue ret2 = eng.evaluate("s[0] = 123; s[0]"); QVERIFY(ret2.isString()); - QCOMPARE(ret2.toString().length(), 1); + QCOMPARE(ret2.toString().size(), 1); QCOMPARE(ret2.toString().at(0), str.at(0)); QJSValue ret3 = eng.evaluate("s[-1] = 123; s[-1]"); @@ -3485,7 +3485,7 @@ void tst_QJSEngine::dateConversionJSQt() QDateTime qtDate = jsDate.toDateTime(); QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString(); - jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000") + jsUTCDateStr.remove(jsUTCDateStr.size() - 5, 4); // get rid of milliseconds (".000") if (qtUTCDateStr != jsUTCDateStr) QFAIL(qPrintable(jsDate.toString())); secs += 2*60*60; @@ -3500,7 +3500,7 @@ void tst_QJSEngine::dateConversionQtJS() QJSValue jsDate = eng.toScriptValue(qtDate); QString jsUTCDateStr = jsDate.property("toISOString").callWithInstance(jsDate).toString(); QString qtUTCDateStr = qtDate.toUTC().toString(Qt::ISODate); - jsUTCDateStr.remove(jsUTCDateStr.length() - 5, 4); // get rid of milliseconds (".000") + jsUTCDateStr.remove(jsUTCDateStr.size() - 5, 4); // get rid of milliseconds (".000") if (jsUTCDateStr != qtUTCDateStr) QFAIL(qPrintable(qtDate.toString())); qtDate = qtDate.addSecs(2*60*60); @@ -4397,7 +4397,7 @@ void tst_QJSEngine::exceptionReporting() function g() {f()} g() )", QString("tesfile.js"), 1, &stackTrace); QVERIFY2(!result.isError(), qPrintable(result.toString())); - QCOMPARE(stackTrace.count(), 3); + QCOMPARE(stackTrace.size(), 3); QCOMPARE(stackTrace.at(0), "f:2:-1:file:tesfile.js"); QCOMPARE(stackTrace.at(1), "g:3:-1:file:tesfile.js"); QCOMPARE(stackTrace.at(2), "%entry:4:-1:file:tesfile.js"); diff --git a/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp b/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp index 568b14b5ac..6723926585 100644 --- a/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp +++ b/tests/auto/qml/qjsmanagedvalue/tst_qjsmanagedvalue.cpp @@ -1742,7 +1742,7 @@ void tst_QJSManagedValue::stringByIndex() const QString testString = QStringLiteral("foobar"); QJSManagedValue str(testString, &engine); - for (uint i = 0; i < testString.length(); ++i) { + for (uint i = 0; i < testString.size(); ++i) { QVERIFY(str.hasOwnProperty(i)); QVERIFY(str.hasProperty(i)); diff --git a/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp b/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp index 339a524604..e329cf948f 100644 --- a/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp +++ b/tests/auto/qml/qjsvalueiterator/tst_qjsvalueiterator.cpp @@ -95,7 +95,7 @@ void tst_QJSValueIterator::iterateForward() QCOMPARE(it.hasNext(), false); it = object; - for (int i = 0; i < lst.count(); ++i) { + for (int i = 0; i < lst.size(); ++i) { QCOMPARE(it.hasNext(), true); it.next(); QCOMPARE(it.name(), lst.at(i)); diff --git a/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp b/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp index 4ba76d882d..048459f03a 100644 --- a/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp +++ b/tests/auto/qml/qmlcppcodegen/data/birthdayparty.cpp @@ -28,7 +28,7 @@ QQmlListProperty<Person> BirthdayParty::guests() int BirthdayParty::guestCount() const { - return m_guests.count(); + return m_guests.size(); } Person *BirthdayParty::guest(int index) const diff --git a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp index 011b496383..19acf4fc78 100644 --- a/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp +++ b/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp @@ -247,7 +247,7 @@ void tst_QmlCppCodegen::idAccess() static QByteArray arg1() { const QStringList args = QCoreApplication::instance()->arguments(); - return args.length() > 1 ? args[1].toUtf8() : QByteArray("undefined"); + return args.size() > 1 ? args[1].toUtf8() : QByteArray("undefined"); } void tst_QmlCppCodegen::globals() @@ -299,7 +299,7 @@ void tst_QmlCppCodegen::multiLookup() QSignalSpy quitSpy(&engine, &QQmlEngine::quit); QScopedPointer<QObject> object(component.create()); QVERIFY(!object.isNull()); - QCOMPARE(quitSpy.count(), 1); + QCOMPARE(quitSpy.size(), 1); } void tst_QmlCppCodegen::enums() @@ -393,7 +393,7 @@ void tst_QmlCppCodegen::compositeTypeMethod() QScopedPointer<QObject> object(component.create()); QVERIFY(!object.isNull()); QSignalSpy spy(object.data(), SIGNAL(foo())); - QTRY_VERIFY(spy.count() > 0); + QTRY_VERIFY(spy.size() > 0); } void tst_QmlCppCodegen::excessiveParameters() @@ -404,7 +404,7 @@ void tst_QmlCppCodegen::excessiveParameters() QScopedPointer<QObject> object(component.create()); QVERIFY(!object.isNull()); QSignalSpy spy(object.data(), SIGNAL(foo())); - QTRY_VERIFY(spy.count() > 0); + QTRY_VERIFY(spy.size() > 0); } void tst_QmlCppCodegen::jsImport() @@ -1010,7 +1010,7 @@ void tst_QmlCppCodegen::lotsOfRegisters() }; for (int i = 0; i < 100; ++i) { - QVERIFY(object->setProperty(props[i % props.length()], (i * 17) % 512)); + QVERIFY(object->setProperty(props[i % props.size()], (i * 17) % 512)); compare(); } } @@ -2655,7 +2655,7 @@ void tst_QmlCppCodegen::mathOperations() const QMetaProperty prop = metaObject->property(i); const QByteArray propName = prop.name(); - if (propName.length() < 3 || propName == "objectName") + if (propName.size() < 3 || propName == "objectName") continue; t1 = propName[0]; diff --git a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp index dc4b66e8f9..19a6731ff7 100644 --- a/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp +++ b/tests/auto/qml/qmldiskcache/tst_qmldiskcache.cpp @@ -697,7 +697,7 @@ void tst_qmldiskcache::cacheResources() } const QSet<QString> entries = entrySet(m_qmlCacheDirectory).subtract(existingFiles); - QCOMPARE(entries.count(), 1); + QCOMPARE(entries.size(), 1); QDateTime cacheFileTimeStamp; @@ -726,7 +726,7 @@ void tst_qmldiskcache::cacheResources() { const QSet<QString> entries = entrySet(m_qmlCacheDirectory).subtract(existingFiles); - QCOMPARE(entries.count(), 1); + QCOMPARE(entries.size(), 1); QCOMPARE(QFileInfo(m_qmlCacheDirectory.absoluteFilePath(*entries.cbegin())).lastModified().toMSecsSinceEpoch(), cacheFileTimeStamp.toMSecsSinceEpoch()); @@ -972,7 +972,7 @@ void tst_qmldiskcache::cacheModuleScripts() const QSet<QString> entries = entrySet(m_qmlCacheDirectory, QStringList("*.mjsc")); - QCOMPARE(entries.count(), 1); + QCOMPARE(entries.size(), 1); QDateTime cacheFileTimeStamp; diff --git a/tests/auto/qml/qmlformat/tst_qmlformat.cpp b/tests/auto/qml/qmlformat/tst_qmlformat.cpp index 9d7beb23a7..e95673221a 100644 --- a/tests/auto/qml/qmlformat/tst_qmlformat.cpp +++ b/tests/auto/qml/qmlformat/tst_qmlformat.cpp @@ -147,7 +147,7 @@ void TestQmlformat::initTestCase() QStringList TestQmlformat::findFiles(const QDir &d) { - for (int ii = 0; ii < m_excludedDirs.count(); ++ii) { + for (int ii = 0; ii < m_excludedDirs.size(); ++ii) { QString s = m_excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return QStringList(); diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index d720904b04..12c2de21e9 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -307,7 +307,7 @@ void TestQmllint::qmltypes_data() QDirIterator it(importsPath, { "*.qmltypes" }, QDir::Files, QDirIterator::Subdirectories); while (it.hasNext()) - QTest::addRow("%s", qPrintable(it.next().mid(importsPath.length()))) << it.filePath(); + QTest::addRow("%s", qPrintable(it.next().mid(importsPath.size()))) << it.filePath(); } void TestQmllint::qmltypes() @@ -374,9 +374,9 @@ void TestQmllint::verifyJsRoot() QStringList currentLines = currentJsRootContent.split(QLatin1Char('\n')); QStringList generatedLines = generatedJsRootContent.split(QLatin1Char('\n')); - QCOMPARE(currentLines.count(), generatedLines.count()); + QCOMPARE(currentLines.size(), generatedLines.size()); - for (qsizetype i = 0; i < currentLines.count(); i++) { + for (qsizetype i = 0; i < currentLines.size(); i++) { QCOMPARE(currentLines[i], generatedLines[i]); } } diff --git a/tests/auto/qml/qmltc/tst_qmltc.cpp b/tests/auto/qml/qmltc/tst_qmltc.cpp index 4064434bee..942c18a44c 100644 --- a/tests/auto/qml/qmltc/tst_qmltc.cpp +++ b/tests/auto/qml/qmltc/tst_qmltc.cpp @@ -1045,8 +1045,8 @@ void tst_qmltc::propertyAlias_external() QSignalSpy heightAliasChangedSpy(&created, &PREPEND_NAMESPACE(propertyAlias_external)::heightAliasChanged); created.setHeight(10); QCOMPARE(created.heightAlias(), 10); - QCOMPARE(heightChangedSpy.count(), 1); - QCOMPARE(heightAliasChangedSpy.count(), 1); + QCOMPARE(heightChangedSpy.size(), 1); + QCOMPARE(heightAliasChangedSpy.size(), 1); } void tst_qmltc::propertyAliasAttribute() @@ -1144,22 +1144,22 @@ void tst_qmltc::propertyAliasAttribute() // write through alias fromQmltc.setNotifiableAlias(stringA); QVERIFY(fromEngine.setProperty("notifiableAlias", stringA)); - QCOMPARE(spyQmltc.count(), ++calls); - QCOMPARE(spyEngine.count(), calls); + QCOMPARE(spyQmltc.size(), ++calls); + QCOMPARE(spyEngine.size(), calls); // write through property fromQmltc.setReadAndWriteAndNotify(stringB); QVERIFY(fromEngine.setProperty("notifiable", stringB)); - QCOMPARE(spyQmltc.count(), ++calls); - QCOMPARE(spyEngine.count(), calls); + QCOMPARE(spyQmltc.size(), ++calls); + QCOMPARE(spyEngine.size(), calls); fromQmltc.setNotifiableMemberAlias(stringA); QVERIFY(fromEngine.setProperty("notifiableMemberAlias", stringA)); - QCOMPARE(spyQmltc.count(), ++calls); - QCOMPARE(spyEngine.count(), calls); + QCOMPARE(spyQmltc.size(), ++calls); + QCOMPARE(spyEngine.size(), calls); fromQmltc.setProperty("notifiableMember", stringB); QVERIFY(fromEngine.setProperty("notifiableMember", stringB)); - QCOMPARE(spyQmltc.count(), ++calls); - QCOMPARE(spyEngine.count(), calls); + QCOMPARE(spyQmltc.size(), ++calls); + QCOMPARE(spyEngine.size(), calls); // check that the alias to a revisioned property works fromQmltc.setLatestReadAndWriteAlias(stringA); @@ -1317,15 +1317,15 @@ void tst_qmltc::complexAliases() created.setAFont(newFont); QCOMPARE(created.aFont(), newFont); QCOMPARE(created.aFont(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 1); + QCOMPARE(aFontSpy.size(), 1); newFont.setStyle(QFont::StyleOblique); theText->setProperty("font", newFont); QCOMPARE(theText->property("font").value<QFont>(), newFont); QCOMPARE(created.aFont(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 2); + QCOMPARE(aFontSpy.size(), 2); created.setAWordSpacing(1); - QCOMPARE(aFontSpy.count(), 3); + QCOMPARE(aFontSpy.size(), 3); // aliasToObjectAlias: QCOMPARE(created.aliasToObjectAlias(), created.aRectObject()); @@ -1360,12 +1360,12 @@ void tst_qmltc::complexAliases() QCOMPARE(created.aliasToValueTypeAlias(), newFont); QCOMPARE(created.aliasToValueTypeAlias(), created.aFont()); QCOMPARE(created.aliasToValueTypeAlias(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 4); - QCOMPARE(aliasToValueTypeAliasSpy.count(), 1); + QCOMPARE(aFontSpy.size(), 4); + QCOMPARE(aliasToValueTypeAliasSpy.size(), 1); newFont.setPixelSize(12); created.setAFont(newFont); - QCOMPARE(aFontSpy.count(), 5); - QCOMPARE(aliasToValueTypeAliasSpy.count(), 2); + QCOMPARE(aFontSpy.size(), 5); + QCOMPARE(aliasToValueTypeAliasSpy.size(), 2); QCOMPARE(created.aliasToValueTypeAlias(), created.aFont()); QCOMPARE(created.aliasToValueTypeAlias(), theText->property("font").value<QFont>()); @@ -1374,8 +1374,8 @@ void tst_qmltc::complexAliases() created.setAliasToPropertyOfValueTypeAlias(3); QCOMPARE(created.aliasToPropertyOfValueTypeAlias(), created.aFont().pixelSize()); QCOMPARE(created.aFont(), theText->property("font").value<QFont>()); - QCOMPARE(aFontSpy.count(), 6); - QCOMPARE(aliasToValueTypeAliasSpy.count(), 3); + QCOMPARE(aFontSpy.size(), 6); + QCOMPARE(aliasToValueTypeAliasSpy.size(), 3); // aliasToImportedMessage: QCOMPARE(created.aliasToImportedMessage(), localImport->property("message").toString()); @@ -1413,7 +1413,7 @@ void tst_qmltc::complexAliases() newPalette->fromQPalette(QPalette(QColor(u"cyan"_s))); QCOMPARE(newPalette->button(), QColor(u"cyan"_s)); created.setAliasToPrivatePalette(newPalette); - QCOMPARE(paletteChangedSpy.count(), 1); + QCOMPARE(paletteChangedSpy.size(), 1); QCOMPARE(QQuickItemPrivate::get(theRect)->palette()->button(), QColor(u"cyan"_s)); QCOMPARE(created.aliasToPrivatePalette(), QQuickItemPrivate::get(theRect)->palette()); @@ -1495,9 +1495,9 @@ void tst_qmltc::componentHelloWorld() QCOMPARE(created->hello(), QStringLiteral("Hello, World!")); QSignalSpy onDestroySpy(created.get(), &PREPEND_NAMESPACE(ComponentHelloWorld)::sDestroying); - QCOMPARE(onDestroySpy.count(), 0); + QCOMPARE(onDestroySpy.size(), 0); created.reset(); - QCOMPARE(onDestroySpy.count(), 1); + QCOMPARE(onDestroySpy.size(), 1); } void tst_qmltc::propertyReturningFunction() @@ -2283,7 +2283,7 @@ void tst_qmltc::calqlatrBits() QSignalSpy scaleChangedSpy(textItem, &QQuickItem::scaleChanged); controller->completeToBeginning(); - QTRY_VERIFY(scaleChangedSpy.count() > 0); + QTRY_VERIFY(scaleChangedSpy.size() > 0); } void tst_qmltc::trickyPropertyChangeAndSignalHandlers() @@ -2358,7 +2358,7 @@ void tst_qmltc::valueTypeListProperty() QQmlEngine e; PREPEND_NAMESPACE(valueTypeListProperty) created(&e); QList<int> intsRef = created.arrayOfInts(); - QCOMPARE(intsRef.count(), 4); + QCOMPARE(intsRef.size(), 4); QList<int> intsGroundTruth = { 1, 0, 42, -5 }; QCOMPARE(intsRef, intsGroundTruth); @@ -2368,13 +2368,13 @@ void tst_qmltc::valueTypeListProperty() QCOMPARE(created.arrayOfInts().at(2), 43); QList<QFont> arrayOfFonts = created.arrayOfFonts(); - QCOMPARE(arrayOfFonts.count(), 2); + QCOMPARE(arrayOfFonts.size(), 2); QCOMPARE(arrayOfFonts[0].family(), "Arial"); QCOMPARE(arrayOfFonts[1].family(), "Comic Sans"); QList<QColor> arrayOfColors = created.arrayOfColors(); - QCOMPARE(arrayOfColors.count(), 3); + QCOMPARE(arrayOfColors.size(), 3); QVERIFY(arrayOfColors[0].red() > 0); QCOMPARE(arrayOfColors[0].green(), 0); diff --git a/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp b/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp index 4ba7deb98e..7a6774c268 100644 --- a/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp +++ b/tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp @@ -41,7 +41,7 @@ void tst_AndroidAssets::loadsFromAssetsPath() // load QML file from assets, by path: engine.load(pathPrefix() + QStringLiteral("/qml/main.qml")); - QTRY_VERIFY(engine.rootObjects().length() == 1); + QTRY_VERIFY(engine.rootObjects().size() == 1); QVERIFY(failureSpy.isEmpty()); } @@ -52,7 +52,7 @@ void tst_AndroidAssets::loadsFromAssetsUrl() // load QML file from assets, by URL: engine.load(QUrl(urlPrefix() + QStringLiteral("/qml/main.qml"))); - QTRY_VERIFY(engine.rootObjects().length() == 1); + QTRY_VERIFY(engine.rootObjects().size() == 1); QVERIFY(failureSpy.isEmpty()); } diff --git a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp index 43f7296d4f..d0f580cf5f 100644 --- a/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp +++ b/tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp @@ -57,14 +57,14 @@ void tst_qqmlapplicationengine::basicLoading() QSignalSpy objectCreated(test, SIGNAL(objectCreated(QObject*,QUrl))); test->load(testFileUrl("basicTest.qml")); - QCOMPARE(objectCreated.count(), size);//one less than rootObjects().size() because we missed the first one + QCOMPARE(objectCreated.size(), size);//one less than rootObjects().size() because we missed the first one QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); QByteArray testQml("import QtQml 2.0; QtObject{property bool success: true; property TestItem t: TestItem{}}"); test->loadData(testQml, testFileUrl("dynamicTest.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); @@ -215,10 +215,10 @@ void tst_qqmlapplicationengine::applicationProperties() QCoreApplication::setOrganizationName(originalOrganization); QCoreApplication::setOrganizationDomain(originalDomain); - QCOMPARE(nameChanged.count(), 1); - QCOMPARE(versionChanged.count(), 1); - QCOMPARE(organizationChanged.count(), 1); - QCOMPARE(domainChanged.count(), 1); + QCOMPARE(nameChanged.size(), 1); + QCOMPARE(versionChanged.size(), 1); + QCOMPARE(organizationChanged.size(), 1); + QCOMPARE(domainChanged.size(), 1); delete test; } @@ -230,12 +230,12 @@ void tst_qqmlapplicationengine::removeObjectsWhenDestroyed() QSignalSpy objectCreated(test.data(), SIGNAL(objectCreated(QObject*,QUrl))); test->load(testFileUrl("basicTest.qml")); - QCOMPARE(objectCreated.count(), 1); + QCOMPARE(objectCreated.size(), 1); QSignalSpy objectDestroyed(test->rootObjects().first(), SIGNAL(destroyed())); test->rootObjects().first()->deleteLater(); objectDestroyed.wait(); - QCOMPARE(objectDestroyed.count(), 1); + QCOMPARE(objectDestroyed.size(), 1); QCOMPARE(test->rootObjects().size(), 0); } @@ -315,7 +315,7 @@ void tst_qqmlapplicationengine::failureToLoadTriggersWarningSignal() QQmlApplicationEngine test; QSignalSpy warningObserver(&test, &QQmlApplicationEngine::warnings); test.load(url); - QTRY_COMPARE(warningObserver.count(), 1); + QTRY_COMPARE(warningObserver.size(), 1); } void tst_qqmlapplicationengine::errorWhileCreating() @@ -330,8 +330,8 @@ void tst_qqmlapplicationengine::errorWhileCreating() test.load(url); - QTRY_COMPARE(observer.count(), 1); - QCOMPARE(failureObserver.count(), 1); + QTRY_COMPARE(observer.size(), 1); + QCOMPARE(failureObserver.size(), 1); QCOMPARE(failureObserver.first().first(), url); QList<QVariant> args = observer.takeFirst(); QVERIFY(args.at(0).isNull()); diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp index 53a8c49e94..faa64ddac5 100644 --- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp +++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp @@ -309,7 +309,7 @@ void tst_qqmlbinding::warningOnUnknownProperty() QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 1); + QCOMPARE(messageHandler.messages().size(), 1); const QString expectedMessage = c.url().toString() + QLatin1String(":6:5: QML Binding: Property 'unknown' does not exist on Item."); QCOMPARE(messageHandler.messages().first(), expectedMessage); @@ -324,7 +324,7 @@ void tst_qqmlbinding::warningOnReadOnlyProperty() QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 1); + QCOMPARE(messageHandler.messages().size(), 1); const QString expectedMessage = c.url().toString() + QLatin1String(":8:5: QML Binding: Property 'name' on Item is read-only."); QCOMPARE(messageHandler.messages().first(), expectedMessage); @@ -339,7 +339,7 @@ void tst_qqmlbinding::disabledOnUnknownProperty() QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 0); + QCOMPARE(messageHandler.messages().size(), 0); } void tst_qqmlbinding::disabledOnReadonlyProperty() @@ -350,7 +350,7 @@ void tst_qqmlbinding::disabledOnReadonlyProperty() QQmlComponent c(&engine, testFileUrl("disabledReadonly.qml")); QScopedPointer<QQuickItem> item { qobject_cast<QQuickItem *>(c.create()) }; QVERIFY(item); - QCOMPARE(messageHandler.messages().count(), 0); + QCOMPARE(messageHandler.messages().size(), 0); } void tst_qqmlbinding::delayed() @@ -447,7 +447,7 @@ void tst_qqmlbinding::bindingOverwriting() QVERIFY(item); QLoggingCategory::setFilterRules(QString()); - QCOMPARE(messageHandler.messages().count(), 2); + QCOMPARE(messageHandler.messages().size(), 2); } void tst_qqmlbinding::bindToQmlComponent() diff --git a/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp index 9788da4520..1aec5dcac3 100644 --- a/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp +++ b/tests/auto/qml/qqmlchangeset/tst_qqmlchangeset.cpp @@ -106,8 +106,8 @@ public: QHash<QQmlChangeSet::MoveKey, int> removedValues; foreach (const Signal &signal, changes) { if (signal.isInsert()) { - if (signal.index < 0 || signal.index > list.count()) { - qDebug() << "insert out of range" << signal.index << list.count(); + if (signal.index < 0 || signal.index > list.size()) { + qDebug() << "insert out of range" << signal.index << list.size(); return false; } if (signal.moveId != -1) { @@ -118,8 +118,8 @@ public: list.insert(signal.index, signal.count, 100); } } else if (signal.isRemove()) { - if (signal.index < 0 || signal.index + signal.count > list.count()) { - qDebug() << "remove out of range" << signal.index << signal.count << list.count(); + if (signal.index < 0 || signal.index + signal.count > list.size()) { + qDebug() << "remove out of range" << signal.index << signal.count << list.size(); return false; } if (signal.moveId != -1) { @@ -131,9 +131,9 @@ public: } else if (signal.isMove()) { if (signal.index < 0 || signal.to < 0 - || signal.index + signal.count > list.count() - || signal.to + signal.count > list.count()) { - qDebug() << "move out of range" << signal.index << signal.to << signal.count << list.count(); + || signal.index + signal.count > list.size() + || signal.to + signal.count > list.size()) { + qDebug() << "move out of range" << signal.index << signal.to << signal.count << list.size(); return false; } move(signal.index, signal.to, signal.count, &list); diff --git a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp index 8e1fd2a353..5e906d87f5 100644 --- a/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp +++ b/tests/auto/qml/qqmlcomponent/tst_qqmlcomponent.cpp @@ -162,7 +162,7 @@ void tst_qqmlcomponent::loadEmptyUrl() c.loadUrl(QUrl()); QVERIFY(c.isError()); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QQmlError error = c.errors().first(); QCOMPARE(error.url(), QUrl()); QCOMPARE(error.line(), -1); @@ -358,7 +358,7 @@ void tst_qqmlcomponent::qmlCreateObjectDirty() QQmlEngine engine; engine.setOutputWarningsToStandardError(false); QObject::connect(&engine, &QQmlEngine::warnings, [](const QList<QQmlError> &warnings) { - QCOMPARE(warnings.count(), 1); + QCOMPARE(warnings.size(), 1); QCOMPARE(warnings[0].description(), "QML Component: Unsuitable arguments passed to createObject(). The first argument " "should be a QObject* or null, and the second argument should be a JavaScript " @@ -576,7 +576,7 @@ void tst_qqmlcomponent::onDestructionCount() engine.setOutputWarningsToStandardError(false); QCOMPARE(engine.outputWarningsToStandardError(), false); - QCOMPARE(warnings.count(), 0); + QCOMPARE(warnings.size(), 0); } void tst_qqmlcomponent::recursion() @@ -1168,7 +1168,7 @@ void tst_qqmlcomponent::qmlPropertySignalExists() QSignalSpy changeSignalSpy(o.get(), SIGNAL(pChanged())); QVERIFY(QMetaObject::invokeMethod(o.get(), "doStuff")); - QCOMPARE(changeSignalSpy.count(), 1); + QCOMPARE(changeSignalSpy.size(), 1); QCOMPARE(o->property("p").toInt(), 42); } diff --git a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp index f203bd1800..dfc01df241 100644 --- a/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp +++ b/tests/auto/qml/qqmlconnections/tst_qqmlconnections.cpp @@ -227,7 +227,7 @@ void tst_qqmlconnections::errors() QQmlComponent c(&engine, url); QVERIFY(c.isError()); QList<QQmlError> errors = c.errors(); - QCOMPARE(errors.count(), 1); + QCOMPARE(errors.size(), 1); QCOMPARE(errors.at(0).description(), error); } diff --git a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp index 1737d1eaeb..11d79707d0 100644 --- a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp +++ b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp @@ -58,7 +58,7 @@ void tst_qqmlcpputils::fastConnect() qmlobject_connect(obj, MyObject, SIGNAL(signal1()), obj, MyObject, SIGNAL(signal2())); obj->signal1(); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); delete obj; } diff --git a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp index 491324fa57..ca66ddb618 100644 --- a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp +++ b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp @@ -56,7 +56,7 @@ public: if (parent.isValid()) return 0; - return mValues.count(); + return mValues.size(); } int columnCount(const QModelIndex &parent) const override @@ -187,15 +187,15 @@ void tst_QQmlDelegateModel::nestedDelegates() QScopedPointer<QObject> o(c.create()); QQuickItem *item = qobject_cast<QQuickItem *>(o.data()); - QCOMPARE(item->childItems().length(), 2); + QCOMPARE(item->childItems().size(), 2); for (QQuickItem *child : item->childItems()) { if (child->objectName() != QLatin1String("loader")) continue; - QCOMPARE(child->childItems().length(), 1); + QCOMPARE(child->childItems().size(), 1); QQuickItem *timeMarks = child->childItems().at(0); const QList<QQuickItem *> children = timeMarks->childItems(); - QCOMPARE(children.length(), 2); + QCOMPARE(children.size(), 2); // One of them is the repeater, the other one is the rectangle QVERIFY(children.at(0)->objectName() == QLatin1String("zap") diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index cb2dd9373a..0b26979c4d 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -401,7 +401,7 @@ void QObjectContainer::children_append(QQmlListProperty<QObject> *prop, QObject qsizetype QObjectContainer::children_count(QQmlListProperty<QObject> *prop) { - return static_cast<QObjectContainer*>(prop->object)->dataChildren.count(); + return static_cast<QObjectContainer*>(prop->object)->dataChildren.size(); } QObject *QObjectContainer::children_at(QQmlListProperty<QObject> *prop, qsizetype index) diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 340b1a148d..9fa617bcc7 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -2290,9 +2290,9 @@ void tst_qqmlecmascript::scriptErrors() QQmlComponent component(&engine, testFileUrl("scriptErrors.qml")); QString url = component.url().toString(); - QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\""; + QString warning1 = url.left(url.size() - 3) + "js:2: Error: Invalid write to global property \"a\""; QString warning2 = url + ":5: ReferenceError: a is not defined"; - QString warning3 = url.left(url.length() - 3) + "js:4: Error: Invalid write to global property \"a\""; + QString warning3 = url.left(url.size() - 3) + "js:4: Error: Invalid write to global property \"a\""; QString warning4 = url + ":13: ReferenceError: a is not defined"; QString warning5 = url + ":11: ReferenceError: a is not defined"; QString warning6 = url + ":10:5: Unable to assign [undefined] to int"; @@ -4849,7 +4849,7 @@ void tst_qqmlecmascript::importScripts() else { QVERIFY(component.isError()); QCOMPARE(warningMessages.size(), 1); - QCOMPARE(component.errors().count(), 2); + QCOMPARE(component.errors().size(), 2); QCOMPARE(component.errors().at(1).toString(), warningMessages.first()); return; } @@ -5864,22 +5864,22 @@ void tst_qqmlecmascript::sequenceConversionRead() QMetaObject::invokeMethod(object.data(), "readSequences"); QList<int> intList; intList << 1 << 2 << 3 << 4; - QCOMPARE(object->property("intListLength").toInt(), intList.length()); + QCOMPARE(object->property("intListLength").toInt(), intList.size()); QCOMPARE(object->property("intList").value<QList<int> >(), intList); QList<qreal> qrealList; qrealList << 1.1 << 2.2 << 3.3 << 4.4; - QCOMPARE(object->property("qrealListLength").toInt(), qrealList.length()); + QCOMPARE(object->property("qrealListLength").toInt(), qrealList.size()); QCOMPARE(object->property("qrealList").value<QList<qreal> >(), qrealList); QList<bool> boolList; boolList << true << false << true << false; - QCOMPARE(object->property("boolListLength").toInt(), boolList.length()); + QCOMPARE(object->property("boolListLength").toInt(), boolList.size()); QCOMPARE(object->property("boolList").value<QList<bool> >(), boolList); QList<QString> stringList; stringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth"); - QCOMPARE(object->property("stringListLength").toInt(), stringList.length()); + QCOMPARE(object->property("stringListLength").toInt(), stringList.size()); QCOMPARE(object->property("stringList").value<QList<QString> >(), stringList); QList<QUrl> urlList; urlList << QUrl("http://www.example1.com") << QUrl("http://www.example2.com") << QUrl("http://www.example3.com"); - QCOMPARE(object->property("urlListLength").toInt(), urlList.length()); + QCOMPARE(object->property("urlListLength").toInt(), urlList.size()); QCOMPARE(object->property("urlList").value<QList<QUrl> >(), urlList); QStringList qstringList; qstringList << QLatin1String("first") << QLatin1String("second") << QLatin1String("third") << QLatin1String("fourth"); - QCOMPARE(object->property("qstringListLength").toInt(), qstringList.length()); + QCOMPARE(object->property("qstringListLength").toInt(), qstringList.size()); QCOMPARE(object->property("qstringList").value<QStringList>(), qstringList); QMetaObject::invokeMethod(object.data(), "readSequenceElements"); @@ -7355,7 +7355,7 @@ void tst_qqmlecmascript::nonNotifyable() QLatin1String(object->metaObject()->className()) + QLatin1String("::value"); - QCOMPARE(messageHandler.messages().length(), 2); + QCOMPARE(messageHandler.messages().size(), 2); QCOMPARE(messageHandler.messages().at(0), expected1); QCOMPARE(messageHandler.messages().at(1), expected2); } @@ -7413,7 +7413,7 @@ void tst_qqmlecmascript::qtbug_22679() QScopedPointer<QObject> o(component.create()); QVERIFY2(o, qPrintable(component.errorString())); - QCOMPARE(warningsSpy.count(), 0); + QCOMPARE(warningsSpy.size(), 0); } void tst_qqmlecmascript::qtbug_22843_data() @@ -7437,7 +7437,7 @@ void tst_qqmlecmascript::qtbug_22843() QQmlComponent component(&engine, testFileUrl(fileName)); QString url = component.url().toString(); - QString expectedError = url.left(url.length()-3) + QLatin1String("js:4:16: Expected token `;'"); + QString expectedError = url.left(url.size()-3) + QLatin1String("js:4:16: Expected token `;'"); QVERIFY(component.isError()); QCOMPARE(component.errors().value(1).toString(), expectedError); @@ -8267,8 +8267,8 @@ void tst_qqmlecmascript::jsOwnedObjectsDeletedOnEngineDestroy() QSignalSpy spy1(object1, SIGNAL(destroyed())); QSignalSpy spy2(object2, SIGNAL(destroyed())); myEngine.reset(); - QCOMPARE(spy1.count(), 1); - QCOMPARE(spy2.count(), 1); + QCOMPARE(spy1.size(), 1); + QCOMPARE(spy2.size(), 1); deleteObject.deleteNestedObject(); } @@ -8583,14 +8583,14 @@ void tst_qqmlecmascript::garbageCollectionDuringCreation() QVERIFY2(object, qPrintable(component.errorString())); QObjectContainer *container = qobject_cast<QObjectContainer*>(object.data()); - QCOMPARE(container->dataChildren.count(), 1); + QCOMPARE(container->dataChildren.size(), 1); QObject *child = container->dataChildren.first(); QQmlData *ddata = QQmlData::get(child); QVERIFY(!ddata->jsWrapper.isNullOrUndefined()); gc(engine); - QCOMPARE(container->dataChildren.count(), 0); + QCOMPARE(container->dataChildren.size(), 0); } void tst_qqmlecmascript::qtbug_39520() diff --git a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp index bc961ef0a3..6e74de7d86 100644 --- a/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp +++ b/tests/auto/qml/qqmlengine/tst_qqmlengine.cpp @@ -716,7 +716,7 @@ void tst_qqmlengine::outputWarningsToStandardError() QVERIFY(o != nullptr); o.reset(); - QCOMPARE(messageHandler.messages().count(), 1); + QCOMPARE(messageHandler.messages().size(), 1); QCOMPARE(messageHandler.messages().at(0), QLatin1String("<Unknown File>:1:32: Unable to assign [undefined] to int")); messageHandler.clear(); @@ -778,7 +778,7 @@ void tst_qqmlengine::objectOwnership() c.createWithInitialProperties({{"test", QVariant::fromValue(this)}})); QVERIFY(o != nullptr); } - QTRY_VERIFY(spy.count()); + QTRY_VERIFY(spy.size()); } { QObject *ptr = new QObject(); @@ -795,7 +795,7 @@ void tst_qqmlengine::objectOwnership() QQmlProperty testProp(o.data(), "test"); testProp.write(QVariant::fromValue<QObject*>(nullptr)); } - QTRY_VERIFY(spy.count()); + QTRY_VERIFY(spy.size()); } } diff --git a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp index f9a0c45753..06df6e6919 100644 --- a/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp +++ b/tests/auto/qml/qqmlimport/tst_qqmlimport.cpp @@ -170,26 +170,26 @@ void tst_QQmlImport::uiFormatLoading() QSignalSpy objectCreated(test, SIGNAL(objectCreated(QObject*,QUrl))); test->load(testFileUrl("TestForm.ui.qml")); - QCOMPARE(objectCreated.count(), size);//one less than rootObjects().size() because we missed the first one + QCOMPARE(objectCreated.size(), size);//one less than rootObjects().size() because we missed the first one QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); QByteArray testQml("import QtQml 2.0; QtObject{property bool success: true; property TestForm t: TestForm{}}"); test->loadData(testQml, testFileUrl("dynamicTestForm.ui.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); test->load(testFileUrl("openTestFormFromDir.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); test->load(testFileUrl("openTestFormFromQmlDir.qml")); - QCOMPARE(objectCreated.count(), size); + QCOMPARE(objectCreated.size(), size); QCOMPARE(test->rootObjects().size(), ++size); QVERIFY(test->rootObjects()[size -1]); QVERIFY(test->rootObjects()[size -1]->property("success").toBool()); diff --git a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp index e6c8ad721e..1baf61574e 100644 --- a/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp +++ b/tests/auto/qml/qqmlincubator/tst_qqmlincubator.cpp @@ -517,7 +517,7 @@ void tst_qqmlincubator::statusChanged() MyIncubator incubator(QQmlIncubator::Synchronous); component.create(incubator); QVERIFY(incubator.isReady()); - QCOMPARE(incubator.statuses.count(), 3); + QCOMPARE(incubator.statuses.size(), 3); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); QCOMPARE(incubator.statuses.at(1), -1); QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready)); @@ -531,7 +531,7 @@ void tst_qqmlincubator::statusChanged() MyIncubator incubator(QQmlIncubator::Asynchronous); component.create(incubator); QVERIFY(incubator.isLoading()); - QCOMPARE(incubator.statuses.count(), 1); + QCOMPARE(incubator.statuses.size(), 1); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); { @@ -539,7 +539,7 @@ void tst_qqmlincubator::statusChanged() controller.incubateWhile(&b); } - QCOMPARE(incubator.statuses.count(), 3); + QCOMPARE(incubator.statuses.size(), 3); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); QCOMPARE(incubator.statuses.at(1), -1); QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready)); @@ -553,7 +553,7 @@ void tst_qqmlincubator::statusChanged() MyIncubator incubator(QQmlIncubator::Asynchronous); component2.create(incubator); QVERIFY(incubator.isLoading()); - QCOMPARE(incubator.statuses.count(), 1); + QCOMPARE(incubator.statuses.size(), 1); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); { @@ -562,7 +562,7 @@ void tst_qqmlincubator::statusChanged() } QVERIFY(incubator.isReady()); - QCOMPARE(incubator.statuses.count(), 3); + QCOMPARE(incubator.statuses.size(), 3); QCOMPARE(incubator.statuses.at(0), int(QQmlIncubator::Loading)); QCOMPARE(incubator.statuses.at(1), -1); QCOMPARE(incubator.statuses.at(2), int(QQmlIncubator::Ready)); diff --git a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp index 03add4b309..4908ca210b 100644 --- a/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp +++ b/tests/auto/qml/qqmlinfo/tst_qqmlinfo.cpp @@ -226,7 +226,7 @@ void tst_qqmlinfo::attachedObject() QScopedPointer<QObject> object(component.create()); QVERIFY2(object != nullptr, qPrintable(component.errorString())); - QCOMPARE(warningSpy.count(), 2); + QCOMPARE(warningSpy.size(), 2); // The Attached C++ type has no QML engine since it was created in C++, so we should see its parent instead. const auto cppWarnings = warningSpy.at(0).first().value<QList<QQmlError>>(); diff --git a/tests/auto/qml/qqmlinstantiator/stringmodel.h b/tests/auto/qml/qqmlinstantiator/stringmodel.h index 69d617a07f..d9676b9460 100644 --- a/tests/auto/qml/qqmlinstantiator/stringmodel.h +++ b/tests/auto/qml/qqmlinstantiator/stringmodel.h @@ -37,7 +37,7 @@ public: int rowCount(const QModelIndex &) const override { - return items.count(); + return items.size(); } QHash<int, QByteArray> roleNames() const override @@ -72,7 +72,7 @@ public: QVariant data (const QModelIndex & index, int role) const override { int row = index.row(); - if ((row<0) || (row>=items.count())) + if ((row<0) || (row>=items.size())) return QVariant(QMetaType(QMetaType::UnknownType)); switch (role) { diff --git a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp index aeca3f4046..1097c65f02 100644 --- a/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp +++ b/tests/auto/qml/qqmlinstantiator/tst_qqmlinstantiator.cpp @@ -124,19 +124,19 @@ void tst_qqmlinstantiator::activeProperty() QCOMPARE(instantiator->count(), 0); QVERIFY(instantiator->delegate()->isReady()); - QCOMPARE(activeSpy.count(), 0); - QCOMPARE(countSpy.count(), 0); - QCOMPARE(objectSpy.count(), 0); - QCOMPARE(modelSpy.count(), 0); + QCOMPARE(activeSpy.size(), 0); + QCOMPARE(countSpy.size(), 0); + QCOMPARE(objectSpy.size(), 0); + QCOMPARE(modelSpy.size(), 0); instantiator->setActive(true); QCOMPARE(instantiator->isActive(), true); QCOMPARE(instantiator->count(), 1); - QCOMPARE(activeSpy.count(), 1); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(objectSpy.count(), 1); - QCOMPARE(modelSpy.count(), 0); + QCOMPARE(activeSpy.size(), 1); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(objectSpy.size(), 1); + QCOMPARE(modelSpy.size(), 0); QObject *object = instantiator->object(); QVERIFY(object); @@ -178,18 +178,18 @@ void tst_qqmlinstantiator::intModelChange() QSignalSpy modelSpy(instantiator, SIGNAL(modelChanged())); QCOMPARE(instantiator->count(), 10); - QCOMPARE(activeSpy.count(), 0); - QCOMPARE(countSpy.count(), 0); - QCOMPARE(objectSpy.count(), 0); - QCOMPARE(modelSpy.count(), 0); + QCOMPARE(activeSpy.size(), 0); + QCOMPARE(countSpy.size(), 0); + QCOMPARE(objectSpy.size(), 0); + QCOMPARE(modelSpy.size(), 0); instantiator->setModel(QVariant(2)); QCOMPARE(instantiator->count(), 2); - QCOMPARE(activeSpy.count(), 0); - QCOMPARE(countSpy.count(), 1); - QCOMPARE(objectSpy.count(), 2); - QCOMPARE(modelSpy.count(), 1); + QCOMPARE(activeSpy.size(), 0); + QCOMPARE(countSpy.size(), 1); + QCOMPARE(objectSpy.size(), 2); + QCOMPARE(modelSpy.size(), 1); for (int i=0; i<2; i++) { QObject *object = instantiator->objectAt(i); @@ -267,7 +267,7 @@ void tst_qqmlinstantiator::handlerWithParent() QScopedPointer<QObject> rootObject(component.create()); QVERIFY(rootObject != nullptr); const auto handlers = rootObject->findChildren<QObject *>("pointHandler"); - QCOMPARE(handlers.count(), 2); + QCOMPARE(handlers.size(), 2); for (const auto *h : handlers) { QCOMPARE(h->parent(), rootObject.data()); } diff --git a/tests/auto/qml/qqmlitemmodels/qtestmodel.h b/tests/auto/qml/qqmlitemmodels/qtestmodel.h index 9839e4c7f9..6cbec533b1 100644 --- a/tests/auto/qml/qqmlitemmodels/qtestmodel.h +++ b/tests/auto/qml/qqmlitemmodels/qtestmodel.h @@ -74,7 +74,7 @@ public: Node *n = (Node*)parent.internalPointer(); if (!n) n = tree; - return n->children.count(); + return n->children.size(); } int columnCount(const QModelIndex& parent = QModelIndex()) const override { @@ -97,7 +97,7 @@ public: Node *pn = (Node*)parent.internalPointer(); if (!pn) pn = tree; - if (row >= pn->children.count()) + if (row >= pn->children.size()) return QModelIndex(); Node *n = pn->children.at(row); @@ -130,7 +130,7 @@ public: if (pn != tree) pn = pn->parent; if (idx.row() < 0 || idx.column() < 0 || idx.column() >= cols - || idx.row() >= pn->children.count()) { + || idx.row() >= pn->children.size()) { wrongIndex = true; qWarning("Invalid modelIndex [%d,%d,%p]", idx.row(), idx.column(), idx.internalPointer()); @@ -268,15 +268,15 @@ public: void addRows(int row, int count) { if (count > 0) { - children.reserve(children.count() + count); + children.reserve(children.size() + count); children.insert(row, count, (Node *)0); } } void removeRows(int row, int count, bool keepAlive = false) { - int newCount = qMax(children.count() - count, 0); - int effectiveCountDiff = children.count() - newCount; + int newCount = qMax(children.size() - count, 0); + int effectiveCountDiff = children.size() - newCount; if (effectiveCountDiff > 0) { if (!keepAlive) for (int i = 0; i < effectiveCountDiff; i++) diff --git a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp index f046fcd35d..fc5164629e 100644 --- a/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp +++ b/tests/auto/qml/qqmlitemmodels/tst_qqmlitemmodels.cpp @@ -163,7 +163,7 @@ void tst_qqmlitemmodels::itemSelection() QCOMPARE(isVariant.userType(), qMetaTypeId<QItemSelection>()); const QItemSelection &sel = isVariant.value<QItemSelection>(); - QCOMPARE(sel.count(), object->itemSelection().count()); + QCOMPARE(sel.size(), object->itemSelection().size()); QCOMPARE(sel, object->itemSelection()); } } diff --git a/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp b/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp index 315b085f1e..a935f9f70d 100644 --- a/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp +++ b/tests/auto/qml/qqmljsscope/tst_qqmljsscope.cpp @@ -37,7 +37,7 @@ class tst_qqmljsscope : public QQmlDataTest QFile f(fi.absoluteFilePath()); f.open(QIODevice::ReadOnly); QByteArray data(fi.size(), Qt::Uninitialized); - f.read(data.data(), data.length()); + f.read(data.data(), data.size()); return QString::fromUtf8(data); } diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp index 4af9975408..f571429b07 100644 --- a/tests/auto/qml/qqmllanguage/testtypes.cpp +++ b/tests/auto/qml/qqmllanguage/testtypes.cpp @@ -189,7 +189,7 @@ void CustomBinding::componentComplete() void EnumSupportingCustomParser::verifyBindings(const QQmlRefPointer<QV4::ExecutableCompilationUnit> &compilationUnit, const QList<const QV4::CompiledData::Binding *> &bindings) { - if (bindings.count() != 1) { + if (bindings.size() != 1) { error(bindings.first(), QStringLiteral("Custom parser invoked incorrectly for unit test")); return; } @@ -221,7 +221,7 @@ void SimpleObjectCustomParser::applyBindings(QObject *object, const QQmlRefPoint { SimpleObjectWithCustomParser *o = qobject_cast<SimpleObjectWithCustomParser*>(object); Q_ASSERT(o); - o->setCustomBindingsCount(bindings.count()); + o->setCustomBindingsCount(bindings.size()); } diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 8b9386f88d..254b19c9e2 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -1706,7 +1706,7 @@ void tst_qqmllanguage::propertyValueSource() valueSources.append(child); } - QCOMPARE(valueSources.count(), 1); + QCOMPARE(valueSources.size(), 1); MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); QVERIFY(valueSource != nullptr); @@ -1727,7 +1727,7 @@ void tst_qqmllanguage::propertyValueSource() valueSources.append(child); } - QCOMPARE(valueSources.count(), 1); + QCOMPARE(valueSources.size(), 1); MyPropertyValueSource *valueSource = qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); QVERIFY(valueSource != nullptr); @@ -2851,7 +2851,7 @@ void tst_qqmllanguage::testType(const QString& qml, const QString& type, const Q actualerror.append("; "); actualerror.append(e.description()); } - QCOMPARE(actualerror.left(partialMatch ? expectederror.length(): -1),expectederror); + QCOMPARE(actualerror.left(partialMatch ? expectederror.size(): -1),expectederror); } else { VERIFY_ERRORS(0); QScopedPointer<QObject> object(component.create()); @@ -3301,7 +3301,7 @@ void tst_qqmllanguage::importsPath() ThreadedTestHTTPServer server(dataDirectory()); - for (int i = 0; i < importPath.count(); ++i) + for (int i = 0; i < importPath.size(); ++i) importPath[i].replace(QStringLiteral("{{ServerBaseUrl}}"), server.baseUrl().toString()); engine.setImportPathList(QStringList(defaultImportPathList) << importPath); @@ -3429,7 +3429,7 @@ void tst_qqmllanguage::importIncorrectCase() QQmlComponent component(&engine, testFileUrl("ImportIncorrectCase.qml")); QList<QQmlError> errors = component.errors(); - QCOMPARE(errors.count(), 1); + QCOMPARE(errors.size(), 1); const QString expectedError = isCaseSensitiveFileSystem(dataDirectory()) ? QStringLiteral("No such file or directory") : @@ -3516,7 +3516,7 @@ void tst_qqmllanguage::importJs() QCOMPARE(actual.size(), expected.size()); for (int i = 0; i < expected.size(); ++i) { - const int compareLen = qMin(expected.at(i).length(), actual.at(i).length()); + const int compareLen = qMin(expected.at(i).size(), actual.at(i).size()); QCOMPARE(actual.at(i).left(compareLen), expected.at(i).left(compareLen)); } } @@ -3565,7 +3565,7 @@ void tst_qqmllanguage::explicitSelfImport() engine.setImportPathList(QStringList(defaultImportPathList) << testFile("lib")); QQmlComponent component(&engine, testFileUrl("mixedModuleWithSelfImport.qml")); - QVERIFY(component.errors().count() == 0); + QVERIFY(component.errors().size() == 0); engine.setImportPathList(defaultImportPathList); } @@ -3736,7 +3736,7 @@ void tst_qqmllanguage::subclassedUncreateableRevision() c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QScopedPointer<QObject> obj(c.create()); QCOMPARE(obj.data(), static_cast<QObject*>(nullptr)); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QCOMPARE(c.errors().first().description(), QString("Cannot create MyUncreateableBaseClass")); } @@ -3791,7 +3791,7 @@ void tst_qqmllanguage::subclassedExtendedUncreateableRevision() c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); QScopedPointer<QObject> obj(c.create()); QCOMPARE(obj.data(), static_cast<QObject*>(nullptr)); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QCOMPARE(c.errors().first().description(), QString("Cannot create MyExtendedUncreateableBaseClass")); } @@ -4170,8 +4170,8 @@ void tst_qqmllanguage::globalEnums() QVERIFY(enum2Class->getValueE() == MyEnum2Class::E_14); QVERIFY(enum2Class->getValueE2() == MyEnum2Class::E_76); - QVERIFY(signalA.count() == 1); - QVERIFY(signalB.count() == 1); + QVERIFY(signalA.size() == 1); + QVERIFY(signalB.size() == 1); QVERIFY(enum2Class->property("aValue") == MyEnum1Class::A_11); QVERIFY(enum2Class->property("bValue") == 37); @@ -5012,13 +5012,13 @@ void tst_qqmllanguage::deferredProperties() QQmlData *qmlData = QQmlData::get(object.data()); QVERIFY(qmlData); - QCOMPARE(qmlData->deferredData.count(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml - QCOMPARE(qmlData->deferredData.first()->bindings.count(), 3); // "innerobj", "innerlist1", "innerlist2" - QCOMPARE(qmlData->deferredData.last()->bindings.count(), 3); // "outerobj", "outerlist1", "outerlist2" + QCOMPARE(qmlData->deferredData.size(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml + QCOMPARE(qmlData->deferredData.first()->bindings.size(), 3); // "innerobj", "innerlist1", "innerlist2" + QCOMPARE(qmlData->deferredData.last()->bindings.size(), 3); // "outerobj", "outerlist1", "outerlist2" qmlExecuteDeferred(object.data()); - QCOMPARE(qmlData->deferredData.count(), 0); + QCOMPARE(qmlData->deferredData.size(), 0); innerObj = object->findChild<QObject *>(QStringLiteral("innerobj")); // MyDeferredListProperty.qml QVERIFY(innerObj); @@ -5129,16 +5129,16 @@ void tst_qqmllanguage::executeDeferredPropertiesOnce() QQmlData *qmlData = QQmlData::get(object.data()); QVERIFY(qmlData); - QCOMPARE(qmlData->deferredData.count(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml - QCOMPARE(qmlData->deferredData.first()->bindings.count(), 3); // "innerobj", "innerlist1", "innerlist2" - QCOMPARE(qmlData->deferredData.last()->bindings.count(), 3); // "outerobj", "outerlist1", "outerlist2" + QCOMPARE(qmlData->deferredData.size(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml + QCOMPARE(qmlData->deferredData.first()->bindings.size(), 3); // "innerobj", "innerlist1", "innerlist2" + QCOMPARE(qmlData->deferredData.last()->bindings.size(), 3); // "outerobj", "outerlist1", "outerlist2" // first execution creates the outer object testExecuteDeferredOnce(QQmlProperty(object.data(), "groupProperty")); - QCOMPARE(qmlData->deferredData.count(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml - QCOMPARE(qmlData->deferredData.first()->bindings.count(), 2); // "innerlist1", "innerlist2" - QCOMPARE(qmlData->deferredData.last()->bindings.count(), 2); // "outerlist1", "outerlist2" + QCOMPARE(qmlData->deferredData.size(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml + QCOMPARE(qmlData->deferredData.first()->bindings.size(), 2); // "innerlist1", "innerlist2" + QCOMPARE(qmlData->deferredData.last()->bindings.size(), 2); // "outerlist1", "outerlist2" QObjectList innerObjsAfterFirstExecute = object->findChildren<QObject *>(QStringLiteral("innerobj")); // MyDeferredListProperty.qml QVERIFY(innerObjsAfterFirstExecute.isEmpty()); @@ -5156,9 +5156,9 @@ void tst_qqmllanguage::executeDeferredPropertiesOnce() // re-execution does nothing (to avoid overriding the property) testExecuteDeferredOnce(QQmlProperty(object.data(), "groupProperty")); - QCOMPARE(qmlData->deferredData.count(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml - QCOMPARE(qmlData->deferredData.first()->bindings.count(), 2); // "innerlist1", "innerlist2" - QCOMPARE(qmlData->deferredData.last()->bindings.count(), 2); // "outerlist1", "outerlist2" + QCOMPARE(qmlData->deferredData.size(), 2); // MyDeferredListProperty.qml + deferredListProperty.qml + QCOMPARE(qmlData->deferredData.first()->bindings.size(), 2); // "innerlist1", "innerlist2" + QCOMPARE(qmlData->deferredData.last()->bindings.size(), 2); // "outerlist1", "outerlist2" QObjectList innerObjsAfterSecondExecute = object->findChildren<QObject *>(QStringLiteral("innerobj")); // MyDeferredListProperty.qml QVERIFY(innerObjsAfterSecondExecute.isEmpty()); @@ -5175,7 +5175,7 @@ void tst_qqmllanguage::executeDeferredPropertiesOnce() // execution of a list property should execute all outer list bindings testExecuteDeferredOnce(QQmlProperty(object.data(), "listProperty")); - QCOMPARE(qmlData->deferredData.count(), 0); + QCOMPARE(qmlData->deferredData.size(), 0); listProperty = object->property("listProperty").value<QQmlListProperty<QObject>>(); QCOMPARE(listProperty.count(&listProperty), 2); @@ -5692,10 +5692,10 @@ void tst_qqmllanguage::extendedForeignTypes() QCOMPARE(o->property("extendedExtension").toInt(), 42); QCOMPARE(o->property("foreignExtendedExtension").toInt(), 42); - QCOMPARE(extensionChangedSpy.count(), 0); + QCOMPARE(extensionChangedSpy.size(), 0); extended->setProperty("extension", 44); - QCOMPARE(extensionChangedSpy.count(), 1); - QCOMPARE(extensionChangedWithValueSpy.count(), 1); + QCOMPARE(extensionChangedSpy.size(), 1); + QCOMPARE(extensionChangedWithValueSpy.size(), 1); QCOMPARE(o->property("extendedChangeCount").toInt(), 1); QCOMPARE(o->property("extendedExtension").toInt(), 44); @@ -6174,7 +6174,7 @@ void tst_qqmllanguage::checkUncreatableNoReason() QString qml = QString("import QtQuick 2.0\nimport qt.uncreatable.noreason 1.0\nUncreatableElementNoReason {}"); QQmlComponent c(&engine); c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); - QCOMPARE(c.errors().count(), 1); + QCOMPARE(c.errors().size(), 1); QCOMPARE(c.errors().first().description(), QString("Type cannot be created in QML.")); } @@ -6185,7 +6185,7 @@ void tst_qqmllanguage::checkURLtoURLObject() "Component.onCompleted: { new URL(parent.source); } }"); QQmlComponent c(&engine); c.setData(qml.toUtf8(), QUrl::fromLocalFile(QDir::currentPath())); - QCOMPARE(c.errors().count(), 0); + QCOMPARE(c.errors().size(), 0); } struct TestValueType @@ -6390,7 +6390,7 @@ void tst_qqmllanguage::qtbug_85932() QQmlComponent c(&engine, testFileUrl("qtbug_85932.qml")); QScopedPointer<QObject> obj(c.create()); - QTRY_COMPARE(allWarnings.count(), 2); + QTRY_COMPARE(allWarnings.size(), 2); QCOMPARE(allWarnings.at(0).toString(), warning1); QCOMPARE(allWarnings.at(1).toString(), warning2); } @@ -7134,13 +7134,13 @@ void tst_qqmllanguage::valueTypeList() QCOMPARE(qvariant_cast<QPointF>(o->property("d")), QPointF(3, 4)); QCOMPARE(qvariant_cast<DerivedValueType>(o->property("y")).content(), 29); const QList<DerivedValueType> x = qvariant_cast<QList<DerivedValueType>>(o->property("x")); - QCOMPARE(x.length(), 3); + QCOMPARE(x.size(), 3); for (const DerivedValueType &d : x) QCOMPARE(d.content(), 29); const QList<BaseValueType> baseList = qvariant_cast<QList<BaseValueType>>(o->property("baseList")); - QCOMPARE(baseList.length(), 3); + QCOMPARE(baseList.size(), 3); for (const BaseValueType &b : baseList) QCOMPARE(b.content(), 29); @@ -7155,13 +7155,13 @@ void tst_qqmllanguage::valueTypeList() QCOMPARE(qvariant_cast<QPointF>(o->property("d")), QPointF(12, 4)); QCOMPARE(qvariant_cast<DerivedValueType>(o->property("y")).content(), 30); const QList<DerivedValueType> x = qvariant_cast<QList<DerivedValueType>>(o->property("x")); - QCOMPARE(x.length(), 3); + QCOMPARE(x.size(), 3); for (const DerivedValueType &d : x) QCOMPARE(d.content(), 30); const QList<BaseValueType> baseList = qvariant_cast<QList<BaseValueType>>(o->property("baseList")); - QCOMPARE(baseList.length(), 3); + QCOMPARE(baseList.size(), 3); for (const BaseValueType &b : baseList) QCOMPARE(b.content(), 30); } @@ -7460,8 +7460,8 @@ static void listsEqual(QObject *object, const char *method) const QList<QRectF> jsArrayProperty = object->property(jsArrayPropertyName.constData()).value<QList<QRectF>>(); - const qsizetype v4SequenceCount = v4SequenceProperty.count(); - QCOMPARE(v4SequenceCount, jsArrayProperty.count()); + const qsizetype v4SequenceCount = v4SequenceProperty.size(); + QCOMPARE(v4SequenceCount, jsArrayProperty.size()); for (qsizetype i = 0; i < v4SequenceCount; ++i) QCOMPARE(v4SequenceProperty.at(i), jsArrayProperty.at(i)); diff --git a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp index dd9df84867..2d02cac9f8 100644 --- a/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp +++ b/tests/auto/qml/qqmllistcompositor/tst_qqmllistcompositor.cpp @@ -1022,7 +1022,7 @@ void tst_qqmllistcompositor::moveFromEnd() QVector<C::Insert> inserts; compositor.listItemsInserted(a, 0, 1, &inserts); - QCOMPARE(inserts.count(), 1); + QCOMPARE(inserts.size(), 1); QCOMPARE(inserts.at(0).index[1], 1); QCOMPARE(inserts.at(0).count, 1); diff --git a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp index 7f31e43b1e..5550d2788e 100644 --- a/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp +++ b/tests/auto/qml/qqmllistmodel/tst_qqmllistmodel.cpp @@ -597,7 +597,7 @@ void tst_qqmllistmodel::dynamic() QCOMPARE(actual,result); if (model.count() > 0) - QVERIFY(spyCount.count() > 0); + QVERIFY(spyCount.size() > 0); } void tst_qqmllistmodel::enumerate() @@ -705,7 +705,7 @@ void tst_qqmllistmodel::error() } else { QVERIFY(component.isError()); QList<QQmlError> errors = component.errors(); - QCOMPARE(errors.count(),1); + QCOMPARE(errors.size(),1); QCOMPARE(errors.at(0).description(),error); } } @@ -803,7 +803,7 @@ void tst_qqmllistmodel::get() QCOMPARE(model->data(index, role), roleValue); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> spyResult = spy.takeFirst(); QCOMPARE(spyResult.at(0).value<QModelIndex>(), model->index(index, 0, QModelIndex())); @@ -904,7 +904,7 @@ void tst_qqmllistmodel::get_nested() testData << qMakePair(1, QString("listRoleB")); testData << qMakePair(1, QString("listRoleC")); - for (int i=0; i<testData.count(); i++) { + for (int i=0; i<testData.size(); i++) { int outerListIndex = testData[i].first; QString outerListRoleName = testData[i].second; int outerListRole = roleFromName(model, outerListRoleName); @@ -927,7 +927,7 @@ void tst_qqmllistmodel::get_nested() } else { QCOMPARE(childModel->data(index, role), roleValue); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> spyResult = spy.takeFirst(); QCOMPARE(spyResult.at(0).value<QModelIndex>(), childModel->index(index, 0, QModelIndex())); @@ -1097,7 +1097,7 @@ void tst_qqmllistmodel::property_changes() expr.evaluate(); QVERIFY2(!expr.hasError(), qPrintable(expr.error().toString())); - QString signalHandler = "on" + QString(roleName[0].toUpper()) + roleName.mid(1, roleName.length()) + "Changed:"; + QString signalHandler = "on" + QString(roleName[0].toUpper()) + roleName.mid(1, roleName.size()) + "Changed:"; QString qml = "import QtQuick 2.0\n" "Connections {\n" "property bool gotSignal: false\n" @@ -1122,11 +1122,11 @@ void tst_qqmllistmodel::property_changes() // test itemsChanged() is emitted correctly if (itemsChanged) { - QCOMPARE(spyItemsChanged.count(), 1); + QCOMPARE(spyItemsChanged.size(), 1); QCOMPARE(spyItemsChanged.at(0).at(0).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); QCOMPARE(spyItemsChanged.at(0).at(1).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); } else { - QCOMPARE(spyItemsChanged.count(), 0); + QCOMPARE(spyItemsChanged.size(), 0); } expr.setExpression(testExpression); @@ -1643,7 +1643,7 @@ void tst_qqmllistmodel::crash_append_empty_array() QQmlExpression expr(engine.rootContext(), model, "append(new Array())"); expr.evaluate(); QVERIFY2(!expr.hasError(), qPrintable(expr.error().toString())); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); } void tst_qqmllistmodel::dynamic_roles_crash_QTBUG_38907() diff --git a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp index 6a9cc93abd..ae7f2ce19b 100644 --- a/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp +++ b/tests/auto/qml/qqmllistmodelworkerscript/tst_qqmllistmodelworkerscript.cpp @@ -331,8 +331,8 @@ void tst_qqmllistmodelworkerscript::dynamic_worker() QSignalSpy spyCount(&model, SIGNAL(countChanged())); - if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) - script = script.mid(1, script.length() - 2); + if (script[0] == QLatin1Char('{') && script[script.size()-1] == QLatin1Char('}')) + script = script.mid(1, script.size() - 2); QVariantList operations; foreach (const QString &s, script.split(';')) { if (!s.isEmpty()) @@ -348,7 +348,7 @@ void tst_qqmllistmodelworkerscript::dynamic_worker() QCOMPARE(QQmlProperty(item, "result").read().toInt(), result); if (model.count() > 0) - QVERIFY(spyCount.count() > 0); + QVERIFY(spyCount.size() > 0); delete item; qApp->processEvents(); @@ -380,8 +380,8 @@ void tst_qqmllistmodelworkerscript::dynamic_worker_sync() QQuickItem *item = createWorkerTest(&eng, &component, &model); QVERIFY(item != nullptr); - if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) - script = script.mid(1, script.length() - 2); + if (script[0] == QLatin1Char('{') && script[script.size()-1] == QLatin1Char('}')) + script = script.mid(1, script.size() - 2); QVariantList operations; foreach (const QString &s, script.split(';')) { if (!s.isEmpty()) @@ -468,7 +468,7 @@ void tst_qqmllistmodelworkerscript::get_worker() QCOMPARE(model.data(index, role), roleValue); } - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> spyResult = spy.takeFirst(); QCOMPARE(spyResult.at(0).value<QModelIndex>(), model.index(index, 0, QModelIndex())); @@ -585,11 +585,11 @@ void tst_qqmllistmodelworkerscript::property_changes_worker() // test itemsChanged() is emitted correctly if (itemsChanged) { - QCOMPARE(spyItemsChanged.count(), 1); + QCOMPARE(spyItemsChanged.size(), 1); QCOMPARE(spyItemsChanged.at(0).at(0).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); QCOMPARE(spyItemsChanged.at(0).at(1).value<QModelIndex>(), model.index(listIndex, 0, QModelIndex())); } else { - QCOMPARE(spyItemsChanged.count(), 0); + QCOMPARE(spyItemsChanged.size(), 0); } delete item; @@ -638,32 +638,32 @@ void tst_qqmllistmodelworkerscript::worker_sync() QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 1); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 0); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 2); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 1); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 1); QVERIFY(QMetaObject::invokeMethod(item, "addItemViaWorker")); waitForWorker(item); QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 2); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 1); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 1); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 2); QCOMPARE(childModel->count(), 3); - QCOMPARE(spyModelInserted.count(), 0); - QCOMPARE(spyChildInserted.count(), 2); + QCOMPARE(spyModelInserted.size(), 0); + QCOMPARE(spyChildInserted.size(), 2); delete item; qApp->processEvents(); @@ -688,7 +688,7 @@ void tst_qqmllistmodelworkerscript::worker_remove_element() QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "addItem")); @@ -698,13 +698,13 @@ void tst_qqmllistmodelworkerscript::worker_remove_element() waitForWorker(item); QCOMPARE(model.count(), 1); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 1); + QCOMPARE(spyModelRemoved.size(), 1); delete item; qApp->processEvents(); @@ -751,7 +751,7 @@ void tst_qqmllistmodelworkerscript::worker_remove_list() QSignalSpy spyModelRemoved(&model, SIGNAL(rowsRemoved(QModelIndex,int,int))); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "addList")); @@ -761,13 +761,13 @@ void tst_qqmllistmodelworkerscript::worker_remove_list() waitForWorker(item); QCOMPARE(model.count(), 1); - QCOMPARE(spyModelRemoved.count(), 0); + QCOMPARE(spyModelRemoved.size(), 0); QVERIFY(QMetaObject::invokeMethod(item, "doSync")); waitForWorker(item); QCOMPARE(model.count(), 0); - QCOMPARE(spyModelRemoved.count(), 1); + QCOMPARE(spyModelRemoved.size(), 1); delete item; qApp->processEvents(); @@ -798,8 +798,8 @@ void tst_qqmllistmodelworkerscript::dynamic_role() QQmlExpression preExp(engine.rootContext(), &model, preamble); QCOMPARE(preExp.evaluate().toInt(), 0); - if (script[0] == QLatin1Char('{') && script[script.length()-1] == QLatin1Char('}')) - script = script.mid(1, script.length() - 2); + if (script[0] == QLatin1Char('{') && script[script.size()-1] == QLatin1Char('}')) + script = script.mid(1, script.size() - 2); QVariantList operations; foreach (const QString &s, script.split(';')) { if (!s.isEmpty()) diff --git a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp index 2a7382922a..29b2f1d122 100644 --- a/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp +++ b/tests/auto/qml/qqmllistreference/tst_qqmllistreference.cpp @@ -170,7 +170,7 @@ void tst_qqmllistreference::qmllistreference() QVERIFY(fromVar.isValid()); QCOMPARE(fromVar.count(), 1); fromVar.append(&tt); - QCOMPARE(tt.data.count(), 2); + QCOMPARE(tt.data.size(), 2); } void tst_qqmllistreference::qmllistreference_invalid() @@ -545,13 +545,13 @@ void tst_qqmllistreference::append() { QQmlListReference ref(tt, "data"); QVERIFY(ref.append(tt)); - QCOMPARE(tt->data.count(), 1); + QCOMPARE(tt->data.size(), 1); QCOMPARE(tt->data.at(0), tt); QVERIFY(!ref.append(&object)); - QCOMPARE(tt->data.count(), 1); + QCOMPARE(tt->data.size(), 1); QCOMPARE(tt->data.at(0), tt); QVERIFY(ref.append(nullptr)); - QCOMPARE(tt->data.count(), 2); + QCOMPARE(tt->data.size(), 2); QCOMPARE(tt->data.at(0), tt); QVERIFY(!tt->data.at(1)); delete tt; @@ -622,7 +622,7 @@ void tst_qqmllistreference::clear() { QQmlListReference ref(tt, "data"); QVERIFY(ref.clear()); - QCOMPARE(tt->data.count(), 0); + QCOMPARE(tt->data.size(), 0); delete tt; QVERIFY(!ref.clear()); } @@ -718,9 +718,9 @@ void tst_qqmllistreference::removeLast() { QQmlListReference ref(tt.get(), "data"); - QCOMPARE(tt->data.count(), 3); + QCOMPARE(tt->data.size(), 3); QVERIFY(ref.removeLast()); - QCOMPARE(tt->data.count(), 2); + QCOMPARE(tt->data.size(), 2); tt.reset(); QVERIFY(!ref.removeLast()); } diff --git a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp index 7c823a3d60..71aea9ae2c 100644 --- a/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp +++ b/tests/auto/qml/qqmllocale/tst_qqmllocale.cpp @@ -484,9 +484,9 @@ void tst_qqmllocale::weekDays() QList<QVariant> qmlDays = val.toList(); QList<Qt::DayOfWeek> days = QLocale(locale).weekdays(); - QCOMPARE(days.count(), qmlDays.count()); + QCOMPARE(days.size(), qmlDays.size()); - for (int i = 0; i < days.count(); ++i) { + for (int i = 0; i < days.size(); ++i) { int day = int(days.at(i)); if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday) day = 0; @@ -524,9 +524,9 @@ void tst_qqmllocale::uiLanguages() QList<QVariant> qmlLangs = val.toList(); QStringList langs = QLocale(locale).uiLanguages(); - QCOMPARE(langs.count(), qmlLangs.count()); + QCOMPARE(langs.size(), qmlLangs.size()); - for (int i = 0; i < langs.count(); ++i) { + for (int i = 0; i < langs.size(); ++i) { QCOMPARE(langs.at(i), qmlLangs.at(i).toString()); } } diff --git a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp index ed6f24aaf3..d945f460eb 100644 --- a/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp +++ b/tests/auto/qml/qqmlmetaobject/tst_qqmlmetaobject.cpp @@ -227,18 +227,18 @@ void tst_QQmlMetaObject::property() QCOMPARE(value, expectedValue); else QVERIFY(value.isValid()); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); if (isWritable) { QVERIFY(prop.write(object, newValue)); - QCOMPARE(changedSpy.count(), 1); + QCOMPARE(changedSpy.size(), 1); QVariant value = prop.read(object); if (value.userType() == qMetaTypeId<QJSValue>()) value = value.value<QJSValue>().toVariant(); QCOMPARE(value, newValue); } else { QVERIFY(!prop.write(object, prop.read(object))); - QCOMPARE(changedSpy.count(), 0); + QCOMPARE(changedSpy.size(), 0); } } diff --git a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp index b36a43243d..a4901aebad 100644 --- a/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp +++ b/tests/auto/qml/qqmlmoduleplugin/tst_qqmlmoduleplugin.cpp @@ -133,7 +133,7 @@ void registerStaticPlugin(const char *uri) PluginType::metaData.append(QCborValue(QCborMap::fromJsonObject(md)).toCbor()); auto rawMetaDataFunctor = []() -> QPluginMetaData { - return {reinterpret_cast<const uchar *>(PluginType::metaData.constData()), size_t(PluginType::metaData.length())}; + return {reinterpret_cast<const uchar *>(PluginType::metaData.constData()), size_t(PluginType::metaData.size())}; }; QStaticPlugin plugin(instanceFunctor, rawMetaDataFunctor); qRegisterStaticPluginFunction(plugin); @@ -235,7 +235,7 @@ void tst_qqmlmoduleplugin::incorrectPluginCase() QQmlComponent component(&engine, testFileUrl(QStringLiteral("incorrectCase.qml"))); QList<QQmlError> errors = component.errors(); - QCOMPARE(errors.count(), 1); + QCOMPARE(errors.size(), 1); QString expectedError = QLatin1String("module \"org.qtproject.WrongCase\" plugin \"PluGin\" not found"); @@ -566,7 +566,7 @@ void tst_qqmlmoduleplugin::importStrictModule() QVERIFY(object != nullptr); } else { QVERIFY(!component.isReady()); - QCOMPARE(component.errors().count(), 1); + QCOMPARE(component.errors().size(), 1); QCOMPARE(component.errors().first().toString(), url.toString() + error); } } diff --git a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp index 438dc3d3c2..4cbaa76225 100644 --- a/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp +++ b/tests/auto/qml/qqmlobjectmodel/tst_qqmlobjectmodel.cpp @@ -65,81 +65,81 @@ void tst_QQmlObjectModel::changes() model.append(&item0); items.append(&item0); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // insert(0, item1) -> [item1, item0] model.insert(0, &item1); items.insert(0, &item1); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // append(item2) -> [item1, item0, item2] model.append(&item2); items.append(&item2); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // insert(2, item3) -> [item1, item0, item3, item2] model.insert(2, &item3); items.insert(2, &item3); QCOMPARE(model.count(), ++count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 0, false)); // move(0, 1) -> [item0, item1, item3, item2] model.move(0, 1); items.move(0, 1); QCOMPARE(model.count(), count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true, 1)); // move(3, 2) -> [item0, item1, item2, item3] model.move(3, 2); items.move(3, 2); QCOMPARE(model.count(), count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 1, 1, true, 2)); // remove(0) -> [item1, item2, item3] model.remove(0); items.removeAt(0); QCOMPARE(model.count(), --count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 1, false)); // remove(2) -> [item1, item2] model.remove(2); items.removeAt(2); QCOMPARE(model.count(), --count); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 1, false)); // clear() -> [] model.clear(); items.clear(); QCOMPARE(model.count(), 0); QVERIFY(compareItems(&model, items)); - QCOMPARE(countSpy.count(), ++countSignals); - QCOMPARE(childrenSpy.count(), ++childrenSignals); - QCOMPARE(modelUpdateSpy.count(), ++modelUpdateSignals); + QCOMPARE(countSpy.size(), ++countSignals); + QCOMPARE(childrenSpy.size(), ++childrenSignals); + QCOMPARE(modelUpdateSpy.size(), ++modelUpdateSignals); QVERIFY(verifyChangeSet(modelUpdateSpy.last().first().value<QQmlChangeSet>(), 0, 2, false)); } diff --git a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp index f0a3c19d16..f8367acd49 100644 --- a/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp +++ b/tests/auto/qml/qqmlparser/tst_qqmlparser.cpp @@ -205,7 +205,7 @@ public: int lastNewline = found.lastIndexOf(QLatin1Char('\n')); if (lastNewline < 0) lastNewline = -int(combined.startColumn); - QCOMPARE(cEnd.startColumn, found.length() - lastNewline); + QCOMPARE(cEnd.startColumn, found.size() - lastNewline); } private: QString m_codeStr; @@ -235,7 +235,7 @@ void tst_qqmlparser::initTestCase() QStringList tst_qqmlparser::findFiles(const QDir &d) { - for (int ii = 0; ii < excludedDirs.count(); ++ii) { + for (int ii = 0; ii < excludedDirs.size(); ++ii) { QString s = excludedDirs.at(ii); if (d.absolutePath().endsWith(s)) return QStringList(); @@ -681,7 +681,7 @@ void tst_qqmlparser::annotations_data() for (const QString &file: qAsConst(files)) { auto fileNameStart = file.lastIndexOf(QDir::separator()); - auto fileName = QStringView(file).mid(fileNameStart, file.length()-fileNameStart); + auto fileName = QStringView(file).mid(fileNameStart, file.size()-fileNameStart); auto ref=std::find_if(refFiles.constBegin(),refFiles.constEnd(), [fileName](const QString &s){ return s.endsWith(fileName); }); if (ref != refFiles.constEnd()) QTest::newRow(qPrintable(file)) << file << *ref; diff --git a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp index aac9c5229f..3c3e0ba1e9 100644 --- a/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp +++ b/tests/auto/qml/qqmlpropertymap/tst_qqmlpropertymap.cpp @@ -90,7 +90,7 @@ void tst_QQmlPropertyMap::insert() QQmlPropertyMap map; map.insert(QLatin1String("key1"),100); map.insert(QLatin1String("key2"),200); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); @@ -103,33 +103,33 @@ void tst_QQmlPropertyMap::insert() //QQmlPropertyMap has an invokable keys() method QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("keys"), 1); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains(QLatin1String("keys"))); QVERIFY(map.value(QLatin1String("keys")).isNull()); //QQmlPropertyMap has a deleteLater() slot QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("deleteLater"), 1); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains(QLatin1String("deleteLater"))); QVERIFY(map.value(QLatin1String("deleteLater")).isNull()); //QQmlPropertyMap has an valueChanged() signal QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols."); map.insert(QLatin1String("valueChanged"), 1); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains(QLatin1String("valueChanged"))); QVERIFY(map.value(QLatin1String("valueChanged")).isNull()); //but 'valueChange' should be ok map.insert(QLatin1String("valueChange"), 1); - QCOMPARE(map.keys().count(), 3); + QCOMPARE(map.keys().size(), 3); QVERIFY(map.contains(QLatin1String("valueChange"))); QCOMPARE(map.value(QLatin1String("valueChange")), QVariant(1)); //'valueCHANGED' should be ok, too map.insert(QLatin1String("valueCHANGED"), 1); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(map.contains(QLatin1String("valueCHANGED"))); QCOMPARE(map.value(QLatin1String("valueCHANGED")), QVariant(1)); } @@ -144,7 +144,7 @@ void tst_QQmlPropertyMap::insertMany() QQmlPropertyMap map; map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); @@ -162,7 +162,7 @@ void tst_QQmlPropertyMap::insertMany() //QQmlPropertyMap has an invokable keys() method QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"keys\" is not permitted, conflicts with internal symbols."); map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(!map.contains(QLatin1String("keys"))); QVERIFY(map.value(QLatin1String("keys")).isNull()); @@ -171,7 +171,7 @@ void tst_QQmlPropertyMap::insertMany() //QQmlPropertyMap has a deleteLater() slot QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"deleteLater\" is not permitted, conflicts with internal symbols."); map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(!map.contains(QLatin1String("deleteLater"))); QVERIFY(map.value(QLatin1String("deleteLater")).isNull()); @@ -180,13 +180,13 @@ void tst_QQmlPropertyMap::insertMany() //QQmlPropertyMap has an valueChanged() signal QTest::ignoreMessage(QtWarningMsg, "Creating property with name \"valueChanged\" is not permitted, conflicts with internal symbols."); map.insert(values); - QCOMPARE(map.keys().count(), 4); + QCOMPARE(map.keys().size(), 4); QVERIFY(!map.contains(QLatin1String("valueChanged"))); QVERIFY(map.value(QLatin1String("valueChanged")).isNull()); values.remove(QStringLiteral("valueChanged")); map.insert(values); // Adds "foobar" and changes "key1" - QCOMPARE(map.keys().count(), 5); + QCOMPARE(map.keys().size(), 5); QCOMPARE(map.value(QStringLiteral("foobar")).toInt(), 12); QCOMPARE(map.value(QStringLiteral("key1")).toInt(), 100); } @@ -196,7 +196,7 @@ void tst_QQmlPropertyMap::operatorInsert() QQmlPropertyMap map; map[QLatin1String("key1")] = 100; map[QLatin1String("key2")] = 200; - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); @@ -225,12 +225,12 @@ void tst_QQmlPropertyMap::clear() { QQmlPropertyMap map; map.insert(QLatin1String("key1"),100); - QCOMPARE(map.keys().count(), 1); + QCOMPARE(map.keys().size(), 1); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); map.clear(QLatin1String("key1")); - QCOMPARE(map.keys().count(), 1); + QCOMPARE(map.keys().size(), 1); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant()); } @@ -241,10 +241,10 @@ void tst_QQmlPropertyMap::changed() QSignalSpy spy(&map, SIGNAL(valueChanged(QString,QVariant))); map.insert(QLatin1String("key1"),100); map.insert(QLatin1String("key2"),200); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); map.clear(QLatin1String("key1")); - QCOMPARE(spy.count(), 0); + QCOMPARE(spy.size(), 0); //make changes in QML QQmlEngine engine; @@ -257,9 +257,9 @@ void tst_QQmlPropertyMap::changed() QScopedPointer<QQuickText> txt(qobject_cast<QQuickText*>(component.create())); QVERIFY(txt); QCOMPARE(txt->text(), QString('X')); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> arguments = spy.takeFirst(); - QCOMPARE(arguments.count(), 2); + QCOMPARE(arguments.size(), 2); QCOMPARE(arguments.at(0).toString(),QLatin1String("key1")); QCOMPARE(arguments.at(1).value<QVariant>(),QVariant("Hello World")); QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); @@ -485,7 +485,7 @@ void tst_QQmlPropertyMap::disallowExtending() "}\n", QUrl()); obj.reset(component.create()); QVERIFY(obj.isNull()); - QCOMPARE(component.errors().count(), 1); + QCOMPARE(component.errors().size(), 1); QCOMPARE(component.errors().at(0).toString(), QStringLiteral("<Unknown File>:3:1: Fully dynamic types cannot declare new properties.")); } @@ -524,24 +524,24 @@ void tst_QQmlPropertyMap::QTBUG_48136() QSignalSpy notifySpy(&map, QByteArray::number(QSIGNAL_CODE) + prop.notifySignal().methodSignature()); map.insert(key, 42); - QCOMPARE(notifySpy.count(), 1); + QCOMPARE(notifySpy.size(), 1); map.insert(key, 43); - QCOMPARE(notifySpy.count(), 2); + QCOMPARE(notifySpy.size(), 2); map.insert(key, 43); - QCOMPARE(notifySpy.count(), 2); + QCOMPARE(notifySpy.size(), 2); map.insert(key, 44); - QCOMPARE(notifySpy.count(), 3); + QCOMPARE(notifySpy.size(), 3); // // Test that the valueChanged signal is emitted correctly // QSignalSpy valueChangedSpy(&map, &QQmlPropertyMap::valueChanged); map.setProperty(key, 44); - QCOMPARE(valueChangedSpy.count(), 0); + QCOMPARE(valueChangedSpy.size(), 0); map.setProperty(key, 45); - QCOMPARE(valueChangedSpy.count(), 1); + QCOMPARE(valueChangedSpy.size(), 1); map.setProperty(key, 45); - QCOMPARE(valueChangedSpy.count(), 1); + QCOMPARE(valueChangedSpy.size(), 1); } void tst_QQmlPropertyMap::lookupsInSubTypes() @@ -560,14 +560,14 @@ void tst_QQmlPropertyMap::freeze() map.insert(QLatin1String("key1"),100); map.insert(QLatin1String("key2"),200); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(map.contains(QLatin1String("key1"))); QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); map.freeze(); map.insert(QLatin1String("key3"), 32); - QCOMPARE(map.keys().count(), 2); + QCOMPARE(map.keys().size(), 2); QVERIFY(!map.contains("key3")); map.insert(QLatin1String("key1"), QStringLiteral("Hello World")); @@ -652,7 +652,7 @@ void tst_QQmlPropertyMap::signalIndices() QSignalSpy spy(&map, method); map.insert(QLatin1String("key1"), 200); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } QTEST_MAIN(tst_QQmlPropertyMap) diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp index 595adf5f67..c3bf3b6181 100644 --- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp +++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp @@ -733,7 +733,7 @@ void tst_qqmlqt::createQmlObject() QQuickItem *item = qobject_cast<QQuickItem *>(object.data()); QVERIFY(item != nullptr); - QCOMPARE(item->childItems().count(), 1); + QCOMPARE(item->childItems().size(), 1); } @@ -825,7 +825,7 @@ void tst_qqmlqt::dateTimeFormatting() QVERIFY2(component.errorString().isEmpty(), qPrintable(component.errorString())); QVERIFY(object != nullptr); - QVERIFY(inputProperties.count() > 0); + QVERIFY(inputProperties.size() > 0); QVariant result; foreach(const QString &prop, inputProperties) { QVERIFY(QMetaObject::invokeMethod(object.data(), method.toUtf8().constData(), @@ -833,7 +833,7 @@ void tst_qqmlqt::dateTimeFormatting() Q_ARG(QVariant, prop))); QStringList output = result.toStringList(); QCOMPARE(output.size(), expectedResults.size()); - for (int i=0; i<output.count(); i++) + for (int i=0; i<output.size(); i++) QCOMPARE(output[i], expectedResults[i]); } } @@ -1136,7 +1136,7 @@ void tst_qqmlqt::quit() QSignalSpy spy(&engine, SIGNAL(quit())); QScopedPointer<QObject> object(component.create()); QVERIFY(object != nullptr); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); } void tst_qqmlqt::exit() @@ -1146,7 +1146,7 @@ void tst_qqmlqt::exit() QSignalSpy spy(&engine, &QQmlEngine::exit); QScopedPointer<QObject> object(component.create()); QVERIFY(object != nullptr); - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); QList<QVariant> arguments = spy.takeFirst(); QVERIFY(arguments.at(0).toInt() == object->property("returnCode").toInt()); } diff --git a/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp b/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp index 4395454140..cd6eb3e9c5 100644 --- a/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp +++ b/tests/auto/qml/qqmltablemodel/tst_qqmltablemodel.cpp @@ -68,8 +68,8 @@ void tst_QQmlTableModel::appendRemoveRow() QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, -1))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() with an rowIndex that is too large. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -77,16 +77,16 @@ void tst_QQmlTableModel::appendRemoveRow() QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 2))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() with a valid rowIndex but negative rows. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*removeRow\\(\\): \"rows\" is less than or equal to zero")); QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0), Q_ARG(int, -1))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() with a valid rowIndex but excessive rows. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -94,8 +94,8 @@ void tst_QQmlTableModel::appendRemoveRow() QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0), Q_ARG(int, 3))); QCOMPARE(model->rowCount(), 2); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call remove() without specifying the number of rows to remove; it should remove one row. QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0))); @@ -103,8 +103,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); // Call append() with a row that has an unexpected role; the row should be added and the extra data ignored. QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "appendRowExtraData")); @@ -115,8 +115,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Foo")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); // Call append() with a row that is an int. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -129,8 +129,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Foo")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call append() with a row with a role of the wrong type. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -143,8 +143,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Foo")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call append() with a row that is an array instead of a simple object. QTest::ignoreMessage(QtWarningMsg, QRegularExpression( @@ -155,8 +155,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Call append() to insert one row. QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "appendRow", Q_ARG(QVariant, QLatin1String("Max")), Q_ARG(QVariant, 40))); @@ -168,8 +168,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Max")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); // Call remove() and specify rowIndex and rows, removing all remaining rows. QVERIFY(QMetaObject::invokeMethod(model, "removeRow", Q_ARG(int, 0), Q_ARG(int, 3))); @@ -177,8 +177,8 @@ void tst_QQmlTableModel::appendRemoveRow() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")), QVariant()); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")), QVariant()); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); } void tst_QQmlTableModel::appendRowToEmptyModel() @@ -208,8 +208,8 @@ void tst_QQmlTableModel::appendRowToEmptyModel() const QHash<int, QByteArray> roleNames = model->roleNames(); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("John")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 1); QCOMPARE(tableView->columns(), 2); } @@ -244,8 +244,8 @@ void tst_QQmlTableModel::clear() QCOMPARE(model->columnCount(), 2); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")), QVariant()); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")), QVariant()); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); // Wait until updatePolish() gets called, which is where the size is recalculated. QTRY_COMPARE(tableView->rows(), 0); QCOMPARE(tableView->columns(), 2); @@ -314,8 +314,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -330,8 +330,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -345,8 +345,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -360,8 +360,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -375,8 +375,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -390,8 +390,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); @@ -408,8 +408,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(3, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Max")); QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 4); QCOMPARE(tableView->columns(), 2); @@ -428,8 +428,8 @@ void tst_QQmlTableModel::insertRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Max")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 5); QCOMPARE(tableView->columns(), 2); } @@ -470,8 +470,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); rowCountSignalEmissions = 3; - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a fromRowIndex that is negative. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"fromRowIndex\" cannot be negative")); @@ -479,16 +479,16 @@ void tst_QQmlTableModel::moveRow() // Shouldn't have changed. QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a fromRowIndex that is too large. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"fromRowIndex\" 5 is greater than or equal to rowCount\\(\\)")); QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 5), Q_ARG(int, 1))); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a toRowIndex that is negative. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"toRowIndex\" cannot be negative")); @@ -496,16 +496,16 @@ void tst_QQmlTableModel::moveRow() // Shouldn't have changed. QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Try to move with a toRowIndex that is too large. QTest::ignoreMessage(QtWarningMsg, QRegularExpression(".*moveRow\\(\\): \"toRowIndex\" 5 is greater than or equal to rowCount\\(\\)")); QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 0), Q_ARG(int, 5))); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Move the first row to the end. QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 0), Q_ARG(int, 4))); @@ -522,8 +522,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("John")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Move it back again. QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 4), Q_ARG(int, 0))); @@ -539,8 +539,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); // Move the first row down one by one row. QVERIFY(QMetaObject::invokeMethod(model, "moveRow", Q_ARG(int, 0), Q_ARG(int, 1))); @@ -556,8 +556,8 @@ void tst_QQmlTableModel::moveRow() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); QCOMPARE(model->data(model->index(4, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Trev")); QCOMPARE(model->data(model->index(4, 1, QModelIndex()), roleNames.key("display")).toInt(), 48); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); } void tst_QQmlTableModel::setRow() @@ -594,8 +594,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -610,8 +610,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -623,8 +623,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -638,8 +638,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -653,8 +653,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -668,8 +668,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -682,8 +682,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -696,8 +696,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 40); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Daisy")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), rowCountSignalEmissions); QCOMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); @@ -712,8 +712,8 @@ void tst_QQmlTableModel::setRow() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 30); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Wot")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 99); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), ++rowCountSignalEmissions); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), ++rowCountSignalEmissions); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); } @@ -742,16 +742,16 @@ void tst_QQmlTableModel::setDataThroughDelegate() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "modify")); QCOMPARE(model->data(model->index(0, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("John")); QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); // Test setting a role that doesn't exist for a certain column. QVERIFY(QMetaObject::invokeMethod(view.rootObject(), "modifyInvalidRole")); @@ -760,8 +760,8 @@ void tst_QQmlTableModel::setDataThroughDelegate() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); // Test setting a role with a value of the wrong type. // There are two rows, so two delegates respond to the signal, which means we need to ignore two warnings. @@ -775,8 +775,8 @@ void tst_QQmlTableModel::setDataThroughDelegate() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 18); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); } // Start off with empty rows and then set them to test rowCountChanged(). @@ -809,8 +809,8 @@ void tst_QQmlTableModel::setRowsImperatively() QCOMPARE(model->data(model->index(0, 1, QModelIndex()), roleNames.key("display")).toInt(), 22); QCOMPARE(model->data(model->index(1, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Oliver")); QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 33); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 2); QCOMPARE(tableView->columns(), 2); } @@ -847,8 +847,8 @@ void tst_QQmlTableModel::setRowsMultipleTimes() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 41); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Power")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 89); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); @@ -864,8 +864,8 @@ void tst_QQmlTableModel::setRowsMultipleTimes() QCOMPARE(model->data(model->index(1, 1, QModelIndex()), roleNames.key("display")).toInt(), 41); QCOMPARE(model->data(model->index(2, 0, QModelIndex()), roleNames.key("display")).toString(), QLatin1String("Power")); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleNames.key("display")).toInt(), 89); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QCOMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); } @@ -962,8 +962,8 @@ void tst_QQmlTableModel::appendRowWithDouble() QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleKey).toDouble(), 3.5); QCOMPARE(model->data(model->index(2, 1, QModelIndex()), roleKey).toString(), QLatin1String("3.5")); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 3); QCOMPARE(tableView->columns(), 2); @@ -977,8 +977,8 @@ void tst_QQmlTableModel::appendRowWithDouble() QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleKey).toDouble(), 5); QCOMPARE(model->data(model->index(3, 1, QModelIndex()), roleKey).toString(), QLatin1String("5")); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 1); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 1); QTRY_COMPARE(tableView->rows(), 4); QCOMPARE(tableView->columns(), 2); @@ -991,8 +991,8 @@ void tst_QQmlTableModel::appendRowWithDouble() // Nothing should change QCOMPARE(model->rowCount(), 4); QCOMPARE(model->columnCount(), 2); - QCOMPARE(columnCountSpy.count(), 0); - QCOMPARE(rowCountSpy.count(), 0); + QCOMPARE(columnCountSpy.size(), 0); + QCOMPARE(rowCountSpy.size(), 0); QCOMPARE(tableView->rows(), 4); QCOMPARE(tableView->columns(), 2); } diff --git a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp index f572016142..736907d5f0 100644 --- a/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp +++ b/tests/auto/qml/qqmltimer/tst_qqmltimer.cpp @@ -142,13 +142,13 @@ void tst_qqmltimer::repeat() timer->setRepeating(false); QVERIFY(!timer->isRepeating()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setRepeating(false); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setRepeating(true); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete timer; } @@ -176,13 +176,13 @@ void tst_qqmltimer::triggeredOnStart() timer->setTriggeredOnStart(false); QVERIFY(!timer->triggeredOnStart()); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setTriggeredOnStart(false); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setTriggeredOnStart(true); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete timer; } @@ -254,13 +254,13 @@ void tst_qqmltimer::changeDuration() timer->setInterval(200); QCOMPARE(timer->interval(), 200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setInterval(200); - QCOMPARE(spy.count(),1); + QCOMPARE(spy.size(),1); timer->setInterval(300); - QCOMPARE(spy.count(),2); + QCOMPARE(spy.size(),2); delete timer; } diff --git a/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp b/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp index 8bf9561316..58587da79c 100644 --- a/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp +++ b/tests/auto/qml/qqmltreemodeltotablemodel/testmodel.cpp @@ -52,7 +52,7 @@ int TestModel::rowCount(const QModelIndex &parent) const if (!parent.isValid()) return 1; // root of the tree if (parent.column() == 0) - return treeItem(parent)->m_childItems.count(); + return treeItem(parent)->m_childItems.size(); return 0; } diff --git a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp index d28035b266..43b86144f6 100644 --- a/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp +++ b/tests/auto/qml/qqmltypeloader/tst_qqmltypeloader.cpp @@ -275,8 +275,8 @@ public: qint64 readData(char *data, qint64 maxlen) override { - if (m_buffer.length() < maxlen) - maxlen = m_buffer.length(); + if (m_buffer.size() < maxlen) + maxlen = m_buffer.size(); std::memcpy(data, m_buffer.data(), maxlen); m_buffer.remove(0, maxlen); return maxlen; @@ -351,9 +351,9 @@ public: segments.removeFirst(); } if (segments.startsWith("plugin")) { - if (segments.length() == 2) { + if (segments.size() == 2) { segments.append(path); - } else if (segments.length() == 3) { + } else if (segments.size() == 3) { if (!segments[2].startsWith('/')) segments[2] = path + segments[2]; } else { @@ -446,7 +446,7 @@ void tst_QQMLTypeLoader::intercept() QTRY_COMPARE(o->property("created").toInt(), 2); QTRY_COMPARE(o->property("loaded").toInt(), 2); - QVERIFY(factory.loadedFiles.length() >= 6); + QVERIFY(factory.loadedFiles.size() >= 6); QVERIFY(factory.loadedFiles.contains(dataDirectory() + "/test_intercept.qml")); QVERIFY(factory.loadedFiles.contains(dataDirectory() + "/Intercept.qml")); QVERIFY(factory.loadedFiles.contains(dataDirectory() + "/Fast/qmldir")); diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp index 5fe817df58..1f9dfb7fd4 100644 --- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp +++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp @@ -1160,7 +1160,7 @@ static void checkNoErrors(QQmlComponent& component) QList<QQmlError> errors = component.errors(); if (errors.isEmpty()) return; - for (int ii = 0; ii < errors.count(); ++ii) { + for (int ii = 0; ii < errors.size(); ++ii) { const QQmlError &error = errors.at(ii); qWarning("%d:%d:%s",error.line(),error.column(),error.description().toUtf8().constData()); } @@ -1690,8 +1690,8 @@ void tst_qqmlvaluetypes::sequences() { QList<BaseGadget> gadgetList{1, 4, 7, 8, 15}; QJSValue value = engine.toScriptValue(gadgetList); - QCOMPARE(value.property("length").toInt(), gadgetList.length()); - for (int i = 0; i < gadgetList.length(); ++i) + QCOMPARE(value.property("length").toInt(), gadgetList.size()); + for (int i = 0; i < gadgetList.size(); ++i) QCOMPARE(value.property(i).property("baseProperty").toInt(), gadgetList.at(i).baseProperty()); } { @@ -1704,8 +1704,8 @@ void tst_qqmlvaluetypes::sequences() { QVector<QChar> qcharVector{QChar(1), QChar(4), QChar(42), QChar(8), QChar(15)}; QJSValue value = engine.toScriptValue(qcharVector); - QCOMPARE(value.property("length").toInt(), qcharVector.length()); - for (int i = 0; i < qcharVector.length(); ++i) + QCOMPARE(value.property("length").toInt(), qcharVector.size()); + for (int i = 0; i < qcharVector.size(); ++i) QCOMPARE(value.property(i).toString(), qcharVector.at(i)); } { @@ -1767,7 +1767,7 @@ void tst_qqmlvaluetypes::enumerableProperties() names.insert(name); } - QCOMPARE(names.count(), 2); + QCOMPARE(names.size(), 2); QVERIFY(names.contains(QStringLiteral("baseProperty"))); QVERIFY(names.contains(QStringLiteral("derivedProperty"))); } diff --git a/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp b/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp index ae4dcbef02..ce30eceb05 100644 --- a/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp +++ b/tests/auto/qml/qqmlxmllistmodel/tst_qqmlxmllistmodel.cpp @@ -79,7 +79,7 @@ private: const QStringList fields = item.split(QLatin1Char(',')); for (const QString &field : fields) { QStringList values = field.split(QLatin1Char('=')); - if (values.count() != 2) { + if (values.size() != 2) { qWarning() << "makeItemXmlAndData: invalid field:" << field; continue; } @@ -235,7 +235,7 @@ void tst_QQmlXmlListModel::roles() QTRY_COMPARE(model->rowCount(), 9); QHash<int, QByteArray> roleNames = model->roleNames(); - QCOMPARE(roleNames.count(), 4); + QCOMPARE(roleNames.size(), 4); QVERIFY(roleNames.key("name", -1) >= 0); QVERIFY(roleNames.key("type", -1) >= 0); QVERIFY(roleNames.key("age", -1) >= 0); @@ -246,7 +246,7 @@ void tst_QQmlXmlListModel::roles() roles.insert(roleNames.key("type")); roles.insert(roleNames.key("age")); roles.insert(roleNames.key("size")); - QCOMPARE(roles.count(), 4); + QCOMPARE(roles.size(), 4); } void tst_QQmlXmlListModel::elementErrors() @@ -294,7 +294,7 @@ void tst_QQmlXmlListModel::uniqueRoleNames() QTRY_COMPARE(model->rowCount(), 9); QHash<int, QByteArray> roleNames = model->roleNames(); - QCOMPARE(roleNames.count(), 1); + QCOMPARE(roleNames.size(), 1); } void tst_QQmlXmlListModel::headers() @@ -345,7 +345,7 @@ void tst_QQmlXmlListModel::source() QCOMPARE(model->property("progress").toDouble(), qreal(1.0)); QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), QQmlXmlListModel::Loading); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); spy.clear(); QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), QQmlXmlListModel::Ready); @@ -359,7 +359,7 @@ void tst_QQmlXmlListModel::source() QQmlXmlListModel::Null); qreal expectedProgress = (source.isLocalFile() || (source.scheme() == "qrc"_L1)) ? 1.0 : 0.0; QCOMPARE(model->property("progress").toDouble(), expectedProgress); - QTRY_COMPARE(spy.count(), 1); + QTRY_COMPARE(spy.size(), 1); spy.clear(); QCOMPARE(qvariant_cast<QQmlXmlListModel::Status>(model->property("status")), QQmlXmlListModel::Loading); @@ -373,10 +373,10 @@ void tst_QQmlXmlListModel::source() timer.start(20000); loop.exec(); - if (spy.count() == 0 && status != QQmlXmlListModel::Ready) { + if (spy.size() == 0 && status != QQmlXmlListModel::Ready) { qWarning("QQmlXmlListModel invalid source test timed out"); } else { - QCOMPARE(spy.count(), 1); + QCOMPARE(spy.size(), 1); spy.clear(); } @@ -415,7 +415,7 @@ void tst_QQmlXmlListModel::data() for (int i = 0; i < 9; i++) { QModelIndex index = model->index(i, 0); - for (int j = 0; j < model->roleNames().count(); j++) { + for (int j = 0; j < model->roleNames().size(); j++) { QCOMPARE(model->data(index, j), QVariant()); } } @@ -442,9 +442,9 @@ void tst_QQmlXmlListModel::reload() QCoreApplication::processEvents(); QMetaObject::invokeMethod(model.get(), "reload"); QMetaObject::invokeMethod(model.get(), "reload"); - QTRY_COMPARE(spyCount.count(), 0); - QTRY_COMPARE(spyInsert.count(), 1); - QTRY_COMPARE(spyRemove.count(), 1); + QTRY_COMPARE(spyCount.size(), 0); + QTRY_COMPARE(spyInsert.size(), 1); + QTRY_COMPARE(spyRemove.size(), 1); QCOMPARE(spyInsert[0][1].toInt(), 0); QCOMPARE(spyInsert[0][2].toInt(), 8); @@ -557,14 +557,14 @@ void tst_QQmlXmlListModel::propertyChanges() QCOMPARE(role->property("name").toString(), QString("size")); QCOMPARE(role->property("elementName").toString(), QString("size")); - QCOMPARE(nameSpy.count(), 1); - QCOMPARE(elementSpy.count(), 1); + QCOMPARE(nameSpy.size(), 1); + QCOMPARE(elementSpy.size(), 1); role->setProperty("name", "size"); role->setProperty("elementName", "size"); - QCOMPARE(nameSpy.count(), 1); - QCOMPARE(elementSpy.count(), 1); + QCOMPARE(nameSpy.size(), 1); + QCOMPARE(elementSpy.size(), 1); QSignalSpy sourceSpy(model.get(), SIGNAL(sourceChanged())); QSignalSpy modelQuerySpy(model.get(), SIGNAL(queryChanged())); @@ -577,14 +577,14 @@ void tst_QQmlXmlListModel::propertyChanges() QTRY_COMPARE(model->rowCount(), 1); - QCOMPARE(sourceSpy.count(), 1); - QCOMPARE(modelQuerySpy.count(), 1); + QCOMPARE(sourceSpy.size(), 1); + QCOMPARE(modelQuerySpy.size(), 1); model->setProperty("source", QUrl("model2.xml")); model->setProperty("query", "/Pets"); - QCOMPARE(sourceSpy.count(), 1); - QCOMPARE(modelQuerySpy.count(), 1); + QCOMPARE(sourceSpy.size(), 1); + QCOMPARE(modelQuerySpy.size(), 1); QTRY_COMPARE(model->rowCount(), 1); } diff --git a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp index b98e1e9da3..7e9e070fa6 100644 --- a/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp +++ b/tests/auto/qml/qv4assembler/tst_qv4assembler.cpp @@ -76,7 +76,7 @@ void tst_QV4Assembler::perfMapFile() const QByteArray contents = file.readLine(); QVERIFY(contents.endsWith('\n')); QList<QByteArray> fields = contents.split(' '); - QCOMPARE(fields.length(), 3); + QCOMPARE(fields.size(), 3); bool ok = false; const qulonglong address = fields[0].toULongLong(&ok, 16); QVERIFY(ok); diff --git a/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp b/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp index d994783e1f..a3f5c4bb70 100644 --- a/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp +++ b/tests/auto/qml/qv4identifiertable/tst_qv4identifiertable.cpp @@ -341,7 +341,7 @@ void tst_qv4identifiertable::insertNumericStringPopulatesIdentifier() QV4::ExecutionEngine engine; const QString numeric = QStringLiteral("1"); uint subtype; - const uint hash = QV4::String::createHashValue(numeric.constData(), numeric.length(), &subtype); + const uint hash = QV4::String::createHashValue(numeric.constData(), numeric.size(), &subtype); QCOMPARE(subtype, QV4::Heap::String::StringType_ArrayIndex); QCOMPARE(engine.identifierTable->insertString(numeric)->identifier, QV4::PropertyKey::fromArrayIndex(hash)); |