Class OccurrenceMatchingResult
- java.lang.Object
-
- io.appium.java_client.imagecomparison.ComparisonResult
-
- io.appium.java_client.imagecomparison.OccurrenceMatchingResult
-
public class OccurrenceMatchingResult extends ComparisonResult
-
-
Field Summary
-
Fields inherited from class io.appium.java_client.imagecomparison.ComparisonResult
commandResult
-
-
Constructor Summary
Constructors Constructor Description OccurrenceMatchingResult(java.lang.Object input)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<OccurrenceMatchingResult>getMultiple()Returns the list of multiple matches (if any).org.openqa.selenium.RectanglegetRect()Returns rectangle of the partial image occurrence.org.openqa.selenium.RectanglegetRect(int matchIndex)Returns rectangle of the partial image occurrence for the given match index.doublegetScore()Returns the score of the partial image occurrence.doublegetScore(int matchIndex)Returns the score of the partial image occurrence for the given match index.byte[]getVisualization()Returns the visualization of the matching result.byte[]getVisualization(int matchIndex)Returns the visualization of the partial image occurrence for the given match index.booleanhasMultiple()Check whether the current instance contains multiple matches.voidstoreVisualization(int matchIndex, java.io.File destination)Stores visualization image into the given file.voidstoreVisualization(java.io.File destination)Stores visualization image into the given file.-
Methods inherited from class io.appium.java_client.imagecomparison.ComparisonResult
getResultAsMap, mapToPoint, mapToRect, verifyPropertyPresence
-
-
-
-
Method Detail
-
hasMultiple
public boolean hasMultiple()
Check whether the current instance contains multiple matches.- Returns:
- True or false.
-
getRect
public org.openqa.selenium.Rectangle getRect()
Returns rectangle of the partial image occurrence.- Returns:
- The region of the partial image occurrence on the full image.
-
getRect
public org.openqa.selenium.Rectangle getRect(int matchIndex)
Returns rectangle of the partial image occurrence for the given match index.- Parameters:
matchIndex- Match index.- Returns:
- Matching rectangle.
- Throws:
java.lang.IllegalStateException- If the current instance does not represent multiple matches.
-
getScore
public double getScore()
Returns the score of the partial image occurrence.- Returns:
- Matching score in range 0..1.
-
getScore
public double getScore(int matchIndex)
Returns the score of the partial image occurrence for the given match index.- Parameters:
matchIndex- Match index.- Returns:
- Matching score in range 0..1.
- Throws:
java.lang.IllegalStateException- If the current instance does not represent multiple matches.
-
getVisualization
public byte[] getVisualization()
Returns the visualization of the matching result.- Overrides:
getVisualizationin classComparisonResult- Returns:
- The visualization of the matching result represented as base64-encoded PNG image.
-
getVisualization
public byte[] getVisualization(int matchIndex)
Returns the visualization of the partial image occurrence for the given match index.- Parameters:
matchIndex- Match index.- Returns:
- The visualization of the matching result represented as base64-encoded PNG image.
- Throws:
java.lang.IllegalStateException- If the current instance does not represent multiple matches.
-
storeVisualization
public void storeVisualization(java.io.File destination) throws java.io.IOExceptionStores visualization image into the given file.- Overrides:
storeVisualizationin classComparisonResult- Parameters:
destination- File path to save the image to.- Throws:
java.io.IOException- On file system I/O error.
-
storeVisualization
public void storeVisualization(int matchIndex, java.io.File destination) throws java.io.IOExceptionStores visualization image into the given file.- Parameters:
matchIndex- Match index.destination- File path to save the image to.- Throws:
java.io.IOException- On file system I/O error.java.lang.IllegalStateException- If the current instance does not represent multiple matches.
-
getMultiple
public java.util.List<OccurrenceMatchingResult> getMultiple()
Returns the list of multiple matches (if any). This property only works if the `multiple` option is enabled.- Returns:
- The list containing properties of each single match or an empty list.
- Throws:
java.lang.IllegalStateException- If the current instance does not represent multiple matches.- Since:
- Appium 1.21.0
-
-