| framework.VisualTestCase
All known Subclasses: apichanges.ConnectionWidgetCollisionsCollectorTest, apichanges.AnimatorListenerTest, apichanges.WidgetPaintBorderTest, bugs.FlowLayout105400Test, bugs.FlowLayoutWeightOverflow108052Test, apichanges.LabelOrientationTest, apichanges.OffscreenRenderingTest, bugs.LayerWidget103528Test, basic.BasicTest, apichanges.AnchorNotificationTest,
VisualTestCase | public class VisualTestCase extends NbTestCase (Code) | | Visual test case allows to create visual test - usually by creating a snapshot of a scene rendered into an image.
Then the image can been "cleaned" by a specific colors at particular regions.
Then the image can be tested if colors that remains there.
author: David Kaspar |
Method Summary | |
public void | assertCleaness(boolean isClean, BufferedImage snapshot, BufferedImage clean) Asserts cleaness and optionally saves snapshots. | public void | assertScene(Scene scene, Color clearColor, Shape... clearShapes) Asserts a scene by taking its snapshots, cleaning specified regions with clear color and asserting that the clear color remains in the snapshot. | public BufferedImage | clearRegions(BufferedImage image, Color clearColor, Shape... clearShapes) Creates a new image which is a copy of a specified image and contains "clean" regions. | public void | saveImage(BufferedImage image, String imageID) Saves an image into the working directory of the test. | public JFrame | showFrame(Scene scene) Shows a frame for a scene and wait until it shown on a screen. | public JFrame | showFrame(Scene scene, int width, int height) Shows a frame of for a scene and wait until it shown on a screen. | public BufferedImage | takeOneTimeSnapshot(Scene scene) Takes a one-time snapshot. | public BufferedImage | takeOneTimeSnapshot(Scene scene, int width, int height) Takes a one-time snapshot. | public BufferedImage | takeSnapshot(Scene scene) Takes a snapshot of a scene. | public BufferedImage | takeSnapshot(Scene scene, int width, int height) Takes a snapshot of a scene. | public boolean | testCleaness(BufferedImage image, Color... colors) Checks whether an image contains only specified colors. |
VisualTestCase | public VisualTestCase(String testName)(Code) | | Creates a new visual test case.
Parameters: testName - the test name |
assertCleaness | public void assertCleaness(boolean isClean, BufferedImage snapshot, BufferedImage clean)(Code) | | Asserts cleaness and optionally saves snapshots.
Parameters: isClean - if true, nothing happens; if false, the assertion fails Parameters: snapshot - the snapshot image Parameters: clean - the clean snapshot image |
assertScene | public void assertScene(Scene scene, Color clearColor, Shape... clearShapes)(Code) | | Asserts a scene by taking its snapshots, cleaning specified regions with clear color and asserting that the clear color remains in the snapshot.
Parameters: scene - the scene Parameters: clearColor - the clear color Parameters: clearShapes - the clear regions |
clearRegions | public BufferedImage clearRegions(BufferedImage image, Color clearColor, Shape... clearShapes)(Code) | | Creates a new image which is a copy of a specified image and contains "clean" regions.
Parameters: image - the image to be copied Parameters: clearColor - the color by which the regions are cleaned. Parameters: clearShapes - the clean regions the clean image |
saveImage | public void saveImage(BufferedImage image, String imageID)(Code) | | Saves an image into the working directory of the test.
Parameters: image - the image to save Parameters: imageID - the image id used as an image file name |
showFrame | public JFrame showFrame(Scene scene)(Code) | | Shows a frame for a scene and wait until it shown on a screen. View size is [400,300].
Parameters: scene - the scene the frame; null if the frame is not shown in 10 seconds |
showFrame | public JFrame showFrame(Scene scene, int width, int height)(Code) | | Shows a frame of for a scene and wait until it shown on a screen.
Parameters: scene - the scene Parameters: width - the view width Parameters: height - the view height the frame; null if the frame is not shown in 10 seconds |
takeOneTimeSnapshot | public BufferedImage takeOneTimeSnapshot(Scene scene)(Code) | | Takes a one-time snapshot. Similar to takeSnapshot method but it automatically creates and disposes a frame for it.
Parameters: scene - the scene the snapshot |
takeOneTimeSnapshot | public BufferedImage takeOneTimeSnapshot(Scene scene, int width, int height)(Code) | | Takes a one-time snapshot. Similar to takeSnapshot method but it automatically creates and disposes a frame for it.
Parameters: scene - the scene Parameters: width - the scene width Parameters: height - the scene height the snapshot |
takeSnapshot | public BufferedImage takeSnapshot(Scene scene)(Code) | | Takes a snapshot of a scene. This method assumes that the scene view is already shown on the screen
and therefore the scene is initialized correctly.
Parameters: scene - the scene the snapshot |
takeSnapshot | public BufferedImage takeSnapshot(Scene scene, int width, int height)(Code) | | Takes a snapshot of a scene. This method assumes that the scene view is already shown on the screen
and therefore the scene is initialized correctly.
Parameters: scene - the scene Parameters: width - the snapshot width Parameters: height - the snapshot height the snapshot |
testCleaness | public boolean testCleaness(BufferedImage image, Color... colors)(Code) | | Checks whether an image contains only specified colors.
Parameters: image - the image Parameters: colors - the colors true if the image contains specified colors only; false otherwise |
|
|