summaryrefslogtreecommitdiff
path: root/tests/kcalconversiontest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/kcalconversiontest.cpp')
-rw-r--r--tests/kcalconversiontest.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/tests/kcalconversiontest.cpp b/tests/kcalconversiontest.cpp
index c62a8e0..9933683 100644
--- a/tests/kcalconversiontest.cpp
+++ b/tests/kcalconversiontest.cpp
@@ -530,6 +530,28 @@ void KCalConversionTest::testContactConversion_data()
QTest::newRow("bday") << kcal << kolab;
}
{
+ //QDateTime with invalid QTime
+ // QTime() -> isNull=true, isValid=false
+ // and also QDateTime isValid=false
+ //this kind of QDateTime is used to "reflect", that the vCard has a date-only value
+
+ KABC::Addressee kcal;
+ kcal.setUid("uid");
+ kcal.setFormattedName("name");
+ QDateTime dt(QDate(2012,2,2));
+ dt.setTime(QTime());
+ QCOMPARE(dt.isValid(), false);
+ kcal.setBirthday(dt);
+
+ //Because QDateTime doesn't know date-only values we always end up with a date-time
+ Kolab::Contact kolab;
+ kolab.setUid("uid");
+ kolab.setName("name");
+ kolab.setBDay(Kolab::cDateTime(2012,2,2,0,0,0));
+
+ QTest::newRow("invalid_qdatetime") << kcal << kolab;
+ }
+ {
KABC::Addressee kcal;
kcal.setUid("uid");
//The first address is always the preferred
@@ -566,8 +588,14 @@ void KCalConversionTest::testContactConversion()
foreach (const QString &mail, e.emails()) {
QCOMPARE(e.custom(QLatin1String("KOLAB"), QString::fromLatin1("EmailTypes%1").arg(mail)), kcal.custom(QLatin1String("KOLAB"), QString::fromLatin1("EmailTypes%1").arg(mail)));
}
- QCOMPARE(e.birthday(), kcal.birthday());
-
+
+ if (!kcal.birthday().isValid()) {
+ QCOMPARE(e.birthday().date(), kcal.birthday().date());
+ QCOMPARE(e.birthday().time(), QTime(0,0,0));
+ } else {
+ QCOMPARE(e.birthday(), kcal.birthday());
+ }
+
const Kolab::Contact &b = fromKABC(kcal);
QCOMPARE(b.uid(), kolab.uid());
QCOMPARE(b.name(), kolab.name());