Test individual pixels
This opens a file handcrafted in Photoshop to contain nothing but pure blue, and tests that this is indeed what is seen:
public void testOpenPNGFile() throws QTException, AWTException {
QTFile file = new QTFile("data/pureblue.png");
FileOpener.openFile(file);
Robot r = new Robot();
r.delay(5000);
Color expected = new Color(0, 0, 255);
Color actual = r.getPixelColor(50, 100);
assertEquals(expected, actual);
}
Improve robustness by getting coordinates to grab from the component you're testing with getLocationOnScreen()
:
public Point getLocationOnScreen()