summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/gallery3d/exif/ExifReaderTest.java
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-10-10 16:58:19 +0800
committerEarl Ou <shunhsingou@google.com>2012-10-17 14:08:09 +0800
commitcdd116de25c9a9cc14704cb7348077ed99c7ade9 (patch)
treeb043b59dbf433b7e5f30f720f6b43629a12f8b4d /tests/src/com/android/gallery3d/exif/ExifReaderTest.java
parente541b11c637d84d44943ee89ab4a0da9f3061ab7 (diff)
downloadandroid_packages_apps_Snap-cdd116de25c9a9cc14704cb7348077ed99c7ade9.tar.gz
android_packages_apps_Snap-cdd116de25c9a9cc14704cb7348077ed99c7ade9.tar.bz2
android_packages_apps_Snap-cdd116de25c9a9cc14704cb7348077ed99c7ade9.zip
Read exif test images from the external storage of the test package
We can now add more exif test images under the application's private Pictures directory, and put their corresponding xml files under Xml directory. The tests will try to load them and use them as a testcase. Change-Id: I2bc82bb7703e3a4516d1bc433ac5fabed2080987
Diffstat (limited to 'tests/src/com/android/gallery3d/exif/ExifReaderTest.java')
-rw-r--r--tests/src/com/android/gallery3d/exif/ExifReaderTest.java35
1 files changed, 8 insertions, 27 deletions
diff --git a/tests/src/com/android/gallery3d/exif/ExifReaderTest.java b/tests/src/com/android/gallery3d/exif/ExifReaderTest.java
index 1300af0e9..3a78e091b 100644
--- a/tests/src/com/android/gallery3d/exif/ExifReaderTest.java
+++ b/tests/src/com/android/gallery3d/exif/ExifReaderTest.java
@@ -16,42 +16,28 @@
package com.android.gallery3d.exif;
-import android.content.res.XmlResourceParser;
import android.graphics.BitmapFactory;
-import java.io.IOException;
-import java.io.InputStream;
import java.util.List;
import java.util.Map;
public class ExifReaderTest extends ExifXmlDataTestCase {
private static final String TAG = "ExifReaderTest";
- private List<Map<Short, String>> mGroundTruth;
-
- private InputStream mImageInputStream;
-
- public ExifReaderTest(int imageResourceId, int xmlResourceId) {
- super(imageResourceId, xmlResourceId);
+ public ExifReaderTest(int imgRes, int xmlRes) {
+ super(imgRes, xmlRes);
}
- @Override
- public void setUp() throws Exception {
- mImageInputStream = getInstrumentation()
- .getContext().getResources().openRawResource(mImageResourceId);
-
- XmlResourceParser parser =
- getInstrumentation().getContext().getResources().getXml(mXmlResourceId);
-
- mGroundTruth = ExifXmlReader.readXml(getInstrumentation().getContext(), mXmlResourceId);
- parser.close();
+ public ExifReaderTest(String imgPath, String xmlPath) {
+ super(imgPath, xmlPath);
}
- public void testRead() throws ExifInvalidFormatException, IOException {
+ public void testRead() throws Exception {
ExifReader reader = new ExifReader();
- ExifData exifData = reader.read(mImageInputStream);
+ ExifData exifData = reader.read(getImageInputStream());
+ List<Map<Short, String>> groundTruth = ExifXmlReader.readXml(getXmlParser());
for (int i = 0; i < IfdId.TYPE_IFD_COUNT; i++) {
- checkIfd(exifData.getIfdData(i), mGroundTruth.get(i));
+ checkIfd(exifData.getIfdData(i), groundTruth.get(i));
}
checkThumbnail(exifData);
}
@@ -124,9 +110,4 @@ public class ExifReaderTest extends ExifXmlDataTestCase {
}
assertEquals(ifdValue.size(), size);
}
-
- @Override
- public void tearDown() throws Exception {
- mImageInputStream.close();
- }
}