File indexing completed on 2024-04-14 03:50:38
0001 /* 0002 * SPDX-FileCopyrightText: 2013 Christian Mollekopf <mollekopf@kolabsys.com> 0003 * 0004 * SPDX-License-Identifier: LGPL-3.0-or-later 0005 */ 0006 0007 #include "testrecurrenceexception.h" 0008 #include "memorycalendar.h" 0009 0010 #include <QTest> 0011 QTEST_MAIN(TestRecurrenceException) 0012 0013 void TestRecurrenceException::testCreateTodoException() 0014 { 0015 const QDateTime dtstart(QDate(2013, 03, 10), QTime(10, 0, 0), QTimeZone::UTC); 0016 const QDateTime dtdue(QDate(2013, 03, 10), QTime(11, 0, 0), QTimeZone::UTC); 0017 const QDateTime recurrenceId(QDateTime(dtstart).addDays(1)); 0018 0019 KCalendarCore::Todo::Ptr todo(new KCalendarCore::Todo()); 0020 todo->setUid(QStringLiteral("todo")); 0021 todo->setDtStart(dtstart); 0022 todo->setDtDue(dtdue); 0023 todo->recurrence()->setDaily(1); 0024 todo->recurrence()->setDuration(3); 0025 todo->setCreated(dtstart); 0026 todo->setLastModified(dtstart); 0027 0028 const KCalendarCore::Todo::Ptr exception = KCalendarCore::MemoryCalendar::createException(todo, recurrenceId, false).staticCast<KCalendarCore::Todo>(); 0029 QCOMPARE(exception->dtStart(), recurrenceId); 0030 QCOMPARE(exception->dtDue(), QDateTime(dtdue).addDays(1)); 0031 QVERIFY(exception->created() >= todo->created()); 0032 QVERIFY(exception->lastModified() >= exception->created()); 0033 // FIXME should be done on clearing the recurrence, but we can't due to BC. 0034 // Probably not that important as long as dtRecurrence is ignored if the todo is not recurring 0035 // QCOMPARE(exception->dtRecurrence(), QDateTime()); 0036 // TODO dtCompleted 0037 } 0038 0039 #include "moc_testrecurrenceexception.cpp"