summaryrefslogtreecommitdiffstats
path: root/tools/qml/qdeclarativetester.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-04-12 04:11:32 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-04-14 01:02:12 (GMT)
commitca64874f1a9f6453a0bd5a0f6b8ae61d49900314 (patch)
tree5fbede3c74dec49e4a443fc7f98edbb80071988a /tools/qml/qdeclarativetester.cpp
parentb16e6e70529b8ef86734324c6c6a0e151ddf4bc8 (diff)
downloadQt-ca64874f1a9f6453a0bd5a0f6b8ae61d49900314.zip
Qt-ca64874f1a9f6453a0bd5a0f6b8ae61d49900314.tar.gz
Qt-ca64874f1a9f6453a0bd5a0f6b8ae61d49900314.tar.bz2
Support recording visual snapshot tests.
Diffstat (limited to 'tools/qml/qdeclarativetester.cpp')
-rw-r--r--tools/qml/qdeclarativetester.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp
index 6245124..cf537ee 100644
--- a/tools/qml/qdeclarativetester.cpp
+++ b/tools/qml/qdeclarativetester.cpp
@@ -240,6 +240,8 @@ void QDeclarativeTester::save()
void QDeclarativeTester::updateCurrentTime(int msec)
{
QDeclarativeItemPrivate::setConsistentTime(msec);
+ if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot)
+ return;
QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32);
@@ -249,11 +251,13 @@ void QDeclarativeTester::updateCurrentTime(int msec)
m_view->render(&p);
}
+ bool snapshot = msec == 16 && options & QDeclarativeViewer::Snapshot;
+
FrameEvent fe;
fe.msec = msec;
if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) {
// Skip first frame, skip if not doing images
- } else if (0 == (m_savedFrameEvents.count() % 60)) {
+ } else if (0 == (m_savedFrameEvents.count() % 60) || snapshot) {
fe.image = img;
} else {
QCryptographicHash hash(QCryptographicHash::Md5);
@@ -366,8 +370,11 @@ void QDeclarativeTester::updateCurrentTime(int msec)
filterEvents = true;
- if (testscript && testscript->count() <= testscriptidx)
+ if (testscript && testscript->count() <= testscriptidx) {
+ //if (msec == 16) //for a snapshot, leave it up long enough to see
+ // (void)::sleep(1);
complete();
+ }
}
void QDeclarativeTester::registerTypes()