aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-13 07:58:45 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-13 07:58:45 (GMT)
commitc0dc9eb02b12583b449bdfabdf794048c8883506 (patch)
tree9687070c6548fc1625b4202d169b83e7f9d17f4e
parent52ef80b5029eadd24930aff33ab534b59b46c042 (diff)
Look at to export as 2.1
-rw-r--r--autotests/phonenumbertest.cpp28
-rw-r--r--autotests/phonenumbertest.h1
2 files changed, 29 insertions, 0 deletions
diff --git a/autotests/phonenumbertest.cpp b/autotests/phonenumbertest.cpp
index e69be58..42f445e 100644
--- a/autotests/phonenumbertest.cpp
+++ b/autotests/phonenumbertest.cpp
@@ -183,6 +183,34 @@ void PhoneNumberTest::labelTest()
QLatin1String("Work Fax/Preferred"));
}
+void PhoneNumberTest::shouldExportVCard21()
+{
+ KContacts::AddresseeList lst;
+ KContacts::Addressee addr;
+ addr.setEmails(QStringList() << QStringLiteral("foo@kde.org"));
+ addr.setUid(QStringLiteral("testuid"));
+
+ KContacts::PhoneNumber number1;
+
+ number1.setId(QStringLiteral("My Id"));
+ number1.setType(KContacts::PhoneNumber::Work | KContacts::PhoneNumber::Cell);
+ number1.setNumber(QStringLiteral("+1-919-676-9564"));
+ addr.setPhoneNumbers(KContacts::PhoneNumber::List() << number1);
+ lst << addr;
+ KContacts::VCardTool vcard;
+ const QByteArray ba = vcard.exportVCards(lst, KContacts::VCard::v2_1);
+ QByteArray expected("BEGIN:VCARD\r\n"
+ "VERSION:2.1\r\n"
+ "EMAIL:foo@kde.org\r\n"
+ "N:;;;;\r\n"
+ "TEL;CELL;WORK:+1-919-676-9564\r\n"
+ "UID:testuid\r\n"
+ "END:VCARD\r\n"
+ "\r\n");
+ QCOMPARE(ba, expected);
+
+}
+
void PhoneNumberTest::shouldExportVCard3()
{
KContacts::AddresseeList lst;
diff --git a/autotests/phonenumbertest.h b/autotests/phonenumbertest.h
index 6e0d805..31a2c88 100644
--- a/autotests/phonenumbertest.h
+++ b/autotests/phonenumbertest.h
@@ -41,6 +41,7 @@ private Q_SLOTS:
void shouldParseVcard3();
void shouldParseVcard4();
+ void shouldExportVCard21();
};
#endif