FileDocCategorySizeDatePackage
CursorWindowTest.javaAPI DocAndroid 5.1 API3660Thu Mar 12 22:22:12 GMT 2015android.database

CursorWindowTest

public class CursorWindowTest extends TestCase implements android.test.PerformanceTestCase

Fields Summary
Constructors Summary
Methods Summary
private voiddoTestValues(android.database.CursorWindow window)

        assertTrue(window.setNumColumns(7));
        assertTrue(window.allocRow());
        double db1 = 1.26;
        assertTrue(window.putDouble(db1, 0, 0));
        double db2 = window.getDouble(0, 0);
        assertEquals(db1, db2);

        long int1 = Long.MAX_VALUE;
        assertTrue(window.putLong(int1, 0, 1));
        long int2 = window.getLong(0, 1);
        assertEquals(int1, int2);

        assertTrue(window.putString("1198032740000", 0, 3));
        assertEquals("1198032740000", window.getString(0, 3));
        assertEquals(1198032740000L, window.getLong(0, 3));

        assertTrue(window.putString(Long.toString(1198032740000L), 0, 3));
        assertEquals(Long.toString(1198032740000L), window.getString(0, 3));
        assertEquals(1198032740000L, window.getLong(0, 3));
        
        assertTrue(window.putString(Double.toString(42.0), 0, 4));
        assertEquals(Double.toString(42.0), window.getString(0, 4));
        assertEquals(42.0, window.getDouble(0, 4));
        
        // put blob
        byte[] blob = new byte[1000];
        byte value = 99;
        Arrays.fill(blob, value);
        assertTrue(window.putBlob(blob, 0, 6));
        assertTrue(Arrays.equals(blob, window.getBlob(0, 6)));
    
public booleanisPerformanceOnly()

        return false;
    
public intstartPerformance(Intermediates intermediates)

        return 1;
    
public voidtestConstructorWithEmptyName()

        CursorWindow window = new CursorWindow("");
        assertEquals("<unnamed>", window.getName());
        assertEquals(0, window.getStartPosition());
        window.close();
    
public voidtestConstructorWithNullName()

        CursorWindow window = new CursorWindow(null);
        assertEquals("<unnamed>", window.getName());
        assertEquals(0, window.getStartPosition());
        window.close();
    
public voidtestConstructor_WithName()

        CursorWindow window = new CursorWindow("MyWindow");
        assertEquals("MyWindow", window.getName());
        assertEquals(0, window.getStartPosition());
        window.close();
    
public voidtestDeprecatedConstructor()

        @SuppressWarnings("deprecation")
        CursorWindow window = new CursorWindow(true /*this argument is ignored*/);
        assertEquals("<unnamed>", window.getName());
        assertEquals(0, window.getStartPosition());
        window.close();
    
public voidtestValues()

        CursorWindow window = new CursorWindow("MyWindow");
        doTestValues(window);
        window.close();