diff options
| author | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-07-18 10:26:59 +0200 |
|---|---|---|
| committer | Jeremy Lainé <jeremy.laine@m4x.org> | 2012-07-18 10:26:59 +0200 |
| commit | 0ed84be38b159a32790cb074dc04760313ba27c2 (patch) | |
| tree | 8f1fb214d3ddf3f1b8cd1bacd75e4f1122d0e611 /tests/tests.cpp | |
| parent | 2006c17c89f270af388cd64cdc15423e0672e00c (diff) | |
| download | qxmpp-0ed84be38b159a32790cb074dc04760313ba27c2.tar.gz | |
Fix and test data form title/instructions XML serialization.
Diffstat (limited to 'tests/tests.cpp')
| -rw-r--r-- | tests/tests.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/tests.cpp b/tests/tests.cpp index f824b938..223aecd9 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -962,6 +962,31 @@ void TestCodec::testTheoraEncoder() #endif } +void TestDataForm::testSimple() +{ + const QByteArray xml( + "<x xmlns=\"jabber:x:data\" type=\"form\">" + "<title>Search</title>" + "<instructions>Fill out this form to search for information!</instructions>" + "<field type=\"text-single\" var=\"search_request\">" + "<value/>" + "<required/>" + "</field>" + "</x>"); + + QXmppDataForm form; + parsePacket(form, xml); + + QCOMPARE(form.isNull(), false); + QCOMPARE(form.instructions(), QString("Fill out this form to search for information!")); + QCOMPARE(form.fields().size(), 1); + QCOMPARE(form.fields().at(0).type(), QXmppDataForm::Field::TextSingleField); + QCOMPARE(form.fields().at(0).isRequired(), true); + QCOMPARE(form.fields().at(0).key(), QString("search_request")); + + serializePacket(form, xml); +} + void TestJingle::testSession() { const QByteArray xml( @@ -1805,6 +1830,9 @@ int main(int argc, char *argv[]) TestCodec testCodec; errors += QTest::qExec(&testCodec); + TestDataForm testDataForm; + errors += QTest::qExec(&testDataForm); + TestJingle testJingle; errors += QTest::qExec(&testJingle); |
