From 5f813f8a4bbe1e075daad7b3933829044befffb4 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Mon, 5 Sep 2022 20:37:05 +0200 Subject: Reformat code --- tests/qxmppattentionmanager/tst_qxmppattentionmanager.cpp | 6 ++++-- tests/qxmppiceconnection/tst_qxmppiceconnection.cpp | 11 +++++++---- .../tst_qxmppregistrationmanager.cpp | 13 ++++++++----- tests/qxmpprpciq/tst_qxmpprpciq.cpp | 3 ++- tests/qxmppsocks/tst_qxmppsocks.cpp | 3 ++- tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp | 3 ++- .../tst_qxmppuploadrequestmanager.cpp | 5 +++-- 7 files changed, 28 insertions(+), 16 deletions(-) (limited to 'tests') diff --git a/tests/qxmppattentionmanager/tst_qxmppattentionmanager.cpp b/tests/qxmppattentionmanager/tst_qxmppattentionmanager.cpp index 4694d636..dce277a2 100644 --- a/tests/qxmppattentionmanager/tst_qxmppattentionmanager.cpp +++ b/tests/qxmppattentionmanager/tst_qxmppattentionmanager.cpp @@ -132,8 +132,9 @@ void tst_QXmppAttentionManager::testRateLimiting() QXmppMessage msg; msg.setAttentionRequested(true); - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { emit client.messageReceived(msg); + } QCOMPARE(signalCalled, allowed); QCOMPARE(rateLimitedCalled, count - allowed); @@ -142,8 +143,9 @@ void tst_QXmppAttentionManager::testRateLimiting() QThread::currentThread()->usleep(1000e3 + 50e3); QCoreApplication::processEvents(); - for (int i = 0; i < count; i++) + for (int i = 0; i < count; i++) { emit client.messageReceived(msg); + } QCOMPARE(signalCalled, allowed * 2); QCOMPARE(rateLimitedCalled, (count - allowed) * 2); diff --git a/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp b/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp index bfd03771..1c8c5775 100644 --- a/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp +++ b/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp @@ -85,10 +85,11 @@ void tst_QXmppIceConnection::testBindStun() const auto &localCandidates = client.localCandidates(); for (const auto &c : localCandidates) { QCOMPARE(c.component(), componentId); - if (c.type() == QXmppJingleCandidate::ServerReflexiveType) + if (c.type() == QXmppJingleCandidate::ServerReflexiveType) { foundReflexive = true; - else + } else { QCOMPARE(c.type(), QXmppJingleCandidate::HostType); + } } QVERIFY(foundReflexive); } @@ -122,11 +123,13 @@ void tst_QXmppIceConnection::testConnect() // exchange candidates const auto &rLocalCandidates = clientR.localCandidates(); - for (const auto &candidate : rLocalCandidates) + for (const auto &candidate : rLocalCandidates) { clientL.addRemoteCandidate(candidate); + } const auto &lLocalCandidates = clientL.localCandidates(); - for (const auto &candidate : lLocalCandidates) + for (const auto &candidate : lLocalCandidates) { clientR.addRemoteCandidate(candidate); + } // start ICE QEventLoop loop; diff --git a/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp b/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp index aab85869..0cd2b005 100644 --- a/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp +++ b/tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp @@ -161,10 +161,11 @@ void tst_QXmppRegistrationManager::testRequestRegistrationForm() } }); - if (triggerManually) + if (triggerManually) { manager->requestRegistrationForm(); - else + } else { sendStreamFeaturesToManager(true); + } QVERIFY(signalCalled); delete context; @@ -251,10 +252,11 @@ void tst_QXmppRegistrationManager::testSendCachedRegistrationForm() }); manager->setRegistrationFormToSend(iq); - if (triggerSendingManually) + if (triggerSendingManually) { manager->sendCachedRegistrationForm(); - else + } else { sendStreamFeaturesToManager(true); + } delete context; } @@ -479,8 +481,9 @@ void tst_QXmppRegistrationManager::sendStreamFeaturesToManager(bool registration { QXmppStreamFeatures features; features.setBindMode(QXmppStreamFeatures::Enabled); - if (registrationEnabled) + if (registrationEnabled) { features.setRegisterMode(QXmppStreamFeatures::Enabled); + } auto writeFeaturesToDom = [&]() -> QDomElement { QBuffer buffer; diff --git a/tests/qxmpprpciq/tst_qxmpprpciq.cpp b/tests/qxmpprpciq/tst_qxmpprpciq.cpp index a83f6999..be651243 100644 --- a/tests/qxmpprpciq/tst_qxmpprpciq.cpp +++ b/tests/qxmpprpciq/tst_qxmpprpciq.cpp @@ -24,8 +24,9 @@ static void checkVariant(const QVariant &value, const QByteArray &xml) QDomElement element = doc.documentElement(); QStringList errors; QVariant test = QXmppRpcMarshaller::demarshall(element, errors); - if (!errors.isEmpty()) + if (!errors.isEmpty()) { qDebug() << errors; + } QCOMPARE(errors, QStringList()); QCOMPARE(test, value); } diff --git a/tests/qxmppsocks/tst_qxmppsocks.cpp b/tests/qxmppsocks/tst_qxmppsocks.cpp index f280c2bf..eea55649 100644 --- a/tests/qxmppsocks/tst_qxmppsocks.cpp +++ b/tests/qxmppsocks/tst_qxmppsocks.cpp @@ -216,8 +216,9 @@ void tst_QXmppSocks::testServer() if (!clientHandshakeWorks) { // consume any last data QByteArray data = client.readAll(); - if (client.state() != QAbstractSocket::UnconnectedState) + if (client.state() != QAbstractSocket::UnconnectedState) { loop.exec(); + } QCOMPARE(client.state(), QAbstractSocket::UnconnectedState); diff --git a/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp b/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp index dbfca713..94e59eeb 100644 --- a/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp +++ b/tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp @@ -16,8 +16,9 @@ static void parsePacketWithStream(T &packet, const QByteArray &xml) QString err; bool parsingSuccess = doc.setContent(wrappedXml, true, &err); - if (!err.isNull()) + if (!err.isNull()) { qDebug() << err; + } QVERIFY(parsingSuccess); packet.parse(doc.documentElement().firstChildElement()); diff --git a/tests/qxmppuploadrequestmanager/tst_qxmppuploadrequestmanager.cpp b/tests/qxmppuploadrequestmanager/tst_qxmppuploadrequestmanager.cpp index 0f7bb6e1..38de7a4c 100644 --- a/tests/qxmppuploadrequestmanager/tst_qxmppuploadrequestmanager.cpp +++ b/tests/qxmppuploadrequestmanager/tst_qxmppuploadrequestmanager.cpp @@ -304,10 +304,11 @@ void tst_QXmppUploadRequestManager::testSending() lastFileSize = fileSize; QString returnId; - if (!fileInfo.baseName().isEmpty()) + if (!fileInfo.baseName().isEmpty()) { returnId = manager->requestUploadSlot(fileInfo); - else + } else { returnId = manager->requestUploadSlot(fileName, fileSize, lastMimeType); + } // The client is not connected, so we never get an ID back (the packet was not sent). QVERIFY(returnId.isNull()); -- cgit v1.2.3