From 4285894ea4facfae76ff57df97f4fd8342608bd4 Mon Sep 17 00:00:00 2001 From: Earl Ou Date: Wed, 1 Aug 2012 17:19:49 +0800 Subject: Test only keep some exif tags for value Change-Id: I06962ffb4e1c6844cc8c0d24b686571483f16c22 --- .../com/android/gallery3d/exif/ExifParserTest.java | 32 ++++++++++++++++++++++ 1 file changed, 32 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 0c160f21a..2e92231de 100644 --- a/tests/src/com/android/gallery3d/exif/ExifParserTest.java +++ b/tests/src/com/android/gallery3d/exif/ExifParserTest.java @@ -285,6 +285,38 @@ public class ExifParserTest extends ActivityTestCase { } } + public void testOnlySaveSomeValue() 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: + ExifTag tag = ifdParser.readTag(); + // only interested in these two tags + if (tag.getOffset() > 0) { + if(tag.getTagId() == ExifTag.TIFF_TAG.TAG_MODEL + || tag.getTagId() == ExifTag.TIFF_TAG.TAG_EXIF_IFD) { + ifdParser.waitValueOfTag(tag); + } + } + break; + case IfdParser.TYPE_NEXT_IFD: + parseIfd1(ifdParser.parseIfdBlock()); + break; + case IfdParser.TYPE_SUB_IFD: + assertEquals(ExifTag.TIFF_TAG.TAG_EXIF_IFD, + ifdParser.getCorrespodingExifTag().getTagId()); + parseExifIfd(ifdParser.parseIfdBlock()); + break; + case IfdParser.TYPE_VALUE_OF_PREV_TAG: + checkTag(ifdParser.getCorrespodingExifTag(), ifdParser, IFD0_VALUE); + break; + } + type = ifdParser.next(); + } + } + @Override protected void tearDown() throws IOException { mImageInputStream.close(); -- cgit v1.2.3