diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/camera/BitmapManagerUnitTests.java | 8 | ||||
-rw-r--r-- | tests/src/com/android/camera/gallery/ImageListUberUnitTests.java | 89 |
2 files changed, 4 insertions, 93 deletions
diff --git a/tests/src/com/android/camera/BitmapManagerUnitTests.java b/tests/src/com/android/camera/BitmapManagerUnitTests.java index fc1ade1..7878b74 100644 --- a/tests/src/com/android/camera/BitmapManagerUnitTests.java +++ b/tests/src/com/android/camera/BitmapManagerUnitTests.java @@ -75,7 +75,7 @@ public class BitmapManagerUnitTests extends AndroidTestCase { assertTrue(mBitmapManager.canThreadDecoding(t)); // Disallow thread t to decode. - mBitmapManager.cancelThreadDecoding(t); + mBitmapManager.cancelThreadDecoding(t, mContext.getContentResolver()); assertFalse(mBitmapManager.canThreadDecoding(t)); // Allow thread t to decode again. @@ -96,7 +96,7 @@ public class BitmapManagerUnitTests extends AndroidTestCase { public void testCancelDecoding() { DecodeThread t = new DecodeThread(); - mBitmapManager.cancelThreadDecoding(t); + mBitmapManager.cancelThreadDecoding(t, mContext.getContentResolver()); try { t.start(); t.join(); @@ -108,7 +108,7 @@ public class BitmapManagerUnitTests extends AndroidTestCase { public void testAllowDecoding() { DecodeThread t = new DecodeThread(); - mBitmapManager.cancelThreadDecoding(t); + mBitmapManager.cancelThreadDecoding(t, mContext.getContentResolver()); mBitmapManager.allowThreadDecoding(t); try { t.start(); @@ -123,7 +123,7 @@ public class BitmapManagerUnitTests extends AndroidTestCase { DecodeThread t1 = new DecodeThread(); DecodeThread t2 = new DecodeThread(); mBitmapManager.allowThreadDecoding(t1); - mBitmapManager.cancelThreadDecoding(t2); + mBitmapManager.cancelThreadDecoding(t2, mContext.getContentResolver()); t1.start(); t2.start(); diff --git a/tests/src/com/android/camera/gallery/ImageListUberUnitTests.java b/tests/src/com/android/camera/gallery/ImageListUberUnitTests.java deleted file mode 100644 index 30487f2..0000000 --- a/tests/src/com/android/camera/gallery/ImageListUberUnitTests.java +++ /dev/null @@ -1,89 +0,0 @@ -package com.android.camera.gallery; - -import com.android.camera.ImageManager; - -import android.test.AndroidTestCase; - -public class ImageListUberUnitTests extends AndroidTestCase { - - public void testTheOrderOfGetImageAt() { - MockImageList listA = new MockImageList(); - MockImageList listB = new MockImageList(); - listA.addImage(new MockImage(2, 2)); - listA.addImage(new MockImage(0, 0)); - listB.addImage(new MockImage(1, 1)); - ImageListUber uber = new ImageListUber( - new IImageList[] {listA, listB}, ImageManager.SORT_DESCENDING); - - assertEquals(2, uber.getImageAt(0).fullSizeImageId()); - assertEquals(1, uber.getImageAt(1).fullSizeImageId()); - assertEquals(0, uber.getImageAt(2).fullSizeImageId()); - uber.close(); - - uber = new ImageListUber( - new IImageList[] {listA, listB}, ImageManager.SORT_DESCENDING); - assertEquals(2, uber.getImageAt(0).fullSizeImageId()); - assertEquals(1, uber.getImageAt(1).fullSizeImageId()); - assertEquals(0, uber.getImageAt(2).fullSizeImageId()); - uber.close(); - } - - public void testTheOrderOfGetImageAtCaseTwo() { - MockImageList listA = new MockImageList(); - MockImageList listB = new MockImageList(); - listA.addImage(new MockImage(2, 2)); - listA.addImage(new MockImage(1, 1)); - listB.addImage(new MockImage(0, 0)); - ImageListUber uber = new ImageListUber( - new IImageList[] {listB, listA}, ImageManager.SORT_DESCENDING); - - assertEquals(2, uber.getImageAt(0).fullSizeImageId()); - assertEquals(1, uber.getImageAt(1).fullSizeImageId()); - assertEquals(0, uber.getImageAt(2).fullSizeImageId()); - uber.close(); - - uber = new ImageListUber( - new IImageList[] {listA, listB}, ImageManager.SORT_DESCENDING); - - assertEquals(2, uber.getImageAt(0).fullSizeImageId()); - assertEquals(1, uber.getImageAt(1).fullSizeImageId()); - assertEquals(0, uber.getImageAt(2).fullSizeImageId()); - uber.close(); - } - - public void testRemoveImage() { - MockImageList listA = new MockImageList(); - MockImageList listB = new MockImageList(); - MockImage target = new MockImage(1, 1); - listA.addImage(new MockImage(2, 2)); - listA.addImage(new MockImage(0, 0)); - listB.addImage(target); - ImageListUber uber = new ImageListUber( - new IImageList[] {listB, listA}, ImageManager.SORT_DESCENDING); - uber.removeImage(target); - assertEquals(2, uber.getImageAt(0).fullSizeImageId()); - assertEquals(0, uber.getImageAt(1).fullSizeImageId()); - - assertEquals(0, uber.getImageIndex(uber.getImageAt(0))); - assertEquals(1, uber.getImageIndex(uber.getImageAt(1))); - uber.close(); - } - - public void testRemoveImageAt() { - MockImageList listA = new MockImageList(); - MockImageList listB = new MockImageList(); - MockImage target = new MockImage(1, 1); - listA.addImage(new MockImage(2, 2)); - listA.addImage(new MockImage(0, 0)); - listB.addImage(target); - ImageListUber uber = new ImageListUber( - new IImageList[] {listB, listA}, ImageManager.SORT_DESCENDING); - uber.removeImageAt(1); - assertEquals(2, uber.getImageAt(0).fullSizeImageId()); - assertEquals(0, uber.getImageAt(1).fullSizeImageId()); - - assertEquals(0, uber.getImageIndex(uber.getImageAt(0))); - assertEquals(1, uber.getImageIndex(uber.getImageAt(1))); - uber.close(); - } -} |