use of java.awt.image.ImagingOpException in project jdk8u_jdk by JetBrains.
the class SamePackingTypeTest method main.
public static void main(String[] args) {
BufferedImageOp op = createTestOp();
try {
System.out.print("Integer-based images... ");
doTest(op, TYPE_INT_ARGB, TYPE_INT_ARGB_PRE);
System.out.println("done.");
System.out.print("Byte-based images... ");
doTest(op, TYPE_4BYTE_ABGR, TYPE_4BYTE_ABGR_PRE);
System.out.println("done");
} catch (ImagingOpException e) {
throw new RuntimeException("Test FAILED", e);
}
}
use of java.awt.image.ImagingOpException in project jdk8u_jdk by JetBrains.
the class EdgeNoOpCrash method crashTest.
private static void crashTest() {
Raster src = createSrcRaster();
WritableRaster dst = createDstRaster();
ConvolveOp op = createConvolveOp(ConvolveOp.EDGE_NO_OP);
try {
op.filter(src, dst);
} catch (ImagingOpException e) {
/*
* The test pair of source and destination rasters
* may cause failure of the medialib convolution routine,
* so this exception is expected.
*
* The JVM crash is the only manifestation of this
* test failure.
*/
}
System.out.println("Test PASSED.");
}
use of java.awt.image.ImagingOpException in project jdk8u_jdk by JetBrains.
the class OpCompatibleImageTest method doTest.
public void doTest(int type) {
System.out.println("Test for type " + describeType(type));
BufferedImage src = createTestImage(type);
BufferedImage res = null;
System.out.println("Testing null destination...");
try {
res = op.filter(src, null);
} catch (ImagingOpException e) {
throw new RuntimeException("Test FAILED!", e);
}
if (res == null || ((src.getType() != BufferedImage.TYPE_BYTE_INDEXED) && (res.getType() != src.getType()))) {
throw new RuntimeException("Test FAILED!");
}
System.out.println("Test PASSED.");
}
use of java.awt.image.ImagingOpException in project jdk8u_jdk by JetBrains.
the class InvalidTransformParameterTest method main.
public static void main(String[] args) {
int count = 0;
final int testScenarios = 12;
double NaNArg = 0.0 / 0.0;
double positiveInfArg = 1.0 / 0.0;
double negativeInfArg = -1.0 / 0.0;
BufferedImage img = new BufferedImage(5, 5, BufferedImage.TYPE_INT_ARGB);
AffineTransform[] inputTransforms = new AffineTransform[testScenarios];
for (int i = 0; i < inputTransforms.length; i++) {
inputTransforms[i] = new AffineTransform();
}
inputTransforms[0].rotate(NaNArg, img.getWidth() / 2, img.getHeight() / 2);
inputTransforms[1].translate(NaNArg, NaNArg);
inputTransforms[2].scale(NaNArg, NaNArg);
inputTransforms[3].shear(NaNArg, NaNArg);
inputTransforms[4].rotate(positiveInfArg, img.getWidth() / 2, img.getHeight() / 2);
inputTransforms[5].translate(positiveInfArg, positiveInfArg);
inputTransforms[6].scale(positiveInfArg, positiveInfArg);
inputTransforms[7].shear(positiveInfArg, positiveInfArg);
inputTransforms[8].rotate(negativeInfArg, img.getWidth() / 2, img.getHeight() / 2);
inputTransforms[9].translate(negativeInfArg, negativeInfArg);
inputTransforms[10].scale(negativeInfArg, negativeInfArg);
inputTransforms[11].shear(negativeInfArg, negativeInfArg);
for (int i = 0; i < inputTransforms.length; i++) {
try {
testImageTransform(img, inputTransforms[i]);
} catch (ImagingOpException ex) {
count++;
}
}
if (count != testScenarios) {
throw new RuntimeException("Test failed. All test scenarios did not" + " result in exception as expected.");
}
// Test Raster AffineTransform ---------------------------------
count = 0;
int[] bandOffsets = { 0 };
Point location = new Point(0, 0);
DataBuffer db = new DataBufferByte(10 * 10);
SampleModel sm = new PixelInterleavedSampleModel(DataBuffer.TYPE_BYTE, 10, 10, 1, 10, bandOffsets);
Raster src = Raster.createRaster(sm, db, location);
WritableRaster dst = Raster.createWritableRaster(sm, db, location);
for (int i = 0; i < inputTransforms.length; i++) {
try {
testRasterTransform(src, dst, inputTransforms[i]);
} catch (ImagingOpException ex) {
count++;
}
}
if (count != testScenarios) {
throw new RuntimeException("Test failed. All test scenarios did not" + " result in exception as expected.");
}
}
Aggregations