summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorEarl Ou <shunhsingou@google.com>2012-08-07 14:33:12 +0800
committerEarl Ou <shunhsingou@google.com>2012-08-07 17:41:36 +0800
commit81ed85086cf9b4e4c7113227a00b42813fd9407b (patch)
tree18165fc69fa87df9214929bc715e32f9fdb1397d /tests
parent808df821a29ad8e84bfc24f7e47668cbd72a6d34 (diff)
downloadandroid_packages_apps_Snap-81ed85086cf9b4e4c7113227a00b42813fd9407b.zip
android_packages_apps_Snap-81ed85086cf9b4e4c7113227a00b42813fd9407b.tar.gz
android_packages_apps_Snap-81ed85086cf9b4e4c7113227a00b42813fd9407b.tar.bz2
Use hex to represent unknown type and byte type for ExifParser debugging
Change-Id: I1d63698a34cc2c582e3c9c1a117231489ea9e3a2
Diffstat (limited to 'tests')
-rw-r--r--tests/src/com/android/gallery3d/exif/ExifParserTest.java11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/src/com/android/gallery3d/exif/ExifParserTest.java b/tests/src/com/android/gallery3d/exif/ExifParserTest.java
index 9bfa03f..c514eb7 100644
--- a/tests/src/com/android/gallery3d/exif/ExifParserTest.java
+++ b/tests/src/com/android/gallery3d/exif/ExifParserTest.java
@@ -230,11 +230,16 @@ public class ExifParserTest extends InstrumentationTestCase {
parser.read(buf);
for(int i = 0; i < tag.getComponentCount(); i++) {
if(i != 0) sbuilder.append(" ");
- sbuilder.append(buf[i]);
+ sbuilder.append(String.format("%02x", buf[i]));
}
break;
case ExifTag.TYPE_ASCII:
- sbuilder.append(parser.readString(tag.getComponentCount()));
+ buf = new byte[tag.getComponentCount()];
+ parser.read(buf);
+ int length = 0;
+ while (buf[length] != 0 && length < buf.length) length++;
+ // trim the string to fit the answer from xml
+ sbuilder.append(new String(buf, 0, length).trim());
break;
case ExifTag.TYPE_INT:
for(int i = 0; i < tag.getComponentCount(); i++) {
@@ -273,7 +278,7 @@ public class ExifParserTest extends InstrumentationTestCase {
parser.read(buffer);
for(int i = 0; i < tag.getComponentCount(); i++) {
if(i != 0) sbuilder.append(" ");
- sbuilder.append(buffer[i]);
+ sbuilder.append(String.format("%02x", buffer[i]));
}
break;
}