ImageExpectation¶
- class ImageExpectation¶
Returned by
- Clone()¶
Call this method if you want to use API-objects in multiple contexts, e.g. if you want to insert a specific test step in multiple blocks.
- Returns:
A copy of this object
- Return type:
- GetColorTolerance()¶
Returns the color tolerance for pixel comparison.
- Returns:
Per-pixel color tolerance (from 0 to 255)
- Return type:
str
- GetComparisonMethod()¶
Returns the method that will be used to compare the two images.
- Returns:
The method of comparison
- Return type:
str
- GetMediaReference()¶
Returns the media access that will be used if the reference type is set to ‘media’.
- Returns:
The media reference
- Return type:
str
- GetReference()¶
Returns the path to the reference image.
- Returns:
Path to an image file
- Return type:
str
- GetReferenceType()¶
Returns the method by which the image is referenced.
- Returns:
Type of reference
- Return type:
str
- GetTolerance()¶
Returns the tolerance.
- Returns:
The tolerance in percent from 0 to 100
- Return type:
str
- SetColorTolerance(tolerance)¶
Sets the color tolerance for pixel comparison. The tolerance defines the maximum deviation allowed for each color channel of a pixel. If any color deviates by more than this value from the reference pixel, the two pixels will be considered different.
- Parameters:
- tolerance : str¶
Maximum allowed deviation for each color channel in each pixel (from 0 to 255)
- SetComparisonMethod(comparisonMethod)¶
Sets the method that will be used to compare the two images, i.e. if they should be equal or if the image should be contained within the reference image.
- Parameters:
- comparisonMethod : str¶
One of “equal”, “notEqual”, “contains”, “containsNot”
- SetMediaReference(mediaReference)¶
Specifies which media reference to use. This will only have effect if the reference type is set to ‘media’ (see
SetReferenceType()). E.g. if the active Test Configuration (.tcf) defines a media source called ‘CAM’ then the media reference should also be set to ‘CAM’ in order to access images relative to the ‘CAM’ media source.- Parameters:
- mediaReference : str¶
The reference to the media access
- SetReference(reference)¶
Sets the path to the reference image that will be used for comparison.
- Parameters:
- reference : str¶
Path to an image file
- SetReferenceType(referenceType)¶
Sets how the image path is referenced. If set to “object” the reference image is expected to be an absolute path. If set to “workspace” the path is evaluated relative to the workspace directory. If set to “media” the path is relative to one of the media directories defined in the current Test Configuration (.tcf). The concrete media reference can be specified with
SetMediaReference(). Setting the reference type to ‘media’ will set the media reference to the first found media source if no other reference was specified.- Parameters:
- referenceType : str¶
One of “media”, “workspace”, “object”
- SetTolerance(tolerance)¶
Sets the tolerance for image comparison. The tolerance defines the maximum percentage of pixels that may be different from the reference image, for which the two images will still be evaluated as equal. A tolerance of 0 signifies that no deviation will be tolerated - all pixels must be equal. With a tolerance of 100 all pixels could be different and the images would still be considered equal.
- Parameters:
- tolerance : str¶
The tolerance in percent from 0 to 100