Package org.xhtmlrenderer.test
Class Regress
- java.lang.Object
-
- org.xhtmlrenderer.test.Regress
-
public class Regress extends java.lang.Object
Creates a directory containing output from the renderer as text, given a set of input files (XHTML, XML). These files serve as the reference image for a comparison with later runs of the renderer. For any input file _input_, the zip will contain _input_, _input.layout.txt_, _input.rendered.txt_ and _input.png_. To use, create an instance of Regress with input directory, output directory and width, then callsnapshot()
.Regress regress = new Regress(sourceDir, outputDir, width); regress.snapshot();
One the regress is done, you can use Zipper to pack it up:new Zipper(outputDir, outputZip).zipDirectory();
Regress will try to render all files in the source directory; a failure to render one file (e.g. if an exception is thrown) will not stop the rendering process. Files in the source directory with the following extensions are included: htm, html, xht, xhtml, and xml. You can also run this from the command line, passing in the source directory as argument 1, and the output file name as argument 2. The output is created in the standard temp directory in a subdirectory called "reference". The path to the output directory will be printed to the console when complete.org.xhtmlrenderer.test.Regress ./regress/input-html/ ./regress/output.zip
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.List
EXTENSIONS
static java.lang.String
LAYOUT_SFX
static java.lang.String
PNG_SFX
static java.lang.String
RENDER_SFX
-
Constructor Summary
Constructors Constructor Description Regress(java.io.File sourceDir, java.io.File outputDir, int width)
Initialize to read from sourceDir and generate files to outputDir, using width points to constrain layout.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
void
snapshot()
For all files in the input directory, attempts to render and output a textual box model and a PNG file in the output directory.
-
-
-
Field Detail
-
EXTENSIONS
public static final java.util.List EXTENSIONS
-
RENDER_SFX
public static final java.lang.String RENDER_SFX
- See Also:
- Constant Field Values
-
LAYOUT_SFX
public static final java.lang.String LAYOUT_SFX
- See Also:
- Constant Field Values
-
PNG_SFX
public static final java.lang.String PNG_SFX
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Regress
public Regress(java.io.File sourceDir, java.io.File outputDir, int width)
Initialize to read from sourceDir and generate files to outputDir, using width points to constrain layout.- Parameters:
sourceDir
- directory to read fromoutputDir
- directory to write towidth
- width to constrain layou to
-
-
Method Detail
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
snapshot
public void snapshot() throws java.io.IOException
For all files in the input directory, attempts to render and output a textual box model and a PNG file in the output directory. Does not zip the contents of the output directory. Any single file that fails to render will not halt the process. Low-level IO errors will may, however, interrupt it. Both the file count and the failed count are reset on starting; on finishing those values can be read through their respective accessors in this class.- Throws:
java.io.IOException
- on reading contents or writing output
-
-