Package org.jzy3d.junit
Class ChartTester
java.lang.Object
org.jzy3d.junit.ChartTester
- Direct Known Subclasses:
NativeChartTester
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
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assertSimilar
(Chart chart, String testImage) void
assertSimilar
(IColorMap colormap, String testImage) void
void
void
boolean
void
compare
(BufferedImage actual, BufferedImage expected) Perform the comparison between twoBufferedImage
.void
Compare the image displayed by the chart with an image given by filename.void
void
compare
(AWTColorbarImageGenerator colorbar, String filename) Compare a colorbar image with a reference image given by filename.protected BufferedImage
copy
(BufferedImage source) protected void
doHighlightPixels
(BufferedImage expected, IntegerCoord2d diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates (IntegerCoord2d
)void
void
Run a chart and verify if its screenshot is pixelwise similar to the test case image.void
void
protected BufferedImage
getBufferedImage
(Chart chart) protected BufferedImage
getBufferedImage
(AWTColorbarImageGenerator colorbar) protected BufferedImage
getErroneousArea
(BufferedImage expected, List<IntegerCoord2d> diffs) protected AWTColorbarImageGenerator
getImageGenerator
(IColorMap colormap) getTestCaseFileName
(String testName) protected void
highlightPixel
(BufferedImage expected, List<IntegerCoord2d> diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates.protected void
highlightSize
(BufferedImage diffImage, String m) boolean
boolean
protected BufferedImage
loadBufferedImage
(String filename) void
setTestCaseInputFolder
(String testCaseFolder) void
setTestCaseOutputFolder
(String testCaseOutputFolder) void
setTextInvisible
(boolean textInvisible) void
Perform a chart comparison to image and output multiple diagnostic images in case of failure Expected image Actual image Diff image Zoom imagevoid
Perform 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
-
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
- Throws:
IOException
-
execute
- Throws:
IOException
-
build
- 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<IntegerCoord2d> diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates. -
doHighlightPixels
protected void doHighlightPixels(BufferedImage expected, IntegerCoord2d diffs, org.jzy3d.junit.ChartTester.Highlight highlight) Invert the pixel color identified by the input coordinates (IntegerCoord2d
) -
getErroneousArea
-
compare
Compare the image displayed by the chart with an image given by filename.- Parameters:
chart
-filename
-- Throws:
IOException
ChartTestFailed
- 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:
IOException
ChartTestFailed
- is thrown if at least one pixel differ. The exception holds all pixel coordinates where a difference exists.
-
compare
- Throws:
IOException
ChartTestFailed
-
getImageGenerator
- 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)
-