void tst_QXmppMessage::testBasic() { QFETCH(QByteArray, xml); QFETCH(int, type); QFETCH(QString, body); QFETCH(QString, subject); QFETCH(QString, thread); QXmppMessage message; parsePacket(message, xml); QCOMPARE(message.to(), QString("[email protected]/QXmpp")); QCOMPARE(message.from(), QString("[email protected]/QXmpp")); QVERIFY(message.extendedAddresses().isEmpty()); QCOMPARE(int(message.type()), type); QCOMPARE(message.body(), body); QCOMPARE(message.subject(), subject); QCOMPARE(message.thread(), thread); QCOMPARE(message.state(), QXmppMessage::None); QCOMPARE(message.isAttentionRequested(), false); QCOMPARE(message.isReceiptRequested(), false); QCOMPARE(message.hasForwarded(), false); QCOMPARE(message.receiptId(), QString()); QCOMPARE(message.xhtml(), QString()); serializePacket(message, xml); }
void tst_QXmppMessage::testXhtml() { const QByteArray xml("<message type=\"normal\">" "<body>hi!</body>" "<html xmlns=\"http://jabber.org/protocol/xhtml-im\">" "<body xmlns=\"http://www.w3.org/1999/xhtml\">" "<p style=\"font-weight:bold\">hi!</p>" "</body>" "</html>" "</message>"); QXmppMessage message; parsePacket(message, xml); QCOMPARE(message.xhtml(), QLatin1String("<p style=\"font-weight:bold\">hi!</p>")); serializePacket(message, xml); }