summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-08-03 12:28:17 +0800
committerEarl Ou <shunhsingou@google.com>2012-08-06 16:32:13 +0800
commit9fae341c1a958285d93d86698ea7ff28dc4bde89 (patch)
treee626ad78f8db5691f9c78592ce9dfa1c88d16242 /tests
parent04504616c1b187ef67304cd5daf2123fae75e23c (diff)
downloadandroid_packages_apps_Snap-9fae341c1a958285d93d86698ea7ff28dc4bde89.zip
android_packages_apps_Snap-9fae341c1a958285d93d86698ea7ff28dc4bde89.tar.gz
android_packages_apps_Snap-9fae341c1a958285d93d86698ea7ff28dc4bde89.tar.bz2
Check number of exif tag in test
Change-Id: Ic84c7c004fe0ab5fcea9a0cc6e7f9d86db61abd8
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/gallery3d/exif/ExifParserTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/src/com/android/gallery3d/exif/ExifParserTest.java b/tests/src/com/android/gallery3d/exif/ExifParserTest.java
index f89b1a2..3c9d276 100644
--- a/tests/src/com/android/gallery3d/exif/ExifParserTest.java
+++ b/tests/src/com/android/gallery3d/exif/ExifParserTest.java
@@ -115,6 +115,7 @@ public class ExifParserTest extends ActivityTestCase {
private void parseIfd0(IfdParser ifdParser) throws IOException,
ExifInvalidFormatException {
int type = ifdParser.next();
+ int tagNumber=0;
while (type != IfdParser.TYPE_END) {
switch (type) {
case IfdParser.TYPE_NEW_TAG:
@@ -123,6 +124,7 @@ public class ExifParserTest extends ActivityTestCase {
ifdParser.waitValueOfTag(tag);
} else {
checkTag(tag, ifdParser, IFD0_VALUE);
+ tagNumber++;
}
break;
case IfdParser.TYPE_NEXT_IFD:
@@ -135,15 +137,18 @@ public class ExifParserTest extends ActivityTestCase {
break;
case IfdParser.TYPE_VALUE_OF_PREV_TAG:
checkTag(ifdParser.getCorrespodingExifTag(), ifdParser, IFD0_VALUE);
+ tagNumber++;
break;
}
type = ifdParser.next();
}
+ assertEquals(IFD0_VALUE.size(), tagNumber);
}
private void parseIfd1(IfdParser ifdParser) throws IOException,
ExifInvalidFormatException {
int type = ifdParser.next();
+ int tagNumber = 0;
while (type != IfdParser.TYPE_END) {
switch (type) {
case IfdParser.TYPE_NEW_TAG:
@@ -152,6 +157,7 @@ public class ExifParserTest extends ActivityTestCase {
ifdParser.waitValueOfTag(tag);
} else {
checkTag(tag, ifdParser, IFD1_VALUE);
+ tagNumber++;
}
break;
case IfdParser.TYPE_NEXT_IFD:
@@ -162,15 +168,18 @@ public class ExifParserTest extends ActivityTestCase {
break;
case IfdParser.TYPE_VALUE_OF_PREV_TAG:
checkTag(ifdParser.getCorrespodingExifTag(), ifdParser, IFD1_VALUE);
+ tagNumber++;
break;
}
type = ifdParser.next();
}
+ assertEquals(IFD1_VALUE.size(), tagNumber);
}
private void parseExifIfd(IfdParser ifdParser) throws IOException,
ExifInvalidFormatException {
int type = ifdParser.next();
+ int tagNumber = 0;
while (type != IfdParser.TYPE_END) {
switch (type) {
case IfdParser.TYPE_NEW_TAG:
@@ -179,6 +188,7 @@ public class ExifParserTest extends ActivityTestCase {
ifdParser.waitValueOfTag(tag);
} else {
checkTag(tag, ifdParser, EXIF_IFD_VALUE);
+ tagNumber++;
}
break;
case IfdParser.TYPE_NEXT_IFD:
@@ -189,10 +199,12 @@ public class ExifParserTest extends ActivityTestCase {
break;
case IfdParser.TYPE_VALUE_OF_PREV_TAG:
checkTag(ifdParser.getCorrespodingExifTag(), ifdParser, EXIF_IFD_VALUE);
+ tagNumber++;
break;
}
type = ifdParser.next();
}
+ assertEquals(EXIF_IFD_VALUE.size(), tagNumber);
}
private void checkTag(ExifTag tag, IfdParser ifdParser, HashMap<Short, String> truth)