Class ChartTester
java.lang.Object
org.jzy3d.junit.ChartTester
Primitives for chart tests.
A chart having a screenshot different from the test case image will generate throw a
ChartTestFailed exception.
- Author:
- martin
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidassertSimilar(Chart chart, String testImage) voidassertSimilar(org.jzy3d.colors.colormaps.IColorMap colormap, String testImage) voidvoidvoidbooleanvoidcompare(BufferedImage actual, BufferedImage expected) Perform the comparison between twoBufferedImage.voidCompare the image displayed by the chart with an image given by filename.voidvoidcompare(AWTColorbarImageGenerator colorbar, String filename) Compare a colorbar image with a reference image given by filename.protected BufferedImagecopy(BufferedImage source) protected voiddoHighlightPixels(BufferedImage expected, org.jzy3d.maths.IntegerCoord2d diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates (IntegerCoord2d)voidvoidRun a chart and verify if its screenshot is pixelwise similar to the test case image.voidexecute(org.jzy3d.colors.colormaps.IColorMap chart) voidprotected BufferedImagegetBufferedImage(Chart chart) protected BufferedImagegetBufferedImage(AWTColorbarImageGenerator colorbar) protected BufferedImagegetErroneousArea(BufferedImage expected, List<org.jzy3d.maths.IntegerCoord2d> diffs) protected AWTColorbarImageGeneratorgetImageGenerator(org.jzy3d.colors.colormaps.IColorMap colormap) getTestCaseFileName(String testName) protected voidhighlightPixel(BufferedImage expected, List<org.jzy3d.maths.IntegerCoord2d> diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates.protected voidhighlightSize(BufferedImage diffImage, String m) booleanbooleanprotected BufferedImageloadBufferedImage(String filename) voidsetTestCaseInputFolder(String testCaseFolder) voidsetTestCaseOutputFolder(String testCaseOutputFolder) voidsetTextInvisible(boolean textInvisible) voidPerform a chart comparison to image and output multiple diagnostic images in case of failure Expected image Actual image Diff image Zoom imagevoidPerform a chart comparison to image and output multiple diagnostic images in case of failure Expected image Actual image Diff image Zoom image
-
Field Details
-
FILE_LABEL_ACTUAL
- See Also:
-
FILE_LABEL_EXPECT
- See Also:
-
FILE_LABEL_DIFF
- See Also:
-
FILE_LABEL_ZOOM
- See Also:
-
TEST_IMG_SIZE
public static int TEST_IMG_SIZE -
textInvisible
protected boolean textInvisible -
testCaseOutputFolder
-
testCaseInputFolder
-
MAVEN_TEST_RESOURCES_PATH
- See Also:
-
MAVEN_TARGET_PATH
- See Also:
-
colorbarDimension
protected org.jzy3d.maths.Dimension colorbarDimension -
WIDTH
protected int WIDTH -
HEIGHT
protected int HEIGHT
-
-
Constructor Details
-
ChartTester
public ChartTester()
-
-
Method Details
-
assertSimilar
-
execute
Run a chart and verify if its screenshot is pixelwise similar to the test case image. If test case image does not exist, build it for the first time. Failure to compare the chart with the test case image will create an imagedata/tests/error-[name].png. This image is always deleted before running a testcase. Calling clean() will delete the test case image.- Parameters:
chart-testImage-- Throws:
IOException- if a non chart related error occurs. Actual chart test errors callfail(...)
-
execute
- Throws:
IOException
-
clean
-
cleanFile
-
build
- Throws:
IOException
-
isBuilt
-
test
Perform a chart comparison to image and output multiple diagnostic images in case of failure- Expected image
- Actual image
- Diff image
- Zoom image
- Parameters:
chart-testImage-- Throws:
IOException
-
assertSimilar
-
execute
public void execute(org.jzy3d.colors.colormaps.IColorMap colormap, String testImage) throws IOException - Throws:
IOException
-
execute
- Throws:
IOException
-
build
public void build(org.jzy3d.colors.colormaps.IColorMap colormap, String testImage) throws IOException - Throws:
IOException
-
test
Perform a chart comparison to image and output multiple diagnostic images in case of failure- Expected image
- Actual image
- Diff image
- Zoom image
- Parameters:
chart-testImage-- Throws:
IOException
-
highlightSize
-
copy
-
highlightPixel
protected void highlightPixel(BufferedImage expected, List<org.jzy3d.maths.IntegerCoord2d> diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates. -
doHighlightPixels
protected void doHighlightPixels(BufferedImage expected, org.jzy3d.maths.IntegerCoord2d diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates (IntegerCoord2d) -
getErroneousArea
protected BufferedImage getErroneousArea(BufferedImage expected, List<org.jzy3d.maths.IntegerCoord2d> diffs) -
compare
Compare the image displayed by the chart with an image given by filename.- Parameters:
chart-filename-- Throws:
IOExceptionChartTestFailed- is thrown if at least one pixel differ. The exception holds all pixel coordinates where a difference exists.
-
compare
public void compare(AWTColorbarImageGenerator colorbar, String filename) throws IOException, ChartTestFailed Compare a colorbar image with a reference image given by filename.- Parameters:
filename-chart-- Throws:
IOExceptionChartTestFailed- is thrown if at least one pixel differ. The exception holds all pixel coordinates where a difference exists.
-
compare
public void compare(org.jzy3d.colors.colormaps.IColorMap colormap, String filename) throws IOException, ChartTestFailed - Throws:
IOExceptionChartTestFailed
-
getImageGenerator
protected AWTColorbarImageGenerator getImageGenerator(org.jzy3d.colors.colormaps.IColorMap colormap) throws IOException - Throws:
IOException
-
getBufferedImage
- Throws:
IOException
-
getBufferedImage
- Throws:
IOException
-
loadBufferedImage
- Throws:
IOException
-
compare
Perform the comparison between twoBufferedImage.- Parameters:
actual-expected-- Throws:
ChartTestFailed- is thrown if at least one pixel differ. The exception holds all pixel coordinates where a difference exists.
-
path
-
path
-
path
-
getTestCaseFile
-
getTestCaseFileName
-
getTestCaseFileName
-
getTestCaseFailedFileName
-
getTestName
-
getTestCanvasType
-
getTestCaseInputFolder
-
setTestCaseInputFolder
-
getTestCaseOutputFolder
-
setTestCaseOutputFolder
-
isTextInvisible
public boolean isTextInvisible() -
setTextInvisible
public void setTextInvisible(boolean textInvisible)
-