aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlapplicationengine
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 07:29:16 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-07 23:38:48 +0200
commit958cd3ee1094a068b6d0ff27c73a4b3caff088ad (patch)
tree6d3816fedf5dab2307675fd6ef70d39758e246f5 /tests/auto/qml/qqmlapplicationengine
parente8e03215654ca730243336a80453cf9396cbdf58 (diff)
Port from container::count() and length() to size()
This is a semantic patch using ClangTidyTransformator as in qtbase/df9d882d41b741fef7c5beeddb0abe9d904443d8: auto QtContainerClass = anyOf( expr(hasType(cxxRecordDecl(isSameOrDerivedFrom(hasAnyName(classes))))).bind(o), expr(hasType(namedDecl(hasAnyName(<classes>)))).bind(o)); makeRule(cxxMemberCallExpr(on(QtContainerClass), callee(cxxMethodDecl(hasAnyName({"count", "length"), parameterCountIs(0))))), changeTo(cat(access(o, cat("size"), "()"))), cat("use 'size()' instead of 'count()/length()'")) a.k.a qt-port-to-std-compatible-api with config Scope: 'Container', with the extended set of container classes recognized. Change-Id: Idb1f75dfe2323bd1d9e8b4d58d54f1b4b80c7ed7 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlapplicationengine')
-rw-r--r--tests/auto/qml/qqmlapplicationengine/androidassets/tst_androidassets.cpp4
-rw-r--r--tests/auto/qml/qqmlapplicationengine/tst_qqmlapplicationengine.cpp22
2 files changed, 13 insertions, 13 deletions
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());