summaryrefslogtreecommitdiffstats
path: root/tests/src
diff options
context:
space:
mode:
authorChia-chi Yeh <chiachi@android.com>2010-12-29 16:03:15 +0800
committerChia-chi Yeh <chiachi@android.com>2010-12-29 16:09:25 +0800
commit9048630a1c9a37327039e6a2855636ecc065b642 (patch)
tree04e6c126b0d05adff4ced0a4c549395290e512af /tests/src
parent0aaed976b603c56006213d196e6b0703285dafd5 (diff)
downloadLegacyCamera-9048630a1c9a37327039e6a2855636ecc065b642.zip
LegacyCamera-9048630a1c9a37327039e6a2855636ecc065b642.tar.gz
LegacyCamera-9048630a1c9a37327039e6a2855636ecc065b642.tar.bz2
Cleanup: Remove BitmapManager, ImageManager, and gallery classes.
There are 1500 lines of code within 12 classes, which are now completely replaced by 250-line Storage class. Hooray! Change-Id: I9d0149cac18185972912f7b7a92f450929060274
Diffstat (limited to 'tests/src')
-rw-r--r--tests/src/com/android/camera/UnitTests.java3
-rw-r--r--tests/src/com/android/camera/gallery/LruCacheUnitTests.java78
-rw-r--r--tests/src/com/android/camera/gallery/MockImage.java111
-rw-r--r--tests/src/com/android/camera/gallery/MockImageList.java70
4 files changed, 1 insertions, 261 deletions
diff --git a/tests/src/com/android/camera/UnitTests.java b/tests/src/com/android/camera/UnitTests.java
index 4fc0e7d..e56a907 100644
--- a/tests/src/com/android/camera/UnitTests.java
+++ b/tests/src/com/android/camera/UnitTests.java
@@ -28,8 +28,7 @@ public class UnitTests extends TestSuite {
public static Test suite() {
return new UnitTestSuiteBuilder(UnitTests.class)
- .includePackages("com.android.camera.unittest",
- "com.android.camera.gallery")
+ .includePackages("com.android.camera.unittest")
.named("Camera Unit Tests")
.build();
}
diff --git a/tests/src/com/android/camera/gallery/LruCacheUnitTests.java b/tests/src/com/android/camera/gallery/LruCacheUnitTests.java
deleted file mode 100644
index c437553..0000000
--- a/tests/src/com/android/camera/gallery/LruCacheUnitTests.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package com.android.camera.gallery;
-
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.util.Log;
-
-public class LruCacheUnitTests extends AndroidTestCase {
-
- @SmallTest
- public void testPut() {
- LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(2);
- Integer key = Integer.valueOf(1);
- Integer value = Integer.valueOf(3);
- cache.put(key, value);
- assertEquals(value, cache.get(key));
- }
-
- @SmallTest
- public void testTracingInUsedObject() {
- LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(2);
- Integer key = Integer.valueOf(1);
- Integer value = new Integer(3);
- cache.put(key, value);
- for (int i = 0; i < 3; ++i) {
- cache.put(i + 10, i * i);
- }
- System.gc();
- assertEquals(value, cache.get(key));
- }
-
- @SmallTest
- public void testLruAlgorithm() {
- LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(2);
- cache.put(0, new Integer(0));
- for (int i = 0; i < 3; ++i) {
- cache.put(i + 1, i * i);
- cache.get(0);
- }
- System.gc();
- assertEquals(Integer.valueOf(0), cache.get(0));
- }
-
- private static final int TEST_COUNT = 10000;
-
- static class Accessor extends Thread {
- private final LruCache<Integer,Integer> mMap;
-
- public Accessor(LruCache<Integer, Integer> map) {
- mMap = map;
- }
-
- @Override
- public void run() {
- Log.v("TAG", "start get " + this);
- for (int i = 0; i < TEST_COUNT; ++i) {
- mMap.get(i % 2);
- }
- Log.v("TAG", "finish get " + this);
- }
- }
-
- @SuppressWarnings("unchecked")
- public void testConcurrentAccess() throws Exception {
- LruCache<Integer, Integer> cache = new LruCache<Integer, Integer>(4);
- cache.put(0, 0);
- cache.put(1, 1);
- Accessor accessor[] = new Accessor[4];
- for (int i = 0; i < accessor.length; ++i) {
- accessor[i] = new Accessor(cache);
- }
- for (int i = 0; i < accessor.length; ++i) {
- accessor[i].start();
- }
- for (int i = 0; i < accessor.length; ++i) {
- accessor[i].join();
- }
- }
-}
diff --git a/tests/src/com/android/camera/gallery/MockImage.java b/tests/src/com/android/camera/gallery/MockImage.java
deleted file mode 100644
index ad68e55..0000000
--- a/tests/src/com/android/camera/gallery/MockImage.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package com.android.camera.gallery;
-
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-
-import java.io.InputStream;
-
-public class MockImage implements IImage {
- private final long mId;
- private final long mTakenDate;
- private IImageList mContainer;
-
- public MockImage(long id, long takenDate) {
- mId = id;
- mTakenDate = takenDate;
- }
-
- public int getDegreesRotated() {
- return 0;
- }
-
- protected void setContainer(IImageList container) {
- this.mContainer = container;
- }
-
- public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels) {
- return null;
- }
-
- public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels,
- boolean rotateAsNeeded) {
- return null;
- }
-
- public Bitmap fullSizeBitmap(int minSideLength, int maxNumberOfPixels,
- boolean rotateAsNeeded, boolean useNative) {
- return null;
- }
-
- public InputStream fullSizeImageData() {
- return null;
- }
-
- public long fullSizeImageId() {
- return mId;
- }
-
- public Uri fullSizeImageUri() {
- return null;
- }
-
- public IImageList getContainer() {
- return mContainer;
- }
-
- public String getDataPath() {
- return null;
- }
-
- public long getDateTaken() {
- return mTakenDate;
- }
-
- public String getDisplayName() {
- return null;
- }
-
- public int getHeight() {
- return 0;
- }
-
- public String getMimeType() {
- return null;
- }
-
- public String getTitle() {
- return null;
- }
-
- public int getWidth() {
- return 0;
- }
-
- public boolean isDrm() {
- return false;
- }
-
- public boolean isReadonly() {
- return false;
- }
-
- public Bitmap miniThumbBitmap() {
- return null;
- }
-
- public boolean rotateImageBy(int degrees) {
- return false;
- }
-
- public void setTitle(String name) {
- }
-
- public Bitmap thumbBitmap(boolean rotateAsNeeded) {
- return null;
- }
-
- public Uri thumbUri() {
- return null;
- }
-}
diff --git a/tests/src/com/android/camera/gallery/MockImageList.java b/tests/src/com/android/camera/gallery/MockImageList.java
deleted file mode 100644
index b9a7846..0000000
--- a/tests/src/com/android/camera/gallery/MockImageList.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package com.android.camera.gallery;
-
-import android.content.ContentResolver;
-import android.net.Uri;
-import android.os.Parcel;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-public class MockImageList implements IImageList {
-
- private final ArrayList<IImage> mList = new ArrayList<IImage>();
-
- public void checkThumbnail(int index) {
- }
-
- public void deactivate() {
- }
-
- public HashMap<String, String> getBucketIds() {
- return null;
- }
-
- public int getCount() {
- return mList.size();
- }
-
- public IImage getImageAt(int i) {
- return mList.get(i);
- }
-
- public IImage getImageForUri(Uri uri) {
- return null;
- }
-
- public int getImageIndex(IImage image) {
- return mList.indexOf(image);
- }
-
- public boolean isEmpty() {
- return mList.isEmpty();
- }
-
- public boolean removeImage(IImage image) {
- return mList.remove(image);
- }
-
- public boolean removeImageAt(int i) {
- return mList.remove(i) != null;
- }
-
- public void addImage(MockImage image) {
- mList.add(image);
- image.setContainer(this);
- }
-
- public void open(ContentResolver resolver) {
- }
-
- public void close() {
- }
-
- public void writeToParcel(Parcel out, int flags) {
- throw new UnsupportedOperationException();
- }
-
- public int describeContents() {
- return 0;
- }
-}