diff options
| author | Linus Jahn <lnj@kaidan.im> | 2019-05-14 17:15:11 +0200 |
|---|---|---|
| committer | LNJ <lnj@kaidan.im> | 2019-10-23 18:09:17 +0200 |
| commit | 4172b33b1222a586d95dbc7e69dad7a19a307ea1 (patch) | |
| tree | 830008c8dd42d257c8aba3080e35813d37383eb2 /tests | |
| parent | b34ceca75db2791f00d9fa12b8714739bd19eade (diff) | |
| download | qxmpp-4172b33b1222a586d95dbc7e69dad7a19a307ea1.tar.gz | |
Replace Q_FOREACH (foreach) by C++11 ranged for-loops
Q_FOREACH is bad and will be deprecated in the future:
https://www.kdab.com/goodbye-q_foreach/
This also disables Q_FOREACH by defining QT_NO_FOREACH.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/qxmppiceconnection/tst_qxmppiceconnection.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp b/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp index 3739cc4d..b15d108d 100644 --- a/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp +++ b/tests/qxmppiceconnection/tst_qxmppiceconnection.cpp @@ -56,7 +56,8 @@ void tst_QXmppIceConnection::testBind() QCOMPARE(client.gatheringState(), QXmppIceConnection::CompleteGatheringState); QCOMPARE(client.localCandidates().size(), component->localCandidates().size()); QVERIFY(!client.localCandidates().isEmpty()); - foreach (const QXmppJingleCandidate &c, client.localCandidates()) { + const auto &localCandidates = client.localCandidates(); + for (const auto &c : localCandidates) { QCOMPARE(c.component(), componentId); QCOMPARE(c.type(), QXmppJingleCandidate::HostType); } @@ -95,7 +96,8 @@ void tst_QXmppIceConnection::testBindStun() QCOMPARE(client.gatheringState(), QXmppIceConnection::CompleteGatheringState); QCOMPARE(client.localCandidates().size(), component->localCandidates().size()); QVERIFY(!client.localCandidates().isEmpty()); - foreach (const QXmppJingleCandidate &c, client.localCandidates()) { + const auto &localCandidates = client.localCandidates(); + for (const auto &c : localCandidates) { QCOMPARE(c.component(), componentId); if (c.type() == QXmppJingleCandidate::ServerReflexiveType) foundReflexive = true; @@ -133,9 +135,11 @@ void tst_QXmppIceConnection::testConnect() clientR.setRemotePassword(clientL.localPassword()); // exchange candidates - foreach (const QXmppJingleCandidate &candidate, clientR.localCandidates()) + const auto &rLocalCandidates = clientR.localCandidates(); + for (const auto &candidate : rLocalCandidates) clientL.addRemoteCandidate(candidate); - foreach (const QXmppJingleCandidate &candidate, clientL.localCandidates()) + const auto &lLocalCandidates = clientL.localCandidates(); + for (const auto &candidate : lLocalCandidates) clientR.addRemoteCandidate(candidate); // start ICE |
