aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickimage/tst_qquickimage.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-24 15:32:22 +0200
committerFriedemann Kleint <Friedemann.Kleint@theqtcompany.com>2015-07-27 18:45:21 +0000
commite6846850a51cbe2a8cc8b9398430d1dd4f6ac7b3 (patch)
treeee08e04b3f0eca16f7f12f2c2392eee9dbae41d8 /tests/auto/quick/qquickimage/tst_qquickimage.cpp
parent0959281be22c2d3317f010ac117010fdf990df7a (diff)
tests/quick: Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b).
- Replace Q[TRY]_VERIFY(pointer == 0) by Q[TRY]_VERIFY(!pointer). - Replace Q[TRY]_VERIFY(smartPointer == 0) by Q[TRY]_VERIFY(smartPointer.isNull()). - Replace Q[TRY]_VERIFY(a == b) by Q[TRY]_COMPARE(a, b) and add casts where necessary. The values will then be logged should a test fail. Change-Id: Ib9f4c2486af23c47990be4b9e004b965de226dcc Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
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);