Commit ff84acfe authored by Laurent Montel's avatar Laurent Montel 😁

Add more autotest (test without year)

parent 47a93967
......@@ -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;
......
......@@ -38,6 +38,8 @@ private Q_SLOTS:
void shouldParseBirthDay();
void shouldParseBirthDayWithoutTime();
void shouldParseBirthDayWithoutTimeAndYear();
void shouldExportVcard4WithoutTimeAndWithoutYear();
void shouldExportVcard3WithoutTimeAndWithoutYear();
};
#endif // BIRTHDAYTEST_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment