ImageMagickHelper { public boolean runImageMagickImageCompare(String outImageFilePath, String cmpImageFilePath, String diffImageName) throws IOException, InterruptedException { return runImageMagickImageCompare(outImageFilePath, cmpImageFilePath, diffImageName, null); } ImageMagickHelper();  ImageMagickHelper(String newCompareExec); String getCliExecutionCommand(); boolean runImageMagickImageCompare(String outImageFilePath, String cmpImageFilePath, String diffImageName); boolean runImageMagickImageCompare(String outImageFilePath, String cmpImageFilePath,
                                              String diffImageName, String fuzzValue); static final String MAGICK_COMPARE_ENVIRONMENT_VARIABLE; }
@Test public void imageMagickEnvVarIsNull() throws IOException, InterruptedException { String inputImage = sourceFolder + "image.png"; String cmpImage = sourceFolder + "cmp_image.png"; String diff = destinationFolder + "diff.png"; ImageMagickHelper imageMagickHelper = new ImageMagickHelper(null); boolean result = imageMagickHelper.runImageMagickImageCompare(inputImage, cmpImage, diff); Assert.assertTrue(result); Assert.assertTrue(FileUtil.fileExists(diff)); }
@Test public void runImageMagickForEqualImages() throws IOException, InterruptedException { String inputImage = sourceFolder + "image.png"; String cmpImage = sourceFolder + "cmp_image.png"; String diff = destinationFolder + "diff_equalImages.png"; ImageMagickHelper imageMagickHelper = new ImageMagickHelper(); boolean result = imageMagickHelper.runImageMagickImageCompare(inputImage, cmpImage, diff); Assert.assertTrue(result); Assert.assertTrue(FileUtil.fileExists(diff)); }
@Test public void runImageMagickForEqualImagesWithFuzzParam() throws IOException, InterruptedException { String inputImage = sourceFolder + "image.png"; String cmpImage = sourceFolder + "cmp_image.png"; String diff = destinationFolder + "diff_equalImagesFuzzParam.png"; ImageMagickHelper imageMagickHelper = new ImageMagickHelper(); boolean result = imageMagickHelper.runImageMagickImageCompare(inputImage, cmpImage, diff, "0.5"); Assert.assertTrue(result); Assert.assertTrue(FileUtil.fileExists(diff)); }
@Test public void runImageMagickForDifferentImages() throws IOException, InterruptedException { String inputImage = sourceFolder + "Im1_1.jpg"; String cmpImage = sourceFolder + "cmp_Im1_1.jpg"; String diff = destinationFolder + "diff_differentImages.png"; ImageMagickHelper imageMagickHelper = new ImageMagickHelper(); boolean result = imageMagickHelper.runImageMagickImageCompare(inputImage, cmpImage, diff); Assert.assertFalse(result); Assert.assertTrue(FileUtil.fileExists(diff)); }
@Test public void runImageMagickForDifferentImagesWithFuzzParamNotEqual() throws IOException, InterruptedException { String inputImage = sourceFolder + "Im1_1.jpg"; String cmpImage = sourceFolder + "cmp_Im1_1.jpg"; String diff = destinationFolder + "diff_differentImagesFuzzNotEnough.png"; ImageMagickHelper imageMagickHelper = new ImageMagickHelper(); boolean result = imageMagickHelper.runImageMagickImageCompare(inputImage, cmpImage, diff, "0.1"); Assert.assertFalse(result); Assert.assertTrue(FileUtil.fileExists(diff)); }
@Test public void runImageMagickForDifferentImagesWithFuzzParamEqual() throws IOException, InterruptedException { String inputImage = sourceFolder + "Im1_1.jpg"; String cmpImage = sourceFolder + "cmp_Im1_1.jpg"; String diff = destinationFolder + "diff_differentImagesFuzzEnough.png"; ImageMagickHelper imageMagickHelper = new ImageMagickHelper(); boolean result = imageMagickHelper.runImageMagickImageCompare(inputImage, cmpImage, diff, "1.2"); Assert.assertTrue(result); Assert.assertTrue(FileUtil.fileExists(diff)); }