Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F118166247
D17.1775656785.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D17.1775656785.diff
View Options
Index: akonadi/calendar/calendarbase.cpp
===================================================================
--- akonadi/calendar/calendarbase.cpp
+++ akonadi/calendar/calendarbase.cpp
@@ -295,7 +295,7 @@
if (resultCode == IncidenceChanger::ResultCodeSuccess) {
KCalCore::Incidence::Ptr incidence = CalendarUtils::incidence(item);
Q_ASSERT(incidence);
- KCalCore::Incidence::Ptr localIncidence = q->incidence(incidence->instanceIdentifier());
+ KCalCore::Incidence::Ptr localIncidence = q->incidence(incidence->uid(), incidence->recurrenceId());
if (localIncidence) {
//update our local one
Index: akonadi/calendar/tests/CMakeLists.txt
===================================================================
--- akonadi/calendar/tests/CMakeLists.txt
+++ akonadi/calendar/tests/CMakeLists.txt
@@ -22,7 +22,7 @@
#add_akonadi_isolated_test_advanced( historytest.cpp "${common_sources}" "")
#add_akonadi_isolated_test( incidencechangertest.cpp )
-#add_akonadi_isolated_test( calendarbasetest.cpp )
+add_akonadi_isolated_test( calendarbasetest.cpp )
#add_akonadi_isolated_test( fetchjobcalendartest.cpp )
#add_akonadi_isolated_test( etmcalendartest.cpp )
Index: akonadi/calendar/tests/calendarbasetest.h
===================================================================
--- akonadi/calendar/tests/calendarbasetest.h
+++ akonadi/calendar/tests/calendarbasetest.h
@@ -37,6 +37,7 @@
public Q_SLOTS:
void handleCreateFinished(bool success, const QString &errorString);
void handleDeleteFinished(bool success, const QString &errorString);
+ void handleModifyFinished(bool success, const QString &errorString);
private Q_SLOTS:
void initTestCase();
@@ -46,6 +47,7 @@
void testChildIncidences_data();
void testChildIncidences();
void testDelete();
+ void testExceptions();
// void testDeleteAll(); This has been disabled in KCalCore::Calendar::deleteAll*() so no need to test
private:
Index: akonadi/calendar/tests/calendarbasetest.cpp
===================================================================
--- akonadi/calendar/tests/calendarbasetest.cpp
+++ akonadi/calendar/tests/calendarbasetest.cpp
@@ -135,6 +135,9 @@
connect(mCalendar, SIGNAL(deleteFinished(bool,QString)),
SLOT(handleDeleteFinished(bool,QString)));
+
+ connect(mCalendar, SIGNAL(modifyFinished(bool,QString)),
+ SLOT(handleModifyFinished(bool,QString)));
createInitialIncidences();
}
@@ -255,6 +258,44 @@
}
*/
+void CalendarBaseTest::testExceptions()
+{
+ const Event::Ptr event = Event::Ptr(new Event());
+ event->setDtStart(KDateTime::currentDateTime(KDateTime::UTC));
+ event->recurrence()->setDaily(1);
+
+ int baseCount = mCalendar->incidences().count();
+ const Incidence::Ptr exception = mCalendar->createException(event,event->dtStart().addDays(1), false);
+
+ mExpectedSlotResult = true;
+ QVERIFY(mCalendar->addIncidence(event));
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QVERIFY(mCalendar->addIncidence(exception));
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(mCalendar->incidences().count(), baseCount+2);
+
+ exception->setSummary(QLatin1String("change"));
+
+ QVERIFY(mCalendar->modifyIncidence(exception));
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ QCOMPARE(mCalendar->incidences().count(), baseCount+2);
+ QCOMPARE(mCalendar->instances(event).count(), 1);
+
+ const Incidence::Ptr retInc = mCalendar->incidence(exception->uid(), exception->recurrenceId());
+ QVERIFY(retInc);
+ QCOMPARE(retInc->summary(), exception->summary());
+
+ QVERIFY(mCalendar->deleteIncidence(exception));
+ QTestEventLoop::instance().enterLoop(5);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+
+ QCOMPARE(mCalendar->incidences().count(), baseCount+1);
+ QCOMPARE(mCalendar->instances(event).count(), 0);
+ QCOMPARE(mCalendar->incidence(event->uid())->instanceIdentifier(), event->uid()); //No recurrenceId means main event
+}
void CalendarBaseTest::handleCreateFinished(bool success, const QString &errorString)
{
@@ -272,6 +313,14 @@
QTestEventLoop::instance().exitLoop();
}
+void CalendarBaseTest::handleModifyFinished(bool success, const QString &errorString)
+{
+ if (!success)
+ qDebug() << "handleDeleteFinished(): " << errorString;
+ QCOMPARE(success, mExpectedSlotResult);
+ QTestEventLoop::instance().exitLoop();
+}
+
Item::Id CalendarBaseTest::createTodo(const QString &uid, const QString &parentUid)
{
Todo::Ptr todo = Todo::Ptr(new Todo());
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 1:59 PM (6 h, 7 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
18833935
Default Alt Text
D17.1775656785.diff (4 KB)
Attached To
Mode
D17: Fix issue if updating exception via modifyIncidence
Attached
Detach File
Event Timeline