Remove the deprecated cursor methods.
Change-Id: Ie3571fea9f36996c31c327240b11086f8cc487f0
This commit is contained in:
@@ -91,43 +91,6 @@ public class DatabaseCursorTest extends AndroidTestCase implements PerformanceTe
|
||||
mDatabase.execSQL("INSERT INTO test (data) VALUES ('" + sString3 + "');");
|
||||
}
|
||||
|
||||
@MediumTest
|
||||
public void testCursorUpdate() {
|
||||
mDatabase.execSQL(
|
||||
"CREATE TABLE test (_id INTEGER PRIMARY KEY, d INTEGER, s INTEGER);");
|
||||
for(int i = 0; i < 20; i++) {
|
||||
mDatabase.execSQL("INSERT INTO test (d, s) VALUES (" + i +
|
||||
"," + i%2 + ");");
|
||||
}
|
||||
|
||||
Cursor c = mDatabase.query("test", null, "s = 0", null, null, null, null);
|
||||
int dCol = c.getColumnIndexOrThrow("d");
|
||||
int sCol = c.getColumnIndexOrThrow("s");
|
||||
|
||||
int count = 0;
|
||||
while (c.moveToNext()) {
|
||||
assertTrue(c.updateInt(dCol, 3));
|
||||
count++;
|
||||
}
|
||||
assertEquals(10, count);
|
||||
|
||||
assertTrue(c.commitUpdates());
|
||||
|
||||
assertTrue(c.requery());
|
||||
|
||||
count = 0;
|
||||
while (c.moveToNext()) {
|
||||
assertEquals(3, c.getInt(dCol));
|
||||
count++;
|
||||
}
|
||||
|
||||
assertEquals(10, count);
|
||||
assertTrue(c.moveToFirst());
|
||||
assertTrue(c.deleteRow());
|
||||
assertEquals(9, c.getCount());
|
||||
c.close();
|
||||
}
|
||||
|
||||
@MediumTest
|
||||
public void testBlob() throws Exception {
|
||||
// create table
|
||||
@@ -164,24 +127,7 @@ public class DatabaseCursorTest extends AndroidTestCase implements PerformanceTe
|
||||
assertTrue(Arrays.equals(blob, cBlob));
|
||||
assertEquals(s, c.getString(sCol));
|
||||
assertEquals((double)d, c.getDouble(dCol));
|
||||
assertEquals((long)l, c.getLong(lCol));
|
||||
|
||||
// new byte[]
|
||||
byte[] newblob = new byte[1000];
|
||||
value = 98;
|
||||
Arrays.fill(blob, value);
|
||||
|
||||
c.updateBlob(bCol, newblob);
|
||||
cBlob = c.getBlob(bCol);
|
||||
assertTrue(Arrays.equals(newblob, cBlob));
|
||||
|
||||
// commit
|
||||
assertTrue(c.commitUpdates());
|
||||
assertTrue(c.requery());
|
||||
c.moveToNext();
|
||||
cBlob = c.getBlob(bCol);
|
||||
assertTrue(Arrays.equals(newblob, cBlob));
|
||||
c.close();
|
||||
assertEquals((long)l, c.getLong(lCol));
|
||||
}
|
||||
|
||||
@MediumTest
|
||||
|
||||
@@ -467,45 +467,6 @@ public class DatabaseGeneralTest extends AndroidTestCase implements PerformanceT
|
||||
boolean mCursor;
|
||||
}
|
||||
|
||||
@MediumTest
|
||||
public void testNotificationTest1() throws Exception {
|
||||
/*
|
||||
Cursor c = mContentResolver.query(Notes.CONTENT_URI,
|
||||
new String[] {Notes._ID, Notes.NOTE},
|
||||
null, null);
|
||||
c.registerContentObserver(new MyContentObserver(true));
|
||||
int count = c.count();
|
||||
|
||||
MyContentObserver observer = new MyContentObserver(false);
|
||||
mContentResolver.registerContentObserver(Notes.CONTENT_URI, true, observer);
|
||||
|
||||
Uri uri;
|
||||
|
||||
HashMap<String, String> values = new HashMap<String, String>();
|
||||
values.put(Notes.NOTE, "test note1");
|
||||
uri = mContentResolver.insert(Notes.CONTENT_URI, values);
|
||||
assertEquals(1, mCursorNotificationCount);
|
||||
assertEquals(1, mNotificationCount);
|
||||
|
||||
c.requery();
|
||||
assertEquals(count + 1, c.count());
|
||||
c.first();
|
||||
assertEquals("test note1", c.getString(c.getColumnIndex(Notes.NOTE)));
|
||||
c.updateString(c.getColumnIndex(Notes.NOTE), "test note2");
|
||||
c.commitUpdates();
|
||||
|
||||
assertEquals(2, mCursorNotificationCount);
|
||||
assertEquals(2, mNotificationCount);
|
||||
|
||||
mContentResolver.delete(uri, null);
|
||||
|
||||
assertEquals(3, mCursorNotificationCount);
|
||||
assertEquals(3, mNotificationCount);
|
||||
|
||||
mContentResolver.unregisterContentObserver(observer);
|
||||
*/
|
||||
}
|
||||
|
||||
@MediumTest
|
||||
public void testSelectionArgs() throws Exception {
|
||||
mDatabase.execSQL("CREATE TABLE test (_id INTEGER PRIMARY KEY, data TEXT);");
|
||||
|
||||
Reference in New Issue
Block a user