aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickimage/tst_qquickimage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick/qquickimage/tst_qquickimage.cpp')
-rw-r--r--tests/auto/quick/qquickimage/tst_qquickimage.cpp56
1 files changed, 28 insertions, 28 deletions
diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
index 337bb6606b..71e9d747f4 100644
--- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp
+++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp
@@ -121,7 +121,7 @@ void tst_qquickimage::noSource()
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
QCOMPARE(obj->source(), QUrl());
- QVERIFY(obj->status() == QQuickImage::Null);
+ QCOMPARE(obj->status(), QQuickImage::Null);
QCOMPARE(obj->width(), 0.);
QCOMPARE(obj->height(), 0.);
QCOMPARE(obj->fillMode(), QQuickImage::Stretch);
@@ -211,18 +211,18 @@ void tst_qquickimage::imageSource()
QVERIFY(!obj->cache());
if (remote || async)
- QTRY_VERIFY(obj->status() == QQuickImage::Loading);
+ QTRY_COMPARE(obj->status(), QQuickImage::Loading);
QCOMPARE(obj->source(), remote ? source : QUrl(source));
if (error.isEmpty()) {
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
QCOMPARE(obj->width(), qreal(width));
QCOMPARE(obj->height(), qreal(height));
QCOMPARE(obj->fillMode(), QQuickImage::Stretch);
QCOMPARE(obj->progress(), 1.0);
} else {
- QTRY_VERIFY(obj->status() == QQuickImage::Error);
+ QTRY_COMPARE(obj->status(), QQuickImage::Error);
}
delete obj;
@@ -237,14 +237,14 @@ void tst_qquickimage::clearSource()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
- QVERIFY(obj->status() == QQuickImage::Ready);
+ QCOMPARE(obj->status(), QQuickImage::Ready);
QCOMPARE(obj->width(), 120.);
QCOMPARE(obj->height(), 120.);
QCOMPARE(obj->progress(), 1.0);
ctxt->setContextProperty("srcImage", "");
QVERIFY(obj->source().isEmpty());
- QVERIFY(obj->status() == QQuickImage::Null);
+ QCOMPARE(obj->status(), QQuickImage::Null);
QCOMPARE(obj->width(), 0.);
QCOMPARE(obj->height(), 0.);
QCOMPARE(obj->progress(), 0.0);
@@ -545,7 +545,7 @@ void tst_qquickimage::noLoading()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
- QVERIFY(obj->status() == QQuickImage::Ready);
+ QCOMPARE(obj->status(), QQuickImage::Ready);
QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(QUrl)));
QSignalSpy progressSpy(obj, SIGNAL(progressChanged(qreal)));
@@ -553,18 +553,18 @@ void tst_qquickimage::noLoading()
// Loading local file
ctxt->setContextProperty("srcImage", testFileUrl("green.png"));
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
- QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
+ QTRY_COMPARE(obj->progress(), 1.0);
QTRY_COMPARE(sourceSpy.count(), 1);
QTRY_COMPARE(progressSpy.count(), 0);
QTRY_COMPARE(statusSpy.count(), 1);
// Loading remote file
ctxt->setContextProperty("srcImage", server.url("/rect.png"));
- QTRY_VERIFY(obj->status() == QQuickImage::Loading);
- QTRY_VERIFY(obj->progress() == 0.0);
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
- QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Loading);
+ QTRY_COMPARE(obj->progress(), 0.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
+ QTRY_COMPARE(obj->progress(), 1.0);
QTRY_COMPARE(sourceSpy.count(), 2);
QTRY_VERIFY(progressSpy.count() >= 2);
QTRY_COMPARE(statusSpy.count(), 3);
@@ -573,8 +573,8 @@ void tst_qquickimage::noLoading()
progressSpy.clear();
ctxt->setContextProperty("srcImage", testFileUrl("green.png"));
ctxt->setContextProperty("srcImage", server.url("/rect.png"));
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
- QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
+ QTRY_COMPARE(obj->progress(), 1.0);
QTRY_COMPARE(sourceSpy.count(), 4);
QTRY_COMPARE(progressSpy.count(), 0);
QTRY_COMPARE(statusSpy.count(), 5);
@@ -628,7 +628,7 @@ void tst_qquickimage::sourceSize_QTBUG_14303()
QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged()));
QTRY_VERIFY(obj != 0);
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
QTRY_COMPARE(obj->sourceSize().width(), 200);
QTRY_COMPARE(obj->sourceSize().height(), 200);
@@ -844,8 +844,8 @@ void tst_qquickimage::progressAndStatusChanges()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
QVERIFY(obj != 0);
- QVERIFY(obj->status() == QQuickImage::Ready);
- QTRY_VERIFY(obj->progress() == 1.0);
+ QCOMPARE(obj->status(), QQuickImage::Ready);
+ QTRY_COMPARE(obj->progress(), 1.0);
qRegisterMetaType<QQuickImageBase::Status>();
QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(QUrl)));
@@ -854,33 +854,33 @@ void tst_qquickimage::progressAndStatusChanges()
// Same image
ctxt->setContextProperty("srcImage", testFileUrl("heart.png"));
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
- QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
+ QTRY_COMPARE(obj->progress(), 1.0);
QTRY_COMPARE(sourceSpy.count(), 0);
QTRY_COMPARE(progressSpy.count(), 0);
QTRY_COMPARE(statusSpy.count(), 0);
// Loading local file
ctxt->setContextProperty("srcImage", testFileUrl("colors.png"));
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
- QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
+ QTRY_COMPARE(obj->progress(), 1.0);
QTRY_COMPARE(sourceSpy.count(), 1);
QTRY_COMPARE(progressSpy.count(), 0);
QTRY_COMPARE(statusSpy.count(), 1);
// Loading remote file
ctxt->setContextProperty("srcImage", server.url("/heart.png"));
- QTRY_VERIFY(obj->status() == QQuickImage::Loading);
- QTRY_VERIFY(obj->progress() == 0.0);
- QTRY_VERIFY(obj->status() == QQuickImage::Ready);
- QTRY_VERIFY(obj->progress() == 1.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Loading);
+ QTRY_COMPARE(obj->progress(), 0.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Ready);
+ QTRY_COMPARE(obj->progress(), 1.0);
QTRY_COMPARE(sourceSpy.count(), 2);
QTRY_VERIFY(progressSpy.count() > 1);
QTRY_COMPARE(statusSpy.count(), 3);
ctxt->setContextProperty("srcImage", "");
- QTRY_VERIFY(obj->status() == QQuickImage::Null);
- QTRY_VERIFY(obj->progress() == 0.0);
+ QTRY_COMPARE(obj->status(), QQuickImage::Null);
+ QTRY_COMPARE(obj->progress(), 0.0);
QTRY_COMPARE(sourceSpy.count(), 3);
QTRY_VERIFY(progressSpy.count() > 2);
QTRY_COMPARE(statusSpy.count(), 4);