summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp26
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp14
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp34
-rw-r--r--src/declarative/util/qdeclarativepixmapcache_p.h3
-rw-r--r--src/imports/particles/qdeclarativeparticles.cpp10
-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
11 files changed, 101 insertions, 44 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 420ed90..be9d8bd 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -43,6 +43,7 @@
#include "private/qdeclarativeborderimage_p_p.h"
#include <qdeclarativeengine.h>
+#include <qdeclarativeinfo.h>
#include <QNetworkRequest>
#include <QNetworkReply>
@@ -218,7 +219,8 @@ void QDeclarativeBorderImage::load()
}
} else {
QSize impsize;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, &impsize, d->async);
+ QString errorString;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async);
if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url);
d->pendingPixmapCache = true;
@@ -230,8 +232,10 @@ void QDeclarativeBorderImage::load()
setImplicitWidth(impsize.width());
setImplicitHeight(impsize.height());
- if (d->pix.isNull())
+ if (d->pix.isNull()) {
d->status = Error;
+ qmlInfo(this) << errorString;
+ }
if (d->status == Loading)
d->status = Ready;
d->progress = 1.0;
@@ -338,7 +342,8 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma
d->sciurl = d->url.resolved(QUrl(sci.pixmapUrl()));
QSize impsize;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->sciurl, &d->pix, &impsize, d->async);
+ QString errorString;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->sciurl, &d->pix, &errorString, &impsize, d->async);
if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->sciurl);
d->sciPendingPixmapCache = true;
@@ -367,8 +372,10 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma
setImplicitWidth(impsize.width());
setImplicitHeight(impsize.height());
- if (d->pix.isNull())
+ if (d->pix.isNull()) {
d->status = Error;
+ qmlInfo(this) << errorString;
+ }
if (d->status == Loading)
d->status = Ready;
d->progress = 1.0;
@@ -386,11 +393,18 @@ void QDeclarativeBorderImage::requestFinished()
QSize impsize;
if (d->url.path().endsWith(QLatin1String(".sci"))) {
d->sciPendingPixmapCache = false;
- QDeclarativePixmapCache::get(d->sciurl, &d->pix, &impsize, d->async);
+ QString errorString;
+ if (QDeclarativePixmapCache::get(d->sciurl, &d->pix, &errorString, &impsize, d->async) != QDeclarativePixmapReply::Ready) {
+ d->status = Error;
+ qmlInfo(this) << errorString;
+ }
} else {
d->pendingPixmapCache = false;
- if (QDeclarativePixmapCache::get(d->url, &d->pix, &impsize, d->async) != QDeclarativePixmapReply::Ready)
+ QString errorString;
+ if (QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async) != QDeclarativePixmapReply::Ready) {
d->status = Error;
+ qmlInfo(this) << errorString;
+ }
}
setImplicitWidth(impsize.width());
setImplicitHeight(impsize.height());
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index 3acafe8..c3f8195 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -43,6 +43,7 @@
#include "private/qdeclarativeimagebase_p_p.h"
#include <qdeclarativeengine.h>
+#include <qdeclarativeinfo.h>
#include <qdeclarativepixmapcache_p.h>
#include <QFile>
@@ -154,7 +155,8 @@ void QDeclarativeImageBase::load()
int reqwidth = d->sourcesize.width();
int reqheight = d->sourcesize.height();
QSize impsize;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, &impsize, d->async, reqwidth, reqheight);
+ QString errorString;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async, reqwidth, reqheight);
if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url, reqwidth, reqheight);
d->pendingPixmapCache = true;
@@ -191,6 +193,7 @@ void QDeclarativeImageBase::load()
emit sourceSizeChanged();
} else {
d->status = Error;
+ qmlInfo(this) << errorString;
}
d->progress = 1.0;
emit statusChanged(d->status);
@@ -210,8 +213,11 @@ void QDeclarativeImageBase::requestFinished()
d->pendingPixmapCache = false;
QSize impsize;
- if (QDeclarativePixmapCache::get(d->url, &d->pix, &impsize, d->async, d->sourcesize.width(), d->sourcesize.height()) != QDeclarativePixmapReply::Ready)
+ QString errorString;
+ if (QDeclarativePixmapCache::get(d->url, &d->pix, &errorString, &impsize, d->async, d->sourcesize.width(), d->sourcesize.height()) != QDeclarativePixmapReply::Ready) {
d->status = Error;
+ qmlInfo(this) << errorString;
+ }
setImplicitWidth(impsize.width());
setImplicitHeight(impsize.height());
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 3b39fa4..9fcfd92 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -45,6 +45,7 @@
#include <qdeclarativeinfo.h>
#include <qdeclarativepixmapcache_p.h>
+#include <QSet>
#include <QTextLayout>
#include <QTextLine>
#include <QTextDocument>
@@ -75,10 +76,16 @@ protected:
if (type == QTextDocument::ImageResource) {
QPixmap pm;
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(url, &pm, 0, true, 0, 0);
+ QString errorString;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(url, &pm, &errorString, 0, true, 0, 0);
if (status == QDeclarativePixmapReply::Ready)
return pm;
- if (status != QDeclarativePixmapReply::Error) {
+ if (status == QDeclarativePixmapReply::Error) {
+ if (!errors.contains(url)) {
+ errors.insert(url);
+ qmlInfo(parent()) << errorString;
+ }
+ } else {
QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(parent()), url);
connect(reply, SIGNAL(finished()), this, SLOT(requestFinished()));
outstanding++;
@@ -98,8 +105,11 @@ private slots:
private:
int outstanding;
+ static QSet<QUrl> errors;
};
+QSet<QUrl> QTextDocumentWithImageResources::errors;
+
/*!
\qmlclass Text QDeclarativeText
\since 4.7
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index 5e60819..4a96a2a 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -194,8 +194,8 @@ static bool readImage(const QUrl& url, QIODevice *dev, QImage *image, QString *e
return true;
} else {
if (errorString)
- *errorString = QLatin1String("Error decoding: ") + url.toString()
- + QLatin1String(" \"") + imgio.errorString() + QLatin1String("\"");
+ *errorString = QDeclarativeImageRequestHandler::tr("Error decoding: %1: %2").arg(url.toString())
+ .arg(imgio.errorString());
return false;
}
}
@@ -264,7 +264,7 @@ bool QDeclarativeImageRequestHandler::event(QEvent *event)
QString errorStr;
if (image.isNull()) {
errorCode = QDeclarativeImageReaderEvent::Loading;
- errorStr = QLatin1String("Failed to get image from provider: ") + url.toString();
+ errorStr = QDeclarativeImageRequestHandler::tr("Failed to get image from provider: %1").arg(url.toString());
}
QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image));
} else {
@@ -283,7 +283,7 @@ bool QDeclarativeImageRequestHandler::event(QEvent *event)
errorCode = QDeclarativeImageReaderEvent::Loading;
}
} else {
- errorStr = QLatin1String("Cannot open: ") + url.toString();
+ errorStr = QDeclarativeImageRequestHandler::tr("Cannot open: %1").arg(url.toString());
errorCode = QDeclarativeImageReaderEvent::Loading;
}
QCoreApplication::postEvent(runningJob, new QDeclarativeImageReaderEvent(errorCode, errorStr, image));
@@ -460,6 +460,7 @@ public:
bool loading;
QDeclarativeImageReader *reader;
int forced_width, forced_height;
+ QString errorString;
};
@@ -511,7 +512,7 @@ bool QDeclarativePixmapReply::event(QEvent *event)
if (d->status == Ready)
d->pixmap = QPixmap::fromImage(de->image);
else
- qWarning() << de->errorString;
+ d->errorString = de->errorString;
QByteArray key = d->url.toEncoded(QUrl::FormattingOption(0x100));
QString strKey = QString::fromLatin1(key.constData(), key.count());
QPixmapCache::insert(strKey, d->pixmap); // note: may fail (returns false)
@@ -523,6 +524,12 @@ bool QDeclarativePixmapReply::event(QEvent *event)
return QObject::event(event);
}
+QString QDeclarativePixmapReply::errorString() const
+{
+ Q_D(const QDeclarativePixmapReply);
+ return d->errorString;
+}
+
QDeclarativePixmapReply::Status QDeclarativePixmapReply::status() const
{
Q_D(const QDeclarativePixmapReply);
@@ -586,7 +593,7 @@ bool QDeclarativePixmapReply::release(bool defer)
Note that images sourced from the network will always be loaded and
decoded asynchonously.
*/
-QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QPixmap *pixmap, QSize *impsize, bool async, int req_width, int req_height)
+QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QPixmap *pixmap, QString *errorString, QSize *impsize, bool async, int req_width, int req_height)
{
QDeclarativePixmapReply::Status status = QDeclarativePixmapReply::Unrequested;
QByteArray key = url.toEncoded(QUrl::FormattingOption(0x100));
@@ -609,17 +616,16 @@ QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QP
QFile f(lf);
QSize read_impsize;
if (f.open(QIODevice::ReadOnly)) {
- QString errorString;
QImage image;
- if (readImage(url, &f, &image, &errorString, &read_impsize, req_width, req_height)) {
+ if (readImage(url, &f, &image, errorString, &read_impsize, req_width, req_height)) {
*pixmap = QPixmap::fromImage(image);
} else {
- qWarning() << errorString;
*pixmap = QPixmap();
status = QDeclarativePixmapReply::Error;
}
} else {
- qWarning() << "Cannot open" << url;
+ if (errorString)
+ *errorString = QDeclarativeImageRequestHandler::tr("Cannot open: %1").arg(url.toString());
*pixmap = QPixmap();
status = QDeclarativePixmapReply::Error;
}
@@ -650,9 +656,15 @@ QDeclarativePixmapReply::Status QDeclarativePixmapCache::get(const QUrl& url, QP
} else if (QPixmapCache::find(strKey, pixmap)) {
if (iter != qmlActivePixmapReplies()->end()) {
status = (*iter)->status();
+ if (errorString)
+ *errorString = (*iter)->errorString();
(*iter)->release();
+ } else if (pixmap->isNull()) {
+ status = QDeclarativePixmapReply::Error;
+ if (errorString)
+ *errorString = QDeclarativeImageRequestHandler::tr("Unknown Error loading %1").arg(url);
} else {
- status = pixmap->isNull() ? QDeclarativePixmapReply::Error : QDeclarativePixmapReply::Ready;
+ status = QDeclarativePixmapReply::Ready;
}
} else if (iter != qmlActivePixmapReplies()->end()) {
status = QDeclarativePixmapReply::Loading;
diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h
index df71d65..7b94728 100644
--- a/src/declarative/util/qdeclarativepixmapcache_p.h
+++ b/src/declarative/util/qdeclarativepixmapcache_p.h
@@ -64,6 +64,7 @@ public:
enum Status { Ready, Error, Unrequested, Loading };
Status status() const;
+ QString errorString() const;
const QUrl &url() const;
int forcedWidth() const;
@@ -95,7 +96,7 @@ private:
class Q_DECLARATIVE_EXPORT QDeclarativePixmapCache
{
public:
- static QDeclarativePixmapReply::Status get(const QUrl& url, QPixmap *pixmap, QSize *impsize=0, bool async=false, int req_width=0, int req_height=0);
+ static QDeclarativePixmapReply::Status get(const QUrl& url, QPixmap *pixmap, QString *errorString, QSize *impsize=0, bool async=false, int req_width=0, int req_height=0);
static QDeclarativePixmapReply *request(QDeclarativeEngine *, const QUrl& url, int req_width=0, int req_height=0);
static void cancel(const QUrl& url, QObject *obj);
static int pendingRequests();
diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp
index d17a8a1..264cba2 100644
--- a/src/imports/particles/qdeclarativeparticles.cpp
+++ b/src/imports/particles/qdeclarativeparticles.cpp
@@ -41,6 +41,7 @@
#include "qdeclarativeparticles_p.h"
+#include <qdeclarativeinfo.h>
#include <private/qdeclarativeitem_p.h>
#include <private/qdeclarativepixmapcache_p.h>
@@ -730,7 +731,9 @@ void QDeclarativeParticles::imageLoaded()
{
Q_D(QDeclarativeParticles);
d->pendingPixmapCache = false;
- QDeclarativePixmapCache::get(d->url, &d->image);
+ QString errorString;
+ if (QDeclarativePixmapCache::get(d->url, &d->image, &errorString)==QDeclarativePixmapReply::Error)
+ qmlInfo(this) << errorString;
d->paintItem->updateSize();
d->paintItem->update();
}
@@ -754,12 +757,15 @@ void QDeclarativeParticles::setSource(const QUrl &name)
} else {
d->url = name;
Q_ASSERT(!name.isRelative());
- QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->image);
+ QString errorString;
+ QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(d->url, &d->image, &errorString);
if (status != QDeclarativePixmapReply::Ready && status != QDeclarativePixmapReply::Error) {
QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(qmlEngine(this), d->url);
connect(reply, SIGNAL(finished()), this, SLOT(imageLoaded()));
d->pendingPixmapCache = true;
} else {
+ if (status == QDeclarativePixmapReply::Error)
+ qmlInfo(this) << errorString;
//### unify with imageLoaded
d->paintItem->updateSize();
d->paintItem->update();
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()