#431: Clean-up + added test

This commit is contained in:
Harald Kuhr
2018-08-18 13:12:54 +02:00
parent 2235f6c911
commit 4afa934251
2 changed files with 20 additions and 4 deletions
@@ -8,6 +8,7 @@ import org.junit.Test;
import javax.imageio.spi.IIORegistry;
import javax.imageio.spi.ImageReaderSpi;
import javax.imageio.stream.ImageInputStream;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.IOException;
@@ -15,6 +16,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
/**
@@ -91,6 +93,21 @@ public class PICTImageReaderTest extends ImageReaderAbstractTest<PICTImageReader
super.testReadWithSubsampleParamPixels();
}
@Test
public void testProviderShouldNotConsumeExistingMarks() throws IOException {
try (ImageInputStream stream = new ByteArrayImageInputStream(new byte[1024])) {
stream.seek(42);
stream.mark();
stream.seek(123);
sProvider.canDecodeInput(stream);
assertEquals(123, stream.getStreamPosition());
stream.reset();
assertEquals(42, stream.getStreamPosition());
}
}
// Regression tests
@Test