diff options
| author | Jonah BrĂ¼chert <jbb@kaidan.im> | 2022-09-28 13:38:25 +0200 |
|---|---|---|
| committer | Linus Jahn <lnj@kaidan.im> | 2022-09-28 15:56:05 +0200 |
| commit | 1916eca1a982b22c10c1c737fcbcb86bee0ec5cc (patch) | |
| tree | 7ebda6bc36a8e0df2b0130cb844902f840d37a47 /tests | |
| parent | 61564526f1cfd53c31353aeb6df26ba0f5da9834 (diff) | |
Allow adding multiple oob urls and a description
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/qxmppmessage/tst_qxmppmessage.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/qxmppmessage/tst_qxmppmessage.cpp b/tests/qxmppmessage/tst_qxmppmessage.cpp index 268ca2a8..1aa2c673 100644 --- a/tests/qxmppmessage/tst_qxmppmessage.cpp +++ b/tests/qxmppmessage/tst_qxmppmessage.cpp @@ -9,6 +9,7 @@ #include "QXmppEncryptedFileSource.h" #include "QXmppMessage.h" #include "QXmppMixInvitation.h" +#include "QXmppOutOfBandUrl.h" #include "QXmppTrustMessageElement.h" #include <optional> @@ -688,6 +689,10 @@ void tst_QXmppMessage::testOutOfBandUrl() "<x xmlns=\"jabber:x:oob\">" "<url>http://www.jabber.org/images/psa-license.jpg</url>" "</x>" + "<x xmlns=\"jabber:x:oob\">" + "<url>https://xmpp.org/images/logos/xmpp-logo.svg</url>" + "<desc>XMPP logo</desc>" + "</x>" "</message>"); const QString firstUrl = "http://www.jabber.org/images/psa-license.jpg"; const QString newUrl = "https://xmpp.org/theme/images/xmpp-logo.svg"; @@ -696,12 +701,19 @@ void tst_QXmppMessage::testOutOfBandUrl() parsePacket(oobMessage, oobXml); QCOMPARE(oobMessage.outOfBandUrl(), firstUrl); - oobMessage.setOutOfBandUrl(newUrl); - QCOMPARE(oobMessage.outOfBandUrl(), newUrl); + QCOMPARE(oobMessage.outOfBandUrls().size(), 2); + + QCOMPARE(oobMessage.outOfBandUrls().front().url(), QStringLiteral("http://www.jabber.org/images/psa-license.jpg")); + QVERIFY(!oobMessage.outOfBandUrls().front().description().has_value()); + + QCOMPARE(oobMessage.outOfBandUrls().at(1).url(), QStringLiteral("https://xmpp.org/images/logos/xmpp-logo.svg")); + QCOMPARE(oobMessage.outOfBandUrls().at(1).description().value(), QStringLiteral("XMPP logo")); - // set first url again - oobMessage.setOutOfBandUrl(firstUrl); serializePacket(oobMessage, oobXml); + + oobMessage.setOutOfBandUrl(newUrl); + QCOMPARE(oobMessage.outOfBandUrl(), newUrl); + QCOMPARE(oobMessage.outOfBandUrls().size(), 1); } void tst_QXmppMessage::testMessageCorrect() |
