summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-03-22 15:59:50 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-03-22 15:59:50 (GMT)
commitea9f34568acd1286f5ed4e7f2bf760982a4e4579 (patch)
tree232e346dba7226f35af80043e072538dba473201 /tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
parentf68f1de5b866a050c4b39f8eed984831b0e6956e (diff)
parent1d8b7f41a5393f77eb3079513b083739edd90b91 (diff)
downloadQt-ea9f34568acd1286f5ed4e7f2bf760982a4e4579.zip
Qt-ea9f34568acd1286f5ed4e7f2bf760982a4e4579.tar.gz
Qt-ea9f34568acd1286f5ed4e7f2bf760982a4e4579.tar.bz2
Merge branch '4.7' of git://scm.dev.nokia.troll.no/qt/qt-doc-team
* '4.7' of git://scm.dev.nokia.troll.no/qt/qt-doc-team: (329 commits) Fixed drawImage() not to attempt drawing null images on openvg. QS60Style: Update placeholder texture to real one qdoc: Avoid infinite loops in table of contents generation. Bump Qt version to 4.7.4 Return SV_S60_5_2 / SV_SF_3 for next gen Symbian platform. Remove incorrect check in qpixmap autotest. Change the pooled QGLPixmapData to be backed by QVolatileImage. Started changes-4.7.4 file Fix endianness detection with gcc 4.6 -flto -fwhole-program remove redundand validateModes() call Changed s60 style not to rely on QPixmapData::toNativeType(). Add missing bitmap locking to QVGPixmapData::fromNativeType. Don't crash calling QTextDocument::blockBoundingRect on invalid block Prepare fromSymbianCFbsBitmap autotest for 16 bpp format. Fix writing to an attached property from script. fixes/improvements for new QML right-to-left docs Fix license headers in example code Add flag for forcibly propagating backing store alpha to framebuffer Fixed unmatched quotes in s60installs.pro Added setSwitchPolicy to MeeGo graphicssystem helper API. ...
Diffstat (limited to 'tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
index 104ee15..7d1b807 100644
--- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
+++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp
@@ -46,6 +46,7 @@
#include <private/qdeclarativeimage_p.h>
#include <private/qdeclarativeanimatedimage_p.h>
#include <QSignalSpy>
+#include <QtDeclarative/qdeclarativecontext.h>
#include "../shared/testhttpserver.h"
#include "../../../shared/util.h"
@@ -76,6 +77,7 @@ private slots:
void sourceSizeReadOnly();
void invalidSource();
void qtbug_16520();
+ void progressAndStatusChanges();
private:
QPixmap grabScene(QGraphicsScene *scene, int width, int height);
@@ -333,6 +335,53 @@ void tst_qdeclarativeanimatedimage::qtbug_16520()
delete anim;
}
+void tst_qdeclarativeanimatedimage::progressAndStatusChanges()
+{
+ TestHTTPServer server(14449);
+ QVERIFY(server.isValid());
+ server.serveDirectory(SRCDIR "/data");
+
+ QDeclarativeEngine engine;
+ QString componentStr = "import QtQuick 1.0\nAnimatedImage { source: srcImage }";
+ QDeclarativeContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/stickman.gif"));
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create());
+ QVERIFY(obj != 0);
+ QVERIFY(obj->status() == QDeclarativeImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+
+ QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(const QUrl &)));
+ QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal)));
+ QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QDeclarativeImageBase::Status)));
+
+ // Loading local file
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.gif"));
+ QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 1);
+ QTRY_COMPARE(progressSpy.count(), 0);
+ QTRY_COMPARE(statusSpy.count(), 0);
+
+ // Loading remote file
+ ctxt->setContextProperty("srcImage", "http://127.0.0.1:14449/stickman.gif");
+ QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready);
+ QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(sourceSpy.count(), 2);
+ QTRY_VERIFY(progressSpy.count() > 1);
+ QTRY_COMPARE(statusSpy.count(), 2);
+
+ ctxt->setContextProperty("srcImage", "");
+ QTRY_VERIFY(obj->status() == QDeclarativeImage::Null);
+ QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_COMPARE(sourceSpy.count(), 3);
+ QTRY_VERIFY(progressSpy.count() > 2);
+ QTRY_COMPARE(statusSpy.count(), 3);
+}
+
QTEST_MAIN(tst_qdeclarativeanimatedimage)
#include "tst_qdeclarativeanimatedimage.moc"