aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickimageprovider
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickimageprovider')
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
index 7f9a0efb33..b44fbfe0fc 100644
--- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -61,6 +61,8 @@ private slots:
void requestImage_sync();
void requestImage_async_data();
void requestImage_async();
+ void requestImage_async_forced_data();
+ void requestImage_async_forced();
void requestPixmap_sync_data();
void requestPixmap_sync();
@@ -81,8 +83,9 @@ private:
class TestQImageProvider : public QQuickImageProvider
{
public:
- TestQImageProvider(bool *deleteWatch = 0)
- : QQuickImageProvider(Image), deleteWatch(deleteWatch)
+ TestQImageProvider(bool *deleteWatch = 0, bool forceAsync = false)
+ : QQuickImageProvider(Image, (forceAsync ? ForceAsynchronousImageLoading : Flags()))
+ , deleteWatch(deleteWatch)
{
}
@@ -231,7 +234,11 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider)
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
- if (async)
+ // From this point on, treat forced async providers as async behaviour-wise
+ if (engine.imageProvider(QUrl(source).host()) == provider)
+ async |= provider->flags() & QQuickImageProvider::ForceAsynchronousImageLoading;
+
+ if (async)
QTRY_VERIFY(obj->status() == QQuickImage::Loading);
QCOMPARE(obj->source(), QUrl(source));
@@ -284,6 +291,18 @@ void tst_qquickimageprovider::requestImage_async()
QVERIFY(deleteWatch);
}
+void tst_qquickimageprovider::requestImage_async_forced_data()
+{
+ fillRequestTestsData("qimage|async_forced");
+}
+
+void tst_qquickimageprovider::requestImage_async_forced()
+{
+ bool deleteWatch = false;
+ runTest(false, new TestQImageProvider(&deleteWatch, true));
+ QVERIFY(deleteWatch);
+}
+
void tst_qquickimageprovider::requestPixmap_sync_data()
{
fillRequestTestsData("qpixmap");