Class ImageConfiguration
HTMLCompare to configure its behavior when comparing binary images, like PNGs, JPEGs, etc. If input files
contain referenced binary images it is recommended to enable this feature. Additionally, If the referenced images are
SVG see SvgConfiguration as it can provide more granular change representation.-
Constructor Summary
ConstructorsConstructorDescriptionInitializes a new emptyImageConfigurationinstance.ImageConfiguration(ImageComparisonGranularity imageComparisonGranularity) Initializes a newImageConfigurationinstance with the provided String of XPaths, inputAMarkupStyle, inputBMarkupStyle, imageComparisonGranularity.ImageConfiguration(ImageComparisonGranularity imageComparisonGranularity, String inputAMarkupStyle, String inputBMarkupStyle) Initializes a newImageConfigurationinstance with the provided inputAMarkupStyle, inputBMarkupStyle, imageComparisonGranularity. -
Method Summary
Modifier and TypeMethodDescriptionReturns theImageComparisonGranularitysetting for Image comparison results.Gets the Input A Image comparison markup style used for image comparison results.Gets the Input B Image comparison markup style used for image comparison results.Gets the value of the outputImageRefFavourSourceDoc parameter.Gets the value of the outputImageRefForm parameter.booleanGets whether Binary Image comparison is enabled.voidsetEnabled(boolean isEnabled) `* Sets whether to use Binary Image comparison.voidsetImageComparisonGranularity(ImageComparisonGranularity imageComparisonGranularity) Sets theImageComparisonGranularityat which the differences between two images will be represented.voidsetInputAMarkupStyle(String inputAMarkupStyle) Sets the Input A image markup style setting for binary image comparison results.voidsetInputBMarkupStyle(String inputBMarkupStyle) Sets the Input B image markup style setting for binary image comparison results.voidIfsetEnabled(boolean)is set to true and there are no differences in the A and B images, this determines which of the source Documents, A or B, will be used to set the value of the result fileref.voidIfsetEnabled(boolean)is set to true this may change the form of fileref attributes of imagedata elements.
-
Constructor Details
-
ImageConfiguration
public ImageConfiguration()Initializes a new emptyImageConfigurationinstance. -
ImageConfiguration
public ImageConfiguration(ImageComparisonGranularity imageComparisonGranularity, String inputAMarkupStyle, String inputBMarkupStyle) Initializes a newImageConfigurationinstance with the provided inputAMarkupStyle, inputBMarkupStyle, imageComparisonGranularity.- Parameters:
imageComparisonGranularity- an instance ofImageComparisonGranularityinputAMarkupStyle- input A markup styleinputBMarkupStyle- input B markup style- Throws:
IllegalArgumentException- if passed imageXPath is invalid.
-
ImageConfiguration
Initializes a newImageConfigurationinstance with the provided String of XPaths, inputAMarkupStyle, inputBMarkupStyle, imageComparisonGranularity.- Parameters:
imageComparisonGranularity- an instance ofImageComparisonGranularity- Throws:
IllegalArgumentException- if passed imageXPath is invalid.
-
-
Method Details
-
setEnabled
public void setEnabled(boolean isEnabled) `* Sets whether to use Binary Image comparison.- Parameters:
isEnabled- sets whether to use binary image comparison.
-
isEnabled
public boolean isEnabled()Gets whether Binary Image comparison is enabled.- Returns:
- a boolean showing whether Binary Image comparison is enabled.
-
setImageComparisonGranularity
Sets theImageComparisonGranularityat which the differences between two images will be represented. The default is DETAILED_ADJACENT.- Parameters:
imageComparisonGranularity- an instance ofImageComparisonGranularity
-
getImageComparisonGranularity
Returns theImageComparisonGranularitysetting for Image comparison results.- Returns:
- an instance of
ImageComparisonGranularity
-
setInputAMarkupStyle
Sets the Input A image markup style setting for binary image comparison results. The default is 'red' and an image color can be provided as color names, RGB or RGBA values, HEX values, HSL or HSLA values.- Parameters:
inputAMarkupStyle- the Input A image markup style.
-
getInputAMarkupStyle
Gets the Input A Image comparison markup style used for image comparison results.- Returns:
- the Input A Image markup style.
-
setInputBMarkupStyle
Sets the Input B image markup style setting for binary image comparison results. The default is"green" and an image color can be provided as color names, RGB or RGBA values, HEX values, HSL or HSLA values.- Parameters:
inputBMarkupStyle- the Input B image markup style.
-
getInputBMarkupStyle
Gets the Input B Image comparison markup style used for image comparison results.- Returns:
- the Input B Image markup style.
-
getOutputImageRefForm
Gets the value of the outputImageRefForm parameter.- Returns:
- the value of the outputImageRefForm parameter
-
setOutputImageRefForm
If
setEnabled(boolean)is set to true this may change the form of fileref attributes of imagedata elements. If set toOutputImageRefForm.SOURCEthe value will be as it appears in the source A or B document. If set toOutputImageRefForm.ABSOLUTEthe value will be the absolute location used to calculate whether the image has changed. This should mean that for filesystem filerefs at least the images should be visible in the result document. SeesetEnabled(boolean)(boolean)} for more detail on how the absolute form is calculated.Default:
OutputImageRefForm.absolute- Parameters:
value- the value to set for the outputImageRefForm parameter- Throws:
IllegalArgumentException- if the value is null
-
getOutputImageRefFavourSourceDoc
Gets the value of the outputImageRefFavourSourceDoc parameter.- Returns:
- the value of the outputImageRefFavourSourceDoc parameter
-
setOutputImageRefFavourSourceDoc
If
setEnabled(boolean)is set to true and there are no differences in the A and B images, this determines which of the source Documents, A or B, will be used to set the value of the result fileref. This value will then be used as is or be turned into an absolute value depending on the value passed tosetOutputImageRefForm(OutputImageRefForm)- Parameters:
value- the value to set for the outputImageRefFavourSourceDoc parameter- Throws:
IllegalArgumentException- if the value is null
-