Search in sources :

Example 1 with CursorWindow

use of android.database.CursorWindow in project android_frameworks_base by ParanoidAndroid.

the class CursorWindowTest method testValues.

@SmallTest
public void testValues() {
    CursorWindow window = new CursorWindow("MyWindow");
    doTestValues(window);
    window.close();
}
Also used : CursorWindow(android.database.CursorWindow) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with CursorWindow

use of android.database.CursorWindow in project android_frameworks_base by ParanoidAndroid.

the class CursorWindowTest method testDeprecatedConstructor.

@SmallTest
public void testDeprecatedConstructor() {
    @SuppressWarnings("deprecation") CursorWindow window = new CursorWindow(true);
    assertEquals("<unnamed>", window.getName());
    assertEquals(0, window.getStartPosition());
    window.close();
}
Also used : CursorWindow(android.database.CursorWindow) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with CursorWindow

use of android.database.CursorWindow in project android_frameworks_base by ParanoidAndroid.

the class CursorWindowTest method testConstructorWithNullName.

@SmallTest
public void testConstructorWithNullName() {
    CursorWindow window = new CursorWindow(null);
    assertEquals("<unnamed>", window.getName());
    assertEquals(0, window.getStartPosition());
    window.close();
}
Also used : CursorWindow(android.database.CursorWindow) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 4 with CursorWindow

use of android.database.CursorWindow in project robolectric by robolectric.

the class ShadowCursorWindowTest method shouldFillWindowWithCursor.

@Test
public void shouldFillWindowWithCursor() throws Exception {
    CursorWindow window = new CursorWindow("name");
    MatrixCursor testCursor = new MatrixCursor(new String[] { "a", "b", "c", "d" });
    testCursor.addRow(new Object[] { 12, "hello", null, new byte[] { (byte) 0xba, (byte) 0xdc, (byte) 0xaf, (byte) 0xfe } });
    testCursor.addRow(new Object[] { 34, "baz", 1.2, null });
    testCursor.addRow(new Object[] { 46, "foo", 2.4, new byte[] {} });
    DatabaseUtils.cursorFillWindow(testCursor, 0, window);
    assertThat(window.getNumRows()).isEqualTo(3);
    assertThat(window.getInt(0, 0)).isEqualTo(12);
    assertThat(window.getString(0, 1)).isEqualTo("hello");
    assertThat(window.getString(0, 2)).isNull();
    assertThat(window.getBlob(0, 3)).isEqualTo(new byte[] { (byte) 0xba, (byte) 0xdc, (byte) 0xaf, (byte) 0xfe });
    assertThat(window.getInt(1, 0)).isEqualTo(34);
    assertThat(window.getString(1, 1)).isEqualTo("baz");
    assertThat(window.getFloat(1, 2)).isEqualTo(1.2f);
    assertThat(window.getBlob(1, 3)).isEqualTo(null);
    assertThat(window.getBlob(2, 3)).isEqualTo(new byte[] {});
}
Also used : CursorWindow(android.database.CursorWindow) MatrixCursor(android.database.MatrixCursor) Test(org.junit.Test)

Example 5 with CursorWindow

use of android.database.CursorWindow in project robolectric by robolectric.

the class ShadowCursorWindowTest method shouldCreateWindowWithName.

@Test
public void shouldCreateWindowWithName() throws Exception {
    CursorWindow window = new CursorWindow("name");
    assertThat(window.getName()).isEqualTo("name");
}
Also used : CursorWindow(android.database.CursorWindow) Test(org.junit.Test)

Aggregations

CursorWindow (android.database.CursorWindow)41 SmallTest (android.test.suitebuilder.annotation.SmallTest)30 DbStats (android.database.sqlite.SQLiteDebug.DbStats)6 Test (org.junit.Test)2 CrossProcessCursor (android.database.CrossProcessCursor)1 MatrixCursor (android.database.MatrixCursor)1 MutableBoolean (android.util.MutableBoolean)1 MutableInt (android.util.MutableInt)1 ArrayList (java.util.ArrayList)1 FastCursor (org.greenrobot.greendao.internal.FastCursor)1 DbStats (org.sqlite.database.sqlite.SQLiteDebug.DbStats)1