@Test public void testProperties2() { Color bckgColor = new Color(1, 2, 3, 4); BasicImageTransformations affine = BasicImageTransformations.newRotateTransformation(3.0); AffineTransform expectedAffine = AffineTransformationStep.getTransformationMatrix(affine); for (InterpolationType interpolation : InterpolationType.values()) { AffineTransformationStep transf = new AffineTransformationStep(affine, bckgColor, interpolation); assertSame(bckgColor, transf.getBackgroundColor()); assertSame(interpolation, transf.getInterpolationType()); PointTransformerChecks.checkEqualPointTransformers( new AffineImagePointTransformer(expectedAffine), new AffineImagePointTransformer(transf.getTransformations())); } }
@Test public void testRenderNullInputProperties() { for (InterpolationType interpolation : InterpolationType.values()) { AffineTransformationStep transformer = new AffineTransformationStep( BasicImageTransformations.newZoomTransformation(100.0, 100.0), Color.GRAY, interpolation); TransformationStepInput input = new TransformationStepInput(null, 100, 100, TransformedImage.NULL_IMAGE); TransformedImage result = transformer.render(Cancellation.UNCANCELABLE_TOKEN, input, null); assertNull(result.getImage()); PointTransformerChecks.checkEqualPointTransformers( AffineImagePointTransformer.IDENTITY, result.getPointTransformer()); } }
public void testRenderNotUsingOffered(BufferedImage offered, int width, int height, int type) { for (InterpolationType interpolation : InterpolationType.values()) { AffineTransformationStep transformer = new AffineTransformationStep( BasicImageTransformations.identityTransformation(), Color.GRAY, interpolation); TransformedImage inputImage = blankTransformedImage(Color.BLUE, width, height, type); TransformationStepInput input = new TransformationStepInput(null, width, height, inputImage); TransformedImage result = transformer.render(Cancellation.UNCANCELABLE_TOKEN, input, offered); assertNotSame(offered, result.getImage()); ImageTestUtils.checkBlankImage(result.getImage(), Color.BLUE); PointTransformerChecks.checkEqualPointTransformers( AffineImagePointTransformer.IDENTITY, result.getPointTransformer()); } }