summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorOwen Lin <owenlin@android.com>2012-08-07 03:06:01 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-08-07 03:06:02 -0700
commit5d6c49fbc92f29ad4311ca747c5eba4df84fb74a (patch)
tree64e7e4f0893f4d8ffcce73ed1701aa20f54b9877 /tests
parent57b74ccd37271a894886f3acf2ba3201493caa87 (diff)
parent81ed85086cf9b4e4c7113227a00b42813fd9407b (diff)
downloadandroid_packages_apps_Snap-5d6c49fbc92f29ad4311ca747c5eba4df84fb74a.tar.gz
android_packages_apps_Snap-5d6c49fbc92f29ad4311ca747c5eba4df84fb74a.tar.bz2
android_packages_apps_Snap-5d6c49fbc92f29ad4311ca747c5eba4df84fb74a.zip
Merge "Use hex to represent unknown type and byte type for ExifParser debugging" into gb-ub-photos-arches
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 9bfa03fdd..c514eb700 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;
}