kinow commented on a change in pull request #55: Add support to read multiple 
images from GIF
URL: https://github.com/apache/commons-imaging/pull/55#discussion_r341434724
 
 

 ##########
 File path: 
src/test/java/org/apache/commons/imaging/formats/gif/GifReadTest.java
 ##########
 @@ -57,10 +58,40 @@ public void testImageInfo() throws Exception {
         // TODO assert more
     }
 
+    @Test
+    public void testImageDimensions() throws Exception {
+        final ImageInfo imageInfo = Imaging.getImageInfo(imageFile);
+        final GifImageMetadata metadata = (GifImageMetadata) 
Imaging.getMetadata(imageFile);
+        final List<BufferedImage> images = 
Imaging.getAllBufferedImages(imageFile);
+
+        int width = 0;
+        int height = 0;
+        for(int i = 0; i < images.size(); i++) {
+            final BufferedImage image = images.get(i);
+            final GifImageMetadataItem metadataItem = 
metadata.getItems().get(i);
+            final int xOffset = metadataItem.getLeftPosition();
+            final int yOffset = metadataItem.getTopPosition();
+            width = Math.max(width, image.getWidth() + xOffset);
+            height = Math.max(height, image.getHeight() + yOffset);
+        }
+
+        assertEquals(width, metadata.getWidth());
+        assertEquals(height, metadata.getHeight());
+        assertEquals(width, imageInfo.getWidth());
+        assertEquals(height, imageInfo.getHeight());
 
 Review comment:
   Why are these two methods called twice here?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to