summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-04-15 06:17:39 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-04-15 06:17:39 (GMT)
commitc24d3ce5d268e6e91bcecb155e4e2f5bd9c7dadd (patch)
treeffa44136301cc0f5772bbba48a32f8367f17d9b6 /tests
parentaad82abd84022f5401c6b79ab15d24abebf082af (diff)
downloadQt-c24d3ce5d268e6e91bcecb155e4e2f5bd9c7dadd.zip
Qt-c24d3ce5d268e6e91bcecb155e4e2f5bd9c7dadd.tar.gz
Qt-c24d3ce5d268e6e91bcecb155e4e2f5bd9c7dadd.tar.bz2
Use qmlInfo for image loading errors, not qWarning().
Task-number: QTBUG-9908
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp4
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp9
-rw-r--r--tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp8
-rw-r--r--tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp23
-rw-r--r--tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp4
5 files changed, 28 insertions, 20 deletions
diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
index 0f03527..8621239 100644
--- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
+++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp
@@ -121,10 +121,10 @@ void tst_qdeclarativeborderimage::imageSource_data()
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << "";
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() + "\" ) ";
+ << "QML BorderImage (file::2:1) Cannot open: " + 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
- << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" ";
+ << "QML BorderImage (file::2:1) Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
}
void tst_qdeclarativeborderimage::imageSource()
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index 53c208e..854bcdd 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -124,13 +124,14 @@ void tst_qdeclarativeimage::imageSource_data()
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << 120.0 << 120.0 << false << false << "";
QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << 120.0 << 120.0 << false << true << "";
QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << 0.0 << 0.0 << false
- << false << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) ";
+ << false << "QML Image (file::2:1) Cannot open: " + 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() << 0.0 << 0.0 << false
- << true << "\"Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() + "\" ";
+ << true << "QML Image (file::2:1) Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString();
QTest::newRow("remote") << SERVER_ADDR "/colors.png" << 120.0 << 120.0 << true << false << "";
QTest::newRow("remote svg") << SERVER_ADDR "/heart.svg" << 550.0 << 500.0 << true << false << "";
- QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true << false
- << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" ";
+ QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << 0.0 << 0.0 << true
+ << false << "QML Image (file::2:1) Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found";
+
}
void tst_qdeclarativeimage::imageSource()
diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
index 162c266..aca951b 100644
--- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
+++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
@@ -96,9 +96,10 @@ void tst_qdeclarativeimageprovider::imageSource_data()
QTest::newRow("exists") << "image://test/exists.png" << "" << QSize(100,100) << "";
QTest::newRow("scaled") << "image://test/exists.png" << "sourceSize: \"80x30\"" << QSize(80,30) << "";
QTest::newRow("missing") << "image://test/no-such-file.png" << "" << QSize()
- << "\"Failed to get image from provider: image://test/no-such-file.png\" ";
+ << "QML Image (file::2:1) Failed to get image from provider: image://test/no-such-file.png";
QTest::newRow("unknown provider") << "image://bogus/exists.png" << "" << QSize()
- << "\"Failed to get image from provider: image://bogus/exists.png\" ";
+ << "QML Image (file::2:1) Failed to get image from provider: image://bogus/exists.png";
+
}
void tst_qdeclarativeimageprovider::imageSource()
@@ -157,7 +158,8 @@ void tst_qdeclarativeimageprovider::removeProvider()
QCOMPARE(obj->width(), 100.0);
// remove the provider and confirm
- QString error("\"Failed to get image from provider: image://test2/exists2.png\" ");
+ QString error("QML Image (file::2:1) Failed to get image from provider: image://test2/exists2.png");
+
QTest::ignoreMessage(QtWarningMsg, error.toUtf8());
engine.removeImageProvider("test2");
diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
index f2ccf80..0cc13ad 100644
--- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
+++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp
@@ -126,19 +126,20 @@ void tst_qdeclarativepixmapcache::single()
QFETCH(bool, exists);
QFETCH(bool, neterror);
+ QString expectedError;
if (neterror) {
- QString expected = "\"Error downloading " + target.toString() + " - server replied: Not found\" ";
- QTest::ignoreMessage(QtWarningMsg, expected.toLatin1());
+ expectedError = "Error downloading " + target.toString() + " - server replied: Not found";
} else if (!exists) {
- QString expected = "Cannot open QUrl( \"" + target.toString() + "\" ) ";
- QTest::ignoreMessage(QtWarningMsg, expected.toLatin1());
+ expectedError = "Cannot open: " + target.toString();
}
QPixmap pixmap;
QVERIFY(pixmap.width() <= 0); // Check Qt assumption
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap);
+ QString errorString;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap, &errorString);
if (incache) {
+ QCOMPARE(errorString, expectedError);
if (exists) {
QVERIFY(status == QDeclarativePixmapReply::Ready);
QVERIFY(pixmap.width() > 0);
@@ -156,13 +157,15 @@ void tst_qdeclarativepixmapcache::single()
QTestEventLoop::instance().enterLoop(10);
QVERIFY(!QTestEventLoop::instance().timeout());
QVERIFY(getter.gotslot);
+ QString errorString;
if (exists) {
- QVERIFY(QDeclarativePixmapCache::get(target, &pixmap) == QDeclarativePixmapReply::Ready);
+ QVERIFY(QDeclarativePixmapCache::get(target, &pixmap, &errorString) == QDeclarativePixmapReply::Ready);
QVERIFY(pixmap.width() > 0);
} else {
- QVERIFY(QDeclarativePixmapCache::get(target, &pixmap) == QDeclarativePixmapReply::Error);
+ QVERIFY(QDeclarativePixmapCache::get(target, &pixmap, &errorString) == QDeclarativePixmapReply::Error);
QVERIFY(pixmap.width() <= 0);
}
+ QCOMPARE(errorString, expectedError);
}
QCOMPARE(QDeclarativePixmapCache::pendingRequests(), 0);
@@ -236,7 +239,8 @@ void tst_qdeclarativepixmapcache::parallel()
for (int i=0; i<targets.count(); ++i) {
QUrl target = targets.at(i);
QPixmap pixmap;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap);
+ QString errorString;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap, &errorString);
QDeclarativePixmapReply *reply = 0;
QVERIFY(status != QDeclarativePixmapReply::Error);
if (status != QDeclarativePixmapReply::Error && status != QDeclarativePixmapReply::Ready)
@@ -273,7 +277,8 @@ void tst_qdeclarativepixmapcache::parallel()
} else {
QVERIFY(getters[i]->gotslot);
QPixmap pixmap;
- QVERIFY(QDeclarativePixmapCache::get(targets[i], &pixmap) == QDeclarativePixmapReply::Ready);
+ QString errorString;
+ QVERIFY(QDeclarativePixmapCache::get(targets[i], &pixmap, &errorString) == QDeclarativePixmapReply::Ready);
QVERIFY(pixmap.width() > 0);
}
delete getters[i];
diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
index 53640d0..ca7dfe7 100644
--- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
+++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp
@@ -871,10 +871,10 @@ void tst_qdeclarativetext::embeddedImages_data()
QTest::addColumn<QString>("error");
QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocal.qml") << "";
QTest::newRow("local-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml")
- << "\"Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/http/notexists.png").toString() + "\" ";
+ << "QML Text ("+QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesLocalError.qml").toString()+":3:1) Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/http/notexists.png").toString();
QTest::newRow("remote") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemote.qml") << "";
QTest::newRow("remote-error") << QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml")
- << "\"Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found\" ";
+ << "QML Text ("+QUrl::fromLocalFile(SRCDIR "/data/embeddedImagesRemoteError.qml").toString()+":3:1) Error downloading http://127.0.0.1:14453/notexists.png - server replied: Not found";
}
void tst_qdeclarativetext::embeddedImages()