summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeimageprovider
diff options
context:
space:
mode:
authorYann Bodson <yann.bodson@nokia.com>2010-09-10 07:33:23 (GMT)
committerYann Bodson <yann.bodson@nokia.com>2010-09-10 07:33:23 (GMT)
commit003d09ab22f4d53995efc2d390c451e60afbe8c9 (patch)
tree3d19e4959d0b035a2e2ec5e63c0b41a278c958df /tests/auto/declarative/qdeclarativeimageprovider
parent4c62387c530787b0db8b159b8a535401a5bb7310 (diff)
downloadQt-003d09ab22f4d53995efc2d390c451e60afbe8c9.zip
Qt-003d09ab22f4d53995efc2d390c451e60afbe8c9.tar.gz
Qt-003d09ab22f4d53995efc2d390c451e60afbe8c9.tar.bz2
Autotests cleanup.
Diffstat (limited to 'tests/auto/declarative/qdeclarativeimageprovider')
-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 d0afc8a..d38160d 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);
}
}