aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-08-29 04:57:25 (GMT)
committerMontel Laurent <montel@kde.org>2016-08-29 04:57:25 (GMT)
commitff84acfe1637c8ac93feed20a8a54736d2411d83 (patch)
treec8ac37ebfe7079efc082cbadb2896905a3f7f150
parent47a93967380e6b9167952b0b12e29d5538da1f9b (diff)
Add more autotest (test without year)
-rw-r--r--autotests/birthdaytest.cpp46
-rw-r--r--autotests/birthdaytest.h2
2 files changed, 48 insertions, 0 deletions
diff --git a/autotests/birthdaytest.cpp b/autotests/birthdaytest.cpp
index cd1a8b4..ea80946 100644
--- a/autotests/birthdaytest.cpp
+++ b/autotests/birthdaytest.cpp
@@ -138,6 +138,29 @@ void BirthDayTest::shouldExportVcard4WithoutTime()
QCOMPARE(ba, expected);
}
+void BirthDayTest::shouldExportVcard4WithoutTimeAndWithoutYear()
+{
+ KContacts::AddresseeList lst;
+ KContacts::Addressee addr;
+ addr.setEmails(QStringList() << QStringLiteral("foo@kde.org") << QStringLiteral("bla@kde.org"));
+ addr.setUid(QStringLiteral("testuid"));
+ const QDate d(-1, 5, 5);
+ addr.setBirthday(d);
+ lst << addr;
+ KContacts::VCardTool vcard;
+ const QByteArray ba = vcard.exportVCards(lst, KContacts::VCard::v4_0);
+ QByteArray expected("BEGIN:VCARD\r\n"
+ "VERSION:4.0\r\n"
+ "BDAY:--0505\r\n"
+ "EMAIL:foo@kde.org\r\n"
+ "EMAIL:bla@kde.org\r\n"
+ "N:;;;;\r\n"
+ "UID:testuid\r\n"
+ "END:VCARD\r\n\r\n");
+
+ QCOMPARE(ba, expected);
+}
+
void BirthDayTest::shouldExportVcard3()
{
KContacts::AddresseeList lst;
@@ -161,6 +184,29 @@ void BirthDayTest::shouldExportVcard3()
QCOMPARE(ba, expected);
}
+void BirthDayTest::shouldExportVcard3WithoutTimeAndWithoutYear()
+{
+ KContacts::AddresseeList lst;
+ KContacts::Addressee addr;
+ addr.setEmails(QStringList() << QStringLiteral("foo@kde.org") << QStringLiteral("bla@kde.org"));
+ addr.setUid(QStringLiteral("testuid"));
+ const QDate d(-1, 5, 5);
+ addr.setBirthday(d);
+ lst << addr;
+ KContacts::VCardTool vcard;
+ const QByteArray ba = vcard.exportVCards(lst, KContacts::VCard::v3_0);
+ QByteArray expected("BEGIN:VCARD\r\n"
+ "VERSION:3.0\r\n"
+ "BDAY:--05-05\r\n"
+ "EMAIL:foo@kde.org\r\n"
+ "EMAIL:bla@kde.org\r\n"
+ "N:;;;;\r\n"
+ "UID:testuid\r\n"
+ "END:VCARD\r\n\r\n");
+
+ QCOMPARE(ba, expected);
+}
+
void BirthDayTest::shouldExportVcard3WithoutTime()
{
KContacts::AddresseeList lst;
diff --git a/autotests/birthdaytest.h b/autotests/birthdaytest.h
index cb7626c..b38592f 100644
--- a/autotests/birthdaytest.h
+++ b/autotests/birthdaytest.h
@@ -38,6 +38,8 @@ private Q_SLOTS:
void shouldParseBirthDay();
void shouldParseBirthDayWithoutTime();
void shouldParseBirthDayWithoutTimeAndYear();
+ void shouldExportVcard4WithoutTimeAndWithoutYear();
+ void shouldExportVcard3WithoutTimeAndWithoutYear();
};
#endif // BIRTHDAYTEST_H