I wrote a unit test which compares the contents of a frame buffer to a control image that was captured previously. When I run the unit test on my development platform, the test succeeds -- but when I transfer the unit test and the control image to another platform, the newly captured frame doesn't quite match the control image. Both platforms have the same screen resoution and color depth. What else do I have to ensure is the same on both machines before I can expect the images to comopare successfully? Or, what other method can I use to compare images that is more robust?
Here is a code snippet:
//grab the frame buffer from the QGLWidget
QImage image
= m_ui.
m_imageWidget->grabFrameBuffer
();
//Read in the control image -- was previously saved using QImage::save with png format
QImage control_image
("./images/controlGeoImage.png");
//Compare the test image with the expected control image
QCOMPARE(image, control_image); //fails if control_image is from a different platform
//grab the frame buffer from the QGLWidget
QImage image = m_ui.m_imageWidget->grabFrameBuffer();
//Read in the control image -- was previously saved using QImage::save with png format
QImage control_image("./images/controlGeoImage.png");
//Compare the test image with the expected control image
QCOMPARE(image, control_image); //fails if control_image is from a different platform
To copy to clipboard, switch view to plain text mode
If I look at the control image and the newly captured test image from a different platform, I can see the differences, but don't know how to avoid the differences so that I can develop the unit tests on one platform, and run them (for nightly testing) on another. See the test image and control image below:


The bottom image, which is the newly captured test image, shows a bit of pink on the edges between the dark blue and light blue sections.
Bookmarks