org.fest.assertions.internal
Class Images

java.lang.Object
  extended by org.fest.assertions.internal.Images

public class Images
extends Object

Reusable assertions for BufferedImages.

Author:
Yvonne Wang

Method Summary
 void assertEqual(AssertionInfo info, BufferedImage actual, BufferedImage expected)
          Asserts that two images are equal.
 void assertEqual(AssertionInfo info, BufferedImage actual, BufferedImage expected, Offset<Integer> offset)
          Asserts that two images are equal.
 void assertHasSize(AssertionInfo info, BufferedImage actual, Dimension size)
          Asserts that the size of the given image is equal to the given size.
 void assertNotEqual(AssertionInfo info, BufferedImage actual, BufferedImage other)
          Asserts that two images are not equal.
static Images instance()
          Returns the singleton instance of this class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

instance

public static Images instance()
Returns the singleton instance of this class.

Returns:
the singleton instance of this class.

assertEqual

public void assertEqual(AssertionInfo info,
                        BufferedImage actual,
                        BufferedImage expected)
Asserts that two images are equal. Two images are equal if:
  1. they have equal size
  2. the the RGB values of the color at each pixel are equal

Parameters:
info - contains information about the assertion.
actual - the actual image.
expected - the expected image.
Throws:
AssertionError - if the actual image is not equal to the expected one.

assertEqual

public void assertEqual(AssertionInfo info,
                        BufferedImage actual,
                        BufferedImage expected,
                        Offset<Integer> offset)
Asserts that two images are equal. Two images are equal if:
  1. they have the same size
  2. the difference between the RGB values of the color at each pixel is less than or equal to the given offset

Parameters:
info - contains information about the assertion.
actual - the actual image.
expected - the expected image.
offset - helps decide if the color of two pixels are similar: two pixels that are identical to the human eye may still have slightly different color values. For example, by using an offset of 1 we can indicate that a blue value of 60 is similar to a blue value of 61.
Throws:
NullPointerException - if the given offset is null.
AssertionError - if the actual image is not equal to the expected one.

assertNotEqual

public void assertNotEqual(AssertionInfo info,
                           BufferedImage actual,
                           BufferedImage other)
Asserts that two images are not equal.

Parameters:
info - contains information about the assertion.
actual - the given image.
other - the object to compare actual to.
Throws:
AssertionError - if actual is equal to other.

assertHasSize

public void assertHasSize(AssertionInfo info,
                          BufferedImage actual,
                          Dimension size)
Asserts that the size of the given image is equal to the given size.

Parameters:
info - contains information about the assertion.
actual - the given image.
size - the expected size of actual.
Throws:
NullPointerException - if the given size is null.
AssertionError - if the size of the given image is not equal to the given size.


Copyright © 2007-2012 FEST (Fixtures for Easy Software Testing). All Rights Reserved.