aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickimageprovider
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /tests/auto/quick/qquickimageprovider
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff)
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickimageprovider')
-rw-r--r--tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
index 98f3972cef..4298bc198b 100644
--- a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
+++ b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp
@@ -76,7 +76,7 @@ private:
class TestQImageProvider : public QQuickImageProvider
{
public:
- TestQImageProvider(bool *deleteWatch = 0, bool forceAsync = false)
+ TestQImageProvider(bool *deleteWatch = nullptr, bool forceAsync = false)
: QQuickImageProvider(Image, (forceAsync ? ForceAsynchronousImageLoading : Flags()))
, deleteWatch(deleteWatch)
{
@@ -114,7 +114,7 @@ Q_DECLARE_METATYPE(TestQImageProvider*);
class TestQPixmapProvider : public QQuickImageProvider
{
public:
- TestQPixmapProvider(bool *deleteWatch = 0)
+ TestQPixmapProvider(bool *deleteWatch = nullptr)
: QQuickImageProvider(Pixmap), deleteWatch(deleteWatch)
{
}
@@ -217,7 +217,7 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider)
QQmlEngine engine;
engine.addImageProvider("test", provider);
- QVERIFY(engine.imageProvider("test") != 0);
+ QVERIFY(engine.imageProvider("test") != nullptr);
QString componentStr = "import QtQuick 2.0\nImage { source: \"" + source + "\"; "
+ (async ? "asynchronous: true; " : "")
@@ -225,7 +225,7 @@ void tst_qquickimageprovider::runTest(bool async, QQuickImageProvider *provider)
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
- QVERIFY(obj != 0);
+ QVERIFY(obj != nullptr);
// From this point on, treat forced async providers as async behaviour-wise
if (engine.imageProvider(QUrl(source).host()) == provider)
@@ -314,14 +314,14 @@ void tst_qquickimageprovider::requestPixmap_async()
QQuickImageProvider *provider = new TestQPixmapProvider();
engine.addImageProvider("test", provider);
- QVERIFY(engine.imageProvider("test") != 0);
+ QVERIFY(engine.imageProvider("test") != nullptr);
// pixmaps are loaded synchronously regardless of 'asynchronous' value
QString componentStr = "import QtQuick 2.0\nImage { asynchronous: true; source: \"image://test/pixmap-async-test.png\" }";
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
- QVERIFY(obj != 0);
+ QVERIFY(obj != nullptr);
delete obj;
}
@@ -341,14 +341,14 @@ void tst_qquickimageprovider::removeProvider()
QQmlEngine engine;
engine.addImageProvider("test", provider);
- QVERIFY(engine.imageProvider("test") != 0);
+ QVERIFY(engine.imageProvider("test") != nullptr);
// add provider, confirm it works
QString componentStr = "import QtQuick 2.0\nImage { source: \"" + newImageFileName() + "\" }";
QQmlComponent component(&engine);
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QQuickImage *obj = qobject_cast<QQuickImage*>(component.create());
- QVERIFY(obj != 0);
+ QVERIFY(obj != nullptr);
QCOMPARE(obj->status(), QQuickImage::Ready);
@@ -384,7 +384,7 @@ void tst_qquickimageprovider::imageProviderId()
TestQImageProvider *provider = new TestQImageProvider(&deleteWatch);
engine.addImageProvider(providerId, provider);
- QVERIFY(engine.imageProvider(providerId) != 0);
+ QVERIFY(engine.imageProvider(providerId) != nullptr);
engine.removeImageProvider(providerId);
QVERIFY(deleteWatch);
@@ -428,7 +428,7 @@ void tst_qquickimageprovider::threadTest()
TestThreadProvider *provider = new TestThreadProvider;
engine.addImageProvider("test_thread", provider);
- QVERIFY(engine.imageProvider("test_thread") != 0);
+ QVERIFY(engine.imageProvider("test_thread") != nullptr);
QString componentStr = "import QtQuick 2.0\nItem { \n"
"Image { source: \"image://test_thread/blue\"; asynchronous: true; }\n"
@@ -440,7 +440,7 @@ void tst_qquickimageprovider::threadTest()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QObject *obj = component.create();
//MUST not deadlock
- QVERIFY(obj != 0);
+ QVERIFY(obj != nullptr);
QList<QQuickImage *> images = obj->findChildren<QQuickImage *>();
QCOMPARE(images.count(), 4);
QTest::qWait(100);
@@ -459,7 +459,7 @@ class TestImageResponse : public QQuickImageResponse, public QRunnable
{
public:
TestImageResponse(QMutex *lock, QWaitCondition *condition, bool *ok, const QString &id, const QSize &requestedSize)
- : m_lock(lock), m_condition(condition), m_ok(ok), m_id(id), m_requestedSize(requestedSize), m_texture(0)
+ : m_lock(lock), m_condition(condition), m_ok(ok), m_id(id), m_requestedSize(requestedSize), m_texture(nullptr)
{
setAutoDelete(false);
}
@@ -523,7 +523,7 @@ void tst_qquickimageprovider::asyncTextureTest()
TestAsyncProvider *provider = new TestAsyncProvider;
engine.addImageProvider("test_async", provider);
- QVERIFY(engine.imageProvider("test_async") != 0);
+ QVERIFY(engine.imageProvider("test_async") != nullptr);
QString componentStr = "import QtQuick 2.0\nItem { \n"
"Image { source: \"image://test_async/blue\"; }\n"
@@ -535,7 +535,7 @@ void tst_qquickimageprovider::asyncTextureTest()
component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
QObject *obj = component.create();
//MUST not deadlock
- QVERIFY(obj != 0);
+ QVERIFY(obj != nullptr);
QList<QQuickImage *> images = obj->findChildren<QQuickImage *>();
QCOMPARE(images.count(), 4);