mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 03:55:28 -04:00
- Added reference module with test cases for JDK-provided readers
- Fixed ThumbsDBImageReader to pass test cases (got rid of some errouneous caching) - Added TODO to remove caching in ICOImageReader (will need a test case for that) - Minor changes in test cases to allow the reference test cases to pass
This commit is contained in:
parent
1221a8bebc
commit
359659dc36
@ -1206,12 +1206,18 @@ public abstract class ImageReaderAbstractTestCase<T extends ImageReader> extends
|
|||||||
catch (IIOException expected) {
|
catch (IIOException expected) {
|
||||||
// TODO: This is thrown by ImageReader.getDestination. But are we happy with that?
|
// TODO: This is thrown by ImageReader.getDestination. But are we happy with that?
|
||||||
// The problem is that the checkReadParamBandSettings throws IllegalArgumentException, which seems more appropriate...
|
// The problem is that the checkReadParamBandSettings throws IllegalArgumentException, which seems more appropriate...
|
||||||
String message = expected.getMessage();
|
String message = expected.getMessage().toLowerCase();
|
||||||
assertTrue("Wrong message: " + message, message.toLowerCase().contains("destination"));
|
assertTrue(
|
||||||
|
"Wrong message: " + message + " for type " + destination.getType(),
|
||||||
|
message.contains("destination") ||
|
||||||
|
((destination.getType() == BufferedImage.TYPE_BYTE_BINARY ||
|
||||||
|
destination.getType() == BufferedImage.TYPE_BYTE_INDEXED)
|
||||||
|
&& message.contains("indexcolormodel"))
|
||||||
|
);
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException expected) {
|
catch (IllegalArgumentException expected) {
|
||||||
String message = expected.getMessage();
|
String message = expected.getMessage().toLowerCase();
|
||||||
assertTrue("Wrong message: " + message, message.toLowerCase().contains("dest"));
|
assertTrue("Wrong message: " + message, message.contains("dest"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1233,14 +1239,14 @@ public abstract class ImageReaderAbstractTestCase<T extends ImageReader> extends
|
|||||||
}
|
}
|
||||||
catch (IIOException expected) {
|
catch (IIOException expected) {
|
||||||
// TODO: This is thrown by ImageReader.getDestination. But are we happy with that?
|
// TODO: This is thrown by ImageReader.getDestination. But are we happy with that?
|
||||||
String message = expected.getMessage();
|
String message = expected.getMessage().toLowerCase();
|
||||||
assertTrue(message.toLowerCase().contains("destination"));
|
assertTrue(message.contains("destination"));
|
||||||
assertTrue(message.toLowerCase().contains("type"));
|
assertTrue(message.contains("type"));
|
||||||
}
|
}
|
||||||
catch (IllegalArgumentException expected) {
|
catch (IllegalArgumentException expected) {
|
||||||
String message = expected.getMessage();
|
String message = expected.getMessage().toLowerCase();
|
||||||
assertTrue(message.toLowerCase().contains("destination"));
|
assertTrue(message.contains("destination"));
|
||||||
assertTrue(message.toLowerCase().contains("type"));
|
assertTrue(message.contains("type"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1272,13 +1278,14 @@ public abstract class ImageReaderAbstractTestCase<T extends ImageReader> extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Test dest offset + destination set?
|
// TODO: Test dest offset + destination set?
|
||||||
|
// TODO: Test that destination offset is used for image data, not just image dimensions...
|
||||||
public void testSetDestinationOffset() throws IOException {
|
public void testSetDestinationOffset() throws IOException {
|
||||||
final ImageReader reader = createReader();
|
final ImageReader reader = createReader();
|
||||||
TestData data = getTestData().get(0);
|
TestData data = getTestData().get(0);
|
||||||
reader.setInput(data.getInputStream());
|
reader.setInput(data.getInputStream());
|
||||||
|
|
||||||
ImageReadParam param = reader.getDefaultReadParam();
|
ImageReadParam param = reader.getDefaultReadParam();
|
||||||
Point point = new Point(10, 10);
|
Point point = new Point(37, 42);
|
||||||
param.setDestinationOffset(point);
|
param.setDestinationOffset(point);
|
||||||
|
|
||||||
BufferedImage image = reader.read(0, param);
|
BufferedImage image = reader.read(0, param);
|
||||||
|
@ -292,6 +292,7 @@ public class ICOImageReader extends ImageReaderBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private BufferedImage readBitmap(final DirectoryEntry pEntry) throws IOException {
|
private BufferedImage readBitmap(final DirectoryEntry pEntry) throws IOException {
|
||||||
|
// TODO: Get rid of the caching, as the images are mutable
|
||||||
BitmapDescriptor descriptor = mDescriptors.get(pEntry);
|
BitmapDescriptor descriptor = mDescriptors.get(pEntry);
|
||||||
|
|
||||||
if (descriptor == null || !mDescriptors.containsKey(pEntry)) {
|
if (descriptor == null || !mDescriptors.containsKey(pEntry)) {
|
||||||
|
@ -41,6 +41,8 @@
|
|||||||
<!-- Wrappers for 3rd party libs -->
|
<!-- Wrappers for 3rd party libs -->
|
||||||
<module>batik</module>
|
<module>batik</module>
|
||||||
<module>jmagick</module>
|
<module>jmagick</module>
|
||||||
|
|
||||||
|
<module>reference</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
|
25
twelvemonkeys-imageio/reference/license.txt
Normal file
25
twelvemonkeys-imageio/reference/license.txt
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
Copyright (c) 2009, Harald Kuhr
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
this list of conditions and the following disclaimer in the documentation
|
||||||
|
and/or other materials provided with the distribution.
|
||||||
|
* Neither the name "TwelveMonkeys" nor the names of its contributors
|
||||||
|
may be used to endorse or promote products derived from this software
|
||||||
|
without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
twelvemonkeys-imageio/reference/pom.xml
Normal file
31
twelvemonkeys-imageio/reference/pom.xml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
|
<artifactId>twelvemonkeys-imageio-reference</artifactId>
|
||||||
|
<version>2.2-SNAPSHOT</version>
|
||||||
|
<name>TwelveMonkeys ImageIO reference test cases</name>
|
||||||
|
<description>
|
||||||
|
Test cases for the JDK provided ImageReader implementations for reference.
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<artifactId>twelvemonkeys-imageio</artifactId>
|
||||||
|
<groupId>com.twelvemonkeys</groupId>
|
||||||
|
<version>2.2-SNAPSHOT</version>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
|
<artifactId>twelvemonkeys-imageio-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.twelvemonkeys.imageio</groupId>
|
||||||
|
<artifactId>twelvemonkeys-imageio-core</artifactId>
|
||||||
|
<classifier>tests</classifier>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</project>
|
@ -0,0 +1,91 @@
|
|||||||
|
package com.twelvemonkeys.imageio.reference;
|
||||||
|
|
||||||
|
import com.sun.imageio.plugins.jpeg.JPEGImageReader;
|
||||||
|
import com.sun.imageio.plugins.jpeg.JPEGImageReaderSpi;
|
||||||
|
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
||||||
|
import com.twelvemonkeys.lang.SystemUtil;
|
||||||
|
|
||||||
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* JPEGImageReaderTestCase
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
|
||||||
|
* @author last modified by $Author: haraldk$
|
||||||
|
* @version $Id: JPEGImageReaderTestCase.java,v 1.0 Oct 9, 2009 3:37:25 PM haraldk Exp$
|
||||||
|
*/
|
||||||
|
public class JPEGImageReaderTestCase extends ImageReaderAbstractTestCase<JPEGImageReader> {
|
||||||
|
private static final boolean IS_JAVA_6 = SystemUtil.isClassAvailable("java.util.Deque");
|
||||||
|
|
||||||
|
protected JPEGImageReaderSpi mProvider = new JPEGImageReaderSpi();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<TestData> getTestData() {
|
||||||
|
return Arrays.asList(
|
||||||
|
new TestData(getClassLoaderResource("/jpeg/R-7439-1151526181.jpeg"), new Dimension(386, 396))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ImageReaderSpi createProvider() {
|
||||||
|
return mProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<JPEGImageReader> getReaderClass() {
|
||||||
|
return JPEGImageReader.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected JPEGImageReader createReader() {
|
||||||
|
try {
|
||||||
|
return (JPEGImageReader) mProvider.createReaderInstance();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These are NOT correct implementations, but I don't really care here
|
||||||
|
@Override
|
||||||
|
protected List<String> getFormatNames() {
|
||||||
|
return Arrays.asList(mProvider.getFormatNames());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getSuffixes() {
|
||||||
|
return Arrays.asList(mProvider.getFileSuffixes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getMIMETypes() {
|
||||||
|
return Arrays.asList(mProvider.getMIMETypes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testSetDestination() throws IOException {
|
||||||
|
// Known bug in Sun JPEGImageReader before Java 6
|
||||||
|
if (IS_JAVA_6) {
|
||||||
|
super.testSetDestination();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.err.println("WARNING: Test skipped due to known bug in Java 1.5, please test again with Java 6 or later");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testSetDestinationType() throws IOException {
|
||||||
|
// Known bug in Sun JPEGImageReader before Java 6
|
||||||
|
if (IS_JAVA_6) {
|
||||||
|
super.testSetDestinationType();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.err.println("WARNING: Test skipped due to known bug in Java 1.5, please test again with Java 6 or later");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,65 @@
|
|||||||
|
package com.twelvemonkeys.imageio.reference;
|
||||||
|
|
||||||
|
import com.sun.imageio.plugins.png.PNGImageReader;
|
||||||
|
import com.sun.imageio.plugins.png.PNGImageReaderSpi;
|
||||||
|
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
||||||
|
|
||||||
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PNGImageReaderTestCase
|
||||||
|
*
|
||||||
|
* @author <a href="mailto:harald.kuhr@gmail.com">Harald Kuhr</a>
|
||||||
|
* @author last modified by $Author: haraldk$
|
||||||
|
* @version $Id: PNGImageReaderTestCase.java,v 1.0 Oct 9, 2009 3:37:25 PM haraldk Exp$
|
||||||
|
*/
|
||||||
|
public class PNGImageReaderTestCase extends ImageReaderAbstractTestCase<PNGImageReader> {
|
||||||
|
protected PNGImageReaderSpi mProvider = new PNGImageReaderSpi();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<TestData> getTestData() {
|
||||||
|
return Arrays.asList(
|
||||||
|
new TestData(getClassLoaderResource("/png/12monkeys-splash.png"), new Dimension(300, 410))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected ImageReaderSpi createProvider() {
|
||||||
|
return mProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Class<PNGImageReader> getReaderClass() {
|
||||||
|
return PNGImageReader.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected PNGImageReader createReader() {
|
||||||
|
try {
|
||||||
|
return (PNGImageReader) mProvider.createReaderInstance();
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// These are NOT correct implementations, but I don't really care here
|
||||||
|
@Override
|
||||||
|
protected List<String> getFormatNames() {
|
||||||
|
return Arrays.asList(mProvider.getFormatNames());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getSuffixes() {
|
||||||
|
return Arrays.asList(mProvider.getFileSuffixes());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<String> getMIMETypes() {
|
||||||
|
return Arrays.asList(mProvider.getMIMETypes());
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
BIN
twelvemonkeys-imageio/reference/src/test/resources/png/12monkeys-splash.png
Executable file
BIN
twelvemonkeys-imageio/reference/src/test/resources/png/12monkeys-splash.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 102 KiB |
76
twelvemonkeys-imageio/thumbsdb/src/main/java/com/twelvemonkeys/imageio/plugins/thumbsdb/ThumbsDBImageReader.java
Executable file → Normal file
76
twelvemonkeys-imageio/thumbsdb/src/main/java/com/twelvemonkeys/imageio/plugins/thumbsdb/ThumbsDBImageReader.java
Executable file → Normal file
@ -80,6 +80,7 @@ public class ThumbsDBImageReader extends ImageReaderBase {
|
|||||||
protected ThumbsDBImageReader(final ThumbsDBImageReaderSpi pProvider) {
|
protected ThumbsDBImageReader(final ThumbsDBImageReaderSpi pProvider) {
|
||||||
super(pProvider);
|
super(pProvider);
|
||||||
mReader = createJPEGReader(pProvider);
|
mReader = createJPEGReader(pProvider);
|
||||||
|
initReaderListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void resetMembers() {
|
protected void resetMembers() {
|
||||||
@ -128,11 +129,11 @@ public class ThumbsDBImageReader extends ImageReaderBase {
|
|||||||
* @throws java.io.IOException if an error occurs during reading
|
* @throws java.io.IOException if an error occurs during reading
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BufferedImage read(int pIndex, ImageReadParam pParam) throws IOException {
|
public BufferedImage read(final int pIndex, final ImageReadParam pParam) throws IOException {
|
||||||
init();
|
init();
|
||||||
checkBounds(pIndex);
|
checkBounds(pIndex);
|
||||||
|
|
||||||
// Quick lookup
|
// Quick look-up
|
||||||
BufferedImage image = null;
|
BufferedImage image = null;
|
||||||
if (pIndex < mThumbnails.length) {
|
if (pIndex < mThumbnails.length) {
|
||||||
image = mThumbnails[pIndex];
|
image = mThumbnails[pIndex];
|
||||||
@ -145,7 +146,9 @@ public class ThumbsDBImageReader extends ImageReaderBase {
|
|||||||
image = mReader.read(0, pParam);
|
image = mReader.read(0, pParam);
|
||||||
mReader.reset();
|
mReader.reset();
|
||||||
|
|
||||||
mThumbnails[pIndex] = image;
|
if (pParam == null) {
|
||||||
|
mThumbnails[pIndex] = image; // TODO: Caching is not kosher, as images are mutable!!
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Keep progress listeners happy
|
// Keep progress listeners happy
|
||||||
@ -154,6 +157,23 @@ public class ThumbsDBImageReader extends ImageReaderBase {
|
|||||||
processImageComplete();
|
processImageComplete();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Fake destination support
|
||||||
|
if (pParam != null && (pParam.getDestination() != null && pParam.getDestination() != image ||
|
||||||
|
pParam.getDestinationType() != null && pParam.getDestinationType().getBufferedImageType() != image.getType())) {
|
||||||
|
BufferedImage destination = getDestination(pParam, getImageTypes(pIndex), getWidth(pIndex), getHeight(pIndex));
|
||||||
|
|
||||||
|
Graphics2D g = destination.createGraphics();
|
||||||
|
try {
|
||||||
|
g.setComposite(AlphaComposite.Src);
|
||||||
|
g.drawImage(image, 0, 0, null);
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
g.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
image = destination;
|
||||||
|
}
|
||||||
|
|
||||||
return image;
|
return image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +215,7 @@ public class ThumbsDBImageReader extends ImageReaderBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void init(final int pIndex) throws IOException {
|
private void init(final int pIndex) throws IOException {
|
||||||
if (mCurrentImage == -1 || pIndex != mCurrentImage) {
|
if (mCurrentImage == -1 || pIndex != mCurrentImage || mReader.getInput() == null) {
|
||||||
init();
|
init();
|
||||||
checkBounds(pIndex);
|
checkBounds(pIndex);
|
||||||
mCurrentImage = pIndex;
|
mCurrentImage = pIndex;
|
||||||
@ -212,39 +232,32 @@ public class ThumbsDBImageReader extends ImageReaderBase {
|
|||||||
ImageInputStream input = new MemoryCacheImageInputStream(entry.getInputStream());
|
ImageInputStream input = new MemoryCacheImageInputStream(entry.getInputStream());
|
||||||
input.skipBytes(THUMBNAIL_OFFSET);
|
input.skipBytes(THUMBNAIL_OFFSET);
|
||||||
mReader.setInput(input);
|
mReader.setInput(input);
|
||||||
initReaderListeners();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initReaderListeners() {
|
private void initReaderListeners() {
|
||||||
if (progressListeners != null) {
|
mReader.addIIOReadProgressListener(new ProgressListenerBase() {
|
||||||
mReader.addIIOReadProgressListener(new ProgressListenerBase() {
|
@Override
|
||||||
@Override
|
public void imageComplete(ImageReader pSource) {
|
||||||
public void imageComplete(ImageReader pSource) {
|
processImageComplete();
|
||||||
processImageComplete();
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void imageStarted(ImageReader pSource, int pImageIndex) {
|
public void imageStarted(ImageReader pSource, int pImageIndex) {
|
||||||
processImageStarted(mCurrentImage);
|
processImageStarted(mCurrentImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void imageProgress(ImageReader pSource, float pPercentageDone) {
|
public void imageProgress(ImageReader pSource, float pPercentageDone) {
|
||||||
processImageProgress(pPercentageDone);
|
processImageProgress(pPercentageDone);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readAborted(ImageReader pSource) {
|
public void readAborted(ImageReader pSource) {
|
||||||
processReadAborted();
|
processReadAborted();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
// TODO: Update listeners
|
||||||
if (updateListeners != null) {
|
// TODO: Warning listeners
|
||||||
// TODO: Update listeners
|
|
||||||
}
|
|
||||||
if (warningListeners != null) {
|
|
||||||
// TODO: Warning listeners
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void init() throws IOException {
|
private void init() throws IOException {
|
||||||
@ -307,6 +320,7 @@ public class ThumbsDBImageReader extends ImageReaderBase {
|
|||||||
|
|
||||||
public Iterator<ImageTypeSpecifier> getImageTypes(int pIndex) throws IOException {
|
public Iterator<ImageTypeSpecifier> getImageTypes(int pIndex) throws IOException {
|
||||||
init(pIndex);
|
init(pIndex);
|
||||||
|
initReader(pIndex);
|
||||||
return mReader.getImageTypes(0);
|
return mReader.getImageTypes(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
25
twelvemonkeys-imageio/thumbsdb/src/test/java/com/twelvemonkeys/imageio/plugins/thumbsdb/ThumbsDBImageReaderTestCase.java
Executable file → Normal file
25
twelvemonkeys-imageio/thumbsdb/src/test/java/com/twelvemonkeys/imageio/plugins/thumbsdb/ThumbsDBImageReaderTestCase.java
Executable file → Normal file
@ -32,6 +32,7 @@ import com.twelvemonkeys.imageio.stream.BufferedImageInputStream;
|
|||||||
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
import com.twelvemonkeys.imageio.util.ImageReaderAbstractTestCase;
|
||||||
import com.twelvemonkeys.io.ole2.CompoundDocument;
|
import com.twelvemonkeys.io.ole2.CompoundDocument;
|
||||||
import com.twelvemonkeys.io.ole2.Entry;
|
import com.twelvemonkeys.io.ole2.Entry;
|
||||||
|
import com.twelvemonkeys.lang.SystemUtil;
|
||||||
|
|
||||||
import javax.imageio.spi.ImageReaderSpi;
|
import javax.imageio.spi.ImageReaderSpi;
|
||||||
import javax.imageio.stream.ImageInputStream;
|
import javax.imageio.stream.ImageInputStream;
|
||||||
@ -50,6 +51,8 @@ import java.util.List;
|
|||||||
* @version $Id: ICOImageReaderTestCase.java,v 1.0 Apr 1, 2008 10:39:17 PM haraldk Exp$
|
* @version $Id: ICOImageReaderTestCase.java,v 1.0 Apr 1, 2008 10:39:17 PM haraldk Exp$
|
||||||
*/
|
*/
|
||||||
public class ThumbsDBImageReaderTestCase extends ImageReaderAbstractTestCase<ThumbsDBImageReader> {
|
public class ThumbsDBImageReaderTestCase extends ImageReaderAbstractTestCase<ThumbsDBImageReader> {
|
||||||
|
private static final boolean IS_JAVA_6 = SystemUtil.isClassAvailable("java.util.Deque");
|
||||||
|
|
||||||
private ThumbsDBImageReaderSpi mProvider = new ThumbsDBImageReaderSpi();
|
private ThumbsDBImageReaderSpi mProvider = new ThumbsDBImageReaderSpi();
|
||||||
|
|
||||||
protected List<TestData> getTestData() {
|
protected List<TestData> getTestData() {
|
||||||
@ -111,4 +114,26 @@ public class ThumbsDBImageReaderTestCase extends ImageReaderAbstractTestCase<Thu
|
|||||||
Entry child = root.getChildEntry("Catalog");
|
Entry child = root.getChildEntry("Catalog");
|
||||||
child.getInputStream();
|
child.getInputStream();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testSetDestination() throws IOException {
|
||||||
|
// Known bug in Sun JPEGImageReader before Java 6
|
||||||
|
if (IS_JAVA_6) {
|
||||||
|
super.testSetDestination();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.err.println("WARNING: Test skipped due to known bug in Java 1.5, please test again with Java 6 or later");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void testSetDestinationType() throws IOException {
|
||||||
|
// Known bug in Sun JPEGImageReader before Java 6
|
||||||
|
if (IS_JAVA_6) {
|
||||||
|
super.testSetDestinationType();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
System.err.println("WARNING: Test skipped due to known bug in Java 1.5, please test again with Java 6 or later");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user