summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp')
-rw-r--r--tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp21
1 files changed, 5 insertions, 16 deletions
diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
index d0afc8a688..d38160d28f 100644
--- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
+++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp
@@ -45,26 +45,15 @@
#include <private/qdeclarativeimage_p.h>
#include <QImageReader>
#include <QWaitCondition>
+#include "../../../shared/util.h"
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
#define SRCDIR "."
#endif
-// QDeclarativeImageProvider::request() is run in an idle thread where possible
-// Be generous in our timeout.
-#define TRY_WAIT(expr) \
- do { \
- for (int ii = 0; ii < 10; ++ii) { \
- if ((expr)) break; \
- QTest::qWait(100); \
- } \
- QVERIFY((expr)); \
- } while (false)
-
Q_DECLARE_METATYPE(QDeclarativeImageProvider*);
-
class tst_qdeclarativeimageprovider : public QObject
{
Q_OBJECT
@@ -212,13 +201,13 @@ void tst_qdeclarativeimageprovider::runTest(bool async, QDeclarativeImageProvide
QVERIFY(obj != 0);
if (async)
- TRY_WAIT(obj->status() == QDeclarativeImage::Loading);
+ QTRY_VERIFY(obj->status() == QDeclarativeImage::Loading);
QCOMPARE(obj->source(), QUrl(source));
if (error.isEmpty()) {
if (async)
- TRY_WAIT(obj->status() == QDeclarativeImage::Ready);
+ QTRY_VERIFY(obj->status() == QDeclarativeImage::Ready);
else
QVERIFY(obj->status() == QDeclarativeImage::Ready);
QCOMPARE(obj->width(), qreal(size.width()));
@@ -229,7 +218,7 @@ void tst_qdeclarativeimageprovider::runTest(bool async, QDeclarativeImageProvide
QCOMPARE(obj->progress(), 1.0);
} else {
if (async)
- TRY_WAIT(obj->status() == QDeclarativeImage::Error);
+ QTRY_VERIFY(obj->status() == QDeclarativeImage::Error);
else
QVERIFY(obj->status() == QDeclarativeImage::Error);
}
@@ -391,7 +380,7 @@ void tst_qdeclarativeimageprovider::threadTest()
provider->cond.wakeAll();
QTest::qWait(250);
foreach(QDeclarativeImage *img, images) {
- TRY_WAIT(img->status() == QDeclarativeImage::Ready);
+ QTRY_VERIFY(img->status() == QDeclarativeImage::Ready);
}
}