Fix unit test with reminders

pull/14/head 3.7.4
Tim Su 14 years ago
parent ca4e9c7cc2
commit 7d6bcee9b0

@ -222,15 +222,12 @@ public class TaskDao extends DatabaseDao<Task> {
/**
* Called after the task is saved. This differs from the call in
* TaskApiDao in that it runs hooks that need to be run from within
* Astrid.
* Astrid. Order matters here!
*/
public static void afterSave(Task task, ContentValues values) {
if(TaskApiDao.insignificantChange(values))
if(values == null)
return;
// run global save hooks
TaskApiDao.afterSave(task, values);
if(values.containsKey(Task.COMPLETION_DATE.name) && task.isCompleted())
afterComplete(task, values);
else {
@ -242,6 +239,12 @@ public class TaskDao extends DatabaseDao<Task> {
ReminderService.getInstance().scheduleAlarm(task);
}
if(TaskApiDao.insignificantChange(values))
return;
// run api save hooks
TaskApiDao.afterSave(task, values);
for(DatabaseUpdateListener listener : taskChangeListeners) {
listener.onDatabaseUpdated();
}

@ -27,9 +27,9 @@ public class AdvancedRepeatTests extends TodorooTestCase {
// repeat once => due date should become tomorrow
long past = task.createDueDate(Task.URGENCY_SPECIFIC_DAY, new Date(110, 7, 1).getTime());
task.setValue(Task.DUE_DATE, past);
long today = task.createDueDate(Task.URGENCY_SPECIFIC_DAY, DateUtilities.now());
long tomorrow = task.createDueDate(Task.URGENCY_SPECIFIC_DAY, DateUtilities.now() + DateUtilities.ONE_DAY);
long nextDueDate = RepeatTaskCompleteListener.computeNextDueDate(task, rrule.toIcal());
assertDatesEqual(today, nextDueDate);
assertDatesEqual(tomorrow, nextDueDate);
// test specific day & time
long pastWithTime = task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, new Date(110, 7, 1, 10, 4).getTime());

Loading…
Cancel
Save