It all works

This commit is contained in:
Erlend Hamnaberg
2009-11-08 19:52:30 +01:00
parent b8faa6e36f
commit 0786949c1c
319 changed files with 0 additions and 0 deletions

View 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.

View 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</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</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>

View File

@@ -0,0 +1,101 @@
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.IIOException;
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");
}
}
@Override
public void testReadAsRenderedImageIndexOutOfBounds() throws IIOException {
try {
super.testReadAsRenderedImageIndexOutOfBounds();
}
catch (IIOException expected) {
// Known bug
}
}
}

View File

@@ -0,0 +1,76 @@
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.IIOException;
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());
}
@Override
public void testSetDestinationTypeIllegal() throws IOException {
try {
super.testSetDestinationTypeIllegal();
}
catch (IIOException expected) {
// Known bug
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 KiB