package com.mortennobel.imagescaling;

import junit.framework.TestCase;

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;

/**
 * Problem when scaling 1 channel (Grayscale) image 
 */
public class Issue10 extends TestCase {
	public void testIssue10() throws Exception {
		BufferedImage image2D = ImageIO.read(getClass().getResourceAsStream("test_issue10.jpg"));

			DimensionConstrain dc = DimensionConstrain.createMaxDimensionNoOrientation(50,50);

			ResampleOp  resampleOp = new ResampleOp (dc);
			BufferedImage rescaledTomato = resampleOp.filter(image2D, null);

	}
}

@@ -64,16 +64,39 @@
 estCase;
+%0Aimport org.junit.Test;
 %0A%0Aimport
@@ -258,16 +258,119 @@
 tCase %7B%0A
+%09/**%0A%09 * Test that the library can scale a grayscale image%0A%09 * @throws Exception should not occur%0A%09 */%0A
 %09public 
@@ -502,17 +502,16 @@
 %22));%0A%0A%09%09
-%09
 Dimensio
@@ -555,161 +555,906 @@
 eate
-MaxDimensionNoOrientation(50,50);%0A%0A%09%09%09ResampleOp  resampleOp = new ResampleOp (dc);%0A%09%09%09BufferedImage rescaledTomato = resampleOp.filter(image2D, null
+AbsolutionDimension(50,50);%0A%0A%09%09ResampleOp  resampleOp = new ResampleOp (dc);%0A%09%09BufferedImage rescaledTomato = resampleOp.filter(image2D, null);%0A%0A%09%7D%0A%0A%09/**%0A%09 * Test that the library throws an exception if a destination image is not compatible with source img%0A%09 * @throws Exception should not occur%0A%09 */%0A%09public void testIssue10Exception() throws Exception %7B%0A%09%09RuntimeException re = null;%0A%09%09try%7B%0A%09%09%09BufferedImage image2D = ImageIO.read(getClass().getResourceAsStream(%22test_issue10.jpg%22));%0A%0A%09%09%09DimensionConstrain dc = DimensionConstrain.createAbsolutionDimension(50,50);%0A%09%09%09BufferedImage out = new BufferedImage(50,50, BufferedImage.TYPE_INT_ARGB);%0A%09%09%09ResampleOp  resampleOp = new ResampleOp (dc);%0A%09%09%09BufferedImage rescaledTomato = resampleOp.filter(image2D, out);%0A%09%09%7D%0A%09%09catch (RuntimeException e)%7B%0A%09%09%09re = e;%0A%09%09%7D%0A%09%09assertNotNull(%22ISL should throw an exception since out image is not compatible%22, re
 );%0A
-%0A
 %09%7D%0A%7D

Add test-case for issue 10. Improved testcase 10. Also test for incompatible out images