aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-09-05 20:37:05 +0200
committerLinus Jahn <lnj@kaidan.im>2022-09-06 00:46:56 +0200
commit5f813f8a4bbe1e075daad7b3933829044befffb4 (patch)
tree20102aa665b03cfb6dfe0c6ece94938320b6430e /tests
parent4c60b13e0b8011e4e0b093a690e939f3b23e2436 (diff)
downloadqxmpp-5f813f8a4bbe1e075daad7b3933829044befffb4.tar.gz
Reformat code
Diffstat (limited to 'tests')
-rw-r--r--tests/qxmppattentionmanager/tst_qxmppattentionmanager.cpp6
-rw-r--r--tests/qxmppiceconnection/tst_qxmppiceconnection.cpp11
-rw-r--r--tests/qxmppregistrationmanager/tst_qxmppregistrationmanager.cpp13
-rw-r--r--tests/qxmpprpciq/tst_qxmpprpciq.cpp3
-rw-r--r--tests/qxmppsocks/tst_qxmppsocks.cpp3
-rw-r--r--tests/qxmppstreamfeatures/tst_qxmppstreamfeatures.cpp3
-rw-r--r--tests/qxmppuploadrequestmanager/tst_qxmppuploadrequestmanager.cpp5
7 files changed, 28 insertions, 16 deletions
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());