server.serveDirectory(SRCDIR "/data");
server.addRedirect("oldcolors.png", SERVER_ADDR "/colors.png");
- QString componentStr = "import QtQuick 2.0\nImage { source: srcImage }";
+ QString componentStr = "import QtQuick 2.0\nImage { source: srcImage; cache: true }";
QDeclarativeContext *ctxt = engine.rootContext();
ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/heart.png"));
QDeclarativeComponent component(&engine);
QSignalSpy statusSpy(obj, SIGNAL(statusChanged(QSGImageBase::Status)));
// Loading local file
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png"));
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/green.png"));
QTRY_VERIFY(obj->status() == QSGImage::Ready);
QTRY_VERIFY(obj->progress() == 1.0);
QTRY_COMPARE(sourceSpy.count(), 1);
QTRY_COMPARE(statusSpy.count(), 0);
// Loading remote file
- ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/heart200.png");
+ ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png");
QTRY_VERIFY(obj->status() == QSGImage::Loading);
QTRY_VERIFY(obj->progress() == 0.0);
QTRY_VERIFY(obj->status() == QSGImage::Ready);
QTRY_COMPARE(statusSpy.count(), 2);
// Loading remote file again - should not go through 'Loading' state.
- ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png"));
- ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/heart200.png");
+ ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/green.png"));
+ ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png");
QTRY_VERIFY(obj->status() == QSGImage::Ready);
QTRY_VERIFY(obj->progress() == 1.0);
QTRY_COMPARE(sourceSpy.count(), 4);