Fixed upgrade test, disabled xml exporter for now, fixed up filter list activity not to be so resistant to change

pull/14/head
Tim Su 16 years ago
parent fa449f749d
commit bfd8a80907

@ -79,8 +79,6 @@
</activity> </activity>
<!-- Activity that displays filter list --> <!-- Activity that displays filter list -->
<activity android:name="com.todoroo.astrid.activity.FilterListActivity" <activity android:name="com.todoroo.astrid.activity.FilterListActivity"
android:launchMode="singleInstance"
android:allowTaskReparenting="true"
android:theme="@style/Theme"> android:theme="@style/Theme">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.SEARCH" /> <action android:name="android.intent.action.SEARCH" />

@ -14,7 +14,6 @@ import org.xmlpull.v1.XmlSerializer;
import android.content.Context; import android.content.Context;
import android.database.Cursor; import android.database.Cursor;
import android.os.Environment; import android.os.Environment;
import android.os.Looper;
import android.util.Log; import android.util.Log;
import android.util.Xml; import android.util.Xml;
import android.widget.Toast; import android.widget.Toast;
@ -38,7 +37,7 @@ public class TasksXmlExporter {
private SyncDataController syncDataController; private SyncDataController syncDataController;
private Context ctx; private Context ctx;
private String output; private String output;
private boolean isService; private final boolean isService;
private int exportCount; private int exportCount;
private XmlSerializer xml; private XmlSerializer xml;
private HashMap<TagIdentifier, TagModelForView> tagMap; private HashMap<TagIdentifier, TagModelForView> tagMap;
@ -240,15 +239,15 @@ public class TasksXmlExporter {
this.output = file; this.output = file;
} }
private Runnable doBackgroundExport = new Runnable() { private final Runnable doBackgroundExport = new Runnable() {
public void run() { public void run() {
Looper.prepare(); /*Looper.prepare();
try { try {
doTasksExport(); doTasksExport();
} catch (IOException e) { } catch (IOException e) {
Log.e("TasksXmlExporter", "IOException in doTasksExport " + e.getMessage()); Log.e("TasksXmlExporter", "IOException in doTasksExport " + e.getMessage());
} }
Looper.loop(); Looper.loop();*/
} }
}; };

@ -242,7 +242,7 @@ public class FilterListActivity extends ExpandableListActivity {
/** /**
* Broadcast a request for lists. The request is sent to every * Broadcast a request for lists. The request is sent to every
* application registered to listen for this broadcast. Each application * application registered to listen for this broadcast. Each application
* can then add lists to the * can then add lists to this activity
*/ */
protected void getLists() { protected void getLists() {
Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_FILTERS); Intent broadcastIntent = new Intent(AstridApiConstants.BROADCAST_REQUEST_FILTERS);

@ -463,8 +463,8 @@ public class TaskListActivity extends ListActivity implements OnScrollListener {
if(requery) { if(requery) {
taskCursor.requery(); taskCursor.requery();
taskAdapter.notifyDataSetChanged();
taskAdapter.flushDetailCache(); taskAdapter.flushDetailCache();
taskAdapter.notifyDataSetChanged();
} }
startManagingCursor(taskCursor); startManagingCursor(taskCursor);

@ -13,9 +13,9 @@ import android.widget.AbsListView;
import android.widget.BaseExpandableListAdapter; import android.widget.BaseExpandableListAdapter;
import android.widget.FrameLayout; import android.widget.FrameLayout;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.TextView; import android.widget.TextView;
import android.widget.ImageView.ScaleType;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.astrid.api.FilterCategory; import com.todoroo.astrid.api.FilterCategory;
@ -41,6 +41,10 @@ public class FilterAdapter extends BaseExpandableListAdapter {
items.add(item); items.add(item);
} }
public void clear() {
items.clear();
}
/* ====================================================================== /* ======================================================================
* ========================================================== child nodes * ========================================================== child nodes
* ====================================================================== */ * ====================================================================== */

@ -145,8 +145,8 @@ public class Astrid2To3UpgradeTests extends DatabaseTestCase {
assertEquals(2, taskController.getAllTaskIdentifiers().size()); assertEquals(2, taskController.getAllTaskIdentifiers().size());
// upgrade // upgrade
Date upgradeTime = new Date();
upgrade2To3(); upgrade2To3();
Date createdDate = new Date();
// verify that data exists in our new table // verify that data exists in our new table
database.openForReading(); database.openForReading();
@ -175,8 +175,10 @@ public class Astrid2To3UpgradeTests extends DatabaseTestCase {
new RRule(task.getValue(Task.RECURRENCE)).getFreq()); new RRule(task.getValue(Task.RECURRENCE)).getFreq());
assertEquals(guti.getElapsedSeconds(), task.getValue(Task.ELAPSED_SECONDS)); assertEquals(guti.getElapsedSeconds(), task.getValue(Task.ELAPSED_SECONDS));
assertEquals(guti.getNotificationIntervalSeconds() * 1000L, (long)task.getValue(Task.REMINDER_PERIOD)); assertEquals(guti.getNotificationIntervalSeconds() * 1000L, (long)task.getValue(Task.REMINDER_PERIOD));
assertDatesEqual(createdDate, task.getValue(Task.CREATION_DATE)); assertTrue(task.getValue(Task.CREATION_DATE) > 0);
assertDatesEqual(createdDate, task.getValue(Task.MODIFICATION_DATE)); assertTrue(task.getValue(Task.MODIFICATION_DATE) > 0);
assertTrue(task.getValue(Task.CREATION_DATE) <= upgradeTime.getTime());
assertTrue(task.getValue(Task.MODIFICATION_DATE) <= upgradeTime.getTime());
} }
/** /**
@ -321,17 +323,26 @@ public class Astrid2To3UpgradeTests extends DatabaseTestCase {
* Test basic upgrading of the sync mapping table * Test basic upgrading of the sync mapping table
*/ */
public void testSyncTableUpgrade() { public void testSyncTableUpgrade() {
TaskController taskController = new TaskController(getContext());
taskController.open();
SyncDataController syncController = new SyncDataController(getContext()); SyncDataController syncController = new SyncDataController(getContext());
syncController.open(); syncController.open();
// create some ish // create some ish
TaskModelForEdit christmas = new TaskModelForEdit();
christmas.setName("christmas");
taskController.saveTask(christmas, false);
String remoteId = "123|456|789000"; String remoteId = "123|456|789000";
SyncMapping mapping = new SyncMapping(new TaskIdentifier(1), 1, remoteId); SyncMapping mapping = new SyncMapping(christmas.getTaskIdentifier(), 1, remoteId);
syncController.saveSyncMapping(mapping); syncController.saveSyncMapping(mapping);
syncController.addToUpdatedList(new TaskIdentifier(2));
christmas = new TaskModelForEdit();
christmas.setName("july");
taskController.saveTask(christmas, false);
syncController.addToUpdatedList(christmas.getTaskIdentifier());
// assert created // assert created
assertEquals(1, syncController.getSyncMappings(1)); assertEquals(1, syncController.getSyncMappings(1).size());
// upgrade // upgrade
upgrade2To3(); upgrade2To3();

Loading…
Cancel
Save