TMI-18: Better filtering of APP segments, now only takes 'Exif' APP1 segments into account.

+ Updated failing test.
This commit is contained in:
Harald Kuhr
2012-04-15 22:10:20 +02:00
parent 08b5891298
commit 2f07329296
2 changed files with 43 additions and 6 deletions
@@ -102,7 +102,7 @@ public class JPEGSegmentImageInputStreamTest {
assertThat(length, new LessOrEqual<Long>(10203l)); // In no case should length increase
assertEquals(9495l, length); // May change, if more chunks are passed to reader...
assertEquals(9625l, length); // May change, if more chunks are passed to reader...
}
@Test
@@ -110,14 +110,17 @@ public class JPEGSegmentImageInputStreamTest {
ImageInputStream stream = new JPEGSegmentImageInputStream(ImageIO.createImageInputStream(getClassLoaderResource("/jpeg/no-image-types-rgb-us-web-coated-v2-ms-photogallery-exif.jpg")));
List<JPEGSegment> appSegments = JPEGSegmentUtil.readSegments(stream, JPEGSegmentUtil.APP_SEGMENTS);
assertEquals(2, appSegments.size());
assertEquals(3, appSegments.size());
assertEquals(JPEG.APP0, appSegments.get(0).marker());
assertEquals("JFIF", appSegments.get(0).identifier());
assertEquals(JPEG.APP14, appSegments.get(1).marker());
assertEquals("Adobe", appSegments.get(1).identifier());
assertEquals(JPEG.APP1, appSegments.get(1).marker());
assertEquals("Exif", appSegments.get(1).identifier());
// And thus, no Exif, no ICC_PROFILE or other segments
assertEquals(JPEG.APP14, appSegments.get(2).marker());
assertEquals("Adobe", appSegments.get(2).identifier());
// And thus, no XMP, no ICC_PROFILE or other segments
}
}