mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-04-05 00:00:01 -04:00
Fixed DCX off-by one issue + minor optimization.
This commit is contained in:
@@ -29,13 +29,21 @@
|
||||
package com.twelvemonkeys.imageio.plugins.dcx;
|
||||
|
||||
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTest;
|
||||
import org.junit.Test;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.spi.ImageReaderSpi;
|
||||
import javax.imageio.stream.ImageInputStream;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
/**
|
||||
* DCXImageReaderTest
|
||||
*
|
||||
@@ -82,4 +90,20 @@ public class DCXImageReaderTest extends ImageReaderAbstractTest<DCXImageReader>
|
||||
"image/dcx", "image/x-dcx"
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCount() throws IOException {
|
||||
try (ImageInputStream input = ImageIO.createImageInputStream(getClassLoaderResource("/dcx/input.dcx"))) {
|
||||
DCXImageReader reader = createReader();
|
||||
reader.setInput(input);
|
||||
|
||||
assertEquals(1, reader.getNumImages(true));
|
||||
assertEquals(70, reader.getWidth(0));
|
||||
assertEquals(46, reader.getHeight(0));
|
||||
|
||||
BufferedImage image = reader.read(0);
|
||||
|
||||
assertNotNull(image);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user