From 8fc0d1c36cae1b0d659e119032af006b8f8eca52 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Mon, 15 Nov 2010 19:44:40 +1000 Subject: Take snapshots starting from the first frame Partly because it's invaluble for the times people forget to record a test as a snapshot, partly because it provides more data on the initial state of the test case. Task-number: QTBUG-14792 --- tools/qml/qdeclarativetester.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp index eaf3403..499822a 100644 --- a/tools/qml/qdeclarativetester.cpp +++ b/tools/qml/qdeclarativetester.cpp @@ -286,7 +286,7 @@ void QDeclarativeTester::updateCurrentTime(int msec) fe.msec = msec; if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { // Skip first frame, skip if not doing images - } else if (0 == (m_savedFrameEvents.count() % 60) || snapshot) { + } else if (0 == (m_savedFrameEvents.count()-1 % 60) || snapshot) { fe.image = img; } else { QCryptographicHash hash(QCryptographicHash::Md5); @@ -356,6 +356,11 @@ void QDeclarativeTester::updateCurrentTime(int msec) if (options & QDeclarativeViewer::TestImages && !(options & QDeclarativeViewer::Record) && !frame->image().isEmpty()) { QImage goodImage(frame->image().toLocalFile()); + if (frame->msec() == 16 && goodImage.size() != img.size()){ + //Also an image mismatch, but this warning is more informative. Only checked at start though. + qWarning() << "QDeclarativeTester(" << m_script << "): Size mismatch. This test must be run at " << goodImage.size(); + imagefailure(); + } if (goodImage != img) { QString reject(frame->image().toLocalFile() + ".reject.png"); qWarning() << "QDeclarativeTester: Image mismatch. Reject saved to:" -- cgit v0.12