Package org.apache.batik.test.svg
Class SVGRenderingAccuracyTest
- java.lang.Object
-
- org.apache.batik.test.AbstractTest
-
- org.apache.batik.test.svg.AbstractRenderingAccuracyTest
-
- org.apache.batik.test.svg.SVGRenderingAccuracyTest
-
- All Implemented Interfaces:
Test
- Direct Known Subclasses:
PreconfiguredRenderingTest
public class SVGRenderingAccuracyTest extends AbstractRenderingAccuracyTest
Checks for regressions in rendering a specific SVG document. TheTest
will rasterize and SVG document and compare it to a reference image. The test passes if the rasterized SVG and the reference image match exactly (i.e., all pixel values are the same).- Version:
- $Id: SVGRenderingAccuracyTest.java 1804130 2017-08-04 14:41:11Z ssteiner $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
SVGRenderingAccuracyTest.InternalPNGTranscoder
Inner class which derives from the PNGTranscoder and calls the manipulateSVGDocument just before encoding happens.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
ERROR_CANNOT_TRANSCODE_SVG
Error when transcoding the SVG document generates an error {0} = URI of the transcoded SVG file {1} = Exception class {2} = Exception message {3} = Stack trace.protected java.lang.String
userLanguage
The userLanguage for which the document should be tested.protected boolean
validate
Controls whether or not the SVG file should be validated.static java.lang.String
VALIDATING_PARSER
Validating parser class name-
Fields inherited from class org.apache.batik.test.svg.AbstractRenderingAccuracyTest
candidateReference, configuration, CONFIGURATION_RESOURCES, COULD_NOT_GENERATE_COMPARISON_IMAGES, COULD_NOT_LOAD_IMAGE, COULD_NOT_OPEN_VARIATION_URL, ENTRY_KEY_DIFFERENCE_IMAGE, ENTRY_KEY_ERROR_DESCRIPTION, ENTRY_KEY_INTERNAL_ERROR, ENTRY_KEY_REFERENCE_GENERATED_IMAGE_URI, ERROR_CANNOT_CREATE_TEMP_FILE, ERROR_CANNOT_CREATE_TEMP_FILE_STREAM, ERROR_CANNOT_OPEN_GENERATED_IMAGE, ERROR_CANNOT_OPEN_REFERENCE_IMAGE, ERROR_ERROR_WHILE_COMPARING_FILES, ERROR_SVG_RENDERING_NOT_ACCURATE, IMAGE_FILE_EXTENSION, IMAGE_TYPE_COMPARISON, IMAGE_TYPE_DIFF, refImgURL, saveVariation, svgURL, TEMP_FILE_PREFIX, TEMP_FILE_SUFFIX, tempDirectory, variationURLs
-
Fields inherited from class org.apache.batik.test.AbstractTest
id, name, parent
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
SVGRenderingAccuracyTest()
For subclassesSVGRenderingAccuracyTest(java.lang.String svgURL, java.lang.String refImgURL)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description TestReport
encode(java.net.URL srcURL, java.io.FileOutputStream fos)
ImageTranscoder
getTestImageTranscoder()
Returns theImageTranscoder
the Test should usejava.lang.String
getUserLanguage()
boolean
getValidating()
protected org.w3c.dom.Document
manipulateSVGDocument(org.w3c.dom.Document doc)
Template method which subclasses can override if they need to manipulate the DOM in some way before running the accuracy test.void
setUserLanguage(java.lang.String userLanguage)
Sets the userLanguagevoid
setValidating(java.lang.Boolean validate)
If true, this test will use validation-
Methods inherited from class org.apache.batik.test.svg.AbstractRenderingAccuracyTest
addVariationURL, buildDiffImage, compare, getCandidateReference, getImage, getImage, getName, getNextTempFileName, getNextTempFileName, getSaveVariation, getTempDirectory, getURLFile, getVariationURLs, imageToFile, makeCompareImage, makeRandomFileName, makeTempFileName, resolveURL, run, saveImage, saveImage, setCandidateReference, setConfig, setSaveVariation
-
Methods inherited from class org.apache.batik.test.AbstractTest
assertEquals, assertEquals, assertNull, assertTrue, error, getId, getParent, getQualifiedId, reportError, reportException, reportSuccess, runImpl, runImplBasic, setId, setName, setParent
-
-
-
-
Field Detail
-
ERROR_CANNOT_TRANSCODE_SVG
public static final java.lang.String ERROR_CANNOT_TRANSCODE_SVG
Error when transcoding the SVG document generates an error {0} = URI of the transcoded SVG file {1} = Exception class {2} = Exception message {3} = Stack trace.- See Also:
- Constant Field Values
-
VALIDATING_PARSER
public static final java.lang.String VALIDATING_PARSER
Validating parser class name
-
validate
protected boolean validate
Controls whether or not the SVG file should be validated. By default, no validation is used.
-
userLanguage
protected java.lang.String userLanguage
The userLanguage for which the document should be tested.
-
-
Constructor Detail
-
SVGRenderingAccuracyTest
public SVGRenderingAccuracyTest(java.lang.String svgURL, java.lang.String refImgURL)
Constructor.- Parameters:
svgURL
- the URL String for the SVG document being tested.refImgURL
- the URL for the reference image.
-
SVGRenderingAccuracyTest
protected SVGRenderingAccuracyTest()
For subclasses
-
-
Method Detail
-
setValidating
public void setValidating(java.lang.Boolean validate)
If true, this test will use validation
-
getValidating
public boolean getValidating()
-
setUserLanguage
public void setUserLanguage(java.lang.String userLanguage)
Sets the userLanguage
-
getUserLanguage
public java.lang.String getUserLanguage()
-
manipulateSVGDocument
protected org.w3c.dom.Document manipulateSVGDocument(org.w3c.dom.Document doc)
Template method which subclasses can override if they need to manipulate the DOM in some way before running the accuracy test. For example, this can be useful to test the alternate stylesheet support.
-
encode
public TestReport encode(java.net.URL srcURL, java.io.FileOutputStream fos)
- Specified by:
encode
in classAbstractRenderingAccuracyTest
-
getTestImageTranscoder
public ImageTranscoder getTestImageTranscoder()
Returns theImageTranscoder
the Test should use
-
-