From 09a5d6fabba1d225761ac37e4bdb6a5cf6e5e058 Mon Sep 17 00:00:00 2001 From: Linus Jahn Date: Thu, 10 Mar 2022 09:15:48 +0100 Subject: Rewrite MIX items with new QXmppPubSubItem --- tests/qxmppmixitem/tst_qxmppmixitem.cpp | 38 +++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 14 deletions(-) (limited to 'tests/qxmppmixitem/tst_qxmppmixitem.cpp') diff --git a/tests/qxmppmixitem/tst_qxmppmixitem.cpp b/tests/qxmppmixitem/tst_qxmppmixitem.cpp index 3d55a815..71daa5d1 100644 --- a/tests/qxmppmixitem/tst_qxmppmixitem.cpp +++ b/tests/qxmppmixitem/tst_qxmppmixitem.cpp @@ -23,6 +23,7 @@ private slots: void tst_QXmppMixItem::testInfo() { const QByteArray xml( + "" "" "" "urn:xmpp:mix:core:1" @@ -38,7 +39,8 @@ void tst_QXmppMixItem::testInfo() "greymalkin@shakespeare.example" "joan@shakespeare.example" "" - ""); + "" + ""); QXmppMixInfoItem item; parsePacket(item, xml); @@ -49,8 +51,7 @@ void tst_QXmppMixItem::testInfo() QCOMPARE(item.contactJids(), QStringList() << "greymalkin@shakespeare.example" << "joan@shakespeare.example"); - QXmppElement element = item.toElement(); - serializePacket(element, xml); + serializePacket(item, xml); // test setters item.setName("Skynet Development"); @@ -67,33 +68,39 @@ void tst_QXmppMixItem::testIsInfoItem() QDomElement element; const QByteArray xmlCorrect( + "" "" "" "urn:xmpp:mix:core:1" "" - ""); + "" + ""); QCOMPARE(doc.setContent(xmlCorrect, true), true); element = doc.documentElement(); - QVERIFY(QXmppMixInfoItem::isMixChannelInfo(element)); + QVERIFY(QXmppMixInfoItem::isItem(element)); const QByteArray xmlWrong( + "" "" "" "other:namespace" "" - ""); + "" + ""); QCOMPARE(doc.setContent(xmlWrong, true), true); element = doc.documentElement(); - QVERIFY(!QXmppMixInfoItem::isMixChannelInfo(element)); + QVERIFY(!QXmppMixInfoItem::isItem(element)); } void tst_QXmppMixItem::testParticipant() { const QByteArray xml( + "" "" "hag66@shakespeare.example" "thirdwitch" - ""); + "" + ""); QXmppMixParticipantItem item; parsePacket(item, xml); @@ -101,8 +108,7 @@ void tst_QXmppMixItem::testParticipant() QCOMPARE(item.nick(), QString("thirdwitch")); QCOMPARE(item.jid(), QString("hag66@shakespeare.example")); - QXmppElement element = item.toElement(); - serializePacket(element, xml); + serializePacket(item, xml); // test setters item.setNick("thomasd"); @@ -117,18 +123,22 @@ void tst_QXmppMixItem::testIsParticipantItem() QDomElement element; const QByteArray xmlCorrect( + "" "" - ""); + "" + ""); QCOMPARE(doc.setContent(xmlCorrect, true), true); element = doc.documentElement(); - QVERIFY(QXmppMixParticipantItem::isMixParticipantItem(element)); + QVERIFY(QXmppMixParticipantItem::isItem(element)); const QByteArray xmlWrong( + "" "" - ""); + "" + ""); QCOMPARE(doc.setContent(xmlWrong, true), true); element = doc.documentElement(); - QVERIFY(!QXmppMixParticipantItem::isMixParticipantItem(element)); + QVERIFY(!QXmppMixParticipantItem::isItem(element)); } QTEST_MAIN(tst_QXmppMixItem) -- cgit v1.2.3