public class Images extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Images.ImageComparator |
| Constructor and Description |
|---|
Images() |
| Modifier and Type | Method and Description |
|---|---|
static void |
assertImageIsEqualToExpected(InBrowser browser,
Path el,
InputStream expectedImageInput)
Verify that the element's image is pixel-perfect
|
static void |
assertImageIsEqualToExpectedWithShiftAndCrop(InBrowser browser,
Path el,
InputStream expectedImageInput,
int maxShift)
Verify that the element's image is pixel-perfect, but allowing some crop/shift
|
static void |
assertImageIsSimilarToExpected(InBrowser browser,
Path el,
InputStream expectedImageInput,
int maxBadPixelsRatio)
Verify the picture is "similar" to the reference image.
|
static BufferedImage |
captureCanvas(InBrowser browser,
Path canvas) |
static void |
captureCanvasToFile(InBrowser browser,
Path el,
File outputFile)
Save an HTML5 canvas to file.
|
static void |
captureToFile(InBrowser browser,
Path el,
File outputFile)
Save image to file
|
static void |
show(InBrowser browser,
Path el)
Display image of an element in a separate window.
|
static void |
showCanvas(InBrowser browser,
Path el)
Display image of an HTML5 canvas element in a separate window.
|
public static void captureToFile(InBrowser browser, Path el, File outputFile)
browser - - browserel - - Path element to captureoutputFile - - output filepublic static void captureCanvasToFile(InBrowser browser, Path el, File outputFile)
browser - - browserel - - Path element to captureoutputFile - - output filepublic static void show(InBrowser browser, Path el)
browser - - browserel - - the element to capture and displaypublic static void showCanvas(InBrowser browser, Path el)
browser - - browserel - - the element to capture and displaypublic static void assertImageIsEqualToExpected(InBrowser browser, Path el, InputStream expectedImageInput) throws IOException
browser - - browserel - - element to capture and verifyexpectedImageInput - reference image fileIOException - - file could not be readpublic static void assertImageIsEqualToExpectedWithShiftAndCrop(InBrowser browser, Path el, InputStream expectedImageInput, int maxShift) throws IOException
browser - - browserel - - element to capture and verifyexpectedImageInput - reference image filemaxShift - maximum pixels the images are shifted/cropped compared to each other (both on x and y axis)IOException - - file could not be readpublic static void assertImageIsSimilarToExpected(InBrowser browser, Path el, InputStream expectedImageInput, int maxBadPixelsRatio) throws IOException
browser - - browserel - - element to capture and validateexpectedImageInput - - reference imagemaxBadPixelsRatio - - a positive number. For example: If it's 100, then
1% of the pixels can have major differences compared to
the reference.IOException - - image file could not be readpublic static BufferedImage captureCanvas(InBrowser browser, Path canvas)
Copyright © 2019. All rights reserved.