aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-08-28 08:37:42 (GMT)
committerMontel Laurent <montel@kde.org>2016-08-28 08:37:42 (GMT)
commit798fae88b1764575eab50c36759f7e59348bc66f (patch)
tree98dd0d2ed360aef1311d8ffa40ffcb3bcc609e76
parenta649e302584aa38ebc77bb2abf1e0e9ab9ad6399 (diff)
Add birthday autotest
-rw-r--r--autotests/birthdaytest.cpp23
-rw-r--r--autotests/birthdaytest.h1
2 files changed, 22 insertions, 2 deletions
diff --git a/autotests/birthdaytest.cpp b/autotests/birthdaytest.cpp
index 4124ad1..6e02b57 100644
--- a/autotests/birthdaytest.cpp
+++ b/autotests/birthdaytest.cpp
@@ -49,9 +49,28 @@ void BirthDayTest::shouldParseBirthDay()
KContacts::VCardTool vcard;
const KContacts::AddresseeList lst = vcard.parseVCards(vcarddata);
QCOMPARE(lst.count(), 1);
- //QCOMPARE(lst.at(0).clientPidMapList().count(), 1);
- //QCOMPARE(lst.at(0).clientPidMapList().at(0).clientPidMap(), QStringLiteral("boo"));
+ QDateTime dt(QDate(1976, 5, 5), QTime(12, 5, 5));
+ QCOMPARE(lst.at(0).birthday(), dt);
+ QCOMPARE(lst.at(0).birthdayHasTime(), true);
+}
+
+void BirthDayTest::shouldParseBirthDayWithoutTime()
+{
+ QByteArray vcarddata("BEGIN:VCARD\r\n"
+ "VERSION:4.0\r\n"
+ "BDAY:19760505\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");
+ KContacts::VCardTool vcard;
+ const KContacts::AddresseeList lst = vcard.parseVCards(vcarddata);
+ QCOMPARE(lst.count(), 1);
+ QDateTime dt(QDate(1976, 5, 5));
+ QCOMPARE(lst.at(0).birthday(), dt);
+ QCOMPARE(lst.at(0).birthdayHasTime(), false);
}
void BirthDayTest::shouldExportVcard4()
diff --git a/autotests/birthdaytest.h b/autotests/birthdaytest.h
index 11041ce..ef5e97f 100644
--- a/autotests/birthdaytest.h
+++ b/autotests/birthdaytest.h
@@ -36,6 +36,7 @@ private Q_SLOTS:
void shouldExportVcard3();
void shouldExportVcard3WithoutTime();
void shouldParseBirthDay();
+ void shouldParseBirthDayWithoutTime();
};
#endif // BIRTHDAYTEST_H