diff --git a/tests-sync/src/com/todoroo/astrid/sync/SyncModelTest.java b/tests-sync/src/com/todoroo/astrid/sync/SyncModelTest.java index 12025a5d1..40c52ec0b 100644 --- a/tests-sync/src/com/todoroo/astrid/sync/SyncModelTest.java +++ b/tests-sync/src/com/todoroo/astrid/sync/SyncModelTest.java @@ -1,7 +1,5 @@ package com.todoroo.astrid.sync; -import android.text.TextUtils; - import com.todoroo.andlib.data.TodorooCursor; import com.todoroo.andlib.sql.Criterion; import com.todoroo.andlib.sql.Query; @@ -41,6 +39,31 @@ public class SyncModelTest extends NewSyncTestCase { } } + public void testUpdateMakesAllOutstandingEntries() { + String title = "Task Important"; + createTask(title, true); + createTask("Task Not Important", true); + createTask(title, true); + + Task template = new Task(); + template.setValue(Task.IMPORTANCE, Task.IMPORTANCE_DO_OR_DIE); + + taskDao.update(Task.TITLE.eq(title), template); + + TodorooCursor cursor = taskOutstandingDao.query(Query.select(TaskOutstanding.PROPERTIES)); + try { + assertEquals(2, cursor.getCount()); + TaskOutstanding to = new TaskOutstanding(); + for (cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) { + to.readPropertiesFromCursor(cursor); + assertEquals(Task.IMPORTANCE.name, to.getValue(TaskOutstanding.COLUMN_STRING)); + assertEquals(Task.IMPORTANCE_DO_OR_DIE, Integer.parseInt(to.getValue(TaskOutstanding.VALUE_STRING))); + } + } finally { + cursor.close(); + } + } + public void testChangeTagMakesOutstandingEntries() { TagData tag = createTagData(); String newName = "changing tag name";