diff options
author | Jeff Sharkey <jsharkey@android.com> | 2013-05-07 12:41:33 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2013-08-17 19:05:07 -0700 |
commit | 9d0843df7e3984293dc4ab6ee2f9502e898b63aa (patch) | |
tree | 9487940fefdc3034d1e13838b0cca47ed5bce35b /core/tests | |
parent | a5599ef636e37cb0b6474349936999be1afe6987 (diff) | |
download | frameworks_base-9d0843df7e3984293dc4ab6ee2f9502e898b63aa.zip frameworks_base-9d0843df7e3984293dc4ab6ee2f9502e898b63aa.tar.gz frameworks_base-9d0843df7e3984293dc4ab6ee2f9502e898b63aa.tar.bz2 |
Resized thumbnails; async; extend MatrixCursor.
When requesting thumbnails, check if their dimensions are larger
than requested, and downscale to avoid memory pressure. Load them
async and with LruCache.
Extend MatrixCursor so that RowBuilder can offer() columns without
requiring they know the projection map. This makes it easier to
respond to query() calls, where the remote side controls the
projection map. Use it to handle custom projections in external
storage backend.
Update date/time formatting to match spec.
Bug: 10333418, 10331689
Change-Id: I7e947a8e8068af8a39b55e6766b3241de4f3fc16
Diffstat (limited to 'core/tests')
-rw-r--r-- | core/tests/coretests/src/android/database/MatrixCursorTest.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/core/tests/coretests/src/android/database/MatrixCursorTest.java b/core/tests/coretests/src/android/database/MatrixCursorTest.java index cdab638..fc48c17 100644 --- a/core/tests/coretests/src/android/database/MatrixCursorTest.java +++ b/core/tests/coretests/src/android/database/MatrixCursorTest.java @@ -128,6 +128,56 @@ public class MatrixCursorTest extends TestCase { } catch (IllegalArgumentException e) { /* expected */ } } + public void testRowBuilderOffer() { + MatrixCursor cursor = newMatrixCursor(); + + cursor.newRow() + .offer("float", 4.2f) + .offer("string", "foobar") + .offer("blob", new byte[] {(byte) 0xaa, (byte) 0x55}) + .offer("lolwat", "kittens"); + + cursor.newRow(); + + cursor.newRow() + .offer("string", "zero") + .offer("string", "one") + .offer("string", "two") + .offer("lolwat", "kittens"); + + assertTrue(cursor.moveToFirst()); + assertEquals("foobar", cursor.getString(0)); + assertEquals(null, cursor.getString(1)); + assertEquals(0, cursor.getShort(1)); + assertEquals(0, cursor.getInt(2)); + assertEquals(0, cursor.getLong(3)); + assertEquals(4.2f, cursor.getFloat(4)); + assertEquals(0.0d, cursor.getDouble(5)); + MoreAsserts.assertEquals(new byte[] {(byte) 0xaa, (byte) 0x55}, cursor.getBlob(6)); + + assertTrue(cursor.moveToNext()); + assertEquals(null, cursor.getString(0)); + assertEquals(0, cursor.getShort(1)); + assertEquals(0, cursor.getInt(2)); + assertEquals(0, cursor.getLong(3)); + assertEquals(0.0f, cursor.getFloat(4)); + assertEquals(0.0d, cursor.getDouble(5)); + assertEquals(null, cursor.getBlob(6)); + + assertTrue(cursor.moveToNext()); + assertEquals("two", cursor.getString(0)); + assertEquals(0, cursor.getShort(1)); + assertEquals(0, cursor.getInt(2)); + assertEquals(0, cursor.getLong(3)); + assertEquals(0.0f, cursor.getFloat(4)); + assertEquals(0.0d, cursor.getDouble(5)); + assertEquals(null, cursor.getBlob(6)); + + assertTrue(cursor.isLast()); + assertFalse(cursor.moveToNext()); + assertTrue(cursor.isAfterLast()); + } + static class NonIterableArrayList<T> extends ArrayList<T> { NonIterableArrayList() {} |