Package com.vaadin.testbench.screenshot
Class ImageComparison
java.lang.Object
com.vaadin.testbench.screenshot.ImageComparison
Class with features for comparing 2 images.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancompareImages(BufferedImage referenceImage, BufferedImage screenshotImage, double errorTolerance) booleanimageEqualToReference(BufferedImage screenshotImage, BufferedImage referenceImage, String referenceFileName, double errorTolerance) booleanimageEqualToReference(BufferedImage screenshotImage, String referenceFileId, double errorTolerance, org.openqa.selenium.Capabilities capabilities) Compare image [name] to image under /reference/.
-
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 extensionerrorTolerance- Allowed RGB error for a macroblock (value range 0-1 default 0.025 == 2.5%)capabilities- browser capabilities- Returns:
trueif 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)
-