diff options
| author | Melvin Keskin <melvo@olomono.de> | 2022-09-25 14:12:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-09-25 14:12:51 +0200 |
| commit | 524a02debffd9552f0928b5804d7b51b045aa9d2 (patch) | |
| tree | a8832b961839c27511193ec58e608ea552ff5362 /tests | |
| parent | 48bc0775e68cb6d7647287e90c3e69fde387003a (diff) | |
| download | qxmpp-524a02debffd9552f0928b5804d7b51b045aa9d2.tar.gz | |
Implement XEP-0272: Multiparty Jingle (Muji) stanza extensions (#457)
Adds the presence extension and the extension of the Jingle IQ.
https://xmpp.org/extensions/xep-0272.html
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/qxmppjingleiq/tst_qxmppjingleiq.cpp | 3 | ||||
| -rw-r--r-- | tests/qxmpppresence/tst_qxmpppresence.cpp | 41 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp b/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp index 2a4caf22..2a1b20f3 100644 --- a/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp +++ b/tests/qxmppjingleiq/tst_qxmppjingleiq.cpp @@ -1,4 +1,5 @@ // SPDX-FileCopyrightText: 2012 Jeremy Lainé <jeremy.laine@m4x.org> +// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de> // // SPDX-License-Identifier: LGPL-2.1-or-later @@ -362,6 +363,7 @@ void tst_QXmppJingleIq::testSession() " action=\"session-initiate\"" " initiator=\"romeo@montague.lit/orchard\"" " sid=\"a73sjjvkla37jfea\">" + "<muji xmlns=\"urn:xmpp:jingle:muji:0\" room=\"darkcave@chat.shakespeare.lit\"/>" "<content creator=\"initiator\" name=\"this-is-a-stub\">" "<description xmlns=\"urn:xmpp:jingle:apps:stub:0\"/>" "<transport xmlns=\"urn:xmpp:jingle:transports:stub:0\"/>" @@ -374,6 +376,7 @@ void tst_QXmppJingleIq::testSession() QCOMPARE(session.action(), QXmppJingleIq::SessionInitiate); QCOMPARE(session.initiator(), QLatin1String("romeo@montague.lit/orchard")); QCOMPARE(session.sid(), QLatin1String("a73sjjvkla37jfea")); + QCOMPARE(session.mujiGroupChatJid(), QStringLiteral("darkcave@chat.shakespeare.lit")); QCOMPARE(session.contents().size(), 1); QCOMPARE(session.contents()[0].creator(), QLatin1String("initiator")); QCOMPARE(session.contents()[0].name(), QLatin1String("this-is-a-stub")); diff --git a/tests/qxmpppresence/tst_qxmpppresence.cpp b/tests/qxmpppresence/tst_qxmpppresence.cpp index 7ba5d90c..95d7ee92 100644 --- a/tests/qxmpppresence/tst_qxmpppresence.cpp +++ b/tests/qxmpppresence/tst_qxmpppresence.cpp @@ -1,5 +1,6 @@ // SPDX-FileCopyrightText: 2012 Oliver Goffart <ogoffart@woboq.com> // SPDX-FileCopyrightText: 2012 Jeremy Lainé <jeremy.laine@m4x.org> +// SPDX-FileCopyrightText: 2022 Melvin Keskin <melvo@olomono.de> // // SPDX-License-Identifier: LGPL-2.1-or-later @@ -21,6 +22,7 @@ private slots: void testPresenceWithMucItem(); void testPresenceWithMucPassword(); void testPresenceWithMucSupport(); + void testPresenceWithMuji(); void testPresenceWithLastUserInteraction(); void testPresenceWithMix(); void testPresenceWithVCard(); @@ -250,6 +252,45 @@ void tst_QXmppPresence::testPresenceWithMucSupport() serializePacket(presence, xml); } +void tst_QXmppPresence::testPresenceWithMuji() +{ + const QByteArray xml( + "<presence>" + "<muji xmlns=\"urn:xmpp:jingle:muji:0\">" + "<preparing/>" + "<content creator=\"initiator\" name=\"video\"/>" + "<content creator=\"initiator\" name=\"voice\"/>" + "</muji>" + "</presence>"); + + QXmppPresence presence1; + QVERIFY(!presence1.isPreparingMujiSession()); + QVERIFY(presence1.mujiContents().isEmpty()); + parsePacket(presence1, xml); + + QVERIFY(presence1.isPreparingMujiSession()); + QCOMPARE(presence1.mujiContents().size(), 2); + QCOMPARE(presence1.mujiContents().at(0).name(), QStringLiteral("video")); + QCOMPARE(presence1.mujiContents().at(1).name(), QStringLiteral("voice")); + serializePacket(presence1, xml); + + QXmppPresence presence2; + presence2.setIsPreparingMujiSession(true); + QXmppJingleIq::Content mujiContent1; + mujiContent1.setCreator(QStringLiteral("initiator")); + mujiContent1.setName(QStringLiteral("video")); + QXmppJingleIq::Content mujiContent2; + mujiContent2.setCreator(QStringLiteral("initiator")); + mujiContent2.setName(QStringLiteral("voice")); + presence2.setMujiContents({ mujiContent1, mujiContent2 }); + + QVERIFY(presence2.isPreparingMujiSession()); + QCOMPARE(presence2.mujiContents().size(), 2); + QCOMPARE(presence2.mujiContents().at(0).name(), QStringLiteral("video")); + QCOMPARE(presence2.mujiContents().at(1).name(), QStringLiteral("voice")); + serializePacket(presence2, xml); +} + void tst_QXmppPresence::testPresenceWithLastUserInteraction() { const QByteArray xml( |
