From 9fae341c1a958285d93d86698ea7ff28dc4bde89 Mon Sep 17 00:00:00 2001 From: Earl Ou Date: Fri, 3 Aug 2012 12:28:17 +0800 Subject: Check number of exif tag in test Change-Id: Ic84c7c004fe0ab5fcea9a0cc6e7f9d86db61abd8 --- tests/src/com/android/gallery3d/exif/ExifParserTest.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'tests/src') diff --git a/tests/src/com/android/gallery3d/exif/ExifParserTest.java b/tests/src/com/android/gallery3d/exif/ExifParserTest.java index f89b1a227..3c9d276e5 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 truth) -- cgit v1.2.3