diff options
author | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-14 14:38:07 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-15 14:00:16 +0000 |
commit | 383465e908c880c00546dc182424b5de17b63de6 (patch) | |
tree | 6c4745c54e744c1948b4c71ca0a5ad90b7519394 /tests/auto/quick/qquickimage | |
parent | 4b72f48637a87c95deedcc501cd9cc8f717117fa (diff) |
Stabilize tst_qquickimage::noLoading
The test loads an image from a remote source and it has a QSignalSpy installed
for the progressChanged(qreal) signal on the QQuickImage. The test counts the
number of times the signal is emitted and expects it to hit an exact value.
That seems wrong when loading an image over the network, as we have no control
over in what pieces the data arrives on our end. And as it turns out, the test
occasionally fails in the CI system, which is also reproducible.
To stabilize the test, we now expect at least two emissions of the signal when
loading from the network (0% and 100%) but there may be more (0% 10% 80% 100%
for example). In addition the reload case is simplified by resetting the spy
and verifying that progressChanged was not emitted at all.
Change-Id: Ib2e660651d40b92eff889ebe3baabb74d6e00fb4
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Reviewed-by: Albert Astals Cid <albert.astals@canonical.com>
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
Diffstat (limited to 'tests/auto/quick/qquickimage')
-rw-r--r-- | tests/auto/quick/qquickimage/tst_qquickimage.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index 69c39b41d2..b8c0f6a22a 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -555,16 +555,17 @@ void tst_qquickimage::noLoading() QTRY_VERIFY(obj->status() == QQuickImage::Ready); QTRY_VERIFY(obj->progress() == 1.0); QTRY_COMPARE(sourceSpy.count(), 2); - QTRY_COMPARE(progressSpy.count(), 2); + QTRY_VERIFY(progressSpy.count() >= 2); QTRY_COMPARE(statusSpy.count(), 3); // Loading remote file again - should not go through 'Loading' state. + progressSpy.clear(); ctxt->setContextProperty("srcImage", testFileUrl("green.png")); ctxt->setContextProperty("srcImage", QString(SERVER_ADDR) + "/rect.png"); QTRY_VERIFY(obj->status() == QQuickImage::Ready); QTRY_VERIFY(obj->progress() == 1.0); QTRY_COMPARE(sourceSpy.count(), 4); - QTRY_COMPARE(progressSpy.count(), 2); + QTRY_COMPARE(progressSpy.count(), 0); QTRY_COMPARE(statusSpy.count(), 5); delete obj; |