From 686b7f7c2ab6b3987925241888fa387be35a97a8 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Thu, 10 Mar 2022 09:36:08 +0100 Subject: Rename MixItem.h to MixItems.h --- tests/qxmppmixitem/tst_qxmppmixitem.cpp | 143 -------------------------------- 1 file changed, 143 deletions(-) delete mode 100644 tests/qxmppmixitem/tst_qxmppmixitem.cpp (limited to 'tests/qxmppmixitem') 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 -// -// 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( - "" - "" - "" - "urn:xmpp:mix:core:1" - "" - "" - "Witches Coven" - "" - "" - "A location not far from the blasted heath where the " - "three witches meet" - "" - "" - "greymalkin@shakespeare.example" - "joan@shakespeare.example" - "" - "" - ""); - - 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( - "" - "" - "" - "urn:xmpp:mix:core:1" - "" - "" - ""); - QCOMPARE(doc.setContent(xmlCorrect, true), true); - element = doc.documentElement(); - QVERIFY(QXmppMixInfoItem::isItem(element)); - - const QByteArray xmlWrong( - "" - "" - "" - "other:namespace" - "" - "" - ""); - QCOMPARE(doc.setContent(xmlWrong, true), true); - element = doc.documentElement(); - QVERIFY(!QXmppMixInfoItem::isItem(element)); -} - -void tst_QXmppMixItem::testParticipant() -{ - const QByteArray xml( - "" - "" - "hag66@shakespeare.example" - "thirdwitch" - "" - ""); - - 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( - "" - "" - "" - ""); - QCOMPARE(doc.setContent(xmlCorrect, true), true); - element = doc.documentElement(); - QVERIFY(QXmppMixParticipantItem::isItem(element)); - - const QByteArray xmlWrong( - "" - "" - "" - ""); - QCOMPARE(doc.setContent(xmlWrong, true), true); - element = doc.documentElement(); - QVERIFY(!QXmppMixParticipantItem::isItem(element)); -} - -QTEST_MAIN(tst_QXmppMixItem) -#include "tst_qxmppmixitem.moc" -- cgit v1.2.3