Advertisement
Guest User

Untitled

a guest
Dec 5th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.98 KB | None | 0 0
  1. /**
  2. * This class contains class (static) methods
  3. * that will help you test the Picture class
  4. * methods. Uncomment the methods and the code
  5. * in the main to test.
  6. *
  7. * @author Barbara Ericson
  8. */
  9. public class PictureTester
  10. {
  11. /** Method to test zeroBlue */
  12. public static void testZeroBlue()
  13. {
  14. Picture beach = new Picture("beach.jpg");
  15. beach.explore();
  16. beach.zeroBlue();
  17. beach.explore();
  18. }
  19.  
  20. public static void testKeepOnlyBlue()
  21. {
  22. Picture beach = new Picture("beach.jpg");
  23. beach.explore();
  24. beach.keepOnlyBlue();
  25. beach.explore();
  26. }
  27.  
  28. public static void testNegate()
  29. {
  30. Picture beach = new Picture("beach.jpg");
  31. beach.explore();
  32. beach.negate();
  33. beach.explore();
  34. }
  35.  
  36. public static void testGrayscale()
  37. {
  38. Picture beach = new Picture("beach.jpg");
  39. beach.explore();
  40. beach.grayscale();
  41. beach.explore();
  42. }
  43.  
  44. public static void testFixUnderwater()
  45. {
  46. Picture fishes = new Picture("water.jpg");
  47. fishes.explore();
  48. fishes.fixUnderwater();
  49. System.out.println("Fixed underwater");
  50. fishes.explore();
  51. }
  52.  
  53. /** Method to test mirrorVertical */
  54. public static void testMirrorVertical()
  55. {
  56. Picture caterpillar = new Picture("caterpillar.jpg");
  57. caterpillar.explore();
  58. caterpillar.mirrorVertical();
  59. caterpillar.explore();
  60. }
  61.  
  62. public static void testMirrorVerticalRightToLeft()
  63. {
  64. Picture caterpillar = new Picture("caterpillar.jpg");
  65. caterpillar.explore();
  66. caterpillar.mirrorVerticalRightToLeft();
  67. caterpillar.explore();
  68. }
  69.  
  70. public static void testMirrorHorizontal()
  71. {
  72. Picture caterpillar = new Picture("caterpillar.jpg");
  73. caterpillar.explore();
  74. caterpillar.mirrorHorizontal();
  75. caterpillar.explore();
  76. }
  77.  
  78. public static void testMirrorHorizontalBottomToTop()
  79. {
  80. Picture caterpillar = new Picture("caterpillar.jpg");
  81. caterpillar.explore();
  82. caterpillar.mirrorHorizontalBottomToTop();
  83. caterpillar.explore();
  84. }
  85.  
  86. public static void testMirrorDiagonal()
  87. {
  88. Picture caterpillar = new Picture("caterpillar.jpg");
  89. caterpillar.explore();
  90. caterpillar.mirrorDiagonal();
  91. caterpillar.explore();
  92. }
  93.  
  94. /** Method to test mirrorTemple */
  95. public static void testMirrorTemple()
  96. {
  97. Picture temple = new Picture("temple.jpg");
  98. temple.explore();
  99. temple.mirrorTemple();
  100. temple.explore();
  101. }
  102.  
  103. public static void testMirrorArms()
  104. {
  105. Picture snowman = new Picture("snowman.jpg");
  106. snowman.explore();
  107. snowman.mirrorArms();
  108. snowman.explore();
  109. }
  110.  
  111. public static void testMirrorGull()
  112. {
  113. Picture seagull = new Picture("seagull.jpg");
  114. seagull.explore();
  115. seagull.mirrorGull();
  116. seagull.explore();
  117. }
  118.  
  119. /** Method to test the collage method */
  120. public static void testCollage()
  121. {
  122. Picture canvas = new Picture("640x480.jpg");
  123. canvas.createCollage();
  124. canvas.explore();
  125. }
  126.  
  127. public static void testmyCollage()
  128. {
  129. Picture wall = new Picture("wall.jpg");
  130. wall.explore();
  131. wall.mirrorHorizontal();
  132. wall.explore();
  133.  
  134. Picture femaleLionAndHall = new Picture("femaleLionAndHall.jpg");
  135. femaleLionAndHall.explore();
  136. femaleLionAndHall.edgeDetection(30);
  137. femaleLionAndHall.explore();
  138.  
  139. Picture flower2 = new Picture("flower2.jpg");
  140. flower2.explore();
  141. flower2.grayscale();
  142. flower2.explore();
  143. }
  144.  
  145. public static void testCopy()
  146. {
  147. Picture canvas = new Picture("640x480.jpg");
  148. canvas.createCollage();
  149. canvas.explore();
  150. }
  151.  
  152. /** Method to test edgeDetection */
  153. public static void testEdgeDetection()
  154. {
  155. Picture swan = new Picture("swan.jpg");
  156. swan.explore();
  157. swan.edgeDetection(27);
  158. swan.explore();
  159. }
  160.  
  161. public static void testEdgeDetection2()
  162. {
  163. Picture swan = new Picture("swan.jpg");
  164. //swan.explore();
  165. swan.edgeDetection2(30);
  166. swan.explore();
  167. }
  168.  
  169. /** Main method for testing. Every class can have a main
  170. * method in Java */
  171. public static void main(String[] args)
  172. {
  173. // uncomment a call here to run a test
  174. // and comment out the ones you don't want
  175. // to run
  176.  
  177. //testZeroBlue();
  178. //testKeepOnlyBlue();
  179. //testKeepOnlyRed();
  180. //testKeepOnlyGreen();
  181. //testNegate();
  182. //testGrayscale();
  183. //testFixUnderwater();
  184. //testMirrorVertical();
  185. //testMirrorVerticalRightToLeft();
  186. //testMirrorHorizontal();
  187. //testMirrorHorizontalBottomToTop();
  188. //testMirrorDiagonal();
  189. //testMirrorTemple();
  190. //testMirrorArms();
  191. //testMirrorGull();
  192. //testMirrorDiagonal();
  193. //testCollage();
  194. testCopy();
  195. testmyCollage();
  196. testEdgeDetection();
  197. testEdgeDetection2();
  198. //testChromakey();
  199. //testEncodeAndDecode();
  200. //testGetCountRedOverValue(250);
  201. //testSetRedToHalfValueInTopHalf();
  202. //testClearBlueOverValue(200);
  203. //testGetAverageForColumn(0);
  204. }
  205. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement