diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 05:29:32 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-02-24 05:29:32 (GMT) |
commit | 40256d682e1a552c9566a744a66cc6fe008b578b (patch) | |
tree | fde8c15bc9a8622daf240638b351c1960ddf0591 /tests/auto/declarative/qdeclarativeimage | |
parent | 0f93f08d1d2dd8cbaaf80d13244c1b655f122357 (diff) | |
parent | 8848b63187cf1b073891bdd6998273a8869bb033 (diff) | |
download | Qt-40256d682e1a552c9566a744a66cc6fe008b578b.zip Qt-40256d682e1a552c9566a744a66cc6fe008b578b.tar.gz Qt-40256d682e1a552c9566a744a66cc6fe008b578b.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'tests/auto/declarative/qdeclarativeimage')
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/data/colors1.png | bin | 0 -> 1655 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp | 18 |
2 files changed, 12 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativeimage/data/colors1.png b/tests/auto/declarative/qdeclarativeimage/data/colors1.png Binary files differnew file mode 100644 index 0000000..dfb62f3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/colors1.png diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index 821386b..ed2095b 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -112,13 +112,17 @@ void tst_qdeclarativeimage::imageSource_data() { QTest::addColumn<QString>("source"); QTest::addColumn<bool>("remote"); + QTest::addColumn<bool>("async"); QTest::addColumn<QString>("error"); - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << ""; + QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << false << ""; + QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << false << true << ""; QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false - << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) "; - QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << ""; - QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true + << false << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) "; + QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << false + << true << "\"Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() + "\" "; + QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << false << ""; + QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true << false << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; } @@ -126,6 +130,7 @@ void tst_qdeclarativeimage::imageSource() { QFETCH(QString, source); QFETCH(bool, remote); + QFETCH(bool, async); QFETCH(QString, error); TestHTTPServer server(SERVER_PORT); @@ -137,13 +142,14 @@ void tst_qdeclarativeimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; asynchronous: " + + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); QVERIFY(obj != 0); - if (remote) + if (remote || async) TRY_WAIT(obj->status() == QDeclarativeImage::Loading); QCOMPARE(obj->source(), remote ? source : QUrl(source)); |