From dbbfed236dc1bb81826ea87e9e2cd09aa141cb8d Mon Sep 17 00:00:00 2001 From: Earl Ou Date: Wed, 1 Aug 2012 16:46:06 +0800 Subject: Test skip to next ifd in ExifParserTest Change-Id: Icc53e75d563acb304c23349c28d604d439b4b314 --- .../com/android/gallery3d/exif/ExifParserTest.java | 25 ++++++++++++++++++++++ 1 file changed, 25 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 91e1d37aa..0c160f21a 100644 --- a/tests/src/com/android/gallery3d/exif/ExifParserTest.java +++ b/tests/src/com/android/gallery3d/exif/ExifParserTest.java @@ -260,6 +260,31 @@ public class ExifParserTest extends ActivityTestCase { return sbuilder.toString(); } + public void testSkipToNextIfd() throws ExifInvalidFormatException, IOException { + ExifParser exifParser = new ExifParser(); + IfdParser ifdParser = exifParser.parse(mImageInputStream); + int type = ifdParser.next(); + while (type != IfdParser.TYPE_END) { + switch (type) { + case IfdParser.TYPE_NEW_TAG: + // Do nothing, we don't care + break; + case IfdParser.TYPE_NEXT_IFD: + parseIfd1(ifdParser.parseIfdBlock()); + break; + case IfdParser.TYPE_SUB_IFD: + // We won't get this since to skip everything + assertTrue(false); + break; + case IfdParser.TYPE_VALUE_OF_PREV_TAG: + // We won't get this since to skip everything + assertTrue(false); + break; + } + type = ifdParser.next(); + } + } + @Override protected void tearDown() throws IOException { mImageInputStream.close(); -- cgit v1.2.3