public class ImageCompareTest extends AbstractTest
Modifier and Type | Field and Description |
---|---|
static String |
ENTRY_KEY_COMPARISON |
static String |
ENTRY_KEY_DIFFERENCE |
static String |
ENTRY_KEY_FIRST_IMAGE |
static String |
ENTRY_KEY_IMAGE_URL |
static String |
ENTRY_KEY_SECOND_IMAGE |
static String |
ERROR_COULD_NOT_LOAD_IMAGE |
static String |
ERROR_COULD_NOT_OPEN_IMAGE |
static String |
ERROR_DIFFERENCES |
static String |
ERROR_WHILE_COMPARING_FILES |
static String |
IMAGE_TYPE_COMPARISON |
static String |
IMAGE_TYPE_DIFFERENCE |
static String |
TEMP_FILE_PREFIX
Prefix for the temporary files created by Tests
of this class
|
static String |
TEMP_FILE_SUFFIX
Suffix for the temporary files created by
Tests of this class
|
protected URL |
urlA |
protected String |
urlAStr
URL for the first image to be compared.
|
protected URL |
urlB |
protected String |
urlBStr
URL for the second image to be compared
|
id, name, parent
Constructor and Description |
---|
ImageCompareTest(String urlA,
String urlB)
This test makes a binary comparison of the two images
(and not a pixel comparison).
|
Modifier and Type | Method and Description |
---|---|
protected BufferedImage |
buildCompareImage(BufferedImage ref,
BufferedImage gen) |
static BufferedImage |
buildDiffImage(BufferedImage ref,
BufferedImage gen)
Builds a new BufferedImage that is the difference between the two input images
|
static boolean |
compare(InputStream refStream,
InputStream newStream)
Compare the two input streams
|
protected BufferedImage |
getImage(URL url)
Loads an image from a URL
|
protected File |
imageToFile(BufferedImage img,
String imageType)
Creates a temporary File into which the input image is
saved.
|
protected void |
initURLs() |
protected File |
makeRandomFileName(String imageType)
Creates a temporary File into which the input image is
saved.
|
protected URL |
resolveURL(String url)
Resolves the input string as follows.
|
TestReport |
rumImpl() |
assertEquals, assertEquals, assertNull, assertTrue, error, getId, getName, getParent, getQualifiedId, reportError, reportException, reportSuccess, run, runImpl, runImplBasic, setId, setName, setParent
public static final String ERROR_COULD_NOT_OPEN_IMAGE
public static final String ERROR_COULD_NOT_LOAD_IMAGE
public static final String ERROR_DIFFERENCES
public static final String ERROR_WHILE_COMPARING_FILES
public static final String ENTRY_KEY_FIRST_IMAGE
public static final String ENTRY_KEY_SECOND_IMAGE
public static final String ENTRY_KEY_COMPARISON
public static final String ENTRY_KEY_DIFFERENCE
public static final String ENTRY_KEY_IMAGE_URL
public static final String IMAGE_TYPE_DIFFERENCE
public static final String IMAGE_TYPE_COMPARISON
public static final String TEMP_FILE_PREFIX
public static final String TEMP_FILE_SUFFIX
protected String urlAStr
protected URL urlA
protected String urlBStr
protected URL urlB
public ImageCompareTest(String urlA, String urlB)
urlA
- first imageurlB
- second imageprotected URL resolveURL(String url)
protected void initURLs()
public TestReport rumImpl() throws Exception
Exception
protected BufferedImage buildCompareImage(BufferedImage ref, BufferedImage gen)
protected File imageToFile(BufferedImage img, String imageType) throws IOException
IOException
protected File makeRandomFileName(String imageType) throws IOException
IOException
public static BufferedImage buildDiffImage(BufferedImage ref, BufferedImage gen)
public static boolean compare(InputStream refStream, InputStream newStream) throws IOException
IOException
protected BufferedImage getImage(URL url)
Copyright © 2000–2023 Apache Software Foundation. All rights reserved.