aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJeremy Lainé <jeremy.laine@m4x.org>2012-08-03 14:15:58 +0200
committerJeremy Lainé <jeremy.laine@m4x.org>2012-08-03 14:15:58 +0200
commit34a30caf544899975b489e7e037fca9afb504267 (patch)
treed161b6eba6571324b4dce8618289cdf0678e4f17 /tests
parentdb39d34c691cf201830fe221ea72982071809247 (diff)
downloadqxmpp-34a30caf544899975b489e7e037fca9afb504267.tar.gz
add a QXmppVCardEmail class
Diffstat (limited to 'tests')
-rw-r--r--tests/vcard.cpp23
-rw-r--r--tests/vcard.h2
2 files changed, 25 insertions, 0 deletions
diff --git a/tests/vcard.cpp b/tests/vcard.cpp
index f7145ae9..2aa76b25 100644
--- a/tests/vcard.cpp
+++ b/tests/vcard.cpp
@@ -26,6 +26,29 @@
#include "tests.h"
#include "vcard.h"
+void tst_QXmppVCardIq::testEmail_data()
+{
+ QTest::addColumn<QByteArray>("xml");
+ QTest::addColumn<int>("type");
+
+ QTest::newRow("none") << QByteArray("<EMAIL><USERID>foo.bar@example.com</USERID></EMAIL>") << int(QXmppVCardEmail::None);
+ QTest::newRow("internet") << QByteArray("<EMAIL><INTERNET/><USERID>foo.bar@example.com</USERID></EMAIL>") << int(QXmppVCardEmail::Internet);
+ QTest::newRow("x400") << QByteArray("<EMAIL><X400/><USERID>foo.bar@example.com</USERID></EMAIL>") << int(QXmppVCardEmail::X400);
+ QTest::newRow("all") << QByteArray("<EMAIL><HOME/><WORK/><INTERNET/><PREF/><X400/><USERID>foo.bar@example.com</USERID></EMAIL>") << int(QXmppVCardEmail::Home | QXmppVCardEmail::Work | QXmppVCardEmail::Internet | QXmppVCardEmail::Preferred | QXmppVCardEmail::X400);
+}
+
+void tst_QXmppVCardIq::testEmail()
+{
+ QFETCH(QByteArray, xml);
+ QFETCH(int, type);
+
+ QXmppVCardEmail email;
+ parsePacket(email, xml);
+ QCOMPARE(email.address(), QLatin1String("foo.bar@example.com"));
+ QCOMPARE(int(email.type()), type);
+ serializePacket(email, xml);
+}
+
void tst_QXmppVCardIq::testVCard()
{
const QByteArray xml(
diff --git a/tests/vcard.h b/tests/vcard.h
index 796a0857..5f0d6677 100644
--- a/tests/vcard.h
+++ b/tests/vcard.h
@@ -28,5 +28,7 @@ class tst_QXmppVCardIq : public QObject
Q_OBJECT
private slots:
+ void testEmail_data();
+ void testEmail();
void testVCard();
};