summaryrefslogtreecommitdiffstats
path: root/tools/qml/qdeclarativetester.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/qml/qdeclarativetester.cpp')
-rw-r--r--tools/qml/qdeclarativetester.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
index cf537ee..11fa22f 100644
--- a/tools/qml/qdeclarativetester.cpp
+++ b/tools/qml/qdeclarativetester.cpp
@@ -332,6 +332,24 @@ void QDeclarativeTester::updateCurrentTime(int msec)
qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:"
<< reject;
img.save(reject);
+ bool doDiff = (goodImage.size() == img.size());
+ if (doDiff) {
+ QImage diffimg(m_view->width(), m_view->height(), QImage::Format_RGB32);
+ diffimg.fill(qRgb(255,255,255));
+ QPainter p(&diffimg);
+ int diffCount = 0;
+ for (int x = 0; x < img.width(); ++x) {
+ for (int y = 0; y < img.height(); ++y) {
+ if (goodImage.pixel(x,y) != img.pixel(x,y)) {
+ ++diffCount;
+ p.drawPoint(x,y);
+ }
+ }
+ }
+ QString diff(frame->image().toLocalFile() + ".diff.png");
+ diffimg.save(diff);
+ qWarning().nospace() << " Diff (" << diffCount << " pixels differed) saved to: " << diff;
+ }
imagefailure();
}
}