org.jzy3d.junit
Class ChartTest

java.lang.Object
  extended by org.jzy3d.junit.ChartTest

public class ChartTest
extends Object

Primitives for chart tests. A chart having a screenshot different from the test case image will generate a call to org.junit.Assert.fail

Author:
martin

Field Summary
protected  int HEIGHT
           
static ChartTest tester
           
protected  int WIDTH
           
 
Constructor Summary
ChartTest()
           
 
Method Summary
static void assertSimilar(Chart chart, String testImage)
           
 void build(Chart chart, String testImage)
           
 void build(com.jogamp.opengl.util.texture.TextureData image, String testImage)
           
 void clean(String testImage)
           
 boolean cleanFile(String file)
           
 void compare(Chart chart, String filename)
           
 void compare(com.jogamp.opengl.util.texture.TextureData i, String filename)
           
 void compare(com.jogamp.opengl.util.texture.TextureData i1, com.jogamp.opengl.util.texture.TextureData i2)
          Compare images pixel-wise.
 void execute(Chart chart)
           
 void execute(Chart chart, String testImage)
          Run a chart and verify if its screenshot is pixelwise similar to the test case image.
 void execute(com.jogamp.opengl.util.texture.TextureData image)
           
 void execute(com.jogamp.opengl.util.texture.TextureData image, String testImage)
           
 String getTestCanvasType()
           
 String getTestCaseFailedFileName()
           
 File getTestCaseFile()
           
 String getTestCaseFileName()
           
 String getTestCaseFileName(String testName)
           
 String getTestCaseFolder()
           
 String getTestName()
           
 boolean isBuilt(String testImage)
           
 void screenshot(Chart chart, String filename)
           
 void screenshot(com.jogamp.opengl.util.texture.TextureData image, String testImage)
           
 void test(Chart chart, String testImage)
           
 void test(com.jogamp.opengl.util.texture.TextureData image, String testImage)
           
 void voidTest()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

tester

public static ChartTest tester

WIDTH

protected int WIDTH

HEIGHT

protected int HEIGHT
Constructor Detail

ChartTest

public ChartTest()
Method Detail

assertSimilar

public static void assertSimilar(Chart chart,
                                 String testImage)

execute

public void execute(Chart chart,
                    String testImage)
             throws IOException
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 image data/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 call fail(...)

execute

public void execute(Chart chart)
             throws IOException
Throws:
IOException

execute

public void execute(com.jogamp.opengl.util.texture.TextureData image,
                    String testImage)
             throws IOException
Throws:
IOException

execute

public void execute(com.jogamp.opengl.util.texture.TextureData image)
             throws IOException
Throws:
IOException

clean

public void clean(String testImage)

cleanFile

public boolean cleanFile(String file)

build

public void build(Chart chart,
                  String testImage)
           throws IOException
Throws:
IOException

build

public void build(com.jogamp.opengl.util.texture.TextureData image,
                  String testImage)
           throws IOException
Throws:
IOException

isBuilt

public boolean isBuilt(String testImage)

test

public void test(Chart chart,
                 String testImage)
          throws IOException
Throws:
IOException

test

public void test(com.jogamp.opengl.util.texture.TextureData image,
                 String testImage)
          throws IOException
Throws:
IOException

compare

public void compare(Chart chart,
                    String filename)
             throws IOException,
                    ChartTestFailed
Throws:
IOException
ChartTestFailed

compare

public void compare(com.jogamp.opengl.util.texture.TextureData i,
                    String filename)
             throws IOException,
                    ChartTestFailed
Throws:
IOException
ChartTestFailed

compare

public void compare(com.jogamp.opengl.util.texture.TextureData i1,
                    com.jogamp.opengl.util.texture.TextureData i2)
             throws ChartTestFailed
Compare images pixel-wise.

Parameters:
i1 -
i2 -
Throws:
ChartTestFailed - as soon as a pixel difference can be found

screenshot

public void screenshot(Chart chart,
                       String filename)
                throws IOException
Throws:
IOException

screenshot

public void screenshot(com.jogamp.opengl.util.texture.TextureData image,
                       String testImage)
                throws IOException
Throws:
IOException

getTestCaseFile

public File getTestCaseFile()

getTestCaseFileName

public String getTestCaseFileName()

getTestCaseFileName

public String getTestCaseFileName(String testName)

getTestCaseFailedFileName

public String getTestCaseFailedFileName()

getTestCaseFolder

public String getTestCaseFolder()

getTestName

public String getTestName()

getTestCanvasType

public String getTestCanvasType()

voidTest

public void voidTest()


Copyright © 2013. All rights reserved.