// SPDX-FileCopyrightText: 2012 Jeremy Lainé // // SPDX-License-Identifier: LGPL-2.1-or-later #include "QXmppIq.h" #include "util.h" #include class tst_QXmppIq : public QObject { Q_OBJECT private: Q_SLOT void testBasic_data(); Q_SLOT void testBasic(); }; void tst_QXmppIq::testBasic_data() { QTest::addColumn("xml"); QTest::addColumn("type"); QTest::newRow("get") << QByteArray(R"()") << int(QXmppIq::Get); QTest::newRow("set") << QByteArray(R"()") << int(QXmppIq::Set); QTest::newRow("result") << QByteArray(R"()") << int(QXmppIq::Result); QTest::newRow("error") << QByteArray(R"()") << int(QXmppIq::Error); } void tst_QXmppIq::testBasic() { QFETCH(QByteArray, xml); QFETCH(int, type); QXmppIq iq; parsePacket(iq, xml); QCOMPARE(iq.to(), QString("foo@example.com/QXmpp")); QCOMPARE(iq.from(), QString("bar@example.com/QXmpp")); QCOMPARE(int(iq.type()), type); serializePacket(iq, xml); } QTEST_MAIN(tst_QXmppIq) #include "tst_qxmppiq.moc"