in reply to How to test Interactive/Graphical Modules

When it comes to graphics "smoke" tests, one common approach is to capture the currently rendered image and then compare it bitwise or numerically to a human-sanctioned example. Sometimes two or four pixels are all you need to test, while other times you need a major chunk. Often, thanks to vendor/hardware/implementation issues, you should allow certain tolerances, such as RGB within 5 points of expected, or 99% of pixels are as expected.

If you design your tests carefully, you can have a "training" and a "smoking" mode. If there are no saved comparison results, it needs to "train" and save the current results as good. If there are comparison results already packaged with the tests, then the current code output needs to be checked against them in order to pass the smoke test. Testing isn't debugging: a third mode for debugging should be the only mode that requires user intervention.

Unfortunately, this means you probably need to write a comparitor that works well for you. I hope this is a call-to-action for you to make a nice PerlMagick or Image::* solution into a new Test::Images module with a looks_ok() for everyone. Take two images, subtract one from the other, and look for nonzero values as being unexpected differences.

--
[ e d @ h a l l e y . c c ]