diff options
author | Owen Lin <owenlin@android.com> | 2012-08-07 03:10:07 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-08-07 03:10:08 -0700 |
commit | 077aca8984fb00b34c6cb0e72968808fad4a48d0 (patch) | |
tree | 39eaa98b3d26abe14d9d00e966d0ec84db698607 /tests | |
parent | 5d6c49fbc92f29ad4311ca747c5eba4df84fb74a (diff) | |
parent | fd3a9b84992ec78ea431d346fdc7870f54d3e1cc (diff) | |
download | android_packages_apps_Snap-077aca8984fb00b34c6cb0e72968808fad4a48d0.tar.gz android_packages_apps_Snap-077aca8984fb00b34c6cb0e72968808fad4a48d0.tar.bz2 android_packages_apps_Snap-077aca8984fb00b34c6cb0e72968808fad4a48d0.zip |
Merge "Change Thumbnail test for ExifParser when there is no thumbnail or thumbnail's information" into gb-ub-photos-arches
Diffstat (limited to 'tests')
-rw-r--r-- | tests/src/com/android/gallery3d/exif/ExifParserTest.java | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/tests/src/com/android/gallery3d/exif/ExifParserTest.java b/tests/src/com/android/gallery3d/exif/ExifParserTest.java index c514eb700..6c9d74d51 100644 --- a/tests/src/com/android/gallery3d/exif/ExifParserTest.java +++ b/tests/src/com/android/gallery3d/exif/ExifParserTest.java @@ -20,6 +20,7 @@ import android.content.res.XmlResourceParser; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.test.InstrumentationTestCase; +import android.util.Log; import org.xmlpull.v1.XmlPullParser; import org.xmlpull.v1.XmlPullParserException; @@ -347,14 +348,13 @@ public class ExifParserTest extends InstrumentationTestCase { while (type != IfdParser.TYPE_END && type != IfdParser.TYPE_NEXT_IFD) { type = ifdParser.next(); } - // We should meet next_ifd before end - assertTrue(type != IfdParser.TYPE_END); - + if (type == IfdParser.TYPE_END) { + Log.i(TAG, "No Thumbnail"); + return; + } IfdParser ifd1Parser = ifdParser.parseIfdBlock(); int thumbOffset = 0; int thumbSize = 0; - int width = 0; - int height = 0; boolean isFinishRead = false; while (!isFinishRead) { switch (ifd1Parser.next()) { @@ -369,20 +369,8 @@ public class ExifParserTest extends InstrumentationTestCase { long unsignedInt = ifdParser.readUnsignedInt(); assertTrue(unsignedInt <= Integer.MAX_VALUE); thumbSize = (int) unsignedInt; - } else if (tag.getTagId() == ExifTag.TIFF_TAG.TAG_IMAGE_WIDTH) { - long unsigned = tag.getDataType() == ExifTag.TYPE_INT ? - ifd1Parser.readUnsignedInt() : ifd1Parser.readUnsignedShort(); - assertTrue(unsigned <= (tag.getDataType() == ExifTag.TYPE_INT ? - Integer.MAX_VALUE: Short.MAX_VALUE)); - width = (int) unsigned; - } else if (tag.getTagId() == ExifTag.TIFF_TAG.TAG_IMAGE_HEIGHT) { - long unsigned = tag.getDataType() == ExifTag.TYPE_INT ? - ifd1Parser.readUnsignedInt() : ifd1Parser.readUnsignedShort(); - assertTrue(unsigned <= (tag.getDataType() == ExifTag.TYPE_INT ? - Integer.MAX_VALUE: Short.MAX_VALUE)); - height = (int) unsigned; } - isFinishRead = thumbOffset != 0 && thumbSize != 0 && width != 0 && height != 0; + isFinishRead = thumbOffset != 0 && thumbSize != 0; break; case IfdParser.TYPE_END: fail("No thumbnail information found"); @@ -396,8 +384,6 @@ public class ExifParserTest extends InstrumentationTestCase { Bitmap bmp = BitmapFactory.decodeByteArray(buf, 0, thumbSize); // Check correctly decoded assertTrue(bmp != null); - assertEquals(width, bmp.getWidth()); - assertEquals(height, bmp.getHeight()); } @Override |