}
private void checkTag(ExifTag tag) {
- // Ignore offset tags since the ground-truth from exiftool doesn't have it.
- // We can verify it by examining the sub-IFD or thumbnail itself.
- if (ExifTag.isSubIfdOffsetTag(tag.getTagId())) return;
-
- // TODO: Test MakerNote and UserComment
- if (tag.getTagId() == ExifTag.TAG_MAKER_NOTE
- || tag.getTagId() == ExifTag.TAG_USER_COMMENT) return;
-
Set<String> truth = mGroundTruth.get(tag.getIfd()).get(tag.getTagId());
if (truth == null) {
fail(String.format("Unknown Tag %02x", tag.getTagId()) + ", " + getImageTitle());
}
+ // No value from exiftool.
+ if (truth.contains(null)) return;
+
String dataString = tag.valueToString().trim();
assertTrue(String.format("Tag %02x", tag.getTagId()) + ", " + getImageTitle()
+ ": " + dataString,
break;
case ExifParser.EVENT_NEW_TAG:
ExifTag tag = parser.getTag();
- // The exiftool doesn't provide MakerNote tag
- if (!ExifTag.isSubIfdOffsetTag(tag.getTagId())
- && tag.getTagId() != ExifTag.TAG_MAKER_NOTE) numOfTag++;
+ numOfTag++;
if (tag.hasValue()) {
checkTag(tag);
} else {
return;
}
ExifTag[] tags = ifd.getAllTags();
- int size = 0;
for (ExifTag tag : tags) {
- if (ExifTag.isSubIfdOffsetTag(tag.getTagId())
- || tag.getTagId() == ExifTag.TAG_MAKER_NOTE) continue;
- if (tag.getTagId() != ExifTag.TAG_USER_COMMENT) {
- Set<String> truth = ifdValue.get(tag.getTagId());
- assertNotNull(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(), truth);
- assertTrue(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(),
- truth.contains(tag.valueToString().trim()));
- }
- size++;
+ Set<String> truth = ifdValue.get(tag.getTagId());
+ assertNotNull(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(), truth);
+ if (truth.contains(null)) continue;
+ assertTrue(String.format("Tag %x, ", tag.getTagId()) + getImageTitle(),
+ truth.contains(tag.valueToString().trim()));
}
- assertEquals(getImageTitle(), ifdValue.size(), size);
+ assertEquals(getImageTitle(), ifdValue.size(), tags.length);
}
}
private static final String ATTR_ID = "id";
private static final String ATTR_IFD = "ifd";
+ private static final String NO_VALUE = "NO_VALUE";
+
/**
* This function read the ground truth XML.
*
tagData = new HashSet<String>();
exifData.get(ifdId).put(id, tagData);
}
- tagData.add(value.trim());
+ if (NO_VALUE.equals(value)) {
+ tagData.add(null);
+ } else {
+ tagData.add(value.trim());
+ }
}
parser.require(XmlPullParser.END_TAG, null, null);