Merge "ExifInterface: fix a bug in readExifEntryValue" into nyc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
e834dd78d4
@@ -1560,8 +1560,6 @@ public class ExifInterface {
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
while (true) {
|
||||
int ch = bytes[index];
|
||||
if (ch < 0)
|
||||
throw new EOFException();
|
||||
if (ch == 0)
|
||||
break;
|
||||
if (ch >= 32)
|
||||
|
||||
BIN
media/tests/MediaFrameworkTest/assets/volantis.jpg
Normal file
BIN
media/tests/MediaFrameworkTest/assets/volantis.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 298 KiB |
BIN
media/tests/MediaFrameworkTest/res/raw/volantis.jpg
Normal file
BIN
media/tests/MediaFrameworkTest/res/raw/volantis.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 298 KiB |
@@ -105,4 +105,34 @@
|
||||
<item>1</item>
|
||||
<item />
|
||||
</array>
|
||||
<array name="volantis_jpg">
|
||||
<item>false</item>
|
||||
<item>0</item>
|
||||
<item>0</item>
|
||||
<item>true</item>
|
||||
<item>37.423</item>
|
||||
<item>-122.162</item>
|
||||
<item>0.0</item>
|
||||
<item>htc</item>
|
||||
<item>Nexus 9</item>
|
||||
<item>1.2904</item>
|
||||
<item>2016:03:09 17:36:42</item>
|
||||
<item>0.0083</item>
|
||||
<item>64</item>
|
||||
<item>3097/1000</item>
|
||||
<item />
|
||||
<item />
|
||||
<item>2016:03:09</item>
|
||||
<item>37/1,25/1,2291/100</item>
|
||||
<item>N</item>
|
||||
<item>122/1,9/1,4330/100</item>
|
||||
<item>W</item>
|
||||
<item />
|
||||
<item>08:35:34</item>
|
||||
<item>720</item>
|
||||
<item>1280</item>
|
||||
<item>175</item>
|
||||
<item>1</item>
|
||||
<item>0</item>
|
||||
</array>
|
||||
</resources>
|
||||
|
||||
@@ -51,10 +51,12 @@ public class ExifInterfaceTest extends AndroidTestCase {
|
||||
private static final String EXIF_BYTE_ORDER_II_JPEG = "image_exif_byte_order_ii.jpg";
|
||||
private static final String EXIF_BYTE_ORDER_MM_JPEG = "image_exif_byte_order_mm.jpg";
|
||||
private static final String LG_G4_ISO_800_DNG = "lg_g4_iso_800.dng";
|
||||
private static final String VOLANTIS_JPEG = "volantis.jpg";
|
||||
private static final int[] IMAGE_RESOURCES = new int[] {
|
||||
R.raw.image_exif_byte_order_ii, R.raw.image_exif_byte_order_mm, R.raw.lg_g4_iso_800 };
|
||||
R.raw.image_exif_byte_order_ii, R.raw.image_exif_byte_order_mm, R.raw.lg_g4_iso_800,
|
||||
R.raw.volantis };
|
||||
private static final String[] IMAGE_FILENAMES = new String[] {
|
||||
EXIF_BYTE_ORDER_II_JPEG, EXIF_BYTE_ORDER_MM_JPEG, LG_G4_ISO_800_DNG };
|
||||
EXIF_BYTE_ORDER_II_JPEG, EXIF_BYTE_ORDER_MM_JPEG, LG_G4_ISO_800_DNG, VOLANTIS_JPEG };
|
||||
|
||||
private static final String[] EXIF_TAGS = {
|
||||
ExifInterface.TAG_MAKE,
|
||||
@@ -415,7 +417,7 @@ public class ExifInterfaceTest extends AndroidTestCase {
|
||||
testExifInterfaceForRaw(LG_G4_ISO_800_DNG, R.array.lg_g4_iso_800_dng);
|
||||
}
|
||||
|
||||
public void testCorruptedImage() {
|
||||
public void testCorruptedImage() throws Throwable {
|
||||
byte[] bytes = new byte[1024];
|
||||
try {
|
||||
new ExifInterface(new ByteArrayInputStream(bytes));
|
||||
@@ -424,4 +426,9 @@ public class ExifInterfaceTest extends AndroidTestCase {
|
||||
// Success
|
||||
}
|
||||
}
|
||||
|
||||
public void testReadExifDataFromVolantisJpg() throws Throwable {
|
||||
// Test if it is possible to parse the volantis generated JPEG smoothly.
|
||||
testExifInterfaceForJpeg(VOLANTIS_JPEG, R.array.volantis_jpg);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user