summaryrefslogtreecommitdiffstats
path: root/tests/auto/integration/tst_integration.cpp
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-10-05 08:09:30 +0200
committerMarc Mutz <marc.mutz@qt.io>2022-10-06 18:11:33 +0200
commitb29b3eacc3c480c39d84576705d7e1f2716a0645 (patch)
tree25c560395072a7c83fd8ad5db6371114b408ddc3 /tests/auto/integration/tst_integration.cpp
parent18567efea34442bf2ba6dbd5374cf835649d7019 (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: Id816b39977e17712fd078900037efc45f66a0175 Reviewed-by: Sona Kurazyan <kurazyan.sona@gmail.com> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/integration/tst_integration.cpp')
-rw-r--r--tests/auto/integration/tst_integration.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/auto/integration/tst_integration.cpp b/tests/auto/integration/tst_integration.cpp
index 62dfaf6..d815e1a 100644
--- a/tests/auto/integration/tst_integration.cpp
+++ b/tests/auto/integration/tst_integration.cpp
@@ -328,7 +328,7 @@ private slots:
QSignalSpy spy(tc_rep.data(), &TestClassReplica::classEnumChanged);
QVERIFY(spy.isValid());
tc_rep->pushClassEnum(TestClassReplica::Two);
- QVERIFY(spy.count() || spy.wait());
+ QVERIFY(spy.size() || spy.wait());
QCOMPARE(qint32(tc.classEnum()), qint32(tc_rep->classEnum()));
}
@@ -456,7 +456,7 @@ private slots:
QSignalSpy spy(engine_r.data(), &QRemoteObjectReplica::stateChanged);
host->disableRemoting(&e);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
instances = client->instances<EngineReplica>();
QCOMPARE(instances, QStringList({"Engine2"}));
@@ -509,8 +509,8 @@ private slots:
QSignalSpy clientSpy(client->registry(), &QRemoteObjectRegistry::remoteObjectAdded);
host->enableRemoting(&e1, engine1);
- QTRY_COMPARE(hostSpy.count(), 1);
- QTRY_COMPARE(clientSpy.count(), 1);
+ QTRY_COMPARE(hostSpy.size(), 1);
+ QTRY_COMPARE(clientSpy.size(), 1);
QCOMPARE(hostObserver.value(), host->registry()->sourceLocations());
QCOMPARE(clientObserver.value(), client->registry()->sourceLocations());
QCOMPARE(hostObserver.value(), clientObserver.value());
@@ -520,8 +520,8 @@ private slots:
expectedSourceLocations[engine2] = { QStringLiteral("Engine"), hostUrl };
host->enableRemoting(&e2, engine2);
- QTRY_COMPARE(hostSpy.count(), 2);
- QTRY_COMPARE(clientSpy.count(), 2);
+ QTRY_COMPARE(hostSpy.size(), 2);
+ QTRY_COMPARE(clientSpy.size(), 2);
QCOMPARE(hostObserver.value(), host->registry()->sourceLocations());
QCOMPARE(clientObserver.value(), client->registry()->sourceLocations());
QCOMPARE(hostObserver.value(), clientObserver.value());
@@ -536,8 +536,8 @@ private slots:
QSignalSpy srcRemovedClientSpy(client->registry(),
&QRemoteObjectRegistry::remoteObjectRemoved);
- QTRY_COMPARE(srcRemovedHostSpy.count(), 1);
- QTRY_COMPARE(srcRemovedClientSpy.count(), 1);
+ QTRY_COMPARE(srcRemovedHostSpy.size(), 1);
+ QTRY_COMPARE(srcRemovedClientSpy.size(), 1);
QCOMPARE(hostObserver.value(), host->registry()->sourceLocations());
QCOMPARE(clientObserver.value(), client->registry()->sourceLocations());
QCOMPARE(hostObserver.value(), clientObserver.value());
@@ -728,7 +728,7 @@ private slots:
QSignalSpy addedSpy(host->registry(), &QRemoteObjectRegistry::remoteObjectAdded);
setupRegistry();
bool added = addedSpy.wait();
- QVERIFY(spy.count() > 0);
+ QVERIFY(spy.size() > 0);
QCOMPARE(added, true);
QCOMPARE(host->registry()->sourceLocations().keys().isEmpty(), false);
QCOMPARE(host->registry()->sourceLocations().keys().at(0), QStringLiteral("Engine"));
@@ -769,7 +769,7 @@ private slots:
e.setRpm(2345);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
const QVariantList &arguments = spy.first();
bool ok;
int res = arguments.at(0).toInt(&ok);
@@ -798,7 +798,7 @@ private slots:
});
e.setRpm(3456);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
const QVariantList &arguments = spy.first();
bool ok;
int res = arguments.at(0).toInt(&ok);
@@ -856,7 +856,7 @@ private slots:
QRemoteObjectPendingCallWatcher watcher(reply);
QSignalSpy spy(&watcher, &QRemoteObjectPendingCallWatcher::finished);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QVERIFY(reply.isFinished());
QCOMPARE(reply.returnValue(), true);
@@ -1011,7 +1011,7 @@ private slots:
QSignalSpy spy(engine_r.data(), &EngineReplica::rpmChanged);
engine_r->setRpm(42);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QCOMPARE(engine_r->rpm(), 42);
}
@@ -1029,7 +1029,7 @@ private slots:
QSignalSpy spy(engine_r.data(), &EngineReplica::startedChanged);
engine_r->pushStarted(true);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QCOMPARE(engine_r->started(), true);
}
@@ -1052,7 +1052,7 @@ private slots:
QSignalSpy spy(engine_dr.data(), QByteArray(QByteArrayLiteral("2")+mp.notifySignal().methodSignature().constData()));
mp.write(engine_dr.data(), 44);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QCOMPARE(mp.read(engine_dr.data()).toInt(), 44);
}
@@ -1072,7 +1072,7 @@ private slots:
QSignalSpy spy(engine_r.data(), &EngineReplica::rpmChanged);
engine_r->increaseRpm(1000);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QCOMPARE(engine_r->rpm(), 1000);
}
@@ -1145,7 +1145,7 @@ private slots:
QSignalSpy spy_r1(engine_r1.data(), &EngineReplica::rpmChanged);
engine_r1->waitForSource();
QCOMPARE(engine_r1->rpm(), e.rpm());
- QCOMPARE(spy_r1.count(), 1);
+ QCOMPARE(spy_r1.size(), 1);
// NOTE: A second replica will have initialized and notify signals emitted as part of acquire,
// which leads to different semantics for first and second replicas. Specifically, there is no
@@ -1200,7 +1200,7 @@ private slots:
// replica gets source change
source.setValue(1);
- QTRY_COMPARE(spy.count(), 1);
+ QTRY_COMPARE(spy.size(), 1);
QCOMPARE(replica->property("value"), QVariant(1));
// source gets replica change
@@ -1216,7 +1216,7 @@ private slots:
// replica gets source change
source.setOtherValue(1);
- QTRY_COMPARE(otherSpy.count(), 1);
+ QTRY_COMPARE(otherSpy.size(), 1);
QCOMPARE(replica->property("otherValue"), QVariant(1));
// source gets replica change
@@ -1314,7 +1314,7 @@ private slots:
Q_SET_OBJECT_NAME(_client);
QSignalSpy errorSpy(&_client, &QRemoteObjectNode::error);
QVERIFY(!_client.connectToNode(QUrl(QLatin1String("invalid:invalid"))));
- QCOMPARE(errorSpy.count(), 1);
+ QCOMPARE(errorSpy.size(), 1);
auto emittedErrorCode = errorSpy.first().at(0).value<QRemoteObjectNode::ErrorCode>();
QCOMPARE(emittedErrorCode, QRemoteObjectNode::RegistryNotAcquired);
QCOMPARE(_client.lastError(), QRemoteObjectNode::RegistryNotAcquired);
@@ -1331,7 +1331,7 @@ private slots:
e.setRpm(50);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
QCOMPARE(engine_d->rpm(), e.rpm());
}
@@ -1354,7 +1354,7 @@ private slots:
const QByteArray data(16384,'y');
emit t.send(data);
spy.wait();
- QCOMPARE(spy.count(), 1);
+ QCOMPARE(spy.size(), 1);
const QVariantList &arguments = spy.first();
QVERIFY(arguments.at(0).toByteArray() == data);
QVERIFY(host->disableRemoting(&t));