com.vaadin.testbench.screenshot.

Class ImageComparison

java.lang.Object
com.vaadin.testbench.screenshot.ImageComparison
public class ImageComparison extends Object

Class with features for comparing 2 images.

  • Constructor Details

    • ImageComparison

      public ImageComparison()
  • Method Details

    • imageEqualToReference

      public boolean imageEqualToReference(BufferedImage screenshotImage, String referenceFileId, double errorTolerance, org.openqa.selenium.Capabilities capabilities) throws IOException

      Compare image [name] to image under /reference/. Images may differ in RGB hues 0.1% (default) per macroblock of 16x16

      Parameters:

      screenshotImage - Image of canvas (must have proper dimensions)

      referenceFileId - File id for this image without .png extension

      errorTolerance - Allowed RGB error for a macroblock (value range 0-1 default 0.025 == 2.5%)

      capabilities - browser capabilities

      Returns:

      true if images are the same

      Throws:

      IOException - if the reference image cannot be read or error screenshot cannot be written

    • imageEqualToReference

      public boolean imageEqualToReference(BufferedImage screenshotImage, BufferedImage referenceImage, String referenceFileName, double errorTolerance)
    • compareImages

      public boolean compareImages(BufferedImage referenceImage, BufferedImage screenshotImage, double errorTolerance)