aboutsummaryrefslogtreecommitdiff
path: root/tests/qxmppmixitem
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2022-03-10 09:36:08 +0100
committerLinus Jahn <lnj@kaidan.im>2022-03-10 10:03:30 +0100
commit686b7f7c2ab6b3987925241888fa387be35a97a8 (patch)
treea8f79c68f804926732267792086d97005eb68a4c /tests/qxmppmixitem
parent523030f0751d69e4f33ee7dc3a4078e213ee94aa (diff)
downloadqxmpp-686b7f7c2ab6b3987925241888fa387be35a97a8.tar.gz
Rename MixItem.h to MixItems.h
Diffstat (limited to 'tests/qxmppmixitem')
-rw-r--r--tests/qxmppmixitem/tst_qxmppmixitem.cpp143
1 files changed, 0 insertions, 143 deletions
diff --git a/tests/qxmppmixitem/tst_qxmppmixitem.cpp b/tests/qxmppmixitem/tst_qxmppmixitem.cpp
deleted file mode 100644
index d3a8168d..00000000
--- a/tests/qxmppmixitem/tst_qxmppmixitem.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-// SPDX-FileCopyrightText: 2019 Linus Jahn <lnj@kaidan.im>
-//
-// SPDX-License-Identifier: LGPL-2.1-or-later
-
-#include "QXmppMixInfoItem.h"
-#include "QXmppMixParticipantItem.h"
-
-#include "util.h"
-
-class tst_QXmppMixItem : public QObject
-{
- Q_OBJECT
-
-private slots:
- void testInfo();
- void testIsInfoItem();
- void testParticipant();
- void testIsParticipantItem();
-};
-
-void tst_QXmppMixItem::testInfo()
-{
- const QByteArray xml(
- "<item>"
- "<x xmlns=\"jabber:x:data\" type=\"result\">"
- "<field type=\"hidden\" var=\"FORM_TYPE\">"
- "<value>urn:xmpp:mix:core:1</value>"
- "</field>"
- "<field type=\"text-single\" var=\"Name\">"
- "<value>Witches Coven</value>"
- "</field>"
- "<field type=\"text-single\" var=\"Description\">"
- "<value>A location not far from the blasted heath where the "
- "three witches meet</value>"
- "</field>"
- "<field type=\"jid-multi\" var=\"Contact\">"
- "<value>greymalkin@shakespeare.example</value>"
- "<value>joan@shakespeare.example</value>"
- "</field>"
- "</x>"
- "</item>");
-
- QXmppMixInfoItem item;
- parsePacket(item, xml);
-
- QCOMPARE(item.name(), QString("Witches Coven"));
- QCOMPARE(item.description(), QString("A location not far from the blasted "
- "heath where the three witches meet"));
- QCOMPARE(item.contactJids(), QStringList() << "greymalkin@shakespeare.example"
- << "joan@shakespeare.example");
-
- serializePacket(item, xml);
-
- // test setters
- item.setName("Skynet Development");
- QCOMPARE(item.name(), QString("Skynet Development"));
- item.setDescription("Very cool development group.");
- QCOMPARE(item.description(), QString("Very cool development group."));
- item.setContactJids(QStringList() << "somebody@example.org");
- QCOMPARE(item.contactJids(), QStringList() << "somebody@example.org");
-}
-
-void tst_QXmppMixItem::testIsInfoItem()
-{
- QDomDocument doc;
- QDomElement element;
-
- const QByteArray xmlCorrect(
- "<item>"
- "<x xmlns=\"jabber:x:data\" type=\"result\">"
- "<field type=\"hidden\" var=\"FORM_TYPE\">"
- "<value>urn:xmpp:mix:core:1</value>"
- "</field>"
- "</x>"
- "</item>");
- QCOMPARE(doc.setContent(xmlCorrect, true), true);
- element = doc.documentElement();
- QVERIFY(QXmppMixInfoItem::isItem(element));
-
- const QByteArray xmlWrong(
- "<item>"
- "<x xmlns=\"jabber:x:data\" type=\"result\">"
- "<field type=\"hidden\" var=\"FORM_TYPE\">"
- "<value>other:namespace</value>"
- "</field>"
- "</x>"
- "</item>");
- QCOMPARE(doc.setContent(xmlWrong, true), true);
- element = doc.documentElement();
- QVERIFY(!QXmppMixInfoItem::isItem(element));
-}
-
-void tst_QXmppMixItem::testParticipant()
-{
- const QByteArray xml(
- "<item>"
- "<participant xmlns=\"urn:xmpp:mix:core:1\">"
- "<jid>hag66@shakespeare.example</jid>"
- "<nick>thirdwitch</nick>"
- "</participant>"
- "</item>");
-
- QXmppMixParticipantItem item;
- parsePacket(item, xml);
-
- QCOMPARE(item.nick(), QString("thirdwitch"));
- QCOMPARE(item.jid(), QString("hag66@shakespeare.example"));
-
- serializePacket(item, xml);
-
- // test setters
- item.setNick("thomasd");
- QCOMPARE(item.nick(), QString("thomasd"));
- item.setJid("thomas@d.example");
- QCOMPARE(item.jid(), QString("thomas@d.example"));
-}
-
-void tst_QXmppMixItem::testIsParticipantItem()
-{
- QDomDocument doc;
- QDomElement element;
-
- const QByteArray xmlCorrect(
- "<item>"
- "<participant xmlns=\"urn:xmpp:mix:core:1\">"
- "</participant>"
- "</item>");
- QCOMPARE(doc.setContent(xmlCorrect, true), true);
- element = doc.documentElement();
- QVERIFY(QXmppMixParticipantItem::isItem(element));
-
- const QByteArray xmlWrong(
- "<item>"
- "<participant xmlns=\"other:namespace:1\">"
- "</participant>"
- "</item>");
- QCOMPARE(doc.setContent(xmlWrong, true), true);
- element = doc.documentElement();
- QVERIFY(!QXmppMixParticipantItem::isItem(element));
-}
-
-QTEST_MAIN(tst_QXmppMixItem)
-#include "tst_qxmppmixitem.moc"