From 9774095b4b808b856f37bb20b00436a25e342f30 Mon Sep 17 00:00:00 2001 From: Hsuan-Hao Date: Thu, 29 Jun 2017 12:36:20 +0200 Subject: [PATCH] modify Test code --- finalproject_Hao/TestColor.java | 36 +++++++++++++++++++++++++++++++----- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/finalproject_Hao/TestColor.java b/finalproject_Hao/TestColor.java index 23c085f..7276646 100644 --- a/finalproject_Hao/TestColor.java +++ b/finalproject_Hao/TestColor.java @@ -19,6 +19,7 @@ public class TestColor { BufferedImage input_image; BufferedImage output_image; + BufferedImage output_image_gray; BufferedImage image; int width; int height; @@ -27,9 +28,7 @@ public class TestColor { public void setUp() throws Exception { LoadFile file = new LoadFile(); input_image = file.Load_File("test.jpg"); - - BlackandWhite bw_image = new BlackandWhite(); - output_image = bw_image.Black_and_White(input_image); + } /** @@ -41,7 +40,9 @@ public class TestColor { @Test public void testBlackandWhite() { - + BlackandWhite bw_image = new BlackandWhite(); + output_image = bw_image.Black_and_White(input_image); + try { width = output_image.getWidth(); @@ -65,5 +66,30 @@ public class TestColor { } catch (Exception e) {} } - + @Test + public void testGray() { + GrayScale g_image = new GrayScale(); + output_image_gray = g_image.Gray_Scale(input_image); + try { + + width = output_image_gray.getWidth(); + height = output_image_gray.getHeight(); + + for(int i=0; i