01: package abbot.tester;
02:
03: import java.awt.image.BufferedImage;
04: import java.io.File;
05:
06: import javax.swing.*;
07:
08: import junit.extensions.abbot.*;
09: import junit.framework.TestCase;
10:
11: /** Test ImageComparator. */
12:
13: public class ImageComparatorTest extends TestCase {
14:
15: private ComponentTester tester;
16:
17: protected void setUp() {
18: tester = new ComponentTester();
19: }
20:
21: public void testImageCompare() throws Throwable {
22:
23: File gif = new File("test/abbot/tester/image.gif");
24: ImageIcon icon = new ImageIcon(gif.toURL());
25: ImageIcon icon2 = new ImageIcon(gif.toURL());
26:
27: ImageComparator ic = new ImageComparator();
28: assertTrue("Images should not differ", ic.compare(icon
29: .getImage(), icon2.getImage()) == 0);
30: }
31:
32: /** Return the default test suite. */
33: public static void main(String[] args) {
34: TestHelper.runTests(args, ImageComparatorTest.class);
35: }
36: }
|