mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-10-03 23:53:15 -04:00
TMI-109: Added test cases.
This commit is contained in:
@@ -53,6 +53,7 @@ import java.awt.color.ColorSpace;
|
||||
import java.awt.color.ICC_Profile;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.DataBufferByte;
|
||||
import java.io.EOFException;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
@@ -101,7 +102,8 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
|
||||
return Arrays.asList(
|
||||
new TestData(getClassLoaderResource("/broken-jpeg/broken-bogus-segment-length.jpg"), new Dimension(467, 612)), // Semi-readable, parts missing
|
||||
new TestData(getClassLoaderResource("/broken-jpeg/broken-adobe-marker-bad-length.jpg"), new Dimension(1800, 1200)), // Unreadable, segment lengths are wrong
|
||||
new TestData(getClassLoaderResource("/broken-jpeg/broken-invalid-adobe-ycc-gray.jpg"), new Dimension(11, 440)) // Image readable, broken metadata (fixable?)
|
||||
new TestData(getClassLoaderResource("/broken-jpeg/broken-invalid-adobe-ycc-gray.jpg"), new Dimension(11, 440)), // Image readable, broken metadata (fixable?)
|
||||
new TestData(getClassLoaderResource("/broken-jpeg/broken-no-sof.jpg"), new Dimension(-1, -1)) // Unreadable, can't find SOFn marker
|
||||
);
|
||||
|
||||
// More test data in specific tests below
|
||||
@@ -434,6 +436,11 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
|
||||
catch (IIOException expected) {
|
||||
assertNotNull(expected.getMessage());
|
||||
}
|
||||
catch (IOException expected) {
|
||||
if (!(expected instanceof EOFException)) {
|
||||
assertNotNull(expected.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -458,6 +465,11 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
|
||||
catch (IIOException expected) {
|
||||
assertNotNull(expected.getMessage());
|
||||
}
|
||||
catch (IOException expected) {
|
||||
if (!(expected instanceof EOFException)) {
|
||||
assertNotNull(expected.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
@@ -479,6 +491,11 @@ public class JPEGImageReaderTest extends ImageReaderAbstractTestCase<JPEGImageRe
|
||||
catch (IIOException expected) {
|
||||
assertNotNull(expected.getMessage());
|
||||
}
|
||||
catch (IOException expected) {
|
||||
if (!(expected instanceof EOFException)) {
|
||||
assertNotNull(expected.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally {
|
||||
|
13
imageio/imageio-jpeg/src/test/resources/broken-jpeg/broken-no-sof.jpg
Executable file
13
imageio/imageio-jpeg/src/test/resources/broken-jpeg/broken-no-sof.jpg
Executable file
@@ -0,0 +1,13 @@
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD> Adobe d<> <01><> <20>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#"""#''''''''''
|
||||
|
||||
|
||||
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
Reference in New Issue
Block a user