aboutsummaryrefslogtreecommitdiff
path: root/tests/qxmppdataform/tst_qxmppdataform.cpp
diff options
context:
space:
mode:
authorLinus Jahn <lnj@kaidan.im>2020-09-07 17:17:59 +0200
committerLinus Jahn <lnj@kaidan.im>2021-03-23 23:40:58 +0100
commit5c6a6b8385df6b3f9cc640781eb76900e9364015 (patch)
tree337f5031643aef10e6e8a56db9535dd50835fc53 /tests/qxmppdataform/tst_qxmppdataform.cpp
parent729b2dfa31c7585028599ca66644fa7270c217e9 (diff)
downloadqxmpp-5c6a6b8385df6b3f9cc640781eb76900e9364015.tar.gz
QXmppDataForm: Add FORM_TYPE search function
Diffstat (limited to 'tests/qxmppdataform/tst_qxmppdataform.cpp')
-rw-r--r--tests/qxmppdataform/tst_qxmppdataform.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/qxmppdataform/tst_qxmppdataform.cpp b/tests/qxmppdataform/tst_qxmppdataform.cpp
index 39925901..cfb10b75 100644
--- a/tests/qxmppdataform/tst_qxmppdataform.cpp
+++ b/tests/qxmppdataform/tst_qxmppdataform.cpp
@@ -43,6 +43,7 @@ private slots:
void testSubmit();
void testMedia();
void testMediaSource();
+ void testFormType();
};
void tst_QXmppDataForm::testSimple()
@@ -62,6 +63,7 @@ void tst_QXmppDataForm::testSimple()
QCOMPARE(form.isNull(), false);
QCOMPARE(form.title(), QLatin1String("Joggle Search"));
QCOMPARE(form.instructions(), QLatin1String("Fill out this form to search for information!"));
+ QVERIFY(form.formType().isNull());
QCOMPARE(form.fields().size(), 1);
QCOMPARE(form.fields().at(0).type(), QXmppDataForm::Field::TextSingleField);
QCOMPARE(form.fields().at(0).isRequired(), true);
@@ -211,5 +213,27 @@ void tst_QXmppDataForm::testMediaSource()
QCOMPARE(source.contentType(), QMimeDatabase().mimeTypeForName("application/xml"));
}
+void tst_QXmppDataForm::testFormType()
+{
+ const auto xml = QByteArrayLiteral(R"(<x xmlns='jabber:x:data' type='submit'>
+ <field var='FORM_TYPE' type='hidden'>
+ <value>http://jabber.org/protocol/pubsub#subscribe_options</value>
+ </field>
+ <field var='pubsub#deliver'><value>1</value></field>
+ <field var='pubsub#digest'><value>0</value></field>
+ <field var='pubsub#include_body'><value>false</value></field>
+ <field var='pubsub#show-values'>
+ <value>chat</value>
+ <value>online</value>
+ <value>away</value>
+ </field>
+</x>)");
+
+ QXmppDataForm form;
+ parsePacket(form, xml);
+
+ QCOMPARE(form.formType(), QStringLiteral("http://jabber.org/protocol/pubsub#subscribe_options"));
+}
+
QTEST_MAIN(tst_QXmppDataForm)
#include "tst_qxmppdataform.moc"