From 4e1d91e55fcdfc87cfb92dfbcb3e741cd4a450fd Mon Sep 17 00:00:00 2001 From: Jeremy Lainé Date: Wed, 18 Jul 2012 13:28:10 +0200 Subject: split dataform tests --- tests/tests.cpp | 64 ++------------------------------------------------------- 1 file changed, 2 insertions(+), 62 deletions(-) (limited to 'tests/tests.cpp') diff --git a/tests/tests.cpp b/tests/tests.cpp index 53cd1f3e..24ce8a2e 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -53,6 +53,7 @@ #include "QXmppGlobal.h" #include "QXmppEntityTimeIq.h" +#include "dataform.h" #include "rtp.h" #include "tests.h" @@ -941,67 +942,6 @@ void TestCodec::testTheoraEncoder() #endif } -void TestDataForm::testSimple() -{ - const QByteArray xml( - "" - "Joggle Search" - "Fill out this form to search for information!" - "" - "" - "" - ""); - - QXmppDataForm form; - parsePacket(form, xml); - - QCOMPARE(form.isNull(), false); - QCOMPARE(form.title(), QLatin1String("Joggle Search")); - QCOMPARE(form.instructions(), QLatin1String("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 TestDataForm::testMedia() -{ - const QByteArray xml( - "" - "" - "" - "" - "" - "http://www.victim.com/challenges/ocr.jpeg?F3A6292C" - "" - "" - "cid:sha1+f24030b8d91d233bac14777be5ab531ca3b9f102@bob.xmpp.org" - "" - "" - "" - ""); - - QXmppDataForm form; - parsePacket(form, xml); - - QCOMPARE(form.isNull(), false); - QCOMPARE(form.fields().size(), 1); - QCOMPARE(form.fields().at(0).type(), QXmppDataForm::Field::TextSingleField); - QCOMPARE(form.fields().at(0).isRequired(), false); - QCOMPARE(form.fields().at(0).media().uris().size(), 2); - QCOMPARE(form.fields().at(0).media().isNull(), false); - QCOMPARE(form.fields().at(0).media().height(), 80); - QCOMPARE(form.fields().at(0).media().width(), 290); - QCOMPARE(form.fields().at(0).media().uris().at(0).first, QString("image/jpeg")); - QCOMPARE(form.fields().at(0).media().uris().at(0).second, QString("http://www.victim.com/challenges/ocr.jpeg?F3A6292C")); - QCOMPARE(form.fields().at(0).media().uris().at(1).first, QString("image/png")); - QCOMPARE(form.fields().at(0).media().uris().at(1).second, QString("cid:sha1+f24030b8d91d233bac14777be5ab531ca3b9f102@bob.xmpp.org")); - - serializePacket(form, xml); -} - void TestJingle::testSession() { const QByteArray xml( @@ -1794,7 +1734,7 @@ int main(int argc, char *argv[]) TestCodec testCodec; errors += QTest::qExec(&testCodec); - TestDataForm testDataForm; + tst_QXmppDataForm testDataForm; errors += QTest::qExec(&testDataForm); TestJingle testJingle; -- cgit v1.2.3