Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * This class contains class (static) methods
- * that will help you test the Picture class
- * methods. Uncomment the methods and the code
- * in the main to test.
- *
- * @author Barbara Ericson
- */
- public class PictureTester
- {
- /** Method to test zeroBlue */
- public static void testZeroBlue()
- {
- Picture beach = new Picture("beach.jpg");
- beach.explore();
- beach.zeroBlue();
- beach.explore();
- }
- public static void testKeepOnlyBlue()
- {
- Picture beach = new Picture("beach.jpg");
- beach.explore();
- beach.keepOnlyBlue();
- beach.explore();
- }
- public static void testNegate()
- {
- Picture beach = new Picture("beach.jpg");
- beach.explore();
- beach.negate();
- beach.explore();
- }
- public static void testGrayscale()
- {
- Picture beach = new Picture("beach.jpg");
- beach.explore();
- beach.grayscale();
- beach.explore();
- }
- public static void testFixUnderwater()
- {
- Picture fishes = new Picture("water.jpg");
- fishes.explore();
- fishes.fixUnderwater();
- System.out.println("Fixed underwater");
- fishes.explore();
- }
- /** Method to test mirrorVertical */
- public static void testMirrorVertical()
- {
- Picture caterpillar = new Picture("caterpillar.jpg");
- caterpillar.explore();
- caterpillar.mirrorVertical();
- caterpillar.explore();
- }
- public static void testMirrorVerticalRightToLeft()
- {
- Picture caterpillar = new Picture("caterpillar.jpg");
- caterpillar.explore();
- caterpillar.mirrorVerticalRightToLeft();
- caterpillar.explore();
- }
- public static void testMirrorHorizontal()
- {
- Picture caterpillar = new Picture("caterpillar.jpg");
- caterpillar.explore();
- caterpillar.mirrorHorizontal();
- caterpillar.explore();
- }
- public static void testMirrorHorizontalBottomToTop()
- {
- Picture caterpillar = new Picture("caterpillar.jpg");
- caterpillar.explore();
- caterpillar.mirrorHorizontalBottomToTop();
- caterpillar.explore();
- }
- public static void testMirrorDiagonal()
- {
- Picture caterpillar = new Picture("caterpillar.jpg");
- caterpillar.explore();
- caterpillar.mirrorDiagonal();
- caterpillar.explore();
- }
- /** Method to test mirrorTemple */
- public static void testMirrorTemple()
- {
- Picture temple = new Picture("temple.jpg");
- temple.explore();
- temple.mirrorTemple();
- temple.explore();
- }
- public static void testMirrorArms()
- {
- Picture snowman = new Picture("snowman.jpg");
- snowman.explore();
- snowman.mirrorArms();
- snowman.explore();
- }
- public static void testMirrorGull()
- {
- Picture seagull = new Picture("seagull.jpg");
- seagull.explore();
- seagull.mirrorGull();
- seagull.explore();
- }
- /** Method to test the collage method */
- public static void testCollage()
- {
- Picture canvas = new Picture("640x480.jpg");
- canvas.createCollage();
- canvas.explore();
- }
- public static void testmyCollage()
- {
- Picture wall = new Picture("wall.jpg");
- wall.explore();
- wall.mirrorHorizontal();
- wall.explore();
- Picture femaleLionAndHall = new Picture("femaleLionAndHall.jpg");
- femaleLionAndHall.explore();
- femaleLionAndHall.edgeDetection(30);
- femaleLionAndHall.explore();
- Picture flower2 = new Picture("flower2.jpg");
- flower2.explore();
- flower2.grayscale();
- flower2.explore();
- }
- public static void testCopy()
- {
- Picture canvas = new Picture("640x480.jpg");
- canvas.createCollage();
- canvas.explore();
- }
- /** Method to test edgeDetection */
- public static void testEdgeDetection()
- {
- Picture swan = new Picture("swan.jpg");
- swan.explore();
- swan.edgeDetection(27);
- swan.explore();
- }
- public static void testEdgeDetection2()
- {
- Picture swan = new Picture("swan.jpg");
- //swan.explore();
- swan.edgeDetection2(30);
- swan.explore();
- }
- /** Main method for testing. Every class can have a main
- * method in Java */
- public static void main(String[] args)
- {
- // uncomment a call here to run a test
- // and comment out the ones you don't want
- // to run
- //testZeroBlue();
- //testKeepOnlyBlue();
- //testKeepOnlyRed();
- //testKeepOnlyGreen();
- //testNegate();
- //testGrayscale();
- //testFixUnderwater();
- //testMirrorVertical();
- //testMirrorVerticalRightToLeft();
- //testMirrorHorizontal();
- //testMirrorHorizontalBottomToTop();
- //testMirrorDiagonal();
- //testMirrorTemple();
- //testMirrorArms();
- //testMirrorGull();
- //testMirrorDiagonal();
- //testCollage();
- testCopy();
- testmyCollage();
- testEdgeDetection();
- testEdgeDetection2();
- //testChromakey();
- //testEncodeAndDecode();
- //testGetCountRedOverValue(250);
- //testSetRedToHalfValueInTopHalf();
- //testClearBlueOverValue(200);
- //testGetAverageForColumn(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement