summaryrefslogtreecommitdiffstats
path: root/tests/src/com/android
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-10-18 16:46:53 +0800
committerEarl Ou <shunhsingou@google.com>2012-10-24 11:13:21 +0800
commit120cdf4530bb3dc61643ab700caeefd4f9190793 (patch)
tree596475e71d429a43282b2d6880f042371dd4f91e /tests/src/com/android
parent8a7732ae1850c69ba4225836df07aae3823818dd (diff)
downloadandroid_packages_apps_Snap-120cdf4530bb3dc61643ab700caeefd4f9190793.zip
android_packages_apps_Snap-120cdf4530bb3dc61643ab700caeefd4f9190793.tar.gz
android_packages_apps_Snap-120cdf4530bb3dc61643ab700caeefd4f9190793.tar.bz2
Use NO_VALUE in ground truth of exif test when no valid value from exiftool
Change-Id: Ia33edf0aba8562eb2dbd61b5753657f245bf7310
Diffstat (limited to 'tests/src/com/android')
-rw-r--r--tests/src/com/android/gallery3d/exif/ExifParserTest.java15
-rw-r--r--tests/src/com/android/gallery3d/exif/ExifReaderTest.java17
-rw-r--r--tests/src/com/android/gallery3d/exif/ExifXmlReader.java8
3 files changed, 17 insertions, 23 deletions
diff --git a/tests/src/com/android/gallery3d/exif/ExifParserTest.java b/tests/src/com/android/gallery3d/exif/ExifParserTest.java
index c93e09a..eb5a574 100644
--- a/tests/src/com/android/gallery3d/exif/ExifParserTest.java
+++ b/tests/src/com/android/gallery3d/exif/ExifParserTest.java
@@ -76,20 +76,15 @@ public class ExifParserTest extends ExifXmlDataTestCase {
}
private void checkTag(ExifTag tag) {
- // Ignore offset tags since the ground-truth from exiftool doesn't have it.
- // We can verify it by examining the sub-IFD or thumbnail itself.
- if (ExifTag.isSubIfdOffsetTag(tag.getTagId())) return;
-
- // TODO: Test MakerNote and UserComment
- if (tag.getTagId() == ExifTag.TAG_MAKER_NOTE
- || tag.getTagId() == ExifTag.TAG_USER_COMMENT) return;
-
Set<String> truth = mGroundTruth.get(tag.getIfd()).get(tag.getTagId());
if (truth == null) {
fail(String.format("Unknown Tag %02x", tag.getTagId()) + ", " + getImageTitle());
}
+ // No value from exiftool.
+ if (truth.contains(null)) return;
+
String dataString = tag.valueToString().trim();
assertTrue(String.format("Tag %02x", tag.getTagId()) + ", " + getImageTitle()
+ ": " + dataString,
@@ -109,9 +104,7 @@ public class ExifParserTest extends ExifXmlDataTestCase {
break;
case ExifParser.EVENT_NEW_TAG:
ExifTag tag = parser.getTag();
- // The exiftool doesn't provide MakerNote tag
- if (!ExifTag.isSubIfdOffsetTag(tag.getTagId())
- && tag.getTagId() != ExifTag.TAG_MAKER_NOTE) numOfTag++;
+ numOfTag++;
if (tag.hasValue()) {
checkTag(tag);
} else {
diff --git a/tests/src/com/android/gallery3d/exif/ExifReaderTest.java b/tests/src/com/android/gallery3d/exif/ExifReaderTest.java
index 40d269e..82dcdc7 100644
--- a/tests/src/com/android/gallery3d/exif/ExifReaderTest.java
+++ b/tests/src/com/android/gallery3d/exif/ExifReaderTest.java
@@ -111,18 +111,13 @@ public class ExifReaderTest extends ExifXmlDataTestCase {
return;
}
ExifTag[] tags = ifd.getAllTags();
- int size = 0;
for (ExifTag tag : tags) {
- if (ExifTag.isSubIfdOffsetTag(tag.getTagId())
- || tag.getTagId() == ExifTag.TAG_MAKER_NOTE) continue;
- if (tag.getTagId() != ExifTag.TAG_USER_COMMENT) {
- Set<String> truth = ifdValue.get(tag.getTagId());
- assertNotNull(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(), truth);
- assertTrue(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(),
- truth.contains(tag.valueToString().trim()));
- }
- size++;
+ Set<String> truth = ifdValue.get(tag.getTagId());
+ assertNotNull(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(), truth);
+ if (truth.contains(null)) continue;
+ assertTrue(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(),
+ truth.contains(tag.valueToString().trim()));
}
- assertEquals(getImageTitle(), ifdValue.size(), size);
+ assertEquals(getImageTitle(), ifdValue.size(), tags.length);
}
}
diff --git a/tests/src/com/android/gallery3d/exif/ExifXmlReader.java b/tests/src/com/android/gallery3d/exif/ExifXmlReader.java
index 54def27..5d19709 100644
--- a/tests/src/com/android/gallery3d/exif/ExifXmlReader.java
+++ b/tests/src/com/android/gallery3d/exif/ExifXmlReader.java
@@ -40,6 +40,8 @@ public class ExifXmlReader {
private static final String ATTR_ID = "id";
private static final String ATTR_IFD = "ifd";
+ private static final String NO_VALUE = "NO_VALUE";
+
/**
* This function read the ground truth XML.
*
@@ -86,7 +88,11 @@ public class ExifXmlReader {
tagData = new HashSet<String>();
exifData.get(ifdId).put(id, tagData);
}
- tagData.add(value.trim());
+ if (NO_VALUE.equals(value)) {
+ tagData.add(null);
+ } else {
+ tagData.add(value.trim());
+ }
}
parser.require(XmlPullParser.END_TAG, null, null);