com.vaadin.testbench.screenshot.

Class ImageComparison


  • public class ImageComparison
    extends Object

    Class with features for comparing 2 images.

    • Constructor Detail

      • ImageComparison

        public ImageComparison()
    • Method Detail

      • 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

      • imageEqualToReference

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

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