public class EspScreenshotTool
extends java.lang.Object
Tools for taking and comparing screenshots.
| Modifier and Type | Field and Description |
|---|---|
static double |
COMPARE_DELTA_FULL_IDENTICAL
Use to assume full equality when comparing screenshots.
|
static double |
COMPARE_DELTA_TIME_CHANGE
Use to ignore time changes when comparing screenshots.
|
static java.lang.String |
screenshotFolderName
This folder will be created in your application data to store screenshots.
|
| Constructor and Description |
|---|
EspScreenshotTool() |
| Modifier and Type | Method and Description |
|---|---|
static double |
comparePercentage(java.lang.String referenceImage,
java.lang.String comparedImage)
Calculate percentage match of two images.
|
protected android.content.Context |
getTargetContext() |
java.lang.String |
obtainScreenshotDirectory() |
static java.io.File |
screenshotLocation(java.lang.String pictureName) |
java.io.File |
screenshotLocationInternal(java.lang.String pictureName) |
static void |
takeWithName(java.lang.String name) |
protected void |
takeWithNameInternal(java.lang.String name) |
protected void |
throwIfUiAutomatorNotExist() |
public static final double COMPARE_DELTA_FULL_IDENTICAL
Use to assume full equality when comparing screenshots.
public static final double COMPARE_DELTA_TIME_CHANGE
Use to ignore time changes when comparing screenshots.
Actionbar contains a time which must be ignored.
public static java.lang.String screenshotFolderName
This folder will be created in your application data to store screenshots.
You can change the name to your needs.
public static void takeWithName(java.lang.String name)
protected void takeWithNameInternal(java.lang.String name)
protected void throwIfUiAutomatorNotExist()
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic java.lang.String obtainScreenshotDirectory()
protected android.content.Context getTargetContext()
public static double comparePercentage(java.lang.String referenceImage,
java.lang.String comparedImage)
Calculate percentage match of two images.
Comparing images only works if both images have identical dimensions. When to images are full identical then you get 100.0 percentage match else an value below of it.
referenceImage - Absolute path of the reference image.comparedImage - Absolute path of the image which should be compared with the referenceImage.public static java.io.File screenshotLocation(java.lang.String pictureName)
public java.io.File screenshotLocationInternal(java.lang.String pictureName)