37 void cleanup(); |
37 void cleanup(); |
38 void initTestCase(); |
38 void initTestCase(); |
39 void cleanupTestCase(); |
39 void cleanupTestCase(); |
40 |
40 |
41 // Test cases. |
41 // Test cases. |
42 void test_addEntry(); |
42 void test_storeWithNewEntry(); |
43 void test_deleteEntry(); |
43 void test_deleteEntry(); |
44 void test_deleteRepeatedEntry(); |
44 void test_deleteRepeatedEntry(); |
45 void test_fetchById(); |
45 void test_fetchById(); |
46 void test_updateEntry(); |
46 void test_storeWithExistingEntry(); |
47 void test_createEntryIdListForDay(); |
47 void test_createEntryIdListForDay(); |
48 void test_entryIds(); |
48 void test_entryIds(); |
49 void test_fetchAllEntries(); |
49 void test_fetchAllEntries(); |
50 void test_deleteEntries(); |
50 void test_deleteEntries(); |
51 void test_fetchEntriesInRange(); |
51 void test_fetchEntriesInRange(); |
138 if (mAgendaUtil) { |
138 if (mAgendaUtil) { |
139 delete mAgendaUtil; |
139 delete mAgendaUtil; |
140 } |
140 } |
141 } |
141 } |
142 /* |
142 /* |
143 Tests the AgendaUtil::addEntry. |
143 Tests the AgendaUtil::store. |
144 */ |
144 */ |
145 void TestAgendaUtil::test_addEntry() |
145 void TestAgendaUtil::test_storeWithNewEntry() |
146 { |
146 { |
147 // Test case setup. |
147 // Test case setup. |
148 AgendaEntry entry; |
148 AgendaEntry entry; |
149 QDate dateSet(2010,12,1); |
149 QDate dateSet(2010,12,1); |
150 QTime timeSet(10,10,10,10); |
150 QTime timeSet(10,10,10,10); |
152 entry.setType(AgendaEntry::TypeEvent); |
152 entry.setType(AgendaEntry::TypeEvent); |
153 entry.setSummary("Test case"); |
153 entry.setSummary("Test case"); |
154 entry.setStartAndEndTime(dateTimeSet, dateTimeSet); |
154 entry.setStartAndEndTime(dateTimeSet, dateTimeSet); |
155 |
155 |
156 // Run the case. |
156 // Run the case. |
157 ulong id = mAgendaUtil->addEntry(entry); |
157 ulong id = mAgendaUtil->store(entry); |
158 |
158 |
159 // Verify. |
159 // Verify. |
160 AgendaEntry newEntry = mAgendaUtil->fetchById(id); |
160 AgendaEntry newEntry = mAgendaUtil->fetchById(id); |
161 QDateTime dateTimeRetrieved = newEntry.startTime(); |
161 QDateTime dateTimeRetrieved = newEntry.startTime(); |
162 QDate dateRetrieved = dateTimeRetrieved.date(); |
162 QDate dateRetrieved = dateTimeRetrieved.date(); |
178 entry.setType(AgendaEntry::TypeEvent); |
178 entry.setType(AgendaEntry::TypeEvent); |
179 entry.setSummary("Test case"); |
179 entry.setSummary("Test case"); |
180 entry.setStartAndEndTime( |
180 entry.setStartAndEndTime( |
181 QDateTime::currentDateTime(), |
181 QDateTime::currentDateTime(), |
182 QDateTime::currentDateTime()); |
182 QDateTime::currentDateTime()); |
183 ulong id = mAgendaUtil->addEntry(entry); |
183 ulong id = mAgendaUtil->store(entry); |
184 |
184 |
185 // Run the case. |
185 // Run the case. |
186 QVERIFY(mAgendaUtil->deleteEntry(id)); |
186 QVERIFY(mAgendaUtil->deleteEntry(id)); |
187 |
187 |
188 // Verify. |
188 // Verify. |
208 QDateTime until(QDate(2019, 12, 3)); |
208 QDateTime until(QDate(2019, 12, 3)); |
209 repeatRule.setUntil(until); |
209 repeatRule.setUntil(until); |
210 repeatRule.setInterval(1); |
210 repeatRule.setInterval(1); |
211 entry.setRepeatRule(repeatRule); |
211 entry.setRepeatRule(repeatRule); |
212 |
212 |
213 ulong id = mAgendaUtil->addEntry(entry); |
213 ulong id = mAgendaUtil->store(entry); |
214 AgendaEntry savedEntry = mAgendaUtil->fetchById(id); |
214 AgendaEntry savedEntry = mAgendaUtil->fetchById(id); |
215 QVERIFY(!savedEntry.isNull()); |
215 QVERIFY(!savedEntry.isNull()); |
216 QVERIFY(savedEntry.isRepeating()); |
216 QVERIFY(savedEntry.isRepeating()); |
217 |
217 |
218 // Run the case. |
218 // Run the case. |
235 entry.setType(AgendaEntry::TypeEvent); |
235 entry.setType(AgendaEntry::TypeEvent); |
236 entry.setSummary("Test case"); |
236 entry.setSummary("Test case"); |
237 entry.setStartAndEndTime(dateTimeSet, dateTimeSet); |
237 entry.setStartAndEndTime(dateTimeSet, dateTimeSet); |
238 |
238 |
239 // Run the case. |
239 // Run the case. |
240 ulong id = mAgendaUtil->addEntry(entry); |
240 ulong id = mAgendaUtil->store(entry); |
241 |
241 |
242 // Verify. |
242 // Verify. |
243 AgendaEntry retrievedEntry = mAgendaUtil->fetchById(id); |
243 AgendaEntry retrievedEntry = mAgendaUtil->fetchById(id); |
244 |
244 |
245 // Check if the fetched entry is same st the added entry |
245 // Check if the fetched entry is same st the added entry |
255 AgendaEntry checkEntryIsNull = mAgendaUtil->fetchById(id); |
255 AgendaEntry checkEntryIsNull = mAgendaUtil->fetchById(id); |
256 QVERIFY(checkEntryIsNull.isNull()); |
256 QVERIFY(checkEntryIsNull.isNull()); |
257 } |
257 } |
258 |
258 |
259 /*! |
259 /*! |
260 Test the api AgendaUtil::updateEntry. |
260 Test the api AgendaUtil::store. |
261 */ |
261 */ |
262 void TestAgendaUtil::test_updateEntry() |
262 void TestAgendaUtil::test_storeWithExistingEntry() |
263 { |
263 { |
264 // Test case setup. |
264 // Test case setup. |
265 AgendaEntry entry; |
265 AgendaEntry entry; |
266 entry.setType(AgendaEntry::TypeAppoinment); |
266 entry.setType(AgendaEntry::TypeAppoinment); |
267 entry.setSummary("Test case"); |
267 entry.setSummary("Test case"); |
268 entry.setDescription("Entry to test the updateEntry API"); |
268 entry.setDescription("Entry to test the store API"); |
269 entry.setLocation("Nokia"); |
269 entry.setLocation("Nokia"); |
270 entry.setStartAndEndTime( |
270 entry.setStartAndEndTime( |
271 QDateTime::currentDateTime(), |
271 QDateTime::currentDateTime(), |
272 QDateTime::currentDateTime()); |
272 QDateTime::currentDateTime()); |
273 |
273 |
274 // Save the entry |
274 // Save the entry |
275 ulong id = mAgendaUtil->addEntry(entry); |
275 ulong id = mAgendaUtil->store(entry); |
276 |
276 |
277 // Fetch the same entry |
277 // Fetch the same entry |
278 AgendaEntry savedEntry = mAgendaUtil->fetchById(id); |
278 AgendaEntry savedEntry = mAgendaUtil->fetchById(id); |
279 QVERIFY(!savedEntry.isNull()); |
279 QVERIFY(!savedEntry.isNull()); |
280 savedEntry.setSummary("Fetced Entry"); |
280 savedEntry.setSummary("Fetced Entry"); |
282 savedEntry.setStartAndEndTime( |
282 savedEntry.setStartAndEndTime( |
283 QDateTime::currentDateTime().addDays(1), |
283 QDateTime::currentDateTime().addDays(1), |
284 QDateTime::currentDateTime().addDays(1)); |
284 QDateTime::currentDateTime().addDays(1)); |
285 |
285 |
286 // Update the entry |
286 // Update the entry |
287 bool success = mAgendaUtil->updateEntry(savedEntry); |
287 ulong success = mAgendaUtil->store(savedEntry); |
288 QVERIFY(success); |
288 QVERIFY(success); |
289 |
289 |
290 // Fetch the updated entry again |
290 // Fetch the updated entry again |
291 AgendaEntry updatedEntry = mAgendaUtil->fetchById(id); |
291 AgendaEntry updatedEntry = mAgendaUtil->fetchById(id); |
292 |
292 |
319 // Create the day for which entries are needed |
319 // Create the day for which entries are needed |
320 QDateTime futureDay(QDate(2009, 05, 01), QTime(0, 0, 0, 0)); |
320 QDateTime futureDay(QDate(2009, 05, 01), QTime(0, 0, 0, 0)); |
321 futureEntry.setStartAndEndTime(futureDay, futureDay); |
321 futureEntry.setStartAndEndTime(futureDay, futureDay); |
322 futureEntry.setType(AgendaEntry::TypeEvent); |
322 futureEntry.setType(AgendaEntry::TypeEvent); |
323 futureEntry.setSummary("Test case"); |
323 futureEntry.setSummary("Test case"); |
324 ulong id = mAgendaUtil->addEntry(futureEntry); |
324 ulong id = mAgendaUtil->store(futureEntry); |
325 // Run the test case |
325 // Run the test case |
326 QList<AgendaEntry> entriesList; |
326 QList<AgendaEntry> entriesList; |
327 entriesList.append(mAgendaUtil->createEntryIdListForDay(futureDay)); |
327 entriesList.append(mAgendaUtil->createEntryIdListForDay(futureDay)); |
328 |
328 |
329 // Verify |
329 // Verify |
378 firstEntry.setType(AgendaEntry::TypeAppoinment); |
378 firstEntry.setType(AgendaEntry::TypeAppoinment); |
379 firstEntry.setSummary("first entry"); |
379 firstEntry.setSummary("first entry"); |
380 QDateTime firstEntryStart(QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
380 QDateTime firstEntryStart(QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
381 QDateTime firstEntryEnd(QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
381 QDateTime firstEntryEnd(QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
382 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
382 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
383 ulong id = mAgendaUtil->addEntry(firstEntry); |
383 ulong id = mAgendaUtil->store(firstEntry); |
384 numOfEntries++; |
384 numOfEntries++; |
385 |
385 |
386 // ToDo. |
386 // ToDo. |
387 AgendaEntry firstToDo; |
387 AgendaEntry firstToDo; |
388 firstToDo.setType(AgendaEntry::TypeTodo); |
388 firstToDo.setType(AgendaEntry::TypeTodo); |
389 firstToDo.setSummary("first ToDo"); |
389 firstToDo.setSummary("first ToDo"); |
390 QDateTime firstToDoStart(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
390 QDateTime firstToDoStart(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
391 QDateTime firstToDoEnd(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
391 QDateTime firstToDoEnd(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
392 firstToDo.setStartAndEndTime(firstToDoStart, firstToDoEnd); |
392 firstToDo.setStartAndEndTime(firstToDoStart, firstToDoEnd); |
393 id = mAgendaUtil->addEntry(firstToDo); |
393 id = mAgendaUtil->store(firstToDo); |
394 numOfEntries++; |
394 numOfEntries++; |
395 |
395 |
396 // Run the test case |
396 // Run the test case |
397 QList<ulong> ids; |
397 QList<ulong> ids; |
398 int num = ids.count(); |
398 int num = ids.count(); |
452 firstEntry.setType(AgendaEntry::TypeAppoinment); |
452 firstEntry.setType(AgendaEntry::TypeAppoinment); |
453 firstEntry.setSummary("first entry"); |
453 firstEntry.setSummary("first entry"); |
454 QDateTime firstEntryStart(QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
454 QDateTime firstEntryStart(QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
455 QDateTime firstEntryEnd(QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
455 QDateTime firstEntryEnd(QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
456 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
456 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
457 ulong id = mAgendaUtil->addEntry(firstEntry); |
457 ulong id = mAgendaUtil->store(firstEntry); |
458 numOfEntries++; |
458 numOfEntries++; |
459 |
459 |
460 // ToDo. |
460 // ToDo. |
461 AgendaEntry firstToDo; |
461 AgendaEntry firstToDo; |
462 firstToDo.setType(AgendaEntry::TypeTodo); |
462 firstToDo.setType(AgendaEntry::TypeTodo); |
463 firstToDo.setSummary("first ToDo"); |
463 firstToDo.setSummary("first ToDo"); |
464 QDateTime firstToDoStart(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
464 QDateTime firstToDoStart(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
465 QDateTime firstToDoEnd(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
465 QDateTime firstToDoEnd(QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
466 firstToDo.setStartAndEndTime(firstToDoStart, firstToDoEnd); |
466 firstToDo.setStartAndEndTime(firstToDoStart, firstToDoEnd); |
467 id = mAgendaUtil->addEntry(firstToDo); |
467 id = mAgendaUtil->store(firstToDo); |
468 numOfEntries++; |
468 numOfEntries++; |
469 |
469 |
470 // Run the test case |
470 // Run the test case |
471 QList<AgendaEntry> entries; |
471 QList<AgendaEntry> entries; |
472 entries.clear(); |
472 entries.clear(); |
561 QDateTime firstEntryStart( |
561 QDateTime firstEntryStart( |
562 QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
562 QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
563 QDateTime firstEntryEnd( |
563 QDateTime firstEntryEnd( |
564 QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
564 QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
565 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
565 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
566 ulong id = mAgendaUtil->addEntry(firstEntry); |
566 ulong id = mAgendaUtil->store(firstEntry); |
567 |
567 |
568 // Create the range for which entries are needed |
568 // Create the range for which entries are needed |
569 QDateTime fromRange( |
569 QDateTime fromRange( |
570 QDate(2020, 01, 01), QTime(0, 0, 0, 0)); |
570 QDate(2020, 01, 01), QTime(0, 0, 0, 0)); |
571 QDateTime toRange( |
571 QDateTime toRange( |
644 QDateTime firstEntryStart( |
644 QDateTime firstEntryStart( |
645 QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
645 QDate(2020, 05, 01), QTime(9, 0, 0, 0)); |
646 QDateTime firstEntryEnd( |
646 QDateTime firstEntryEnd( |
647 QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
647 QDate(2020, 05, 01), QTime(10, 0, 0, 0)); |
648 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
648 firstEntry.setStartAndEndTime(firstEntryStart, firstEntryEnd); |
649 ulong id = mAgendaUtil->addEntry(firstEntry); |
649 ulong id = mAgendaUtil->store(firstEntry); |
650 numOfEntries++; |
650 numOfEntries++; |
651 |
651 |
652 // Events. |
652 // Events. |
653 AgendaEntry firstEvent; |
653 AgendaEntry firstEvent; |
654 firstEvent.setType(AgendaEntry::TypeEvent); |
654 firstEvent.setType(AgendaEntry::TypeEvent); |
656 QDateTime firstEventStart( |
656 QDateTime firstEventStart( |
657 QDate(2023, 05, 01), QTime(10, 0, 0, 0)); |
657 QDate(2023, 05, 01), QTime(10, 0, 0, 0)); |
658 QDateTime firstEventEnd( |
658 QDateTime firstEventEnd( |
659 QDate(2023, 05, 01), QTime(12, 0, 0, 0)); |
659 QDate(2023, 05, 01), QTime(12, 0, 0, 0)); |
660 firstEvent.setStartAndEndTime(firstEventStart, firstEventEnd); |
660 firstEvent.setStartAndEndTime(firstEventStart, firstEventEnd); |
661 id = mAgendaUtil->addEntry(firstEvent); |
661 id = mAgendaUtil->store(firstEvent); |
662 numOfEntries++; |
662 numOfEntries++; |
663 |
663 |
664 // ToDos. |
664 // ToDos. |
665 AgendaEntry firstToDo; |
665 AgendaEntry firstToDo; |
666 firstToDo.setType(AgendaEntry::TypeTodo); |
666 firstToDo.setType(AgendaEntry::TypeTodo); |
668 QDateTime firstToDoStart( |
668 QDateTime firstToDoStart( |
669 QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
669 QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
670 QDateTime firstToDoEnd( |
670 QDateTime firstToDoEnd( |
671 QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
671 QDate(2026, 05, 01), QTime(10, 0, 0, 0)); |
672 firstToDo.setStartAndEndTime(firstToDoStart, firstToDoEnd); |
672 firstToDo.setStartAndEndTime(firstToDoStart, firstToDoEnd); |
673 id = mAgendaUtil->addEntry(firstToDo); |
673 id = mAgendaUtil->store(firstToDo); |
674 numOfEntries++; |
674 numOfEntries++; |
675 |
675 |
676 return numOfEntries; |
676 return numOfEntries; |
677 } |
677 } |
678 |
678 |
689 long notSavedEntryId = mAgendaUtil->cloneEntry( |
689 long notSavedEntryId = mAgendaUtil->cloneEntry( |
690 noteEntry, AgendaEntry::TypeTodo); |
690 noteEntry, AgendaEntry::TypeTodo); |
691 // Shouldn't clone the entry as AgendaEntry is not yet saved. |
691 // Shouldn't clone the entry as AgendaEntry is not yet saved. |
692 QVERIFY(!notSavedEntryId); |
692 QVERIFY(!notSavedEntryId); |
693 |
693 |
694 long noteId = mAgendaUtil->addEntry(noteEntry); |
694 long noteId = mAgendaUtil->store(noteEntry); |
695 QVERIFY(noteId); |
695 QVERIFY(noteId); |
696 |
696 |
697 // Fetch the saved note entry for cloning |
697 // Fetch the saved note entry for cloning |
698 AgendaEntry fetchedNoteEntry = mAgendaUtil->fetchById(noteId); |
698 AgendaEntry fetchedNoteEntry = mAgendaUtil->fetchById(noteId); |
699 |
699 |
716 { |
716 { |
717 // Create an agenda entry(TypeNote) and save it. |
717 // Create an agenda entry(TypeNote) and save it. |
718 AgendaEntry noteEntry(AgendaEntry::TypeNote); |
718 AgendaEntry noteEntry(AgendaEntry::TypeNote); |
719 noteEntry.setDescription(QString("test cloning of note to meeting")); |
719 noteEntry.setDescription(QString("test cloning of note to meeting")); |
720 |
720 |
721 long noteId = mAgendaUtil->addEntry(noteEntry); |
721 long noteId = mAgendaUtil->store(noteEntry); |
722 QVERIFY(noteId); |
722 QVERIFY(noteId); |
723 |
723 |
724 // Fetch the saved note entry for cloning |
724 // Fetch the saved note entry for cloning |
725 AgendaEntry fetchedNoteEntry = mAgendaUtil->fetchById(noteId); |
725 AgendaEntry fetchedNoteEntry = mAgendaUtil->fetchById(noteId); |
726 |
726 |
743 // Create an agenda entry(TypeTodo) and save it. |
743 // Create an agenda entry(TypeTodo) and save it. |
744 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
744 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
745 todoEntry.setDescription(QString("test cloning of todo to note")); |
745 todoEntry.setDescription(QString("test cloning of todo to note")); |
746 QDateTime dueDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
746 QDateTime dueDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
747 todoEntry.setStartAndEndTime(dueDate, dueDate); |
747 todoEntry.setStartAndEndTime(dueDate, dueDate); |
748 long todoId = mAgendaUtil->addEntry(todoEntry); |
748 long todoId = mAgendaUtil->store(todoEntry); |
749 QVERIFY(todoId); |
749 QVERIFY(todoId); |
750 |
750 |
751 // Fetch the saved note entry for cloning |
751 // Fetch the saved note entry for cloning |
752 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
752 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
753 |
753 |
772 // Create an agenda entry(TypeTodo) and save it. |
772 // Create an agenda entry(TypeTodo) and save it. |
773 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
773 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
774 todoEntry.setSummary(QString("test cloning of todo to meeting")); |
774 todoEntry.setSummary(QString("test cloning of todo to meeting")); |
775 QDateTime dueDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
775 QDateTime dueDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
776 todoEntry.setStartAndEndTime(dueDate, dueDate); |
776 todoEntry.setStartAndEndTime(dueDate, dueDate); |
777 long todoId = mAgendaUtil->addEntry(todoEntry); |
777 long todoId = mAgendaUtil->store(todoEntry); |
778 QVERIFY(todoId); |
778 QVERIFY(todoId); |
779 |
779 |
780 // Fetch the saved note entry for cloning |
780 // Fetch the saved note entry for cloning |
781 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
781 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
782 |
782 |
803 AgendaEntry appointment(AgendaEntry::TypeAppoinment); |
803 AgendaEntry appointment(AgendaEntry::TypeAppoinment); |
804 appointment.setSummary(QString("test cloning of meeting to note")); |
804 appointment.setSummary(QString("test cloning of meeting to note")); |
805 QDateTime startDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
805 QDateTime startDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
806 QDateTime endDate(QDate(2011, 06, 01), QTime(12, 0, 0, 0)); |
806 QDateTime endDate(QDate(2011, 06, 01), QTime(12, 0, 0, 0)); |
807 appointment.setStartAndEndTime(startDate, endDate); |
807 appointment.setStartAndEndTime(startDate, endDate); |
808 long appointmentId = mAgendaUtil->addEntry(appointment); |
808 long appointmentId = mAgendaUtil->store(appointment); |
809 QVERIFY(appointmentId); |
809 QVERIFY(appointmentId); |
810 |
810 |
811 // Fetch the saved note entry for cloning |
811 // Fetch the saved note entry for cloning |
812 AgendaEntry fetchedAppointment = mAgendaUtil->fetchById(appointmentId); |
812 AgendaEntry fetchedAppointment = mAgendaUtil->fetchById(appointmentId); |
813 |
813 |
832 AgendaEntry appointment(AgendaEntry::TypeAppoinment); |
832 AgendaEntry appointment(AgendaEntry::TypeAppoinment); |
833 appointment.setSummary(QString("test cloning of meeting to todo")); |
833 appointment.setSummary(QString("test cloning of meeting to todo")); |
834 QDateTime startDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
834 QDateTime startDate(QDate(2011, 06, 01), QTime(10, 0, 0, 0)); |
835 QDateTime endDate(QDate(2011, 06, 01), QTime(12, 0, 0, 0)); |
835 QDateTime endDate(QDate(2011, 06, 01), QTime(12, 0, 0, 0)); |
836 appointment.setStartAndEndTime(startDate, endDate); |
836 appointment.setStartAndEndTime(startDate, endDate); |
837 long appointmentId = mAgendaUtil->addEntry(appointment); |
837 long appointmentId = mAgendaUtil->store(appointment); |
838 QVERIFY(appointmentId); |
838 QVERIFY(appointmentId); |
839 |
839 |
840 // Fetch the saved note entry for cloning |
840 // Fetch the saved note entry for cloning |
841 AgendaEntry fetchedAppointment = mAgendaUtil->fetchById(appointmentId); |
841 AgendaEntry fetchedAppointment = mAgendaUtil->fetchById(appointmentId); |
842 |
842 |
862 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
862 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
863 todoEntry.setSummary(QString("Test making To-do event as Completed")); |
863 todoEntry.setSummary(QString("Test making To-do event as Completed")); |
864 QDateTime dueDate(QDate(2011, 06, 01), QTime(0, 0, 0, 0)); |
864 QDateTime dueDate(QDate(2011, 06, 01), QTime(0, 0, 0, 0)); |
865 todoEntry.setStartAndEndTime(dueDate, dueDate); |
865 todoEntry.setStartAndEndTime(dueDate, dueDate); |
866 |
866 |
867 ulong todoId = mAgendaUtil->addEntry(todoEntry); |
867 ulong todoId = mAgendaUtil->store(todoEntry); |
868 QVERIFY(todoId); |
868 QVERIFY(todoId); |
869 |
869 |
870 // Complete the to-do. |
870 // Complete the to-do. |
871 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
871 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
872 QDateTime completedTime(QDate(2011, 07, 01),QTime(0, 0, 0, 0)); |
872 QDateTime completedTime(QDate(2011, 07, 01),QTime(0, 0, 0, 0)); |
886 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
886 AgendaEntry todoEntry(AgendaEntry::TypeTodo); |
887 todoEntry.setSummary(QString("Test making To-do event as Completed")); |
887 todoEntry.setSummary(QString("Test making To-do event as Completed")); |
888 QDateTime dueDate(QDate(2011, 06, 01), QTime(0, 0, 0, 0)); |
888 QDateTime dueDate(QDate(2011, 06, 01), QTime(0, 0, 0, 0)); |
889 todoEntry.setStartAndEndTime(dueDate, dueDate); |
889 todoEntry.setStartAndEndTime(dueDate, dueDate); |
890 |
890 |
891 ulong todoId = mAgendaUtil->addEntry(todoEntry); |
891 ulong todoId = mAgendaUtil->store(todoEntry); |
892 QVERIFY(todoId); |
892 QVERIFY(todoId); |
893 |
893 |
894 // Complete the to-do. |
894 // Complete the to-do. |
895 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
895 AgendaEntry fetchedTodoEntry = mAgendaUtil->fetchById(todoId); |
896 QDateTime completedTime(QDate(2011, 07, 01),QTime(0, 0, 0, 0)); |
896 QDateTime completedTime(QDate(2011, 07, 01),QTime(0, 0, 0, 0)); |