Package com.deltaxml.core.config
Class SVGConfiguration
java.lang.Object
com.deltaxml.core.config.SVGConfiguration
Specifies configuration options for SVG comparison. These configuration options can be specified on a
DocumentComparator to configure its behaviour when comparing SVG.- Since:
- 12.2
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidenableNumericTolerance(boolean value) Sets whether to use a numeric tolerance.doubleGets the fallback change percentage setting for SVG comparison results.Gets the Input A SVG markup style used for SVG comparison results.Gets the current Input B SVG markup style used for SVG comparison results.Gets the numeric tolerance value for SVG comparison results.Returns theSVGGranularitysetting for SVG comparison results.Gets the XPath to the referenced SVG.Gets the current Input Z SVG markup style used for SVG comparison results.booleanReturns whether SVG comparison is enabled.booleanReturns enabled state of fall back feature in the SVG comparison.booleanDetermines whether to use numeric tolerance in the SVG comparison.booleanReturns whether Z-index changes are shown in the SVG Comparisons.voidsetEnabled(boolean value) Sets whether theDocumentComparatorshould do SVG comparison.voidsetFallback(boolean value) Sets whether to fall backSVGGranularity.ADJACENT.voidsetFallbackChangePercentage(double fallbackChangePercentage) Sets fall back change percentage setting for SVG comparison results.voidsetInputASVGMarkupStyle(String inputASVGMarkupStyle) Sets the Input A SVG markup style used for SVG comparison results.voidsetInputBSVGMarkupStyle(String inputBSVGMarkupStyle) Sets the Input B SVG markup style used for SVG comparison results.voidsetNumericToleranceValue(String numericToleranceValue) Sets the numeric tolerance value for SVG comparison results.voidsetSVGComparisonGranularity(SVGGranularity svgComparisonGranularity) Sets theSVGGranularityat which the differences between two SVG images will be represented.voidsetXpathToReferencedSVG(String xPathToReferencedSVG) Sets XPath to the referenced SVG.voidsetZIndex(boolean value) Sets whether theDocumentComparatorshould show Z-Index changes in a SVG comparison.voidsetZIndexSVGMarkupStyle(String zIndexSVGMarkupStyle) Sets the Z Index SVG markup style used for SVG comparison results.
-
Constructor Details
-
SVGConfiguration
public SVGConfiguration()Initialise a newSVGConfigurationwith default settings.
-
-
Method Details
-
setEnabled
public void setEnabled(boolean value) Sets whether theDocumentComparatorshould do SVG comparison. SVG comparison is recommended as it will use SVG XML-aware features when comparing two SVG images to ensure that the result can be rendered.- Parameters:
value- whether to use SVG comparison
-
isEnabled
public boolean isEnabled()Returns whether SVG comparison is enabled.- Returns:
- a boolean describing the enabled state of SVG comparison
-
setSVGComparisonGranularity
Sets theSVGGranularityat which the differences between two SVG images will be represented. The default is DETAILED_ADJACENT.- Parameters:
svgComparisonGranularity- an instance ofSVGGranularity
-
getSVGComparisonGranularity
Returns theSVGGranularitysetting for SVG comparison results.- Returns:
- an instance of
SVGGranularity
-
setZIndex
public void setZIndex(boolean value) Sets whether theDocumentComparatorshould show Z-Index changes in a SVG comparison. Z-Index changes in SVG comparisons are recommended as it will recognise Z-index changes and render the changes with an alternate colour.- Parameters:
value- whether to show Z-index changes in the SVG comparison
-
isZIndexEnabled
public boolean isZIndexEnabled()Returns whether Z-index changes are shown in the SVG Comparisons.- Returns:
- a boolean describing the enabled state of Z-Index changes within the SVG Comparison.
-
setFallback
public void setFallback(boolean value) Sets whether to fall backSVGGranularity.ADJACENT. SVG comparison granularity will fall back toSVGGranularity.ADJACENT if SVG exceeds the percentage of changed elements defined by FallbackChangePercentage.- Parameters:
value- whether to fall back toSVGGranularity.ADJACENT if percentage of changed elements is above the FallbackChangePercentage threshold.
-
isFallbackEnabled
public boolean isFallbackEnabled()Returns enabled state of fall back feature in the SVG comparison.- Returns:
- a boolean describing the enabled state of SVG comparison fallback.
-
setFallbackChangePercentage
public void setFallbackChangePercentage(double fallbackChangePercentage) Sets fall back change percentage setting for SVG comparison results. This is the percentage of changed elements in the SVG comparison before the images are deemed too different and we therefore show the images side by side usingSVGGranularity.ADJACENT. The default value is 30.00%.- Parameters:
fallbackChangePercentage- the threshold value for changed elements before falling back toSVGGranularity.ADJACENT.
-
getFallbackChangePercentage
public double getFallbackChangePercentage()Gets the fallback change percentage setting for SVG comparison results.- Returns:
- the fallback threshold percentage as a
Double.
-
setInputASVGMarkupStyle
Sets the Input A SVG markup style used for SVG comparison results. The default is "red" and XML Compare expects the style in the same format.- Parameters:
inputASVGMarkupStyle- the Input A SVG markup style.
-
getInputASVGMarkupStyle
Gets the Input A SVG markup style used for SVG comparison results.- Returns:
- the Input A SVG markup style.
-
setInputBSVGMarkupStyle
Sets the Input B SVG markup style used for SVG comparison results. The default is "green" and XML Compare expects the style in the same format.- Parameters:
inputBSVGMarkupStyle- the Input B SVG markup style.
-
getInputBSVGMarkupStyle
Gets the current Input B SVG markup style used for SVG comparison results.- Returns:
- the Input B SVG markup style.
-
setZIndexSVGMarkupStyle
Sets the Z Index SVG markup style used for SVG comparison results. The default is "purple" and XML Compare expects the style in the same format.- Parameters:
zIndexSVGMarkupStyle- the Z index SVG markup style.
-
getZIndexSVGMarkupStyle
Gets the current Input Z SVG markup style used for SVG comparison results.- Returns:
- the Input Z SVG markup style.
-
setNumericToleranceValue
Sets the numeric tolerance value for SVG comparison results. This value is used to check if co-ordinate values are within specified tolerance and therefore can be considered having negligible change. The default value is 1%.- Parameters:
numericToleranceValue- a value for SVG numeric tolerance either fixed value or percentage
-
getNumericToleranceValue
Gets the numeric tolerance value for SVG comparison results.- Returns:
- the string value of the SVG numeric tolerance
-
enableNumericTolerance
public void enableNumericTolerance(boolean value) Sets whether to use a numeric tolerance. SVG comparison will check co-ordinate values are within specified tolerance and therefore can be considered having negligible change.- Parameters:
value- whether to use a numeric tolerance in SVG comparison.
-
isNumericToleranceEnabled
public boolean isNumericToleranceEnabled()Determines whether to use numeric tolerance in the SVG comparison.- Returns:
- a boolean describing the enabled state of SVG comparison numeric tolerance
-
setXpathToReferencedSVG
Sets XPath to the referenced SVG. This is a xpath to an attribute referencing SVG relative to its parent element. For example. with an HTML input documents, XPath to the referenced SVG will be *:img/@src. This configuration assumes SVG can be created at the same place as that of its reference. It also assumes that SVG doesn't require a container around it. For example, if the DITA files are compared using XML Compare then this configuration will not work as DITA expects an SVG within a svg-container element. While applying SVG comparison to format like DITA XML Compare will need a special filter to consider svg-container.- Parameters:
xPathToReferencedSVG- XPath to the referenced SVG.
-
getXpathToReferencedSVG
Gets the XPath to the referenced SVG.- Returns:
- the XPath to the referenced SVG.
-