diff options
author | Liang Qi <liang.qi@qt.io> | 2018-02-27 08:43:10 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-02-27 08:43:10 +0100 |
commit | bb7a5d0cb6e62fa411e8b66759bf6b798c3f68d9 (patch) | |
tree | 06c325dc386afd26281ba0ebdbf4fd3f56f892b0 /tests/auto/quick | |
parent | 41edb3bd9f373a865d5698ac8c18bf341071eae9 (diff) | |
parent | e41d067227eb6225b05df88ab724708588fa5304 (diff) | |
download | qtdeclarative-bb7a5d0cb6e62fa411e8b66759bf6b798c3f68d9.tar.gz |
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts:
src/qml/jsruntime/qv4engine.cpp
src/qml/jsruntime/qv4internalclass.cpp
src/qml/parser/qqmljslexer.cpp
src/qml/qml/v8/qv8engine.cpp
src/qml/util/qqmladaptormodel_p.h
src/quick/items/qquickanimatedsprite.cpp
tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp
Change-Id: I16702b7a0da29c2a332afee47728d6a6ebf4fb3f
Diffstat (limited to 'tests/auto/quick')
57 files changed, 2191 insertions, 2175 deletions
diff --git a/tests/auto/quick/examples/tst_examples.cpp b/tests/auto/quick/examples/tst_examples.cpp index 2dc5a8ed23..716651ec0c 100644 --- a/tests/auto/quick/examples/tst_examples.cpp +++ b/tests/auto/quick/examples/tst_examples.cpp @@ -36,7 +36,7 @@ #include <QQmlEngine> #include <QQmlError> -static QtMessageHandler testlibMsgHandler = 0; +static QtMessageHandler testlibMsgHandler = nullptr; void msgHandlerFilter(QtMsgType type, const QMessageLogContext &ctxt, const QString &msg) { if (type == QtCriticalMsg || type == QtFatalMsg) diff --git a/tests/auto/quick/geometry/tst_geometry.cpp b/tests/auto/quick/geometry/tst_geometry.cpp index 904f85c4c6..54de46276c 100644 --- a/tests/auto/quick/geometry/tst_geometry.cpp +++ b/tests/auto/quick/geometry/tst_geometry.cpp @@ -58,7 +58,7 @@ void GeometryTest::testPoint2D() QSGGeometry::updateRectGeometry(&geometry, QRectF(1, 2, 3, 4)); QSGGeometry::Point2D *pts = geometry.vertexDataAsPoint2D(); - QVERIFY(pts != 0); + QVERIFY(pts != nullptr); QCOMPARE(pts[0].x, (float) 1); QCOMPARE(pts[0].y, (float) 2); @@ -91,7 +91,7 @@ void GeometryTest::testTexturedPoint2D() QSGGeometry::updateTexturedRectGeometry(&geometry, QRectF(1, 2, 3, 4), QRectF(5, 6, 7, 8)); QSGGeometry::TexturedPoint2D *pts = geometry.vertexDataAsTexturedPoint2D(); - QVERIFY(pts != 0); + QVERIFY(pts != nullptr); QCOMPARE(pts[0].x, (float) 1); QCOMPARE(pts[0].y, (float) 2); diff --git a/tests/auto/quick/nodes/tst_nodestest.cpp b/tests/auto/quick/nodes/tst_nodestest.cpp index e7303604b4..79a9e5f757 100644 --- a/tests/auto/quick/nodes/tst_nodestest.cpp +++ b/tests/auto/quick/nodes/tst_nodestest.cpp @@ -76,9 +76,9 @@ private Q_SLOTS: void textureNodeRect(); private: - QOffscreenSurface *surface; - QOpenGLContext *context; - QSGDefaultRenderContext *renderContext; + QOffscreenSurface *surface = nullptr; + QOpenGLContext *context = nullptr; + QSGDefaultRenderContext *renderContext = nullptr; }; void NodesTest::initTestCase() @@ -118,8 +118,8 @@ class DummyRenderer : public QSGBatchRenderer::Renderer public: DummyRenderer(QSGRootNode *root, QSGDefaultRenderContext *renderContext) : QSGBatchRenderer::Renderer(renderContext) - , changedNode(0) - , changedState(0) + , changedNode(nullptr) + , changedState(nullptr) , renderCount(0) { setRootNode(root); @@ -147,9 +147,6 @@ public: int DummyRenderer::globalRendereringOrder; NodesTest::NodesTest() - : surface(nullptr) - , context(nullptr) - , renderContext(nullptr) { } diff --git a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp index a2934eee32..8d8c915e39 100644 --- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp +++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp @@ -72,7 +72,7 @@ void tst_MptaInterop::createView(QScopedPointer<QQuickView> &window, const char window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_MptaInterop::initTestCase() diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp index f827b82205..53bb10b7b8 100644 --- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp @@ -77,7 +77,7 @@ void tst_DragHandler::createView(QScopedPointer<QQuickView> &window, const char window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } QSet<QQuickPointerHandler*> tst_DragHandler::passiveGrabbers(QQuickWindow *window, int pointId /*= 0*/) diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp index d38ae3190e..0158d864c4 100644 --- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp @@ -94,7 +94,7 @@ class EventItem : public QQuickItem { Q_OBJECT public: - EventItem(QQuickItem *parent = 0) + EventItem(QQuickItem *parent = nullptr) : QQuickItem(parent), acceptPointer(false), grabPointer(false), acceptMouse(false), acceptTouch(false), filterTouch(false) {} @@ -269,7 +269,7 @@ void tst_PointerHandlers::createView(QScopedPointer<QQuickView> &window, const c window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_PointerHandlers::initTestCase() diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp index 9e3261f7b2..cf18b5eca1 100644 --- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp +++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp @@ -85,7 +85,7 @@ void tst_TapHandler::createView(QScopedPointer<QQuickView> &window, const char * window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_TapHandler::initTestCase() diff --git a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp index e843f9e5a1..0ee78fae54 100644 --- a/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp +++ b/tests/auto/quick/qquickaccessible/tst_qquickaccessible.cpp @@ -143,7 +143,7 @@ void tst_QQuickAccessible::commonTests() view->setSource(testFileUrl(accessibleRoleFileName)); view->show(); // view->setFocus(); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(view); QVERIFY(iface); @@ -160,10 +160,10 @@ void tst_QQuickAccessible::quickAttachedProperties() component.setData("import QtQuick 2.0\nItem {\n" "}", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); - QCOMPARE(attachedObject, static_cast<QObject*>(0)); + QCOMPARE(attachedObject, static_cast<QObject*>(nullptr)); delete object; } @@ -181,7 +181,7 @@ void tst_QQuickAccessible::quickAttachedProperties() "Accessible.role: Accessible.Button\n" "}", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); QVERIFY(attachedObject); @@ -207,7 +207,7 @@ void tst_QQuickAccessible::quickAttachedProperties() "Accessible.description: \"Duck\"\n" "}", QUrl()); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QObject *attachedObject = QQuickAccessibleAttached::attachedProperties(object); QVERIFY(attachedObject); @@ -282,7 +282,7 @@ QAccessibleInterface *topLevelChildAt(QAccessibleInterface *iface, int x, int y) { QAccessibleInterface *child = iface->childAt(x, y); if (!child) - return 0; + return nullptr; QAccessibleInterface *childOfChild; while ( ( childOfChild = child->childAt(x, y)) ) { diff --git a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp index e303495944..3e5a054cc7 100644 --- a/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp +++ b/tests/auto/quick/qquickanimatedimage/tst_qquickanimatedimage.cpp @@ -152,7 +152,7 @@ void tst_qquickanimatedimage::mirror_running() QQuickView window; window.setSource(testFileUrl("hearts.qml")); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject()); QVERIFY(anim); @@ -334,7 +334,7 @@ void tst_qquickanimatedimage::sourceSizeChanges() QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", ""); QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage*>(component.create()); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QSignalSpy sourceSizeSpy(anim, SIGNAL(sourceSizeChanged())); @@ -397,7 +397,7 @@ void tst_qquickanimatedimage::sourceSizeChanges_intermediate() ctxt->setContextProperty("srcImage", ""); QScopedPointer<QQuickAnimatedImage> anim(qobject_cast<QQuickAnimatedImage*>(component.create())); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); ctxt->setContextProperty("srcImage", testFileUrl("hearts.gif")); QTRY_COMPARE(anim->status(), QQuickAnimatedImage::Ready); @@ -422,7 +422,7 @@ void tst_qquickanimatedimage::qtbug_16520() QQuickRectangle *root = qobject_cast<QQuickRectangle *>(component.create()); QVERIFY(root); QQuickAnimatedImage *anim = root->findChild<QQuickAnimatedImage*>("anim"); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); anim->setProperty("source", server.urlString("/stickman.gif")); QTRY_COMPARE(anim->opacity(), qreal(0)); @@ -445,7 +445,7 @@ void tst_qquickanimatedimage::progressAndStatusChanges() 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); QTRY_COMPARE(obj->progress(), 1.0); @@ -499,7 +499,7 @@ void tst_qquickanimatedimage::playingAndPausedChanges() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickAnimatedImage *obj = qobject_cast<QQuickAnimatedImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickAnimatedImage::Null); QTRY_VERIFY(obj->isPlaying()); QTRY_VERIFY(!obj->isPaused()); @@ -565,8 +565,8 @@ void tst_qquickanimatedimage::noCaching() window_nocache.setSource(testFileUrl("colors_nocache.qml")); window.show(); window_nocache.show(); - QTest::qWaitForWindowExposed(&window); - QTest::qWaitForWindowExposed(&window_nocache); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(QTest::qWaitForWindowExposed(&window_nocache)); QQuickAnimatedImage *anim = qobject_cast<QQuickAnimatedImage *>(window.rootObject()); QVERIFY(anim); diff --git a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp index fb5201946a..4ca31fd957 100644 --- a/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp +++ b/tests/auto/quick/qquickanimatedsprite/tst_qquickanimatedsprite.cpp @@ -31,6 +31,7 @@ #include <private/qabstractanimation_p.h> #include <private/qquickanimatedsprite_p.h> #include <private/qquickitem_p.h> +#include <QtCore/qscopedpointer.h> #include <QtGui/qpainter.h> #include <QtGui/qopenglcontext.h> #include <QtGui/qopenglfunctions.h> @@ -53,6 +54,7 @@ private slots: void test_reparenting(); void test_changeSourceToSmallerImgKeepingBigFrameSize(); void test_infiniteLoops(); + void test_implicitSize(); }; void tst_qquickanimatedsprite::initTestCase() @@ -63,11 +65,11 @@ void tst_qquickanimatedsprite::initTestCase() void tst_qquickanimatedsprite::test_properties() { - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->setSource(testFileUrl("basic.qml")); window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject()); QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); @@ -87,17 +89,15 @@ void tst_qquickanimatedsprite::test_properties() QCOMPARE(finishedSpy.count(), 0); sprite->setInterpolate(false); QVERIFY(!sprite->interpolate()); - - delete window; } void tst_qquickanimatedsprite::test_runningChangedSignal() { - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->setSource(testFileUrl("runningChange.qml")); window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject()); QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); @@ -115,8 +115,6 @@ void tst_qquickanimatedsprite::test_runningChangedSignal() QTRY_VERIFY(!sprite->running()); QTRY_COMPARE(runningChangedSpy.count(), 2); QCOMPARE(finishedSpy.count(), 1); - - delete window; } template <typename T> @@ -128,7 +126,7 @@ static bool isWithinRange(T min, T value, T max) void tst_qquickanimatedsprite::test_frameChangedSignal() { - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->setSource(testFileUrl("frameChange.qml")); window->show(); @@ -137,7 +135,7 @@ void tst_qquickanimatedsprite::test_frameChangedSignal() QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); QSignalSpy frameChangedSpy(sprite, SIGNAL(currentFrameChanged(int))); QVERIFY(sprite); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(!sprite->running()); QVERIFY(!sprite->paused()); @@ -165,8 +163,6 @@ void tst_qquickanimatedsprite::test_frameChangedSignal() prevFrame = frame; } QCOMPARE(loopCounter, 3); - - delete window; } void tst_qquickanimatedsprite::test_largeAnimation_data() @@ -225,11 +221,11 @@ void tst_qquickanimatedsprite::test_largeAnimation() { QFETCH(bool, frameSync); - QQuickView *window = new QQuickView(0); + QScopedPointer<QQuickView> window(new QQuickView); window->engine()->addImageProvider(QLatin1String("test"), new AnimationImageProvider); window->setSource(testFileUrl("largeAnimation.qml")); window->show(); - QVERIFY(QTest::qWaitForWindowExposed(window)); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->rootObject()); QQuickAnimatedSprite* sprite = window->rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); @@ -275,7 +271,6 @@ void tst_qquickanimatedsprite::test_largeAnimation() maxTextureSize /= 512; QVERIFY(maxFrame > maxTextureSize); // make sure we go beyond the texture width limitation QCOMPARE(loopCounter, sprite->loops()); - delete window; } void tst_qquickanimatedsprite::test_reparenting() @@ -290,7 +285,7 @@ void tst_qquickanimatedsprite::test_reparenting() QVERIFY(sprite); QTRY_VERIFY(sprite->running()); - sprite->setParentItem(0); + sprite->setParentItem(nullptr); sprite->setParentItem(window.rootObject()); // don't crash (QTBUG-51162) @@ -324,7 +319,7 @@ void tst_qquickanimatedsprite::test_changeSourceToSmallerImgKeepingBigFrameSize( QQmlProperty big(sprite, "big"); big.write(QVariant::fromValue(false)); - KillerThread *killer = new KillerThread; + QScopedPointer<KillerThread> killer(new KillerThread); killer->start(); // will kill us in case the GUI or render thread enters an infinite loop QTest::qWait(50); // let it draw with the new source. @@ -333,7 +328,44 @@ void tst_qquickanimatedsprite::test_changeSourceToSmallerImgKeepingBigFrameSize( killer->terminate(); killer->wait(); - delete killer; +} + +void tst_qquickanimatedsprite::test_implicitSize() +{ + QQuickView window; + window.setSource(testFileUrl("basic.qml")); + window.show(); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(window.rootObject()); + + QQuickAnimatedSprite* sprite = window.rootObject()->findChild<QQuickAnimatedSprite*>("sprite"); + QVERIFY(sprite); + QCOMPARE(sprite->frameWidth(), 31); + QCOMPARE(sprite->frameHeight(), 30); + QCOMPARE(sprite->implicitWidth(), 31); + QCOMPARE(sprite->implicitHeight(), 30); + + // Ensure that implicitWidth matches frameWidth. + QSignalSpy frameWidthChangedSpy(sprite, SIGNAL(frameWidthChanged(int))); + QVERIFY(frameWidthChangedSpy.isValid()); + + QSignalSpy frameImplicitWidthChangedSpy(sprite, SIGNAL(implicitWidthChanged())); + QVERIFY(frameImplicitWidthChangedSpy.isValid()); + + sprite->setFrameWidth(20); + QCOMPARE(frameWidthChangedSpy.count(), 1); + QCOMPARE(frameImplicitWidthChangedSpy.count(), 1); + + // Ensure that implicitHeight matches frameHeight. + QSignalSpy frameHeightChangedSpy(sprite, SIGNAL(frameHeightChanged(int))); + QVERIFY(frameHeightChangedSpy.isValid()); + + QSignalSpy frameImplicitHeightChangedSpy(sprite, SIGNAL(implicitHeightChanged())); + QVERIFY(frameImplicitHeightChangedSpy.isValid()); + + sprite->setFrameHeight(20); + QCOMPARE(frameHeightChangedSpy.count(), 1); + QCOMPARE(frameImplicitHeightChangedSpy.count(), 1); } void tst_qquickanimatedsprite::test_infiniteLoops() diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp index d28d065d17..de86bb16db 100644 --- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp +++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp @@ -760,7 +760,7 @@ void tst_qquickanimations::badTypes() QQuickItemPrivate::get(rect)->setState("state1"); - QQuickRectangle *myRect = 0; + QQuickRectangle *myRect = nullptr; QTRY_VERIFY(myRect = rect->findChild<QQuickRectangle*>("MyRect")); QTRY_COMPARE(myRect->x(),qreal(200)); } @@ -1153,7 +1153,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad); } @@ -1164,7 +1164,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce); QCOMPARE(animObject->easing().amplitude(), 5.0); } @@ -1176,7 +1176,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic); QCOMPARE(animObject->easing().amplitude(), 5.0); QCOMPARE(animObject->easing().period(), 3.0); @@ -1189,7 +1189,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack); QCOMPARE(animObject->easing().overshoot(), 2.0); } @@ -1201,7 +1201,7 @@ void tst_qquickanimations::easingProperties() animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickPropertyAnimation *animObject = qobject_cast<QQuickPropertyAnimation*>(animationComponent.create()); - QVERIFY(animObject != 0); + QVERIFY(animObject != nullptr); QCOMPARE(animObject->easing().type(), QEasingCurve::BezierSpline); QList<QPointF> points = animObject->easing().cubicBezierSpline(); QCOMPARE(points.count(), 3); @@ -1324,7 +1324,7 @@ void tst_qquickanimations::nonTransitionBug() QQmlComponent c(&engine, testFileUrl("nonTransitionBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *mover = rect->findChild<QQuickRectangle*>("mover"); @@ -1350,7 +1350,7 @@ void tst_qquickanimations::registrationBug() QQmlComponent c(&engine, testFileUrl("registrationBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QTRY_COMPARE(rect->property("value"), QVariant(int(100))); } @@ -1360,10 +1360,10 @@ void tst_qquickanimations::doubleRegistrationBug() QQmlComponent c(&engine, testFileUrl("doubleRegistrationBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickAbstractAnimation *anim = rect->findChild<QQuickAbstractAnimation*>("animation"); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QTRY_COMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Stopped); } @@ -1401,7 +1401,7 @@ void tst_qquickanimations::transitionAssignmentBug() QQmlComponent c(&engine, testFileUrl("transitionAssignmentBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->property("nullObject").toBool(), false); } @@ -1413,7 +1413,7 @@ void tst_qquickanimations::pauseBindingBug() QQmlComponent c(&engine, testFileUrl("pauseBindingBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickAbstractAnimation *anim = rect->findChild<QQuickAbstractAnimation*>("animation"); QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Paused); @@ -1427,7 +1427,7 @@ void tst_qquickanimations::pauseBug() QQmlComponent c(&engine, testFileUrl("pauseBug.qml")); QQuickAbstractAnimation *anim = qobject_cast<QQuickAbstractAnimation*>(c.create()); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimationJob::Paused); QCOMPARE(anim->isPaused(), true); QCOMPARE(anim->isRunning(), true); @@ -1444,14 +1444,14 @@ void tst_qquickanimations::loopingBug() QObject *obj = c.create(); QQuickAbstractAnimation *anim = obj->findChild<QQuickAbstractAnimation*>(); - QVERIFY(anim != 0); + QVERIFY(anim != nullptr); QCOMPARE(anim->qtAnimation()->totalDuration(), 300); QCOMPARE(anim->isRunning(), true); QTRY_COMPARE(static_cast<QAnimationGroupJob*>(anim->qtAnimation())->firstChild()->currentLoop(), 2); QTRY_COMPARE(anim->isRunning(), false); QQuickRectangle *rect = obj->findChild<QQuickRectangle*>(); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->rotation(), qreal(90)); delete obj; diff --git a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp index 89b7924618..62027f59f4 100644 --- a/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp +++ b/tests/auto/quick/qquickapplication/tst_qquickapplication.cpp @@ -95,12 +95,12 @@ void tst_qquickapplication::active() // active window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(QGuiApplication::focusWindow(), &window); QVERIFY(item->property("active").toBool()); QVERIFY(item->property("active2").toBool()); - QWindowSystemInterface::handleWindowActivated(0); + QWindowSystemInterface::handleWindowActivated(nullptr); #ifdef Q_OS_OSX // OS X has the concept of "reactivation" @@ -165,13 +165,13 @@ void tst_qquickapplication::state() // triggered by window activation. window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(QGuiApplication::focusWindow(), &window); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationActive); QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationActive); // not active again - QWindowSystemInterface::handleWindowActivated(0); + QWindowSystemInterface::handleWindowActivated(nullptr); QTRY_VERIFY(QGuiApplication::focusWindow() != &window); QCOMPARE(Qt::ApplicationState(item->property("state").toInt()), Qt::ApplicationInactive); QCOMPARE(Qt::ApplicationState(item->property("state2").toInt()), Qt::ApplicationInactive); diff --git a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp index bdd53702e5..fa9eba095d 100644 --- a/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp +++ b/tests/auto/quick/qquickbehaviors/tst_qquickbehaviors.cpp @@ -393,7 +393,7 @@ void tst_qquickbehaviors::delayedRegistration() QVERIFY2(!rect.isNull(), qPrintable(c.errorString())); QQuickItem *innerRect = rect->property("myItem").value<QQuickItem*>(); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QCOMPARE(innerRect->property("x").toInt(), int(0)); @@ -410,7 +410,7 @@ void tst_qquickbehaviors::startOnCompleted() QVERIFY2(!rect.isNull(), qPrintable(c.errorString())); QQuickItem *innerRect = rect->findChild<QQuickRectangle*>(); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QCOMPARE(innerRect->property("x").toInt(), int(0)); @@ -427,7 +427,7 @@ void tst_qquickbehaviors::multipleChangesToValueType() QVERIFY2(!rect.isNull(), qPrintable(c.errorString())); QQuickText *text = rect->findChild<QQuickText *>(); - QVERIFY(text != 0); + QVERIFY(text != nullptr); QFont value; value.setPointSize(24); diff --git a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp index 71b0160c8e..02e89ba0a7 100644 --- a/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp +++ b/tests/auto/quick/qquickborderimage/tst_qquickborderimage.cpp @@ -101,7 +101,7 @@ void tst_qquickborderimage::noSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->source(), QUrl()); QCOMPARE(obj->width(), 0.); QCOMPARE(obj->height(), 0.); @@ -153,7 +153,7 @@ void tst_qquickborderimage::imageSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (remote) QTRY_COMPARE(obj->status(), QQuickBorderImage::Loading); @@ -183,7 +183,7 @@ void tst_qquickborderimage::clearSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickBorderImage::Ready); QCOMPARE(obj->width(), 120.); QCOMPARE(obj->height(), 120.); @@ -203,7 +203,7 @@ void tst_qquickborderimage::resized() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->sourceSize().width(), 120); @@ -220,7 +220,7 @@ void tst_qquickborderimage::smooth() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->smooth(), true); @@ -235,7 +235,7 @@ void tst_qquickborderimage::mirror() QQuickView *window = new QQuickView; window->setSource(testFileUrl("mirror.qml")); QQuickBorderImage *image = qobject_cast<QQuickBorderImage*>(window->rootObject()); - QVERIFY(image != 0); + QVERIFY(image != nullptr); QImage screenshot = window->grabWindow(); @@ -248,7 +248,7 @@ void tst_qquickborderimage::mirror() screenshot = window->grabWindow(); window->show(); - QTest::qWaitForWindowExposed(window); + QVERIFY(QTest::qWaitForWindowExposed(window)); if (window->rendererInterface()->graphicsApi() == QSGRendererInterface::Software) QSKIP("QTBUG-53823"); QCOMPARE(screenshot, srcPixmap); @@ -263,7 +263,7 @@ void tst_qquickborderimage::tileModes() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 100.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Repeat); @@ -276,7 +276,7 @@ void tst_qquickborderimage::tileModes() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 150.); QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Round); @@ -304,7 +304,7 @@ void tst_qquickborderimage::sciSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (remote) QTRY_COMPARE(obj->status(), QQuickBorderImage::Loading); @@ -352,7 +352,7 @@ void tst_qquickborderimage::invalidSciFile() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->status(), QQuickImageBase::Error); @@ -380,7 +380,7 @@ void tst_qquickborderimage::validSciFiles() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->horizontalTileMode(), QQuickBorderImage::Round); @@ -397,7 +397,7 @@ void tst_qquickborderimage::pendingRemoteRequest() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickBorderImage::Loading); // verify no crash @@ -450,7 +450,7 @@ void tst_qquickborderimage::statusChanges() QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); qRegisterMetaType<QQuickImageBase::Status>(); QSignalSpy spy(obj, SIGNAL(statusChanged(QQuickImageBase::Status))); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->setSource(source); if (remote) server.sendDelayedItem(); @@ -473,7 +473,7 @@ void tst_qquickborderimage::sourceSizeChanges() QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", ""); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged())); @@ -539,7 +539,7 @@ void tst_qquickborderimage::progressAndStatusChanges() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickBorderImage *obj = qobject_cast<QQuickBorderImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->status(), QQuickBorderImage::Ready); QTRY_COMPARE(obj->progress(), 1.0); @@ -590,7 +590,7 @@ void tst_qquickborderimage::borderImageMesh() window->setSource(testFileUrl("nonmesh.qml")); window->show(); - QTest::qWaitForWindowExposed(window); + QVERIFY(QTest::qWaitForWindowExposed(window)); QImage nonmesh = window->grabWindow(); window->setSource(testFileUrl("mesh.qml")); diff --git a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp index 9463f7b4d5..96a11e16e9 100644 --- a/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp +++ b/tests/auto/quick/qquickdesignersupport/tst_qquickdesignersupport.cpp @@ -102,7 +102,7 @@ void tst_qquickdesignersupport::customData() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(newItem, view->engine()->contextForObject(newItem), "width", - 0)); + nullptr)); //Check if reseting property does work after setting binding QQuickDesignerSupportProperties::doResetProperty(newItem, view->rootContext(), "width"); @@ -136,7 +136,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 200); @@ -149,7 +149,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(!QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); //Reset the binding to the default QQuickDesignerSupportProperties::doResetProperty(testComponent, @@ -159,7 +159,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 200); @@ -173,7 +173,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 300); @@ -188,7 +188,7 @@ void tst_qquickdesignersupport::customDataBindings() QVERIFY(QQuickDesignerSupportProperties::hasBindingForProperty(testComponent, view->engine()->contextForObject(testComponent), "x", - 0)); + nullptr)); QCOMPARE(testComponent->property("x").toInt(), 200); } @@ -417,7 +417,7 @@ void tst_qquickdesignersupport::statesPropertyChanges() } -static QObject * s_object = 0; +static QObject * s_object = nullptr; static QQuickDesignerSupport::PropertyName s_propertyName; static void notifyPropertyChangeCallBackFunction(QObject *object, const QQuickDesignerSupport::PropertyName &propertyName) @@ -476,7 +476,7 @@ void tst_qquickdesignersupport::testFixResourcePathsForObjectCallBack() QVERIFY(rootItem); - s_object = 0; + s_object = nullptr; QQuickDesignerSupportItems::registerFixResourcePathsForObjectCallBack(fixResourcePathsForObjectCallBackPointer); diff --git a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp index 6a919d048e..9d832066af 100644 --- a/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp +++ b/tests/auto/quick/qquickdrag/tst_qquickdrag.cpp @@ -57,16 +57,8 @@ class TestDropTarget : public QQuickItem { Q_OBJECT public: - TestDropTarget(QQuickItem *parent = 0) + TestDropTarget(QQuickItem *parent = nullptr) : QQuickItem(parent) - , enterEvents(0) - , moveEvents(0) - , leaveEvents(0) - , dropEvents(0) - , acceptAction(Qt::MoveAction) - , defaultAction(Qt::IgnoreAction) - , proposedAction(Qt::IgnoreAction) - , accept(true) { setFlags(ItemAcceptsDrops); } @@ -119,16 +111,16 @@ public: event->setAccepted(accept); } - int enterEvents; - int moveEvents; - int leaveEvents; - int dropEvents; - Qt::DropAction acceptAction; - Qt::DropAction defaultAction; - Qt::DropAction proposedAction; + int enterEvents = 0; + int moveEvents = 0; + int leaveEvents = 0; + int dropEvents = 0; + Qt::DropAction acceptAction = Qt::MoveAction; + Qt::DropAction defaultAction = Qt::IgnoreAction; + Qt::DropAction proposedAction = Qt::IgnoreAction; Qt::DropActions supportedActions; QPointF position; - bool accept; + bool accept = true; }; class tst_QQuickDrag: public QObject @@ -199,16 +191,16 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); dropTarget.reset(); evaluate<void>(item, "Drag.cancel()"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.reset(); @@ -232,8 +224,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.cancel()"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); // Enter events aren't sent to items without the QQuickItem::ItemAcceptsDrops flag. @@ -243,16 +235,16 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.reset(); evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.setFlags(QQuickItem::ItemAcceptsDrops); @@ -271,8 +263,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); // Follow up events aren't sent to items if the enter event isn't accepted. @@ -283,16 +275,16 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 1); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.reset(); evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); dropTarget.accept = true; @@ -311,8 +303,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = false"); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 1); // Events are sent to hidden or disabled items. @@ -322,8 +314,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); evaluate<void>(item, "Drag.active = false"); @@ -346,8 +338,8 @@ void tst_QQuickDrag::active() evaluate<void>(item, "Drag.active = true"); QCOMPARE(evaluate<bool>(item, "Drag.active"), true); QCOMPARE(evaluate<bool>(item, "dragActive"), true); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(dropTarget.enterEvents, 0); QCOMPARE(dropTarget.leaveEvents, 0); evaluate<void>(item, "Drag.active = false"); @@ -510,8 +502,8 @@ void tst_QQuickDrag::drop() QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.IgnoreAction"), true); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 1); QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0); @@ -522,8 +514,8 @@ void tst_QQuickDrag::drop() QCOMPARE(evaluate<bool>(item, "Drag.drop() == Qt.IgnoreAction"), true); QCOMPARE(evaluate<bool>(item, "Drag.active"), false); QCOMPARE(evaluate<bool>(item, "dragActive"), false); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 0); QCOMPARE(outerTarget.dropEvents, 0); QCOMPARE(innerTarget.enterEvents, 0); QCOMPARE(innerTarget.leaveEvents, 0); QCOMPARE(innerTarget.dropEvents, 0); @@ -638,8 +630,8 @@ void tst_QQuickDrag::move() outerTarget.reset(); leftTarget.reset(); rightTarget.reset(); item->setPosition(QPointF(110, 50)); QCoreApplication::processEvents(); - QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(item, "Drag.target"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(item, "dragTarget"), static_cast<QObject *>(nullptr)); QCOMPARE(outerTarget.enterEvents, 0); QCOMPARE(outerTarget.leaveEvents, 1); QCOMPARE(outerTarget.moveEvents, 0); QCOMPARE(leftTarget .enterEvents, 0); QCOMPARE(leftTarget .leaveEvents, 1); QCOMPARE(leftTarget .moveEvents, 0); QCOMPARE(rightTarget.enterEvents, 0); QCOMPARE(rightTarget.leaveEvents, 0); QCOMPARE(rightTarget.moveEvents, 0); @@ -751,7 +743,7 @@ void tst_QQuickDrag::parentChange() QCOMPARE(dropTarget2.enterEvents, 1); // Removing then parent item sends a leave event. - item->setParentItem(0); + item->setParentItem(nullptr); QCOMPARE(dropTarget1.enterEvents, 1); QCOMPARE(dropTarget1.moveEvents, 1); QCOMPARE(dropTarget1.leaveEvents, 1); @@ -775,7 +767,7 @@ void tst_QQuickDrag::parentChange() item->setParentItem(window2.contentItem()); QCoreApplication::processEvents(); - item->setParentItem(0); + item->setParentItem(nullptr); QCoreApplication::processEvents(); QCOMPARE(dropTarget1.enterEvents, 1); QCOMPARE(dropTarget1.moveEvents, 1); @@ -1046,7 +1038,7 @@ class RecursingDropTarget : public TestDropTarget { public: RecursingDropTarget(const QString &script, int type, QQuickItem *parent) - : TestDropTarget(parent), script(script), type(type), item(0) {} + : TestDropTarget(parent), script(script), type(type), item(nullptr) {} void setItem(QQuickItem *i) { item = i; } diff --git a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp index 071a7b3607..3c7159782c 100644 --- a/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp +++ b/tests/auto/quick/qquickdroparea/tst_qquickdroparea.cpp @@ -463,8 +463,8 @@ void tst_QQuickDropArea::source_internal() QQuickItem *dragSource = dropArea->findChild<QQuickItem *>("dragSource"); QVERIFY(dragSource); - QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(nullptr)); evaluate<void>(dragItem, "Drag.active = true"); QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(dragItem)); @@ -472,8 +472,8 @@ void tst_QQuickDropArea::source_internal() QCOMPARE(evaluate<QObject *>(dropArea, "eventSource"), static_cast<QObject *>(dragItem)); evaluate<void>(dragItem, "Drag.active = false"); - QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(nullptr)); evaluate<void>(dropArea, "{ eventSource = null }"); @@ -485,8 +485,8 @@ void tst_QQuickDropArea::source_internal() QCOMPARE(evaluate<QObject *>(dropArea, "eventSource"), static_cast<QObject *>(dragSource)); evaluate<void>(dragItem, "Drag.active = false"); - QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(0)); - QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(0)); + QCOMPARE(evaluate<QObject *>(dropArea, "source"), static_cast<QObject *>(nullptr)); + QCOMPARE(evaluate<QObject *>(dropArea, "drag.source"), static_cast<QObject *>(nullptr)); } // Setting a source can't be emulated using the QWindowSystemInterface API. diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp index bdf7d3dcfd..248f8447e0 100644 --- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp +++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp @@ -57,7 +57,7 @@ class TouchDragArea : public QQuickItem Q_PROPERTY(bool keepTouchGrab READ keepTouchGrab WRITE setKeepTouchGrab NOTIFY keepTouchGrabChanged) public: - TouchDragArea(QQuickItem *parent = 0) + TouchDragArea(QQuickItem *parent = nullptr) : QQuickItem(parent) , touchEvents(0) , touchUpdates(0) @@ -226,7 +226,7 @@ void tst_qquickflickable::create() QQmlComponent c(&engine, testFileUrl("flickable01.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->isAtXBeginning(), true); QCOMPARE(obj->isAtXEnd(), false); QCOMPARE(obj->isAtYBeginning(), true); @@ -251,7 +251,7 @@ void tst_qquickflickable::horizontalViewportSize() QQmlComponent c(&engine, testFileUrl("flickable02.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentWidth(), 800.); QCOMPARE(obj->contentHeight(), 300.); QCOMPARE(obj->isAtXBeginning(), true); @@ -268,7 +268,7 @@ void tst_qquickflickable::verticalViewportSize() QQmlComponent c(&engine, testFileUrl("flickable03.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentWidth(), 200.); QCOMPARE(obj->contentHeight(), 6000.); QCOMPARE(obj->isAtXBeginning(), true); @@ -285,7 +285,7 @@ void tst_qquickflickable::visibleAreaRatiosUpdate() QQmlComponent c(&engine, testFileUrl("ratios.qml")); QQuickItem *obj = qobject_cast<QQuickItem*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // check initial ratio values QCOMPARE(obj->property("heightRatioIs").toDouble(), obj->property("heightRatioShould").toDouble()); QCOMPARE(obj->property("widthRatioIs").toDouble(), obj->property("widthRatioShould").toDouble()); @@ -307,7 +307,7 @@ void tst_qquickflickable::properties() QQmlComponent c(&engine, testFileUrl("flickable04.qml")); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->isInteractive(), false); QCOMPARE(obj->boundsBehavior(), QQuickFlickable::StopAtBounds); QCOMPARE(obj->pressDelay(), 200); @@ -368,10 +368,10 @@ void tst_qquickflickable::rebound() window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickTransition *rebound = window->rootObject()->findChild<QQuickTransition*>("rebound"); QVERIFY(rebound); @@ -507,7 +507,7 @@ void tst_qquickflickable::pressDelay() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); @@ -535,7 +535,7 @@ void tst_qquickflickable::pressDelay() QCOMPARE(clickedSpy.count(),0); // On release the clicked signal should be emitted - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); QCOMPARE(clickedSpy.count(),1); // Press and release position should match @@ -553,7 +553,7 @@ void tst_qquickflickable::pressDelay() QCOMPARE(clickedSpy.count(),0); // On release the press, release and clicked signal should be emitted - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(180, 180)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(180, 180)); QCOMPARE(clickedSpy.count(),1); // Press and release position should match @@ -574,7 +574,7 @@ void tst_qquickflickable::pressDelay() QTRY_VERIFY(!mouseArea->property("pressed").toBool()); // On release the clicked signal should *not* be emitted - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 190)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 190)); QCOMPARE(clickedSpy.count(),1); } @@ -588,13 +588,13 @@ void tst_qquickflickable::nestedPressDelay() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(outer != 0); + QVERIFY(outer != nullptr); QQuickFlickable *inner = window->rootObject()->findChild<QQuickFlickable*>("innerFlickable"); - QVERIFY(inner != 0); + QVERIFY(inner != nullptr); moveAndPress(window.data(), QPoint(150, 150)); // the MouseArea is not pressed immediately @@ -614,7 +614,7 @@ void tst_qquickflickable::nestedPressDelay() QVERIFY(inner->property("moving").toBool()); QVERIFY(inner->property("dragging").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); QVERIFY(!inner->property("dragging").toBool()); QTRY_VERIFY(!inner->property("moving").toBool()); @@ -634,7 +634,7 @@ void tst_qquickflickable::nestedPressDelay() QVERIFY(!outer->property("moving").toBool()); QVERIFY(!outer->property("dragging").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(20, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20, 150)); QVERIFY(!inner->property("dragging").toBool()); QTRY_VERIFY(!inner->property("moving").toBool()); @@ -653,7 +653,7 @@ void tst_qquickflickable::nestedPressDelay() QVERIFY(inner->property("moving").toBool()); QVERIFY(inner->property("dragging").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(90, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(90, 150)); QVERIFY(!inner->property("dragging").toBool()); QTRY_VERIFY(!inner->property("moving").toBool()); @@ -668,13 +668,13 @@ void tst_qquickflickable::filterReplayedPress() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(outer != 0); + QVERIFY(outer != nullptr); QQuickFlickable *inner = window->rootObject()->findChild<QQuickFlickable*>("innerFlickable"); - QVERIFY(inner != 0); + QVERIFY(inner != nullptr); QQuickItem *filteringMouseArea = outer->findChild<QQuickItem *>("filteringMouseArea"); QVERIFY(filteringMouseArea); @@ -697,7 +697,7 @@ void tst_qquickflickable::filterReplayedPress() QCOMPARE(filteringMouseArea->property("pressed").toBool(), true); QCOMPARE(filteringMouseArea->keepMouseGrab(), true); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); } @@ -711,13 +711,13 @@ void tst_qquickflickable::nestedClickThenFlick() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *outer = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(outer != 0); + QVERIFY(outer != nullptr); QQuickFlickable *inner = window->rootObject()->findChild<QQuickFlickable*>("innerFlickable"); - QVERIFY(inner != 0); + QVERIFY(inner != nullptr); moveAndPress(window.data(), QPoint(150, 150)); @@ -725,7 +725,7 @@ void tst_qquickflickable::nestedClickThenFlick() QVERIFY(!outer->property("pressed").toBool()); QTRY_VERIFY(outer->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); QVERIFY(!outer->property("pressed").toBool()); @@ -743,7 +743,7 @@ void tst_qquickflickable::nestedClickThenFlick() QVERIFY(!outer->property("moving").toBool()); QVERIFY(inner->property("moving").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(80, 100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(80, 100)); } void tst_qquickflickable::flickableDirection() @@ -785,7 +785,7 @@ void tst_qquickflickable::resizeContent() QQuickItem *root = qobject_cast<QQuickItem*>(c.create()); QQuickFlickable *obj = findItem<QQuickFlickable>(root, "flick"); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentX(), 0.); QCOMPARE(obj->contentY(), 0.); QCOMPARE(obj->contentWidth(), 300.); @@ -818,14 +818,14 @@ void tst_qquickflickable::returnToBounds() window->setSource(testFileUrl("resize.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *obj = findItem<QQuickFlickable>(window->rootObject(), "flick"); QQuickTransition *rebound = window->rootObject()->findChild<QQuickTransition*>("rebound"); QVERIFY(rebound); QSignalSpy reboundSpy(rebound, SIGNAL(runningChanged())); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->contentX(), 0.); QCOMPARE(obj->contentY(), 0.); QCOMPARE(obj->contentWidth(), 300.); @@ -862,10 +862,10 @@ void tst_qquickflickable::wheel() window->setSource(testFileUrl("wheel.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick"); - QVERIFY(flick != 0); + QVERIFY(flick != nullptr); QQuickFlickablePrivate *fp = QQuickFlickablePrivate::get(flick); QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded())); @@ -916,10 +916,10 @@ void tst_qquickflickable::trackpad() window->setSource(testFileUrl("wheel.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flick"); - QVERIFY(flick != 0); + QVERIFY(flick != nullptr); QSignalSpy moveEndSpy(flick, SIGNAL(movementEnded())); QPoint pos(200, 200); @@ -993,10 +993,10 @@ void tst_qquickflickable::movingAndFlicking() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged())); QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged())); @@ -1156,10 +1156,10 @@ void tst_qquickflickable::movingAndDragging() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy vDragSpy(flickable, SIGNAL(draggingVerticallyChanged())); QSignalSpy hDragSpy(flickable, SIGNAL(draggingHorizontallyChanged())); @@ -1201,7 +1201,7 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(moveStartSpy.count(), 1); QCOMPARE(dragStartSpy.count(), 1); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithoutSnapBack*3); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithoutSnapBack*3); QVERIFY(!flickable->isDragging()); QVERIFY(!flickable->isDraggingHorizontally()); @@ -1274,7 +1274,7 @@ void tst_qquickflickable::movingAndDragging() QCOMPARE(dragStartSpy.count(), 1); QCOMPARE(dragEndSpy.count(), 0); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, moveFrom + moveByWithSnapBack*3); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, moveFrom + moveByWithSnapBack*3); // should now start snapping back to bounds (moving but not dragging) QVERIFY(flickable->isMoving()); @@ -1325,10 +1325,10 @@ void tst_qquickflickable::flickOnRelease() window->setSource(testFileUrl("flickable03.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // Vertical with a quick press-move-release: should cause a flick in release. QSignalSpy vFlickSpy(flickable, SIGNAL(flickingVerticallyChanged())); @@ -1339,7 +1339,7 @@ void tst_qquickflickable::flickOnRelease() // working even with small movements. moveAndPress(window.data(), QPoint(50, 300)); QTest::mouseMove(window.data(), QPoint(50, 10), 10); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10), 10); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 10), 10); QCOMPARE(vFlickSpy.count(), 1); @@ -1359,10 +1359,10 @@ void tst_qquickflickable::pressWhileFlicking() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy vMoveSpy(flickable, SIGNAL(movingVerticallyChanged())); QSignalSpy hMoveSpy(flickable, SIGNAL(movingHorizontallyChanged())); @@ -1388,13 +1388,13 @@ void tst_qquickflickable::pressWhileFlicking() QCOMPARE(hFlickSpy.count(), 0); QCOMPARE(flickSpy.count(), 1); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(20, 50)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20, 50)); QTRY_VERIFY(!flickable->isFlicking()); QVERIFY(!flickable->isFlickingVertically()); QVERIFY(flickable->isMoving()); QVERIFY(flickable->isMovingVertically()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(20,50)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(20,50)); QVERIFY(!flickable->isFlicking()); QVERIFY(!flickable->isFlickingVertically()); QTRY_VERIFY(!flickable->isMoving()); @@ -1409,10 +1409,10 @@ void tst_qquickflickable::disabled() window->setSource(testFileUrl("disabled.qml")); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flick = window->rootObject()->findChild<QQuickFlickable*>("flickable"); - QVERIFY(flick != 0); + QVERIFY(flick != nullptr); moveAndPress(window.data(), QPoint(50, 90)); @@ -1422,11 +1422,11 @@ void tst_qquickflickable::disabled() QVERIFY(!flick->isMoving()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 60)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 60)); // verify that mouse clicks on other elements still work (QTBUG-20584) moveAndPress(window.data(), QPoint(50, 10)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 10)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 10)); QTRY_VERIFY(window->rootObject()->property("clicked").toBool()); } @@ -1440,10 +1440,10 @@ void tst_qquickflickable::flickVelocity() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // flick up flick(window.data(), QPoint(20,190), QPoint(20, 50), 200); @@ -1488,7 +1488,7 @@ void tst_qquickflickable::margins() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); // starting state QCOMPARE(obj->contentX(), -40.); @@ -1567,10 +1567,10 @@ void tst_qquickflickable::cancelOnMouseGrab() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); moveAndPress(window.data(), QPoint(10, 10)); // drag out of bounds @@ -1605,20 +1605,20 @@ void tst_qquickflickable::clickAndDragWhenTransformed() QQuickViewTestUtil::moveMouseAway(view.data()); view->show(); QVERIFY(QTest::qWaitForWindowActive(view.data())); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QQuickFlickable *flickable = view->rootObject()->findChild<QQuickFlickable*>("flickable"); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // click outside child rect moveAndPress(view.data(), QPoint(190, 190)); QTRY_COMPARE(flickable->property("itemPressed").toBool(), false); - QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(190, 190)); + QTest::mouseRelease(view.data(), Qt::LeftButton, Qt::NoModifier, QPoint(190, 190)); // click inside child rect moveAndPress(view.data(), QPoint(200, 200)); QTRY_COMPARE(flickable->property("itemPressed").toBool(), true); - QTest::mouseRelease(view.data(), Qt::LeftButton, 0, QPoint(200, 200)); + QTest::mouseRelease(view.data(), Qt::LeftButton, Qt::NoModifier, QPoint(200, 200)); const int threshold = qApp->styleHints()->startDragDistance(); @@ -1649,10 +1649,10 @@ void tst_qquickflickable::flickTwiceUsingTouches() QQuickViewTestUtil::centerOnScreen(window.data()); QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QCOMPARE(flickable->contentY(), 0.0f); flickWithTouch(window.data(), QPoint(100, 400), QPoint(100, 240)); @@ -1780,7 +1780,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), true); QCOMPARE(inner->isDragging(), false); QCOMPARE(inner->isMoving(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->isDragging()); QTRY_VERIFY(!outer->isMoving()); @@ -1802,7 +1802,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), false); QCOMPARE(inner->isDragging(), true); QCOMPARE(inner->isMoving(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!inner->isDragging()); QTRY_VERIFY(!inner->isMoving()); @@ -1826,7 +1826,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), true); QCOMPARE(inner->isDragging(), false); QCOMPARE(inner->isMoving(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->isDragging()); QTRY_VERIFY(!outer->isMoving()); @@ -1850,7 +1850,7 @@ void tst_qquickflickable::nestedStopAtBounds() QCOMPARE(outer->isMoving(), true); QCOMPARE(inner->isDragging(), false); QCOMPARE(inner->isMoving(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->isDragging()); QTRY_VERIFY(!outer->isMoving()); @@ -1946,7 +1946,7 @@ void tst_qquickflickable::stopAtBounds() QCOMPARE(transpose ? flickable->contentY() : flickable->contentX(), 0.0); } - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); if (transpose) { flickable->setContentY(invert ? 100 : 0); @@ -1982,10 +1982,10 @@ void tst_qquickflickable::nestedMouseAreaUsingTouch() QQuickViewTestUtil::centerOnScreen(window.data()); QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QCOMPARE(flickable->contentY(), 50.0f); flickWithTouch(window.data(), QPoint(100, 300), QPoint(100, 200)); @@ -2028,7 +2028,7 @@ void tst_qquickflickable::nestedSliderUsingTouch() QQuickViewTestUtil::moveMouseAway(window); window->show(); QVERIFY(QTest::qWaitForWindowActive(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); QVERIFY(flickable); @@ -2067,11 +2067,11 @@ void tst_qquickflickable::pressDelayWithLoader() QQuickViewTestUtil::moveMouseAway(window.data()); window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); // do not crash moveAndPress(window.data(), QPoint(150, 150)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(150, 150)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(150, 150)); } // QTBUG-34507 @@ -2086,7 +2086,7 @@ void tst_qquickflickable::movementFromProgrammaticFlick() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); // verify that the signals for movement and flicking are called in the right order flickable->flick(0, -1000); @@ -2141,7 +2141,7 @@ void tst_qquickflickable::ratios_smallContent() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickFlickable *obj = qobject_cast<QQuickFlickable*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); //doublecheck the item, as specified by contentWidth/Height, fits in the view //use tryCompare to allow a bit of stabilization in component's properties @@ -2198,7 +2198,7 @@ void tst_qquickflickable::keepGrab() QTest::mouseMove(window.data(), pos); QTest::qWait(10); } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(310, 310)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(310, 310)); QTest::qWait(10); QCOMPARE(flickable->contentX(), 0.0); @@ -2213,7 +2213,7 @@ void tst_qquickflickable::keepGrab() QTest::mouseMove(window.data(), pos); QTest::qWait(10); } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(310, 310)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(310, 310)); QTest::qWait(10); QVERIFY(flickable->contentX() != 0.0); @@ -2245,11 +2245,11 @@ void tst_qquickflickable::overshoot() flickable->setBoundsMovement(QQuickFlickable::BoundsMovement(boundsMovement)); // drag past the beginning - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); QTest::mouseMove(window.data(), QPoint(20, 20)); QTest::mouseMove(window.data(), QPoint(30, 30)); QTest::mouseMove(window.data(), QPoint(40, 40)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::DragOverBounds)) { QVERIFY(flickable->property("minContentX").toReal() < 0.0); @@ -2314,11 +2314,11 @@ void tst_qquickflickable::overshoot() QMetaObject::invokeMethod(flickable, "reset"); // drag past the end - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QTest::mouseMove(window.data(), QPoint(40, 40)); QTest::mouseMove(window.data(), QPoint(30, 30)); QTest::mouseMove(window.data(), QPoint(20, 20)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); if ((boundsMovement == QQuickFlickable::FollowBoundsBehavior) && (boundsBehavior & QQuickFlickable::DragOverBounds)) { QVERIFY(flickable->property("maxContentX").toReal() > 200.0); diff --git a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp index 9c892488f4..b4082b3d34 100644 --- a/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp +++ b/tests/auto/quick/qquickflipable/tst_qquickflipable.cpp @@ -61,7 +61,7 @@ void tst_qquickflipable::create() QQmlComponent c(&engine, testFileUrl("test-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); delete obj; } @@ -71,9 +71,9 @@ void tst_qquickflipable::checkFrontAndBack() QQmlComponent c(&engine, testFileUrl("test-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->front() != 0); - QVERIFY(obj->back() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->front() != nullptr); + QVERIFY(obj->back() != nullptr); delete obj; } @@ -83,9 +83,9 @@ void tst_qquickflipable::setFrontAndBack() QQmlComponent c(&engine, testFileUrl("test-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->front() != 0); - QVERIFY(obj->back() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->front() != nullptr); + QVERIFY(obj->back() != nullptr); QString message = c.url().toString() + ":3:1: QML Flipable: front is a write-once property"; QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); @@ -102,7 +102,7 @@ void tst_qquickflipable::flipFlipable() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("flip-flipable.qml")); QQuickFlipable *obj = qobject_cast<QQuickFlipable*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->side(), QQuickFlipable::Front); obj->setProperty("flipped", QVariant(true)); QTRY_COMPARE(obj->side(), QQuickFlipable::Back); @@ -116,7 +116,7 @@ void tst_qquickflipable::QTBUG_9161_crash() QQuickView *window = new QQuickView; window->setSource(testFileUrl("crash.qml")); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); window->show(); delete window; } @@ -126,7 +126,7 @@ void tst_qquickflipable::QTBUG_8474_qgv_abort() QQuickView *window = new QQuickView; window->setSource(testFileUrl("flipable-abort.qml")); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); window->show(); delete window; } diff --git a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp index 5ac7fa7015..e59bb7266c 100644 --- a/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp +++ b/tests/auto/quick/qquickfocusscope/tst_qquickfocusscope.cpp @@ -67,15 +67,15 @@ void tst_qquickfocusscope::basic() QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1")); QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); view->show(); view->requestActivate(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(view->isTopLevel()); @@ -111,16 +111,16 @@ void tst_qquickfocusscope::nested() QQuickFocusScope *item3 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item3")); QQuickFocusScope *item4 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item4")); QQuickFocusScope *item5 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item5")); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); - QVERIFY(item4 != 0); - QVERIFY(item5 != 0); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); + QVERIFY(item4 != nullptr); + QVERIFY(item5 != nullptr); view->show(); view->requestActivate(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(item1->hasActiveFocus()); @@ -140,10 +140,10 @@ void tst_qquickfocusscope::noFocus() QQuickRectangle *item1 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item1")); QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); view->show(); view->requestActivate(); @@ -179,15 +179,15 @@ void tst_qquickfocusscope::textEdit() QQuickTextEdit *item1 = findItem<QQuickTextEdit>(view->rootObject(), QLatin1String("item1")); QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickTextEdit *item3 = findItem<QQuickTextEdit>(view->rootObject(), QLatin1String("item3")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); view->show(); view->requestActivate(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(item0->hasActiveFocus()); @@ -231,16 +231,16 @@ void tst_qquickfocusscope::forceFocus() QQuickFocusScope *item3 = findItem<QQuickFocusScope>(view->rootObject(), QLatin1String("item3")); QQuickRectangle *item4 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item4")); QQuickRectangle *item5 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item5")); - QVERIFY(item0 != 0); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); - QVERIFY(item4 != 0); - QVERIFY(item5 != 0); + QVERIFY(item0 != nullptr); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); + QVERIFY(item4 != nullptr); + QVERIFY(item5 != nullptr); view->show(); view->requestActivate(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(item0->hasActiveFocus()); @@ -277,7 +277,7 @@ void tst_qquickfocusscope::noParentFocus() view->show(); view->requestActivate(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVERIFY(!view->rootObject()->property("focus1").toBool()); @@ -298,15 +298,15 @@ void tst_qquickfocusscope::signalEmission() QQuickRectangle *item2 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item2")); QQuickRectangle *item3 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item3")); QQuickRectangle *item4 = findItem<QQuickRectangle>(view->rootObject(), QLatin1String("item4")); - QVERIFY(item1 != 0); - QVERIFY(item2 != 0); - QVERIFY(item3 != 0); - QVERIFY(item4 != 0); + QVERIFY(item1 != nullptr); + QVERIFY(item2 != nullptr); + QVERIFY(item3 != nullptr); + QVERIFY(item4 != nullptr); view->show(); view->requestActivate(); - QTest::qWaitForWindowActive(view); + QVERIFY(QTest::qWaitForWindowActive(view)); QTRY_COMPARE(view, qGuiApp->focusWindow()); QVariant blue(QColor("blue")); diff --git a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp index a38b62eb16..87a5bd469a 100644 --- a/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp +++ b/tests/auto/quick/qquickfontloader/tst_qquickfontloader.cpp @@ -77,7 +77,7 @@ void tst_qquickfontloader::noFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QCOMPARE(fontObject->name(), QString("")); QCOMPARE(fontObject->source(), QUrl("")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Null); @@ -92,7 +92,7 @@ void tst_qquickfontloader::namedFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QCOMPARE(fontObject->source(), QUrl("")); QCOMPARE(fontObject->name(), QString("Helvetica")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -105,7 +105,7 @@ void tst_qquickfontloader::localFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -119,7 +119,7 @@ void tst_qquickfontloader::failLocalFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Error); @@ -133,7 +133,7 @@ void tst_qquickfontloader::webFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -149,7 +149,7 @@ void tst_qquickfontloader::redirWebFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); @@ -164,7 +164,7 @@ void tst_qquickfontloader::failWebFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("")); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Error); @@ -179,7 +179,7 @@ void tst_qquickfontloader::changeFont() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(component.create()); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QSignalSpy nameSpy(fontObject, SIGNAL(nameChanged())); QSignalSpy statusSpy(fontObject, SIGNAL(statusChanged())); @@ -218,7 +218,7 @@ void tst_qquickfontloader::changeFontSourceViaState() QCOMPARE(&window, qGuiApp->focusWindow()); QQuickFontLoader *fontObject = qobject_cast<QQuickFontLoader*>(qvariant_cast<QObject *>(window.rootObject()->property("fontloader"))); - QVERIFY(fontObject != 0); + QVERIFY(fontObject != nullptr); QTRY_COMPARE(fontObject->status(), QQuickFontLoader::Ready); QVERIFY(fontObject->source() != QUrl("")); QTRY_COMPARE(fontObject->name(), QString("OCRA")); diff --git a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp index 363064aa31..12e9794dc8 100644 --- a/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp +++ b/tests/auto/quick/qquickframebufferobject/tst_qquickframebufferobject.cpp @@ -193,7 +193,7 @@ void tst_QQuickFramebufferObject::testThatStuffWorks() view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QImage result = view.grabWindow(); @@ -233,7 +233,7 @@ void tst_QQuickFramebufferObject::testInvalidate() view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(frameInfo.fboSize, QSize(200, 200)); diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp index 58c9ffce71..915b9b43ea 100644 --- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp +++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp @@ -287,7 +287,7 @@ private: if (m_view) { if (QString(QTest::currentTestFunction()) != testForView) { delete m_view; - m_view = 0; + m_view = nullptr; } else { m_view->setSource(QUrl()); return m_view; @@ -316,7 +316,7 @@ private: QString testForView; }; -tst_QQuickGridView::tst_QQuickGridView() : m_view(0) +tst_QQuickGridView::tst_QQuickGridView() : m_view(nullptr) { } @@ -326,7 +326,7 @@ void tst_QQuickGridView::init() if (m_view && QString(QTest::currentTestFunction()) != testForView) { testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; } #endif } @@ -336,7 +336,7 @@ void tst_QQuickGridView::cleanupTestCase() #ifdef SHARE_VIEWS testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; #endif } @@ -360,10 +360,10 @@ void tst_QQuickGridView::items() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); @@ -371,10 +371,10 @@ void tst_QQuickGridView::items() for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -408,17 +408,17 @@ void tst_QQuickGridView::changed() qApp->processEvents(); QQuickFlickable *gridview = findItem<QQuickFlickable>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); model.modifyItem(1, "Will", "9876"); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); delete window; @@ -439,10 +439,10 @@ void tst_QQuickGridView::inserted_basic() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); model.insertItem(1, "Will", "9876"); @@ -450,10 +450,10 @@ void tst_QQuickGridView::inserted_basic() QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); // Checks that onAdd is called @@ -472,10 +472,10 @@ void tst_QQuickGridView::inserted_basic() QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); QTRY_COMPARE(gridview->currentIndex(), 1); @@ -526,9 +526,9 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (flow == QQuickGridView::FlowTopToBottom) { insertIndex = insertIndex_ttb; @@ -571,7 +571,7 @@ void tst_QQuickGridView::inserted_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -716,9 +716,9 @@ void tst_QQuickGridView::insertBeforeVisible() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); gridview->setCacheBuffer(cacheBuffer); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); @@ -756,7 +756,7 @@ void tst_QQuickGridView::insertBeforeVisible() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0 + itemsOffsetAfterMove); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -800,19 +800,19 @@ void tst_QQuickGridView::removed_basic() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.removeItem(1); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); @@ -834,10 +834,10 @@ void tst_QQuickGridView::removed_basic() QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); @@ -913,7 +913,7 @@ void tst_QQuickGridView::removed_basic() model.removeItem(20); QTRY_COMPARE(gridview->currentIndex(), 20); - QTRY_VERIFY(gridview->currentItem() != 0); + QTRY_VERIFY(gridview->currentItem() != nullptr); // remove item before current, but visible gridview->setCurrentIndex(8); @@ -956,9 +956,9 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (flow == QQuickGridView::FlowTopToBottom) { removeIndex = removeIndex_ttb; @@ -997,7 +997,7 @@ void tst_QQuickGridView::removed_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -1173,9 +1173,9 @@ void tst_QQuickGridView::addOrRemoveBeforeVisible() window->setSource(testFileUrl("gridview1.qml")); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); QTRY_COMPARE(name->text(), QString("Item0")); @@ -1251,9 +1251,9 @@ void tst_QQuickGridView::clear() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.clear(); @@ -1269,7 +1269,7 @@ void tst_QQuickGridView::clear() model.addItem("New", "1"); gridview->forceLayout(); QTRY_COMPARE(gridview->count(), 1); - QVERIFY(gridview->currentItem() != 0); + QVERIFY(gridview->currentItem() != nullptr); QCOMPARE(gridview->currentIndex(), 0); delete window; @@ -1304,13 +1304,13 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *currentItem = gridview->currentItem(); - QTRY_VERIFY(currentItem != 0); + QTRY_VERIFY(currentItem != nullptr); if (flow == QQuickGridView::FlowTopToBottom) { from = from_ttb; @@ -1345,7 +1345,7 @@ void tst_QQuickGridView::moved_defaultLayout(QQuickGridView::Flow flow, QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, rowOffsetAfterMove)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); // current index should have been updated @@ -1559,7 +1559,7 @@ void tst_QQuickGridView::multipleChanges(bool condensed) qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); for (int i=0; i<changes.count(); i++) { @@ -1600,16 +1600,16 @@ void tst_QQuickGridView::multipleChanges(bool condensed) QQuickText *name; QQuickText *number; QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -1804,7 +1804,7 @@ void tst_QQuickGridView::swapWithFirstItem() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); // ensure content position is stable gridview->setContentY(0); @@ -1820,7 +1820,7 @@ void tst_QQuickGridView::currentIndex() for (int i = 0; i < 60; i++) initModel.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); window->show(); @@ -1833,11 +1833,11 @@ void tst_QQuickGridView::currentIndex() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QTRY_VERIFY(!QQuickItemPrivate::get(gridview)->polishScheduled); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); // currentIndex is initialized to 35 // currentItem should be in view @@ -1921,7 +1921,7 @@ void tst_QQuickGridView::noCurrentIndex() for (int i = 0; i < 60; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -1933,9 +1933,9 @@ void tst_QQuickGridView::noCurrentIndex() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // current index should be -1 @@ -1974,17 +1974,17 @@ void tst_QQuickGridView::keyNavigation() window->rootContext()->setContextProperty("testModel", &model); window->setSource(testFileUrl("gridview1.qml")); window->show(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QTRY_COMPARE(qGuiApp->focusWindow(), window); QCOMPARE(gridview->currentIndex(), 0); @@ -2183,10 +2183,10 @@ void tst_QQuickGridView::changeFlow() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // Confirm items positioned correctly and indexes correct int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); @@ -2197,10 +2197,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal((i%3)*80)); QTRY_COMPARE(item->y(), qreal((i/3)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -2215,10 +2215,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal((i/5)*80)); QTRY_COMPARE(item->y(), qreal((i%5)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -2233,10 +2233,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal(-(i/5)*80 - item->width())); QTRY_COMPARE(item->y(), qreal((i%5)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } gridview->setContentX(100); @@ -2253,10 +2253,10 @@ void tst_QQuickGridView::changeFlow() QTRY_COMPARE(item->x(), qreal(240 - (i%3+1)*80)); QTRY_COMPARE(item->y(), qreal((i/3)*60)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -2269,7 +2269,7 @@ void tst_QQuickGridView::defaultValues() QQmlComponent c(&engine, testFileUrl("gridview3.qml")); QQuickGridView *obj = qobject_cast<QQuickGridView*>(c.create()); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_COMPARE(obj->model(), QVariant()); QTRY_VERIFY(!obj->delegate()); QTRY_COMPARE(obj->currentIndex(), -1); @@ -2296,14 +2296,14 @@ void tst_QQuickGridView::properties() QQmlComponent c(&engine, testFileUrl("gridview2.qml")); QQuickGridView *obj = qobject_cast<QQuickGridView*>(c.create()); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_VERIFY(obj->model() != QVariant()); - QTRY_VERIFY(obj->delegate() != 0); + QTRY_VERIFY(obj->delegate() != nullptr); QTRY_COMPARE(obj->currentIndex(), 0); - QTRY_VERIFY(obj->currentItem() != 0); + QTRY_VERIFY(obj->currentItem() != nullptr); QTRY_COMPARE(obj->count(), 4); - QTRY_VERIFY(obj->highlight() != 0); - QTRY_VERIFY(obj->highlightItem() != 0); + QTRY_VERIFY(obj->highlight() != nullptr); + QTRY_VERIFY(obj->highlightItem() != nullptr); QTRY_COMPARE(obj->highlightFollowsCurrentItem(), false); QTRY_COMPARE(obj->flow(), QQuickGridView::FlowLeftToRight); QTRY_COMPARE(obj->isWrapEnabled(), true); @@ -2488,9 +2488,9 @@ void tst_QQuickGridView::positionViewAtBeginningEnd() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // positionViewAtBeginning @@ -2575,9 +2575,9 @@ void tst_QQuickGridView::positionViewAtIndex() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); window->rootObject()->setProperty("enforceRange", enforceRange); @@ -2687,7 +2687,7 @@ void tst_QQuickGridView::snapping() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setHeight(220); QCOMPARE(gridview->height(), 220.); @@ -2716,12 +2716,12 @@ void tst_QQuickGridView::mirroring() QQuickView *windowA = createView(); windowA->setSource(testFileUrl("mirroring.qml")); QQuickGridView *gridviewA = findItem<QQuickGridView>(windowA->rootObject(), "view"); - QTRY_VERIFY(gridviewA != 0); + QTRY_VERIFY(gridviewA != nullptr); QQuickView *windowB = createView(); windowB->setSource(testFileUrl("mirroring.qml")); QQuickGridView *gridviewB = findItem<QQuickGridView>(windowB->rootObject(), "view"); - QTRY_VERIFY(gridviewA != 0); + QTRY_VERIFY(gridviewA != nullptr); qApp->processEvents(); QList<QString> objectNames; @@ -2788,16 +2788,16 @@ void tst_QQuickGridView::resetModel() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QTRY_COMPARE(gridview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } @@ -2809,7 +2809,7 @@ void tst_QQuickGridView::resetModel() for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } @@ -2832,10 +2832,10 @@ void tst_QQuickGridView::enforceRange() window->setSource(testFileUrl("gridview-enforcerange.qml")); window->show(); qApp->processEvents(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QTRY_COMPARE(gridview->preferredHighlightBegin(), 100.0); QTRY_COMPARE(gridview->preferredHighlightEnd(), 100.0); @@ -2843,7 +2843,7 @@ void tst_QQuickGridView::enforceRange() QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // view should be positioned at the top of the range. QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -2851,10 +2851,10 @@ void tst_QQuickGridView::enforceRange() QTRY_COMPARE(gridview->contentY(), -100.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when contentItem moves @@ -2890,17 +2890,17 @@ void tst_QQuickGridView::enforceRange_rightToLeft() window->setSource(testFileUrl("gridview-enforcerange.qml")); window->show(); QTRY_VERIFY(window->isExposed()); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QCOMPARE(gridview->preferredHighlightBegin(), 100.0); QCOMPARE(gridview->preferredHighlightEnd(), 100.0); QCOMPARE(gridview->highlightRangeMode(), QQuickGridView::StrictlyEnforceRange); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); // view should be positioned at the top of the range. QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -2909,10 +2909,10 @@ void tst_QQuickGridView::enforceRange_rightToLeft() QTRY_COMPARE(gridview->contentY(), 0.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when contentItem moves @@ -2941,7 +2941,7 @@ void tst_QQuickGridView::QTBUG_8456() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QTRY_COMPARE(gridview->currentIndex(), 0); @@ -2958,10 +2958,10 @@ void tst_QQuickGridView::manualHighlight() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->currentIndex(), 0); QTRY_COMPARE(gridview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0)); @@ -3019,14 +3019,14 @@ void tst_QQuickGridView::footer() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(footer); @@ -3079,7 +3079,7 @@ void tst_QQuickGridView::footer() // if header is toggled, it shouldn't affect the footer position window->rootObject()->setProperty("showHeader", true); - QVERIFY(findItem<QQuickItem>(contentItem, "header") != 0); + QVERIFY(findItem<QQuickItem>(contentItem, "header") != nullptr); QTRY_COMPARE(footer->position(), posWhenNoItems); window->rootObject()->setProperty("showHeader", false); @@ -3216,9 +3216,9 @@ void tst_QQuickGridView::initialZValues() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QVERIFY(gridview->currentItem()); QTRY_COMPARE(gridview->currentItem()->z(), gridview->property("itemZ").toReal()); @@ -3268,14 +3268,14 @@ void tst_QQuickGridView::header() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *header = findItem<QQuickText>(contentItem, "header"); QVERIFY(header); @@ -3345,7 +3345,7 @@ void tst_QQuickGridView::header() qApp->processEvents(); gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -3490,14 +3490,14 @@ void tst_QQuickGridView::extents() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); gridview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -3606,10 +3606,10 @@ void tst_QQuickGridView::resetModel_headerFooter() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -3652,9 +3652,9 @@ void tst_QQuickGridView::resizeViewAndRepaint() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // item at index 10 should not be currently visible @@ -3728,9 +3728,9 @@ void tst_QQuickGridView::resizeGrid() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // set the width to slightly larger than 3 items across, to test // items are aligned correctly in right-to-left @@ -3753,7 +3753,7 @@ void tst_QQuickGridView::resizeGrid() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -3785,7 +3785,7 @@ void tst_QQuickGridView::resizeGrid() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QCOMPARE(item->position(), expectedItemPos(gridview, i, 0)); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -3862,9 +3862,9 @@ void tst_QQuickGridView::changeColumnCount() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); // a single column of 6 items are visible @@ -3939,14 +3939,14 @@ void tst_QQuickGridView::indexAt_itemAt() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->count(), model.count()); - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (index >= 0) { item = findItem<QQuickItem>(contentItem, "wrapper", index); QVERIFY(item); @@ -4078,7 +4078,7 @@ void tst_QQuickGridView::attachedProperties_QTBUG_32836() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *header = gridview->headerItem(); QVERIFY(header); @@ -4136,9 +4136,9 @@ void tst_QQuickGridView::margins() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QCOMPARE(gridview->contentX(), -30.); @@ -4199,10 +4199,10 @@ void tst_QQuickGridView::margins() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(gridview->contentX(), -240+50.); QTRY_COMPARE(gridview->originX(), -100. * 10); @@ -4319,7 +4319,7 @@ void tst_QQuickGridView::snapToRow() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); @@ -4327,7 +4327,7 @@ void tst_QQuickGridView::snapToRow() QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); qreal origContentY = gridview->contentY(); qreal origContentX = gridview->contentX(); @@ -4340,7 +4340,7 @@ void tst_QQuickGridView::snapToRow() // click to stop it. Otherwise we wouldn't know how much further it will go. We don't want to it // to hit the endExtent, yet. - QTest::mouseClick(window, Qt::LeftButton, 0, flickEnd); + QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, flickEnd); QTRY_VERIFY(gridview->isMoving() == false); // wait until it stops if (flow == QQuickGridView::FlowLeftToRight) @@ -4426,7 +4426,7 @@ void tst_QQuickGridView::snapOneRow() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); gridview->setFlow(flow); gridview->setLayoutDirection(layoutDirection); @@ -4434,7 +4434,7 @@ void tst_QQuickGridView::snapOneRow() QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QQuickItem *contentItem = gridview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QSignalSpy currentIndexSpy(gridview, SIGNAL(currentIndexChanged())); @@ -4507,10 +4507,10 @@ void tst_QQuickGridView::unaligned() qApp->processEvents(); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); for (int i = 0; i < 10; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); @@ -4523,7 +4523,7 @@ void tst_QQuickGridView::unaligned() // appending for (int i = 10; i < 18; ++i) { model.addItem("Item" + QString::number(i), ""); - QQuickItem *item = 0; + QQuickItem *item = nullptr; QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i)); QCOMPARE(item->x(), qreal((i%9)*gridview->cellWidth())); QCOMPARE(item->y(), qreal((i/9)*gridview->cellHeight())); @@ -4532,7 +4532,7 @@ void tst_QQuickGridView::unaligned() // inserting for (int i = 0; i < 10; ++i) { model.insertItem(i, "Item" + QString::number(i), ""); - QQuickItem *item = 0; + QQuickItem *item = nullptr; QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i)); QCOMPARE(item->x(), qreal((i%9)*gridview->cellWidth())); QCOMPARE(item->y(), qreal((i/9)*gridview->cellHeight())); @@ -4543,7 +4543,7 @@ void tst_QQuickGridView::unaligned() gridview->forceLayout(); QTRY_COMPARE(model.count(), gridview->count()); for (int i = 0; i < 18; ++i) { - QQuickItem *item = 0; + QQuickItem *item = nullptr; QTRY_VERIFY(item = findItem<QQuickItem>(contentItem, "wrapper", i)); QCOMPARE(item->x(), qreal(i%9)*gridview->cellWidth()); QCOMPARE(item->y(), qreal(i/9)*gridview->cellHeight()); @@ -4605,7 +4605,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -4641,7 +4641,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -4659,7 +4659,7 @@ void tst_QQuickGridView::populateTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -4714,9 +4714,9 @@ void tst_QQuickGridView::addTransitions() window->show(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); if (contentYRowOffset != 0) { @@ -4795,7 +4795,7 @@ void tst_QQuickGridView::addTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); } @@ -4919,9 +4919,9 @@ void tst_QQuickGridView::moveTransitions() window->show(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name; if (contentYRowOffset != 0) { @@ -4993,7 +4993,7 @@ void tst_QQuickGridView::moveTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0 + pixelOffset); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5164,9 +5164,9 @@ void tst_QQuickGridView::removeTransitions() window->show(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); if (contentYRowOffset != 0) { @@ -5247,7 +5247,7 @@ void tst_QQuickGridView::removeTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), gridview->contentY() + ((i-firstVisibleIndex)/3) * 60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5382,9 +5382,9 @@ void tst_QQuickGridView::displacedTransitions() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); @@ -5466,7 +5466,7 @@ void tst_QQuickGridView::displacedTransitions() QCOMPARE(item->x(), (i%3)*80.0); QCOMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5601,9 +5601,9 @@ void tst_QQuickGridView::multipleTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); if (contentY != 0) { @@ -5688,7 +5688,7 @@ void tst_QQuickGridView::multipleTransitions() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5771,9 +5771,9 @@ void tst_QQuickGridView::multipleDisplaced() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.moveItems(12, 8, 1); @@ -5795,7 +5795,7 @@ void tst_QQuickGridView::multipleDisplaced() QTRY_COMPARE(item->x(), (i%3)*80.0); QTRY_COMPARE(item->y(), (i/3)*60.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5823,7 +5823,7 @@ void tst_QQuickGridView::regression_QTBUG_57225() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(gridview)->polishScheduled, false); model.removeItems(removeIndex, removeCount); @@ -5875,11 +5875,11 @@ void tst_QQuickGridView::cacheBuffer() qApp->processEvents(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *contentItem = gridview->contentItem(); - QVERIFY(contentItem != 0); - QVERIFY(gridview->delegate() != 0); + QVERIFY(contentItem != nullptr); + QVERIFY(gridview->delegate() != nullptr); QVERIFY(gridview->model() != 0); // Confirm items positioned correctly @@ -5898,8 +5898,8 @@ void tst_QQuickGridView::cacheBuffer() // items will be created one at a time for (int i = itemCount; i < qMin(itemCount+9,model.count()); ++i) { - QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -5933,11 +5933,11 @@ void tst_QQuickGridView::cacheBuffer() QTRY_COMPARE(item->y(), (i/3)*60.0); } - QVERIFY(findItem<QQuickItem>(gridview, "wrapper", 34) == 0); + QVERIFY(findItem<QQuickItem>(gridview, "wrapper", 34) == nullptr); // ensure buffered items are created for (int i = 34; i < qMin(44,model.count()); ++i) { - QQuickItem *item = 0; + QQuickItem *item = nullptr; while (!item) { qGuiApp->processEvents(); // allow refill to happen bool b = false; @@ -5966,7 +5966,7 @@ void tst_QQuickGridView::asynchronous() QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject()); QVERIFY(rootObject); - QQuickGridView *gridview = 0; + QQuickGridView *gridview = nullptr; while (!gridview) { bool b = false; controller.incubateWhile(&b); @@ -5975,8 +5975,8 @@ void tst_QQuickGridView::asynchronous() // items will be created one at a time for (int i = 0; i < 12; ++i) { - QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(gridview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -6007,7 +6007,7 @@ void tst_QQuickGridView::unrequestedVisibility() for (int i = 0; i < 30; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -6021,16 +6021,16 @@ void tst_QQuickGridView::unrequestedVisibility() qApp->processEvents(); QQuickGridView *leftview = findItem<QQuickGridView>(window->rootObject(), "leftGrid"); - QTRY_VERIFY(leftview != 0); + QTRY_VERIFY(leftview != nullptr); QQuickGridView *rightview = findItem<QQuickGridView>(window->rootObject(), "rightGrid"); - QTRY_VERIFY(rightview != 0); + QTRY_VERIFY(rightview != nullptr); QQuickItem *leftContent = leftview->contentItem(); - QTRY_VERIFY(leftContent != 0); + QTRY_VERIFY(leftContent != nullptr); QQuickItem *rightContent = rightview->contentItem(); - QTRY_VERIFY(rightContent != 0); + QTRY_VERIFY(rightContent != nullptr); rightview->setCurrentIndex(12); @@ -6445,10 +6445,10 @@ void tst_QQuickGridView::displayMargin() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = window->rootObject()->findChild<QQuickGridView*>(); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QQuickItem *content = gridview->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QQuickItem *item0; QQuickItem *item97; @@ -6461,7 +6461,7 @@ void tst_QQuickGridView::displayMargin() QCOMPARE(delegateVisible(item97), true); // GridView staggers item creation, so the 118th item should be outside the end margin. - QVERIFY(findItem<QQuickItem>(content, "delegate", 117) == 0); + QVERIFY(findItem<QQuickItem>(content, "delegate", 117) == nullptr); // the first delegate should still be within the begin margin gridview->positionViewAtIndex(20, QQuickGridView::Beginning); @@ -6484,13 +6484,13 @@ void tst_QQuickGridView::negativeDisplayMargin() QQuickItem *listview = window->rootObject(); QQuickGridView *gridview = findItem<QQuickGridView>(window->rootObject(), "grid"); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QTRY_COMPARE(gridview->property("createdItems").toInt(), 11); QCOMPARE(gridview->property("destroyedItem").toInt(), 0); QQuickItem *content = gridview->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QVERIFY(item = findItem<QQuickItem>(content, "delegate", 0)); QCOMPARE(delegateVisible(item), true); @@ -6589,7 +6589,7 @@ void tst_QQuickGridView::contentHeightWithDelayRemove() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = window->rootObject()->findChild<QQuickGridView*>(); - QTRY_VERIFY(gridview != 0); + QTRY_VERIFY(gridview != nullptr); const int initialCount(gridview->count()); const int eventualCount(initialCount + countDelta); @@ -6620,7 +6620,7 @@ void tst_QQuickGridView::QTBUG_45640() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickGridView *gridview = qobject_cast<QQuickGridView*>(window->rootObject()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); QCOMPARE(gridview->contentY(), qreal(-50.0)); @@ -6640,7 +6640,7 @@ void tst_QQuickGridView::QTBUG_49218() QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject()); QQuickGridView *gridview = qobject_cast<QQuickGridView *>(rootItem->childItems().first()); - QVERIFY(gridview != 0); + QVERIFY(gridview != nullptr); auto processEventsAndForceLayout = [&gridview] () { for (int pass = 0; pass < 2; ++pass) { @@ -6739,7 +6739,7 @@ void tst_QQuickGridView::QTBUG_48870_fastModelUpdates() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickGridView *view = findItem<QQuickGridView>(window->rootObject(), "view"); - QTRY_VERIFY(view != 0); + QTRY_VERIFY(view != nullptr); QQuickItemViewPrivate *priv = QQuickItemViewPrivate::get(view); bool nonUnique; diff --git a/tests/auto/quick/qquickimage/tst_qquickimage.cpp b/tests/auto/quick/qquickimage/tst_qquickimage.cpp index ec0ec6c2b6..9a93bf8892 100644 --- a/tests/auto/quick/qquickimage/tst_qquickimage.cpp +++ b/tests/auto/quick/qquickimage/tst_qquickimage.cpp @@ -116,7 +116,7 @@ void tst_qquickimage::noSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->source(), QUrl()); QCOMPARE(obj->status(), QQuickImage::Null); QCOMPARE(obj->width(), 0.); @@ -203,7 +203,7 @@ void tst_qquickimage::imageSource() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); if (async) QVERIFY(obj->asynchronous()); @@ -241,7 +241,7 @@ void tst_qquickimage::clearSource() 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); QCOMPARE(obj->width(), 120.); QCOMPARE(obj->height(), 120.); @@ -263,7 +263,7 @@ void tst_qquickimage::resized() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->fillMode(), QQuickImage::Stretch); @@ -273,13 +273,13 @@ void tst_qquickimage::resized() void tst_qquickimage::preserveAspectRatio() { - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); window->setSource(testFileUrl("aspectratio.qml")); QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject()); - QVERIFY(image != 0); + QVERIFY(image != nullptr); image->setWidth(80.0); QCOMPARE(image->width(), 80.); QCOMPARE(image->height(), 80.); @@ -287,7 +287,7 @@ void tst_qquickimage::preserveAspectRatio() window->setSource(testFileUrl("aspectratio.qml")); image = qobject_cast<QQuickImage*>(window->rootObject()); image->setHeight(60.0); - QVERIFY(image != 0); + QVERIFY(image != nullptr); QCOMPARE(image->height(), 60.); QCOMPARE(image->width(), 60.); } @@ -298,7 +298,7 @@ void tst_qquickimage::smooth() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->smooth(), true); @@ -327,7 +327,7 @@ void tst_qquickimage::mirror() window->setSource(testFileUrl("mirror.qml")); QQuickImage *obj = window->rootObject()->findChild<QQuickImage*>("image"); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->setFillMode(fillMode); obj->setProperty("mirror", true); @@ -411,7 +411,7 @@ void tst_qquickimage::svg() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 300.0); QCOMPARE(obj->height(), 300.0); obj->setSourceSize(QSize(200,200)); @@ -486,7 +486,7 @@ void tst_qquickimage::geometry() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), itemWidth); QCOMPARE(obj->paintedWidth(), paintedWidth); @@ -509,7 +509,7 @@ void tst_qquickimage::big() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 100.0); QCOMPARE(obj->height(), 256.0); @@ -530,7 +530,7 @@ void tst_qquickimage::tiling_QTBUG_6716() QQuickImage *tiling = findItem<QQuickImage>(view.rootObject(), "tiling"); - QVERIFY(tiling != 0); + QVERIFY(tiling != nullptr); QImage img = view.grabWindow(); for (int x = 0; x < tiling->width(); ++x) { for (int y = 0; y < tiling->height(); ++y) { @@ -561,7 +561,7 @@ void tst_qquickimage::noLoading() 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); QSignalSpy sourceSpy(obj, SIGNAL(sourceChanged(QUrl))); @@ -608,7 +608,7 @@ void tst_qquickimage::paintedWidthHeight() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 200.0); QCOMPARE(obj->height(), 25.0); QCOMPARE(obj->paintedWidth(), 25.0); @@ -623,7 +623,7 @@ void tst_qquickimage::paintedWidthHeight() QQmlComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 26.0); QCOMPARE(obj->height(), 175.0); QCOMPARE(obj->paintedWidth(), 26.0); @@ -644,7 +644,7 @@ void tst_qquickimage::sourceSize_QTBUG_14303() QSignalSpy sourceSizeSpy(obj, SIGNAL(sourceSizeChanged())); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_COMPARE(obj->status(), QQuickImage::Ready); QTRY_COMPARE(obj->sourceSize().width(), 200); @@ -666,7 +666,7 @@ void tst_qquickimage::sourceSize_QTBUG_14303() void tst_qquickimage::sourceSize_QTBUG_16389() { - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); window->setSource(testFileUrl("qtbug_16389.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -690,7 +690,7 @@ void tst_qquickimage::sourceSize_QTBUG_16389() // QTBUG-15690 void tst_qquickimage::nullPixmapPaint() { - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); window->setSource(testFileUrl("nullpixmap.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -700,7 +700,7 @@ void tst_qquickimage::nullPixmapPaint() server.serveDirectory(dataDirectory(), TestHTTPServer::Delay); QQuickImage *image = qobject_cast<QQuickImage*>(window->rootObject()); - QTRY_VERIFY(image != 0); + QTRY_VERIFY(image != nullptr); image->setSource(server.url("/no-such-file.png")); QQmlTestMessageHandler messageHandler; @@ -730,7 +730,7 @@ void tst_qquickimage::imageCrash_QTBUG_22125() // shouldn't crash when deleting cancelled QQmlPixmapReplys. server.sendDelayedItem(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -763,7 +763,7 @@ void tst_qquickimage::sourceSize() QFETCH(qreal, implicitWidth); QFETCH(qreal, implicitHeight); - QScopedPointer<QQuickView> window(new QQuickView(0)); + QScopedPointer<QQuickView> window(new QQuickView(nullptr)); QQmlContext *ctxt = window->rootContext(); ctxt->setContextProperty("srcWidth", sourceWidth); ctxt->setContextProperty("srcHeight", sourceHeight); @@ -794,7 +794,7 @@ void tst_qquickimage::sourceSizeChanges() QQmlContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", ""); QQuickImage *img = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(img != 0); + QVERIFY(img != nullptr); QSignalSpy sourceSizeSpy(img, SIGNAL(sourceSizeChanged())); @@ -860,7 +860,7 @@ void tst_qquickimage::progressAndStatusChanges() 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); QTRY_COMPARE(obj->progress(), 1.0); @@ -977,7 +977,7 @@ void tst_qquickimage::highdpi() ctxt->setContextProperty("srcImage", testFileUrl("heart-highdpi@2x.png")); QQuickImage *obj = qobject_cast<QQuickImage*>(component.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->width(), 150.0); QCOMPARE(obj->height(), 150.0); diff --git a/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp b/tests/auto/quick/qquickimageprovider/tst_qquickimageprovider.cpp index 98f3972cef..d8464ebc74 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); @@ -393,7 +393,7 @@ void tst_qquickimageprovider::imageProviderId() class TestThreadProvider : public QQuickImageProvider { public: - TestThreadProvider() : QQuickImageProvider(Image), ok(false) {} + TestThreadProvider() : QQuickImageProvider(Image) {} ~TestThreadProvider() {} @@ -417,7 +417,7 @@ class TestThreadProvider : public QQuickImageProvider QWaitCondition cond; QMutex mutex; - bool ok; + bool ok = false; }; @@ -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); } @@ -495,7 +495,7 @@ class TestImageResponse : public QQuickImageResponse, public QRunnable class TestAsyncProvider : public QQuickAsyncImageProvider { public: - TestAsyncProvider() : ok(false) + TestAsyncProvider() { pool.setMaxThreadCount(4); } @@ -512,7 +512,7 @@ class TestAsyncProvider : public QQuickAsyncImageProvider QThreadPool pool; QMutex lock; QWaitCondition condition; - bool ok; + bool ok = 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); diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp index f5e8c6858a..ee9d36560d 100644 --- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp @@ -50,7 +50,7 @@ class TestItem : public QQuickItem { Q_OBJECT public: - TestItem(QQuickItem *parent = 0) + TestItem(QQuickItem *parent = nullptr) : QQuickItem(parent), focused(false), pressCount(0), releaseCount(0) , wheelCount(0), acceptIncomingTouchEvents(true) , touchEventReached(false), timestamp(0) @@ -105,7 +105,7 @@ class TestPolishItem : public QQuickItem { Q_OBJECT public: - TestPolishItem(QQuickItem *parent = 0) + TestPolishItem(QQuickItem *parent = nullptr) : QQuickItem(parent), wasPolished(false) { } @@ -127,7 +127,7 @@ class TestFocusScope : public QQuickFocusScope { Q_OBJECT public: - TestFocusScope(QQuickItem *parent = 0) : QQuickFocusScope(parent), focused(false) {} + TestFocusScope(QQuickItem *parent = nullptr) : QQuickFocusScope(parent), focused(false) {} bool focused; protected: @@ -203,12 +203,12 @@ private: NoOp, Append, Remove, StackBefore, StackAfter, SetZ }; - void ensureFocus(QWindow *w) { + bool ensureFocus(QWindow *w) { if (w->width() <=0 || w->height() <= 0) w->setGeometry(100, 100, 400, 300); w->show(); w->requestActivate(); - QTest::qWaitForWindowActive(w); + return QTest::qWaitForWindowActive(w); } }; @@ -264,7 +264,7 @@ struct FocusData { }; struct FocusState : public QHash<QQuickItem *, FocusData> { - FocusState() : activeFocusItem(0) {} + FocusState() : activeFocusItem(nullptr) {} FocusState &operator<<(QQuickItem *item) { insert(item, FocusData()); return *this; @@ -299,7 +299,7 @@ struct FocusState : public QHash<QQuickItem *, FocusData> void tst_qquickitem::simpleFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); @@ -338,7 +338,7 @@ void tst_qquickitem::simpleFocus() l1c3->setFocus(false); focusState[l1c3].set(false, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); l2c1->setFocus(true); @@ -351,7 +351,7 @@ void tst_qquickitem::simpleFocus() void tst_qquickitem::scopedFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *l1c1 = new TestItem(window.contentItem()); @@ -431,7 +431,7 @@ void tst_qquickitem::addedToWindow() { { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *item = new TestItem; @@ -451,7 +451,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *item = new TestItem(window.contentItem()); @@ -480,7 +480,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *tree = new TestItem; @@ -504,7 +504,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *tree = new TestFocusScope; QQuickItem *c1 = new TestItem(tree); @@ -532,7 +532,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *tree = new TestFocusScope; QQuickItem *c1 = new TestItem(tree); @@ -558,7 +558,7 @@ void tst_qquickitem::addedToWindow() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *tree = new TestFocusScope; @@ -598,7 +598,7 @@ void tst_qquickitem::changeParent() // Parent to no parent { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); @@ -611,16 +611,16 @@ void tst_qquickitem::changeParent() focusState.active(child); FVERIFY(); - child->setParentItem(0); + child->setParentItem(nullptr); focusState[child].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); } // Different parent, same focus scope { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestItem(window.contentItem()); @@ -641,7 +641,7 @@ void tst_qquickitem::changeParent() // Different parent, different focus scope { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestFocusScope(window.contentItem()); @@ -658,12 +658,12 @@ void tst_qquickitem::changeParent() item->setParentItem(child2); focusState[item].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); } { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestFocusScope(window.contentItem()); @@ -675,7 +675,7 @@ void tst_qquickitem::changeParent() item->setFocus(true); focusState[item].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); item->setParentItem(child); @@ -685,7 +685,7 @@ void tst_qquickitem::changeParent() } { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *child = new TestItem(window.contentItem()); QQuickItem *child2 = new TestFocusScope(window.contentItem()); @@ -711,7 +711,7 @@ void tst_qquickitem::changeParent() // child is deleted, then its parent changes again to a valid parent { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem *item = new TestFocusScope(window.contentItem()); QQuickItem *child = new TestItem(item); @@ -728,10 +728,10 @@ void tst_qquickitem::changeParent() focusState.active(child); FVERIFY(); - item->setParentItem(0); + item->setParentItem(nullptr); focusState[child].set(true, false); focusState[item].set(true, false); - focusState.active(0); + focusState.active(nullptr); FVERIFY(); focusState.remove(child); @@ -750,7 +750,7 @@ void tst_qquickitem::multipleFocusClears() QQuickView view; view.setSource(testFileUrl("multipleFocusClears.qml")); view.show(); - ensureFocus(&view); + QVERIFY(ensureFocus(&view)); QTRY_COMPARE(QGuiApplication::focusWindow(), &view); } @@ -759,7 +759,7 @@ void tst_qquickitem::focusSubItemInNonFocusScope() QQuickView view; view.setSource(testFileUrl("focusSubItemInNonFocusScope.qml")); view.show(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickItem *dummyItem = view.rootObject()->findChild<QQuickItem *>("dummyItem"); QVERIFY(dummyItem); @@ -781,7 +781,7 @@ void tst_qquickitem::focusSubItemInNonFocusScope() void tst_qquickitem::parentItemWithFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); { QQuickItem parent; @@ -880,7 +880,7 @@ void tst_qquickitem::parentItemWithFocus() void tst_qquickitem::reparentFocusedItem() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QTRY_COMPARE(QGuiApplication::focusWindow(), &window); QQuickItem parent(window.contentItem()); @@ -951,7 +951,7 @@ void tst_qquickitem::setParentItem() QCOMPARE(root->childItems().at(0), child1); QCOMPARE(root->childItems().at(1), child2); - child1->setParentItem(0); + child1->setParentItem(nullptr); QVERIFY(!child1->parent()); QVERIFY(!child1->parentItem()); QCOMPARE(root->childItems().count(), 1); @@ -1047,7 +1047,7 @@ void tst_qquickitem::enabled() void tst_qquickitem::enabledFocus() { QQuickWindow window; - ensureFocus(&window); + QVERIFY(ensureFocus(&window)); QQuickFocusScope root; @@ -1238,56 +1238,56 @@ void tst_qquickitem::mouseGrab() child2->setSize(QSizeF(200, 100)); child2->setParentItem(window.contentItem()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(100); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QTest::qWait(100); QCOMPARE(child1->pressCount, 1); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); - QVERIFY2(window.mouseGrabberItem() == 0, msgItem(window.mouseGrabberItem()).constData()); + QVERIFY2(window.mouseGrabberItem() == nullptr, msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->releaseCount, 1); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->pressCount, 2); child1->setEnabled(false); - QVERIFY2(window.mouseGrabberItem() == 0, msgItem(window.mouseGrabberItem()).constData()); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QVERIFY2(window.mouseGrabberItem() == nullptr, msgItem(window.mouseGrabberItem()).constData()); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->releaseCount, 1); child1->setEnabled(true); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->pressCount, 3); child1->setVisible(false); - QVERIFY2(window.mouseGrabberItem() == 0, msgItem(window.mouseGrabberItem())); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QVERIFY2(window.mouseGrabberItem() == nullptr, msgItem(window.mouseGrabberItem())); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QCOMPARE(child1->releaseCount, 1); child1->setVisible(true); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QVERIFY2(window.mouseGrabberItem() == child1.data(), msgItem(window.mouseGrabberItem()).constData()); QCOMPARE(child1->pressCount, 4); child2->grabMouse(); QVERIFY2(window.mouseGrabberItem() == child2.data(), msgItem(window.mouseGrabberItem()).constData()); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->releaseCount, 1); QCOMPARE(child2->releaseCount, 1); child2->grabMouse(); QVERIFY2(window.mouseGrabberItem() == child2.data(), msgItem(window.mouseGrabberItem()).constData()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->pressCount, 4); QCOMPARE(child2->pressCount, 1); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50,50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50,50)); QTest::qWait(50); QCOMPARE(child1->releaseCount, 1); QCOMPARE(child2->releaseCount, 2); @@ -1308,14 +1308,14 @@ void tst_qquickitem::touchEventAcceptIgnore() TestWindow window; window.resize(100, 100); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QScopedPointer<TestItem> item(new TestItem); item->setSize(QSizeF(100, 100)); item->setParentItem(window.contentItem()); item->acceptIncomingTouchEvents = itemSupportsTouch; - static QTouchDevice* device = 0; + static QTouchDevice* device = nullptr; if (!device) { device =new QTouchDevice; device->setType(QTouchDevice::TouchScreen); @@ -1419,7 +1419,7 @@ void tst_qquickitem::polishOnCompleted() QQuickView view; view.setSource(testFileUrl("polishOnCompleted.qml")); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); TestPolishItem *item = qobject_cast<TestPolishItem*>(view.rootObject()); QVERIFY(item); @@ -1451,7 +1451,7 @@ void tst_qquickitem::wheelEvent() QQuickWindow window; window.resize(width, height); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); TestItem *item = new TestItem; item->setSize(QSizeF(width, height)); @@ -1483,7 +1483,7 @@ class HoverItem : public QQuickItem { Q_OBJECT public: - HoverItem(QQuickItem *parent = 0) + HoverItem(QQuickItem *parent = nullptr) : QQuickItem(parent), hoverEnterCount(0), hoverMoveCount(0), hoverLeaveCount(0) { } void resetCounters() { @@ -1529,7 +1529,7 @@ void tst_qquickitem::hoverEvent_data() // ### For some unknown reason QTest::mouseMove() isn't working correctly. static void sendMouseMove(QObject *object, const QPoint &position) { - QMouseEvent moveEvent(QEvent::MouseMove, position, Qt::NoButton, Qt::NoButton, 0); + QMouseEvent moveEvent(QEvent::MouseMove, position, Qt::NoButton, Qt::NoButton, nullptr); QGuiApplication::sendEvent(object, &moveEvent); } @@ -1745,54 +1745,54 @@ void tst_qquickitem::acceptedMouseButtons() item.setSize(QSizeF(200,100)); item.setParentItem(window.contentItem()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 0); QCOMPARE(item.releaseCount, 0); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 0); QCOMPARE(item.releaseCount, 0); - QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 0); QCOMPARE(item.releaseCount, 0); item.setAcceptedMouseButtons(Qt::LeftButton); QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::LeftButton)); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); - QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); item.setAcceptedMouseButtons(Qt::RightButton | Qt::MiddleButton); QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::RightButton | Qt::MiddleButton)); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 2); QCOMPARE(item.releaseCount, 2); - QTest::mousePress(&window, Qt::MiddleButton, 0, QPoint(50, 50)); - QTest::mouseRelease(&window, Qt::MiddleButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mouseRelease(&window, Qt::MiddleButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 3); QCOMPARE(item.releaseCount, 3); } @@ -1800,7 +1800,7 @@ void tst_qquickitem::acceptedMouseButtons() static void gc(QQmlEngine &engine) { engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); } @@ -1826,7 +1826,7 @@ void tst_qquickitem::visualParentOwnership() gc(engine); QVERIFY(!newItem.isNull()); - newItem->setParentItem(0); + newItem->setParentItem(nullptr); gc(engine); QVERIFY(newItem.isNull()); @@ -1883,7 +1883,7 @@ void tst_qquickitem::visualParentOwnershipWindow() gc(engine); QVERIFY(!newItem.isNull()); - newItem->setParentItem(0); + newItem->setParentItem(nullptr); gc(engine); QVERIFY(newItem.isNull()); @@ -2059,10 +2059,10 @@ void tst_qquickitem::ignoreButtonPressNotInAcceptedMouseButtons() item.setAcceptedMouseButtons(Qt::LeftButton); QCOMPARE(item.acceptedMouseButtons(), Qt::MouseButtons(Qt::LeftButton)); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(50, 50)); - QTest::mousePress(&window, Qt::RightButton, 0, QPoint(50, 50)); // ignored because it's not LeftButton - QTest::mouseRelease(&window, Qt::RightButton, 0, QPoint(50, 50)); // ignored because it didn't grab the RightButton press - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(50, 50)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); + QTest::mousePress(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); // ignored because it's not LeftButton + QTest::mouseRelease(&window, Qt::RightButton, Qt::NoModifier, QPoint(50, 50)); // ignored because it didn't grab the RightButton press + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(50, 50)); QCOMPARE(item.pressCount, 1); QCOMPARE(item.releaseCount, 1); @@ -2072,7 +2072,7 @@ void tst_qquickitem::shortcutOverride() { QQuickView view; view.setSource(testFileUrl("shortcutOverride.qml")); - ensureFocus(&view); + QVERIFY(ensureFocus(&view)); QCOMPARE(view.rootObject()->property("escapeHandlerActivationCount").toInt(), 0); QCOMPARE(view.rootObject()->property("shortcutActivationCount").toInt(), 0); @@ -2131,9 +2131,9 @@ void tst_qquickitem::qtBug60123() auto activateWindowAndTestPress = [] (QQuickView* testWindow) { testWindow->requestActivate(); QTest::qWaitForWindowActive(testWindow); - QTest::mousePress(testWindow, Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mousePress(testWindow, Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); QCOMPARE(testWindow->rootObject()->property("lastEvent").toString(), QString("pressed")); - QTest::mouseRelease(testWindow, Qt::LeftButton, 0, QPoint(10, 10)); + QTest::mouseRelease(testWindow, Qt::LeftButton, Qt::NoModifier, QPoint(10, 10)); QCOMPARE(testWindow->rootObject()->property("lastEvent").toString(), QString("released")); }; diff --git a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp index b66dc1708f..0f4850d4a7 100644 --- a/tests/auto/quick/qquickitem2/tst_qquickitem.cpp +++ b/tests/auto/quick/qquickitem2/tst_qquickitem.cpp @@ -193,7 +193,7 @@ class KeyTestItem : public QQuickItem { Q_OBJECT public: - KeyTestItem(QQuickItem *parent=0) : QQuickItem(parent), mKey(0) {} + KeyTestItem(QQuickItem *parent=nullptr) : QQuickItem(parent), mKey(0) {} protected: void keyPressEvent(QKeyEvent *e) { @@ -240,7 +240,7 @@ class HollowTestItem : public QQuickItem Q_PROPERTY(qreal holeRadius READ holeRadius WRITE setHoleRadius) public: - HollowTestItem(QQuickItem *parent = 0) + HollowTestItem(QQuickItem *parent = nullptr) : QQuickItem(parent), m_isPressed(false), m_isHovered(false), @@ -343,7 +343,7 @@ void tst_QQuickItem::initTestCase() void tst_QQuickItem::cleanup() { QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } void tst_QQuickItem::activeFocusOnTab() @@ -351,7 +351,7 @@ void tst_QQuickItem::activeFocusOnTab() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab.qml")); @@ -463,7 +463,7 @@ void tst_QQuickItem::activeFocusOnTab2() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab.qml")); @@ -503,7 +503,7 @@ void tst_QQuickItem::activeFocusOnTab3() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab3.qml")); @@ -685,7 +685,7 @@ void tst_QQuickItem::activeFocusOnTab4() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab4.qml")); @@ -717,7 +717,7 @@ void tst_QQuickItem::activeFocusOnTab5() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab4.qml")); @@ -751,7 +751,7 @@ void tst_QQuickItem::activeFocusOnTab6() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab6.qml")); @@ -809,7 +809,7 @@ void tst_QQuickItem::activeFocusOnTab7() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab7.qml")); @@ -842,7 +842,7 @@ void tst_QQuickItem::activeFocusOnTab7() void tst_QQuickItem::activeFocusOnTab8() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab8.qml")); @@ -894,7 +894,7 @@ void tst_QQuickItem::activeFocusOnTab9() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab9.qml")); @@ -945,7 +945,7 @@ void tst_QQuickItem::activeFocusOnTab10() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300,300)); window->setSource(testFileUrl("activeFocusOnTab9.qml")); @@ -1028,7 +1028,7 @@ void tst_QQuickItem::nextItemInFocusChain() if (!qt_tab_all_widgets()) QSKIP("This function doesn't support NOT iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab.qml")); @@ -1104,7 +1104,7 @@ void tst_QQuickItem::nextItemInFocusChain2() if (qt_tab_all_widgets()) QSKIP("This function doesn't support iterating all."); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("activeFocusOnTab6.qml")); @@ -1149,7 +1149,7 @@ void tst_QQuickItem::nextItemInFocusChain2() void tst_QQuickItem::nextItemInFocusChain3() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("nextItemInFocusChain3.qml")); @@ -1177,7 +1177,7 @@ void verifyTabFocusChain(QQuickView *window, const char **focusChain, bool forwa void tst_QQuickItem::tabFence() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("tabFence.qml")); @@ -1216,7 +1216,7 @@ void tst_QQuickItem::tabFence() void tst_QQuickItem::qtbug_50516() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("qtbug_50516.qml")); @@ -1261,7 +1261,7 @@ void tst_QQuickItem::qtbug_50516_2() QFETCH(QString, item1); QFETCH(QString, item2); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl(filename)); @@ -1282,7 +1282,7 @@ void tst_QQuickItem::qtbug_50516_2() void tst_QQuickItem::keys() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); KeysTestObject *testObject = new KeysTestObject; @@ -1471,7 +1471,7 @@ void tst_QQuickItem::standardKeys() void tst_QQuickItem::keysProcessingOrder() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); KeysTestObject *testObject = new KeysTestObject; @@ -1532,7 +1532,7 @@ void tst_QQuickItem::keysim() QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); inputMethodPrivate->testContext = &platformInputContext; - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keysim.qml")); @@ -1650,7 +1650,7 @@ bool anchorsMirrored(QQuickItem *rootItem, const char * itemString) void tst_QQuickItem::layoutMirroring() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("layoutmirroring.qml")); window->show(); @@ -1801,7 +1801,7 @@ void tst_QQuickItem::layoutMirroringIllegalParent() component.setData("import QtQuick 2.0; QtObject { LayoutMirroring.enabled: true; LayoutMirroring.childrenInherit: true }", QUrl::fromLocalFile("")); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1:21: QML QtObject: LayoutDirection attached property only works with Items and Windows"); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); } void tst_QQuickItem::keyNavigation_data() @@ -1815,7 +1815,7 @@ void tst_QQuickItem::keyNavigation() { QFETCH(QString, source); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl(source)); @@ -1892,7 +1892,7 @@ void tst_QQuickItem::keyNavigation() void tst_QQuickItem::keyNavigation_RightToLeft() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest.qml")); @@ -1947,7 +1947,7 @@ void tst_QQuickItem::keyNavigation_RightToLeft() void tst_QQuickItem::keyNavigation_skipNotVisible() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest.qml")); @@ -2022,7 +2022,7 @@ void tst_QQuickItem::keyNavigation_skipNotVisible() void tst_QQuickItem::keyNavigation_implicitSetting() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest_implicit.qml")); @@ -2149,7 +2149,7 @@ void tst_QQuickItem::keyNavigation_implicitSetting() void tst_QQuickItem::keyNavigation_focusReason() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); FocusEventFilter focusEventFilter; @@ -2210,7 +2210,7 @@ void tst_QQuickItem::keyNavigation_focusReason() void tst_QQuickItem::keyNavigation_loop() { // QTBUG-47229 - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(240,320)); window->setSource(testFileUrl("keynavigationtest_loop.qml")); @@ -2325,18 +2325,18 @@ void tst_QQuickItem::mapCoordinates() QFETCH(int, x); QFETCH(int, y); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300, 300)); window->setSource(testFileUrl("mapCoordinates.qml")); window->show(); qApp->processEvents(); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA"); - QVERIFY(a != 0); + QVERIFY(a != nullptr); QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB"); - QVERIFY(b != 0); + QVERIFY(b != nullptr); QVariant result; @@ -2396,18 +2396,18 @@ void tst_QQuickItem::mapCoordinatesRect() QFETCH(int, width); QFETCH(int, height); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300, 300)); window->setSource(testFileUrl("mapCoordinatesRect.qml")); window->show(); qApp->processEvents(); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickItem *a = findItem<QQuickItem>(window->rootObject(), "itemA"); - QVERIFY(a != 0); + QVERIFY(a != nullptr); QQuickItem *b = findItem<QQuickItem>(window->rootObject(), "itemB"); - QVERIFY(b != 0); + QVERIFY(b != nullptr); QVariant result; @@ -2478,7 +2478,7 @@ void tst_QQuickItem::transforms() component.setData("import QtQuick 2.3\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); QVERIFY(item); - QCOMPARE(item->itemTransform(0,0), transform); + QCOMPARE(item->itemTransform(nullptr,nullptr), transform); } void tst_QQuickItem::childrenProperty() @@ -2486,7 +2486,7 @@ void tst_QQuickItem::childrenProperty() QQmlComponent component(&engine, testFileUrl("childrenProperty.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test1").toBool(), true); QCOMPARE(o->property("test2").toBool(), true); @@ -2501,7 +2501,7 @@ void tst_QQuickItem::resourcesProperty() QQmlComponent component(&engine, testFileUrl("resourcesProperty.qml")); QObject *object = component.create(); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQmlProperty property(object, "resources", component.creationContext()); @@ -2533,7 +2533,7 @@ void tst_QQuickItem::resourcesProperty() void tst_QQuickItem::propertyChanges() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(300, 300)); window->setSource(testFileUrl("propertychanges.qml")); window->show(); @@ -2624,7 +2624,7 @@ void tst_QQuickItem::nonexistentPropertyConnection() void tst_QQuickItem::childrenRect() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("childrenRect.qml")); window->setBaseSize(QSize(240,320)); window->show(); @@ -2653,7 +2653,7 @@ void tst_QQuickItem::childrenRect() // QTBUG-11383 void tst_QQuickItem::childrenRectBug() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); QString warning = testFileUrl("childrenRectBug.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"height\""; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); @@ -2674,7 +2674,7 @@ void tst_QQuickItem::childrenRectBug() // QTBUG-11465 void tst_QQuickItem::childrenRectBug2() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); QString warning1 = testFileUrl("childrenRectBug2.qml").toString() + ":7:5: QML Item: Binding loop detected for property \"width\""; QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); @@ -2708,7 +2708,7 @@ void tst_QQuickItem::childrenRectBug2() // QTBUG-12722 void tst_QQuickItem::childrenRectBug3() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("childrenRectBug3.qml")); window->show(); @@ -2719,7 +2719,7 @@ void tst_QQuickItem::childrenRectBug3() // QTBUG-38732 void tst_QQuickItem::childrenRectBottomRightCorner() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("childrenRectBottomRightCorner.qml")); window->show(); @@ -2811,7 +2811,7 @@ void tst_QQuickItem::changeListener() { QQuickWindow window; window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *item = new QQuickItem; TestListener itemListener; @@ -2994,7 +2994,7 @@ void tst_QQuickItem::changeListener() // QTBUG-13893 void tst_QQuickItem::transformCrash() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("transformCrash.qml")); window->show(); @@ -3003,7 +3003,7 @@ void tst_QQuickItem::transformCrash() void tst_QQuickItem::implicitSize() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("implicitsize.qml")); window->show(); @@ -3076,14 +3076,14 @@ void tst_QQuickItem::qtbug_16871() { QQmlComponent component(&engine, testFileUrl("qtbug_16871.qml")); QObject *o = component.create(); - QVERIFY(o != 0); + QVERIFY(o != nullptr); delete o; } void tst_QQuickItem::visibleChildren() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("visiblechildren.qml")); window->show(); @@ -3141,7 +3141,7 @@ void tst_QQuickItem::visibleChildren() void tst_QQuickItem::parentLoop() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); #if QT_CONFIG(regularexpression) QRegularExpression msgRegexp = QRegularExpression("QQuickItem::setParentItem: Parent QQuickItem\\(.*\\) is already part of the subtree of QQuickItem\\(.*\\)"); @@ -3231,7 +3231,7 @@ void tst_QQuickItem::contains() QFETCH(bool, insideTarget); QFETCH(QList<QPoint>, points); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->rootContext()->setContextProperty("circleShapeTest", circleTest); window->setBaseSize(QSize(400, 400)); window->setSource(testFileUrl("hollowTestItem.qml")); @@ -3253,12 +3253,12 @@ void tst_QQuickItem::contains() QCOMPARE(hollowItem->isHovered(), insideTarget); // check mouse press - QTest::mousePress(window, Qt::LeftButton, 0, point); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, point); QTest::qWait(10); QCOMPARE(hollowItem->isPressed(), insideTarget); // check mouse release - QTest::mouseRelease(window, Qt::LeftButton, 0, point); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, point); QTest::qWait(10); QCOMPARE(hollowItem->isPressed(), false); } @@ -3299,8 +3299,8 @@ void tst_QQuickItem::childAt() QCOMPARE(parent.childAt(75, 75), &child2); QCOMPARE(parent.childAt(149, 149), &child2); QCOMPARE(parent.childAt(25, 200), &child3); - QCOMPARE(parent.childAt(0, 150), static_cast<QQuickItem *>(0)); - QCOMPARE(parent.childAt(300, 300), static_cast<QQuickItem *>(0)); + QCOMPARE(parent.childAt(0, 150), static_cast<QQuickItem *>(nullptr)); + QCOMPARE(parent.childAt(300, 300), static_cast<QQuickItem *>(nullptr)); } void tst_QQuickItem::grab() @@ -3312,7 +3312,7 @@ void tst_QQuickItem::grab() QQuickView view; view.setSource(testFileUrl("grabToImage.qml")); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QQuickItem *root = qobject_cast<QQuickItem *>(view.rootObject()); QVERIFY(root); diff --git a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp index a8a00b51e9..1a289a2087 100644 --- a/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp +++ b/tests/auto/quick/qquickitemlayer/tst_qquickitemlayer.cpp @@ -89,17 +89,12 @@ private slots: private: void mirroringCheck(int mirroring, int x, bool shouldMirror, const QImage &fb); - bool m_isMesaSoftwareRasterizer; - int m_mesaVersion; - bool m_isOpenGLRenderer; + bool m_isMesaSoftwareRasterizer = false; + int m_mesaVersion = 0; + bool m_isOpenGLRenderer = true; }; -tst_QQuickItemLayer::tst_QQuickItemLayer() - : m_isMesaSoftwareRasterizer(false) - , m_mesaVersion(0) - , m_isOpenGLRenderer(true) -{ -} +tst_QQuickItemLayer::tst_QQuickItemLayer() { } void tst_QQuickItemLayer::initTestCase() { @@ -139,7 +134,7 @@ void tst_QQuickItemLayer::initTestCase() #endif QQuickView view; view.showNormal(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); if (view.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) m_isOpenGLRenderer = false; } @@ -307,7 +302,7 @@ void tst_QQuickItemLayer::layerVisibility() view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QImage fb = view.grabWindow(); uint pixel = fb.pixel(0, 0); @@ -513,7 +508,7 @@ void tst_QQuickItemLayer::textureMirroring() view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QImage fb = view.grabWindow(); diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index dc8c727cbe..8bc5575e34 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -294,7 +294,7 @@ private: if (m_view) { if (QString(QTest::currentTestFunction()) != testForView) { delete m_view; - m_view = 0; + m_view = nullptr; } else { m_view->setSource(QUrl()); return m_view; @@ -332,7 +332,7 @@ class TestObject : public QObject Q_PROPERTY(int cacheBuffer READ cacheBuffer NOTIFY changedCacheBuffer) public: - TestObject(QObject *parent = 0) + TestObject(QObject *parent = nullptr) : QObject(parent), mError(true), mAnimate(false), mInvalidHighlight(false) , mCacheBuffer(0) {} @@ -361,7 +361,7 @@ public: int mCacheBuffer; }; -tst_QQuickListView::tst_QQuickListView() : m_view(0) +tst_QQuickListView::tst_QQuickListView() : m_view(nullptr) { } @@ -371,7 +371,7 @@ void tst_QQuickListView::init() if (m_view && QString(QTest::currentTestFunction()) != testForView) { testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; } #endif qmlRegisterType<QAbstractItemModel>(); @@ -384,7 +384,7 @@ void tst_QQuickListView::cleanupTestCase() #ifdef SHARE_VIEWS testForView = QString(); delete m_view; - m_view = 0; + m_view = nullptr; #endif } @@ -408,16 +408,16 @@ void tst_QQuickListView::items(const QUrl &source) qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->forceLayout(); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QTRY_VERIFY(!testObject->error()); - QTRY_VERIFY(listview->highlightItem() != 0); + QTRY_VERIFY(listview->highlightItem() != nullptr); QTRY_COMPARE(listview->count(), model.count()); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); listview->forceLayout(); @@ -428,10 +428,10 @@ void tst_QQuickListView::items(const QUrl &source) for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", i); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -453,7 +453,7 @@ void tst_QQuickListView::items(const QUrl &source) QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QTRY_VERIFY(!testObject->error()); QTRY_VERIFY(listview->currentItem()); - QTRY_VERIFY(listview->highlightItem() != 0); + QTRY_VERIFY(listview->highlightItem() != nullptr); // set an empty model and confirm that items are destroyed T model2; @@ -492,21 +492,21 @@ void tst_QQuickListView::changed(const QUrl &source) qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->forceLayout(); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // Force a layout, necessary if ListView is completed before VisualDataModel. listview->forceLayout(); model.modifyItem(1, "Will", "9876"); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); delete testObject; @@ -534,10 +534,10 @@ void tst_QQuickListView::inserted(const QUrl &source) qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); model.insertItem(1, "Will", "9876"); @@ -545,10 +545,10 @@ void tst_QQuickListView::inserted(const QUrl &source) QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly @@ -563,10 +563,10 @@ void tst_QQuickListView::inserted(const QUrl &source) QTRY_COMPARE(contentItem->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); QTRY_COMPARE(listview->currentIndex(), 1); @@ -633,9 +633,9 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (verticalLayoutDirection == QQuickItemView::BottomToTop) { listview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -706,10 +706,10 @@ void tst_QQuickListView::inserted_more(QQuickItemView::VerticalLayoutDirection v } QTRY_COMPARE(item->y(), pos); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -828,9 +828,9 @@ void tst_QQuickListView::insertBeforeVisible() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); listview->setCacheBuffer(cacheBuffer); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -872,7 +872,7 @@ void tst_QQuickListView::insertBeforeVisible() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->y(), i*20.0 + itemsOffsetAfterMove); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -941,19 +941,19 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); model.removeItem(1); QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 1); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(1)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 1); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly @@ -970,10 +970,10 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) QTRY_COMPARE(window->rootObject()->property("count").toInt(), model.count()); name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly @@ -1041,7 +1041,7 @@ void tst_QQuickListView::removed(const QUrl &source, bool /* animated */) model.removeItem(20); QTRY_COMPARE(listview->currentIndex(), 20); - QTRY_VERIFY(listview->currentItem() != 0); + QTRY_VERIFY(listview->currentItem() != nullptr); // remove item before current, but visible listview->setCurrentIndex(8); @@ -1125,9 +1125,9 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); if (verticalLayoutDirection == QQuickItemView::BottomToTop) { listview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -1173,10 +1173,10 @@ void tst_QQuickListView::removed_more(const QUrl &source, QQuickItemView::Vertic pos = -item0->height() - pos; QTRY_COMPARE(item->y(), pos); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -1307,9 +1307,9 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -1331,7 +1331,7 @@ void tst_QQuickListView::clear(const QUrl &source, QQuickItemView::VerticalLayou model.addItem("New", "1"); listview->forceLayout(); QTRY_COMPARE(listview->count(), 1); - QVERIFY(listview->currentItem() != 0); + QVERIFY(listview->currentItem() != nullptr); QCOMPARE(listview->currentIndex(), 0); delete testObject; @@ -1365,9 +1365,9 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // always need to wait for view to be painted before the first move() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -1405,10 +1405,10 @@ void tst_QQuickListView::moved(const QUrl &source, QQuickItemView::VerticalLayou pos = -item->height() - pos; QTRY_COMPARE(item->y(), pos); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); // current index should have been updated @@ -1595,7 +1595,7 @@ void tst_QQuickListView::multipleChanges(bool condensed) QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); for (int i=0; i<changes.count(); i++) { @@ -1636,16 +1636,16 @@ void tst_QQuickListView::multipleChanges(bool condensed) QQuickText *name; QQuickText *number; QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); for (int i=0; i < model.count() && i < itemCount; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QQuickText>(contentItem, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(i)); } @@ -1843,7 +1843,7 @@ void tst_QQuickListView::swapWithFirstItem() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // ensure content position is stable @@ -1870,7 +1870,7 @@ void tst_QQuickListView::enforceRange() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(listview->preferredHighlightBegin(), 100.0); QTRY_COMPARE(listview->preferredHighlightEnd(), 100.0); @@ -1878,7 +1878,7 @@ void tst_QQuickListView::enforceRange() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // view should be positioned at the top of the range. QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -1886,10 +1886,10 @@ void tst_QQuickListView::enforceRange() QTRY_COMPARE(listview->contentY(), -100.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", 0); - QTRY_VERIFY(name != 0); + QTRY_VERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(0)); QQuickText *number = findItem<QQuickText>(contentItem, "textNumber", 0); - QTRY_VERIFY(number != 0); + QTRY_VERIFY(number != nullptr); QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when contentItem moves @@ -1929,7 +1929,7 @@ void tst_QQuickListView::enforceRange_withoutHighlight() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); qreal expectedPos = -100.0; @@ -1970,10 +1970,10 @@ void tst_QQuickListView::spacing() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -2028,10 +2028,10 @@ void tst_QQuickListView::sections(const QUrl &source) QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -2128,10 +2128,10 @@ void tst_QQuickListView::sectionsDelegate() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -2237,30 +2237,30 @@ void tst_QQuickListView::sectionsDragOutsideBounds() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setCacheBuffer(cacheBuffer); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // QTBUG-17769 // Drag view up beyond bounds - QTest::mousePress(window, Qt::LeftButton, 0, QPoint(20,20)); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,20)); QTest::mouseMove(window, QPoint(20,0)); QTest::mouseMove(window, QPoint(20,-50)); QTest::mouseMove(window, QPoint(20,-distance)); - QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(20,-distance)); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,-distance)); // view should settle back at 0 QTRY_COMPARE(listview->contentY(), 0.0); - QTest::mousePress(window, Qt::LeftButton, 0, QPoint(20,0)); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,0)); QTest::mouseMove(window, QPoint(20,20)); QTest::mouseMove(window, QPoint(20,70)); QTest::mouseMove(window, QPoint(20,distance)); - QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(20,distance)); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(20,distance)); // view should settle back at 0 QTRY_COMPARE(listview->contentY(), 0.0); @@ -2282,13 +2282,13 @@ void tst_QQuickListView::sectionsDelegate_headerVisibility() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); window->requestActivate(); - QTest::qWaitForWindowActive(window.data()); + QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // ensure section header is maintained in view @@ -2317,9 +2317,9 @@ void tst_QQuickListView::sectionsPositioning() window->rootObject()->setProperty("sectionPositioning", QVariant(int(QQuickViewSection::InlineLabels | QQuickViewSection::CurrentLabelAtStart | QQuickViewSection::NextLabelAtEnd))); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); for (int i = 0; i < 3; ++i) { @@ -2475,10 +2475,10 @@ void tst_QQuickListView::sectionPropertyChange() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); @@ -2539,10 +2539,10 @@ void tst_QQuickListView::sectionDelegateChange() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQUICK_VERIFY_POLISH(listview); @@ -2585,9 +2585,9 @@ void tst_QQuickListView::sectionsItemInsertion() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); for (int i = 0; i < 3; ++i) { @@ -2643,9 +2643,9 @@ void tst_QQuickListView::currentIndex_delayedItemCreation() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QSignalSpy spy(listview, SIGNAL(currentItemChanged())); //QCOMPARE(listview->currentIndex(), 0); @@ -2670,7 +2670,7 @@ void tst_QQuickListView::currentIndex() for (int i = 0; i < 30; i++) initModel.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -2683,9 +2683,9 @@ void tst_QQuickListView::currentIndex() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // currentIndex is initialized to 20 @@ -2774,7 +2774,7 @@ void tst_QQuickListView::noCurrentIndex() for (int i = 0; i < 30; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -2786,9 +2786,9 @@ void tst_QQuickListView::noCurrentIndex() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // current index should be -1 at startup @@ -2826,10 +2826,10 @@ void tst_QQuickListView::keyNavigation() window->rootContext()->setContextProperty("testObject", testObject); window->setSource(testFileUrl("listviewtest.qml")); window->show(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -2837,7 +2837,7 @@ void tst_QQuickListView::keyNavigation() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QTRY_COMPARE(qGuiApp->focusWindow(), window); QTest::keyClick(window, forwardsKey); @@ -2939,13 +2939,13 @@ void tst_QQuickListView::itemList() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel"); - QTRY_VERIFY(model != 0); + QTRY_VERIFY(model != nullptr); QTRY_COMPARE(model->count(), 3); QTRY_COMPARE(listview->currentIndex(), 0); @@ -2978,13 +2978,13 @@ void tst_QQuickListView::itemListFlicker() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel"); - QTRY_VERIFY(model != 0); + QTRY_VERIFY(model != nullptr); QTRY_COMPARE(model->count(), 3); QTRY_COMPARE(listview->currentIndex(), 0); @@ -3043,13 +3043,13 @@ void tst_QQuickListView::cacheBuffer() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); - QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(contentItem != nullptr); + QTRY_VERIFY(listview->delegate() != nullptr); QTRY_VERIFY(listview->model() != 0); - QTRY_VERIFY(listview->highlight() != 0); + QTRY_VERIFY(listview->highlight() != nullptr); // Confirm items positioned correctly int itemCount = findItems<QQuickItem>(contentItem, "wrapper").count(); @@ -3068,8 +3068,8 @@ void tst_QQuickListView::cacheBuffer() // items will be created one at a time for (int i = itemCount; i < qMin(itemCount+10,model.count()); ++i) { - QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -3103,11 +3103,11 @@ void tst_QQuickListView::cacheBuffer() QCOMPARE(item->y(), qreal(i*20)); } - QVERIFY(findItem<QQuickItem>(listview, "wrapper", 32) == 0); + QVERIFY(findItem<QQuickItem>(listview, "wrapper", 32) == nullptr); // ensure buffered items are created for (int i = 32; i < qMin(41,model.count()); ++i) { - QQuickItem *item = 0; + QQuickItem *item = nullptr; while (!item) { qGuiApp->processEvents(); // allow refill to happen bool b = false; @@ -3146,9 +3146,9 @@ void tst_QQuickListView::positionViewAtBeginningEnd() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); listview->setContentY(100); @@ -3206,9 +3206,9 @@ void tst_QQuickListView::positionViewAtIndex() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); window->rootObject()->setProperty("enforceRange", enforceRange); @@ -3286,16 +3286,16 @@ void tst_QQuickListView::resetModel() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QTRY_COMPARE(listview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } @@ -3308,7 +3308,7 @@ void tst_QQuickListView::resetModel() for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(contentItem, "displayText", i); - QTRY_VERIFY(display != 0); + QTRY_VERIFY(display != nullptr); QTRY_COMPARE(display->text(), strings.at(i)); } } @@ -3455,11 +3455,11 @@ void tst_QQuickListView::QTBUG_9791() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); - QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(contentItem != nullptr); + QTRY_VERIFY(listview->delegate() != nullptr); QTRY_VERIFY(listview->model() != 0); QMetaObject::invokeMethod(listview, "fillModel"); @@ -3488,7 +3488,7 @@ void tst_QQuickListView::QTBUG_33568() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); // we want to verify that the change animates smoothly, rather than jumping into place QSignalSpy spy(listview, SIGNAL(contentYChanged())); @@ -3505,7 +3505,7 @@ void tst_QQuickListView::QTBUG_33568() void tst_QQuickListView::manualHighlight() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QString filename(testFile("manual-highlight.qml")); @@ -3514,10 +3514,10 @@ void tst_QQuickListView::manualHighlight() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(listview->currentIndex(), 0); QTRY_COMPARE(listview->currentItem(), findItem<QQuickItem>(contentItem, "wrapper", 0)); @@ -3557,9 +3557,9 @@ void tst_QQuickListView::QTBUG_11105() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -3594,9 +3594,9 @@ void tst_QQuickListView::initialZValues() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QVERIFY(listview->currentItem()); QTRY_COMPARE(listview->currentItem()->z(), listview->property("itemZ").toReal()); @@ -3610,7 +3610,7 @@ void tst_QQuickListView::initialZValues() QVERIFY(listview->highlightItem()); QTRY_COMPARE(listview->highlightItem()->z(), listview->property("highlightZ").toReal()); - QQuickText *sectionItem = 0; + QQuickText *sectionItem = nullptr; QTRY_VERIFY(sectionItem = findItem<QQuickText>(contentItem, "section")); QTRY_COMPARE(sectionItem->z(), listview->property("sectionZ").toReal()); } @@ -3648,16 +3648,16 @@ void tst_QQuickListView::header() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); - QQuickText *header = 0; + QQuickText *header = nullptr; QTRY_VERIFY(header = findItem<QQuickText>(contentItem, "header")); QCOMPARE(header, listview->headerItem()); @@ -3727,7 +3727,7 @@ void tst_QQuickListView::header() QVERIFY(QTest::qWaitForWindowExposed(window)); listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); @@ -3814,10 +3814,10 @@ void tst_QQuickListView::header_delayItemCreation() qApp->processEvents(); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *header = findItem<QQuickText>(contentItem, "header"); QVERIFY(header); @@ -3837,13 +3837,13 @@ void tst_QQuickListView::headerChangesViewport() window->setSource(testFileUrl("headerchangesviewport.qml")); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); - QQuickText *header = 0; + QQuickText *header = nullptr; QTRY_VERIFY(header = findItem<QQuickText>(contentItem, "header")); QCOMPARE(header, listview->headerItem()); @@ -3884,14 +3884,14 @@ void tst_QQuickListView::footer() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickText *footer = findItem<QQuickText>(contentItem, "footer"); QVERIFY(footer); @@ -4073,14 +4073,14 @@ void tst_QQuickListView::extents() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); listview->setVerticalLayoutDirection(verticalLayoutDirection); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -4171,10 +4171,10 @@ void tst_QQuickListView::resetModel_headerFooter() qApp->processEvents(); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QQuickItem *header = findItem<QQuickItem>(contentItem, "header"); QVERIFY(header); @@ -4214,9 +4214,9 @@ void tst_QQuickListView::resizeView() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -4291,9 +4291,9 @@ void tst_QQuickListView::resizeViewAndRepaint() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // item at index 10 should not be currently visible @@ -4326,9 +4326,9 @@ void tst_QQuickListView::sizeLessThan1() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Confirm items positioned correctly @@ -4350,10 +4350,10 @@ void tst_QQuickListView::QTBUG_14821() qApp->processEvents(); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); listview->decrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 99); @@ -4378,9 +4378,9 @@ void tst_QQuickListView::resizeDelegate() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QCOMPARE(listview->count(), model.rowCount()); @@ -4391,7 +4391,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 0; i < 16; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->y(), i*20.0); } @@ -4403,7 +4403,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 0; i < 11; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QTRY_COMPARE(item->y(), i*30.0); } @@ -4417,7 +4417,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 5; i < 16; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->y(), i*30.0); } @@ -4429,7 +4429,7 @@ void tst_QQuickListView::resizeDelegate() for (int i = 5; i < 11; ++i) { QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QTRY_COMPARE(item->y(), 150 + (i-5)*20.0); } @@ -4459,15 +4459,15 @@ void tst_QQuickListView::resizeFirstDelegate() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QQuickItem *item = 0; + QQuickItem *item = nullptr; for (int i = 0; i < model.count(); ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->y(), i*20.0); } @@ -4482,7 +4482,7 @@ void tst_QQuickListView::resizeFirstDelegate() for (int i = 1; i < model.count(); ++i) { item = findItem<QQuickItem>(contentItem, "wrapper", i); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QTRY_COMPARE(item->y(), (i-1)*20.0); } @@ -4531,7 +4531,7 @@ void tst_QQuickListView::repositionResizedDelegate() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *positioner = findItem<QQuickItem>(window->rootObject(), "positioner"); @@ -4623,7 +4623,7 @@ void tst_QQuickListView::QTBUG_16037() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "listview"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QVERIFY(listview->contentHeight() <= 0.0); @@ -4668,13 +4668,13 @@ void tst_QQuickListView::indexAt_itemAt() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (index >= 0) { item = findItem<QQuickItem>(contentItem, "wrapper", index); QVERIFY(item); @@ -4699,10 +4699,10 @@ void tst_QQuickListView::incrementalModel() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(listview->count(), 35); listview->positionViewAtIndex(10, QQuickListView::Beginning); @@ -4823,17 +4823,17 @@ void tst_QQuickListView::rightToLeft() window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQmlObjectModel *model = window->rootObject()->findChild<QQmlObjectModel*>("itemModel"); - QTRY_VERIFY(model != 0); + QTRY_VERIFY(model != nullptr); QTRY_COMPARE(model->count(), 3); QTRY_COMPARE(listview->currentIndex(), 0); @@ -4872,12 +4872,12 @@ void tst_QQuickListView::test_mirroring() QScopedPointer<QQuickView> windowA(createView()); windowA->setSource(testFileUrl("rightToLeft.qml")); QQuickListView *listviewA = findItem<QQuickListView>(windowA->rootObject(), "view"); - QTRY_VERIFY(listviewA != 0); + QTRY_VERIFY(listviewA != nullptr); QScopedPointer<QQuickView> windowB(createView()); windowB->setSource(testFileUrl("rightToLeft.qml")); QQuickListView *listviewB = findItem<QQuickListView>(windowB->rootObject(), "view"); - QTRY_VERIFY(listviewA != 0); + QTRY_VERIFY(listviewA != nullptr); qApp->processEvents(); QList<QString> objectNames; @@ -4940,9 +4940,9 @@ void tst_QQuickListView::margins() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QCOMPARE(listview->contentY(), -30.); @@ -5011,7 +5011,7 @@ void tst_QQuickListView::marginsResize() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "listview"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -5150,7 +5150,7 @@ void tst_QQuickListView::snapToItem() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -5159,7 +5159,7 @@ void tst_QQuickListView::snapToItem() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); // confirm that a flick hits an item boundary flick(window, flickStart, flickEnd, 180); @@ -5210,7 +5210,7 @@ void tst_QQuickListView::snapOneItemResize_QTBUG_43555() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QSignalSpy currentIndexSpy(listview, SIGNAL(currentIndexChanged())); @@ -5413,7 +5413,7 @@ void tst_QQuickListView::asynchronous() QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject()); QVERIFY(rootObject); - QQuickListView *listview = 0; + QQuickListView *listview = nullptr; while (!listview) { bool b = false; controller.incubateWhile(&b); @@ -5422,8 +5422,8 @@ void tst_QQuickListView::asynchronous() // items will be created one at a time for (int i = 0; i < 8; ++i) { - QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(listview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -5510,7 +5510,7 @@ void tst_QQuickListView::snapOneItem() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->setOrientation(orientation); listview->setLayoutDirection(layoutDirection); @@ -5519,7 +5519,7 @@ void tst_QQuickListView::snapOneItem() QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QSignalSpy currentIndexSpy(listview, SIGNAL(currentIndexChanged())); @@ -5583,7 +5583,7 @@ void tst_QQuickListView::snapOneItemCurrentIndexRemoveAnimation() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QTRY_COMPARE(listview->currentIndex(), 0); @@ -5606,7 +5606,7 @@ void tst_QQuickListView::attachedProperties_QTBUG_32836() qApp->processEvents(); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *header = listview->headerItem(); QVERIFY(header); @@ -5635,7 +5635,7 @@ void tst_QQuickListView::unrequestedVisibility() for (int i = 0; i < 30; i++) model.addItem("Item" + QString::number(i), QString::number(i)); - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -5889,7 +5889,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5924,7 +5924,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5942,7 +5942,7 @@ void tst_QQuickListView::populateTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -5987,7 +5987,7 @@ void tst_QQuickListView::sizeTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // the following will start the transition @@ -6050,9 +6050,9 @@ void tst_QQuickListView::addTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); if (contentY != 0) { @@ -6131,7 +6131,7 @@ void tst_QQuickListView::addTransitions() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6246,9 +6246,9 @@ void tst_QQuickListView::moveTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name; if (contentY != 0) { @@ -6316,7 +6316,7 @@ void tst_QQuickListView::moveTransitions() QVERIFY2(item, QTest::toString(QString("Item %1 not found").arg(i))); QTRY_COMPARE(item->y(), i*20.0 + itemsOffsetAfterMove); name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6449,9 +6449,9 @@ void tst_QQuickListView::removeTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); if (contentY != 0) { @@ -6530,7 +6530,7 @@ void tst_QQuickListView::removeTransitions() QCOMPARE(item->x(), 0.0); QCOMPARE(item->y(), contentY + (i-firstVisibleIndex) * 20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6661,9 +6661,9 @@ void tst_QQuickListView::displacedTransitions() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); @@ -6745,7 +6745,7 @@ void tst_QQuickListView::displacedTransitions() QCOMPARE(item->x(), 0.0); QCOMPARE(item->y(), i * 20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -6881,9 +6881,9 @@ void tst_QQuickListView::multipleTransitions() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); if (contentY != 0) { @@ -6953,7 +6953,7 @@ void tst_QQuickListView::multipleTransitions() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -7038,9 +7038,9 @@ void tst_QQuickListView::multipleDisplaced() QVERIFY(QTest::qWaitForWindowExposed(window)); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); model.moveItems(12, 8, 1); @@ -7062,7 +7062,7 @@ void tst_QQuickListView::multipleDisplaced() QTRY_COMPARE(item->x(), 0.0); QTRY_COMPARE(item->y(), i*20.0); QQuickText *name = findItem<QQuickText>(contentItem, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model.name(i)); } @@ -7131,10 +7131,10 @@ void tst_QQuickListView::flickBeyondBounds() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); // Flick view up beyond bounds @@ -7243,10 +7243,10 @@ void tst_QQuickListView::destroyItemOnCreation() QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QCOMPARE(window->rootObject()->property("createdIndex").toInt(), -1); @@ -7264,13 +7264,13 @@ void tst_QQuickListView::parentBinding() window->setSource(testFileUrl("parentBinding.qml")); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QTRY_COMPARE(QQuickItemPrivate::get(listview)->polishScheduled, false); QQuickItem *item = findItem<QQuickItem>(contentItem, "wrapper", 0); @@ -7300,7 +7300,7 @@ void tst_QQuickListView::accessEmptyCurrentItem_QTBUG_30227() window->setSource(testFileUrl("emptymodel.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); listview->forceLayout(); QMetaObject::invokeMethod(window->rootObject(), "remove"); @@ -7316,7 +7316,7 @@ void tst_QQuickListView::delayedChanges_QTBUG_30555() window->setSource(testFileUrl("delayedChanges.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QCOMPARE(listview->count(), 10); @@ -7335,7 +7335,7 @@ void tst_QQuickListView::outsideViewportChangeNotAffectingView() window->setSource(testFileUrl("outsideViewportChangeNotAffectingView.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -7369,7 +7369,7 @@ void tst_QQuickListView::testProxyModelChangedAfterMove() window->setSource(testFileUrl("proxytest.qml")); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); @@ -7389,7 +7389,7 @@ void tst_QQuickListView::typedModel() QCOMPARE(listview->count(), 6); - QQmlListModel *listModel = 0; + QQmlListModel *listModel = nullptr; listview->setModel(QVariant::fromValue(listModel)); QCOMPARE(listview->count(), 0); @@ -7403,10 +7403,10 @@ void tst_QQuickListView::displayMargin() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *content = listview->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QQuickItem *item0 = findItem<QQuickItem>(content, "delegate", 0); QVERIFY(item0); @@ -7419,7 +7419,7 @@ void tst_QQuickListView::displayMargin() QCOMPARE(delegateVisible(item14), true); // the 15th item should be outside the end margin - QVERIFY(findItem<QQuickItem>(content, "delegate", 14) == 0); + QVERIFY(findItem<QQuickItem>(content, "delegate", 14) == nullptr); // the first delegate should still be within the begin margin listview->positionViewAtIndex(3, QQuickListView::Beginning); @@ -7439,13 +7439,13 @@ void tst_QQuickListView::negativeDisplayMargin() QQuickItem *listview = window->rootObject(); QQuickListView *innerList = findItem<QQuickListView>(window->rootObject(), "innerList"); - QVERIFY(innerList != 0); + QVERIFY(innerList != nullptr); QTRY_COMPARE(innerList->property("createdItems").toInt(), 11); QCOMPARE(innerList->property("destroyedItem").toInt(), 0); QQuickItem *content = innerList->contentItem(); - QVERIFY(content != 0); + QVERIFY(content != nullptr); QQuickItem *item = findItem<QQuickItem>(content, "delegate", 0); QVERIFY(item); @@ -7512,7 +7512,7 @@ void tst_QQuickListView::QTBUG_35920() QQuickListView *listview = qobject_cast<QQuickListView *>(window->rootObject()); QVERIFY(listview); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,0)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,0)); for (int i = 0; i < 100; ++i) { QTest::mouseMove(window.data(), QPoint(10,i)); if (listview->isMoving()) { @@ -7529,7 +7529,7 @@ void tst_QQuickListView::QTBUG_35920() QCOMPARE(listview->contentY(), contentY); } } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(10,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,100)); } Q_DECLARE_METATYPE(Qt::Orientation) @@ -7963,12 +7963,12 @@ void tst_QQuickListView::roundingErrors() // QTBUG-37339: drag an item and verify that it doesn't // get prematurely released due to rounding errors - QTest::mousePress(window.data(), Qt::LeftButton, 0, viewPos); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, viewPos); for (int i = 0; i < 150; i += 5) { QTest::mouseMove(window.data(), viewPos - QPoint(i, 0)); QVERIFY(item); } - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(0, 36)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(0, 36)); // maintain position relative to the right edge listview->setLayoutDirection(Qt::RightToLeft); @@ -8349,7 +8349,7 @@ void tst_QQuickListView::contentHeightWithDelayRemove() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); const int initialCount(listview->count()); const int eventualCount(initialCount + countDelta); @@ -8378,7 +8378,7 @@ void tst_QQuickListView::QTBUG_48044_currentItemNotVisibleAfterTransition() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); // Expand 2nd header listview->setProperty("transitionsDone", QVariant(false)); @@ -8527,7 +8527,7 @@ void tst_QQuickListView::QTBUG_48870_fastModelUpdates() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "list"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItemViewPrivate *priv = QQuickItemViewPrivate::get(listview); bool nonUnique; @@ -8570,7 +8570,7 @@ void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QTRY_COMPARE(listview->contentY(), -100.0); // the header size, since the header is overlaid listview->setProperty("currentPage", 2); QTRY_COMPARE(listview->contentY(), 400.0); // a full page of items down, sans the original negative header position @@ -8586,7 +8586,7 @@ void tst_QQuickListView::QTBUG_63974_stickyHeader_positionViewAtIndex_Contain() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = qobject_cast<QQuickListView*>(window->rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); const qreal headerSize = 20; const qreal footerSize = 20; @@ -8643,7 +8643,7 @@ void tst_QQuickListView::itemFiltered() window->setContent(QUrl(), &component, component.create()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); // this should not crash model.setData(model.index(2), QStringLiteral("modified three"), Qt::DisplayRole); @@ -8663,7 +8663,7 @@ void tst_QQuickListView::releaseItems() void tst_QQuickListView::QTBUG_34576_velocityZero() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); QQmlContext *ctxt = window->rootContext(); @@ -8694,8 +8694,8 @@ void tst_QQuickListView::QTBUG_34576_velocityZero() QSignalSpy currentIndexChangedSpy(listview, SIGNAL(currentIndexChanged())); // click button which increases currentIndex - QTest::mousePress(window, Qt::LeftButton, 0, QPoint(295,215)); - QTest::mouseRelease(window, Qt::LeftButton, 0, QPoint(295,215)); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, QPoint(295,215)); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, QPoint(295,215)); // verify that currentIndexChanged is triggered QTRY_VERIFY(currentIndexChangedSpy.count() > 0); @@ -8745,10 +8745,10 @@ void tst_QQuickListView::addOnCompleted() QVERIFY(QTest::qWaitForWindowExposed(window.data())); QQuickListView *listview = findItem<QQuickListView>(window->rootObject(), "view"); - QTRY_VERIFY(listview != 0); + QTRY_VERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QTRY_VERIFY(contentItem != 0); + QTRY_VERIFY(contentItem != nullptr); qreal y = -1; for (char name = 'a'; name <= 'j'; ++name) { diff --git a/tests/auto/quick/qquickloader/tst_qquickloader.cpp b/tests/auto/quick/qquickloader/tst_qquickloader.cpp index 65493f52e2..30fc52f95a 100644 --- a/tests/auto/quick/qquickloader/tst_qquickloader.cpp +++ b/tests/auto/quick/qquickloader/tst_qquickloader.cpp @@ -54,11 +54,11 @@ class PeriodicIncubationController : public QObject, public QQmlIncubationController { public: - PeriodicIncubationController() : incubated(false) {} + PeriodicIncubationController() {} void start() { startTimer(20); } - bool incubated; + bool incubated = false; protected: virtual void timerEvent(QTimerEvent *) { @@ -167,8 +167,8 @@ void tst_QQuickLoader::sourceOrComponent() , dataDirectoryUrl()); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); - QCOMPARE(loader->item() == 0, error); + QVERIFY(loader != nullptr); + QCOMPARE(loader->item() == nullptr, error); QCOMPARE(loader->source(), sourceUrl); QCOMPARE(loader->progress(), 1.0); @@ -231,7 +231,7 @@ void tst_QQuickLoader::clear() " }") , dataDirectoryUrl()); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); @@ -252,7 +252,7 @@ void tst_QQuickLoader::clear() QCOMPARE(loader->progress(), 1.0); QCOMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); - loader->setSourceComponent(0); + loader->setSourceComponent(nullptr); QVERIFY(!loader->item()); QCOMPARE(loader->progress(), 0.0); @@ -293,7 +293,7 @@ void tst_QQuickLoader::urlToComponent() , dataDirectoryUrl()); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); QTest::qWait(200); - QTRY_VERIFY(loader != 0); + QTRY_VERIFY(loader != nullptr); QVERIFY(loader->item()); QCOMPARE(loader->progress(), 1.0); QCOMPARE(static_cast<QQuickItem*>(loader.data())->childItems().count(), 1); @@ -327,12 +327,12 @@ void tst_QQuickLoader::anchoredLoader() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/AnchoredLoader.qml")); QScopedPointer<QQuickItem> rootItem(qobject_cast<QQuickItem*>(component.create())); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QQuickItem *loader = rootItem->findChild<QQuickItem*>("loader"); QQuickItem *sourceElement = rootItem->findChild<QQuickItem*>("sourceElement"); - QVERIFY(loader != 0); - QVERIFY(sourceElement != 0); + QVERIFY(loader != nullptr); + QVERIFY(sourceElement != nullptr); QCOMPARE(rootItem->width(), 300.0); QCOMPARE(rootItem->height(), 200.0); @@ -349,7 +349,7 @@ void tst_QQuickLoader::sizeLoaderToItem() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/SizeToItem.qml")); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QCOMPARE(loader->width(), 120.0); QCOMPARE(loader->height(), 60.0); @@ -389,7 +389,7 @@ void tst_QQuickLoader::sizeItemToLoader() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/SizeToLoader.qml")); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QCOMPARE(loader->width(), 200.0); QCOMPARE(loader->height(), 80.0); @@ -424,7 +424,7 @@ void tst_QQuickLoader::noResize() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/NoResize.qml")); QScopedPointer<QQuickItem> item(qobject_cast<QQuickItem*>(component.create())); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->width(), 200.0); QCOMPARE(item->height(), 80.0); } @@ -440,7 +440,7 @@ void tst_QQuickLoader::networkRequestUrl() if (component.isError()) qDebug() << component.errors(); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QTRY_COMPARE(loader->status(), QQuickLoader::Ready); @@ -494,7 +494,7 @@ void tst_QQuickLoader::failNetworkRequest() component.setData(qml.toUtf8(), server.url("/dummy.qml")); QTRY_COMPARE(component.status(), QQmlComponent::Ready); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QTRY_COMPARE(loader->status(), QQuickLoader::Error); @@ -512,7 +512,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.1.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == false); // set manually to false @@ -522,14 +522,14 @@ void tst_QQuickLoader::active() QMetaObject::invokeMethod(object.data(), "doSetSource"); QVERIFY(!loader->item()); QMetaObject::invokeMethod(object.data(), "doSetActive"); - QVERIFY(loader->item() != 0); + QVERIFY(loader->item() != nullptr); } // check that the status is Null if active is set to false { QQmlComponent component(&engine, testFileUrl("active.2.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default @@ -544,7 +544,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.3.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default @@ -559,14 +559,14 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.4.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default - QVERIFY(loader->sourceComponent() != 0); + QVERIFY(loader->sourceComponent() != nullptr); int currSourceComponentChangedCount = loader->property("sourceComponentChangedCount").toInt(); QMetaObject::invokeMethod(object.data(), "doSetInactive"); - QVERIFY(loader->sourceComponent() != 0); + QVERIFY(loader->sourceComponent() != nullptr); QCOMPARE(loader->property("sourceComponentChangedCount").toInt(), currSourceComponentChangedCount); } @@ -574,11 +574,11 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.5.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default - QVERIFY(loader->item() != 0); + QVERIFY(loader->item() != nullptr); int currItemChangedCount = loader->property("itemChangedCount").toInt(); QMetaObject::invokeMethod(object.data(), "doSetInactive"); QVERIFY(!loader->item()); @@ -589,7 +589,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.6.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); QVERIFY(loader->active() == true); // active is true by default @@ -617,7 +617,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.7.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } @@ -625,7 +625,7 @@ void tst_QQuickLoader::active() { QQmlComponent component(&engine, testFileUrl("active.8.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->property("success").toBool(), true); } } @@ -693,7 +693,7 @@ void tst_QQuickLoader::initialPropertyValues() QQmlEngine engine; QQmlComponent component(&engine, qmlFile); QScopedPointer<QObject> object(component.beginCreate(engine.rootContext())); - QVERIFY(object != 0); + QVERIFY(object != nullptr); const int serverBaseUrlPropertyIndex = object->metaObject()->indexOfProperty("serverBaseUrl"); if (serverBaseUrlPropertyIndex != -1) { @@ -716,7 +716,7 @@ void tst_QQuickLoader::initialPropertyValuesBinding() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("initialPropertyValues.binding.qml")); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QVERIFY(object->setProperty("bindable", QVariant(8))); QCOMPARE(object->property("canaryValue").toInt(), 8); @@ -752,9 +752,9 @@ void tst_QQuickLoader::initialPropertyValuesError() QQmlEngine engine; QQmlComponent component(&engine, qmlFile); QScopedPointer<QObject> object(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QQuickLoader *loader = object->findChild<QQuickLoader*>("loader"); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QVERIFY(!loader->item()); } @@ -774,7 +774,7 @@ void tst_QQuickLoader::deleteComponentCrash() QCOMPARE(loader->item()->objectName(), QLatin1String("blue")); QCOMPARE(loader->progress(), 1.0); QCOMPARE(loader->status(), QQuickLoader::Ready); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QTRY_COMPARE(static_cast<QQuickItem*>(loader)->childItems().count(), 1); QCOMPARE(loader->source(), testFileUrl("BlueRect.qml")); @@ -815,7 +815,7 @@ void tst_QQuickLoader::creationContext() QQmlComponent component(&engine, testFileUrl("creationContext.qml")); QScopedPointer<QObject> o(component.create()); - QVERIFY(o != 0); + QVERIFY(o != nullptr); QCOMPARE(o->property("test").toBool(), true); } @@ -1136,7 +1136,7 @@ void tst_QQuickLoader::sizeBound() QScopedPointer<QQuickItem> root(qobject_cast<QQuickItem*>(component.create())); QVERIFY(root); QQuickLoader *loader = root->findChild<QQuickLoader*>("loader"); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QVERIFY(loader->item()); @@ -1154,7 +1154,7 @@ void tst_QQuickLoader::QTBUG_30183() QQmlEngine engine; QQmlComponent component(&engine, testFileUrl("/QTBUG_30183.qml")); QScopedPointer<QQuickLoader> loader(qobject_cast<QQuickLoader*>(component.create())); - QVERIFY(loader != 0); + QVERIFY(loader != nullptr); QCOMPARE(loader->width(), 240.0); QCOMPARE(loader->height(), 120.0); @@ -1188,7 +1188,7 @@ void tst_QQuickLoader::transientWindow() // QTBUG-52944 timer.start(); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(loadedWindowVisibleTime >= 0); QVERIFY(viewVisibleTime >= 0); @@ -1229,7 +1229,7 @@ void tst_QQuickLoader::nestedTransientWindow() // QTBUG-52944 timer.start(); view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(loadedWindowVisibleTime >= 0); QVERIFY(viewVisibleTime >= 0); @@ -1254,7 +1254,7 @@ void tst_QQuickLoader::sourceComponentGarbageCollection() QMetaObject::invokeMethod(obj.data(), "setSourceComponent"); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QSignalSpy spy(obj.data(), SIGNAL(loaded())); diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp index 4fe01787fa..ea55c25761 100644 --- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp +++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp @@ -219,20 +219,20 @@ void tst_QQuickMouseArea::dragProperties() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("dragproperties.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QQuickItem *rootItem = qobject_cast<QQuickItem*>(window.rootObject()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); drag->setTarget(rootItem); QCOMPARE(targetSpy.count(),1); @@ -317,22 +317,22 @@ void tst_QQuickMouseArea::resetDrag() window.rootContext()->setContextProperty("haveTarget", QVariant(true)); QVERIFY2(initView(window, testFileUrl("dragreset.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QQuickItem *rootItem = qobject_cast<QQuickItem*>(window.rootObject()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); - QVERIFY(drag->target() != 0); + QVERIFY(drag->target() != nullptr); window.rootContext()->setContextProperty("haveTarget", QVariant(false)); QCOMPARE(targetSpy.count(),1); QVERIFY(!drag->target()); @@ -349,24 +349,24 @@ void tst_QQuickMouseArea::dragging() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(acceptedButtons); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); QPoint p = QPoint(100,100); - QTest::mousePress(&window, button, 0, p); + QTest::mousePress(&window, button, Qt::NoModifier, p); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -400,7 +400,7 @@ void tst_QQuickMouseArea::dragging() QTRY_COMPARE(blackRect->x(), 61.0); QCOMPARE(blackRect->y(), 61.0); - QTest::mouseRelease(&window, button, 0, p); + QTest::mouseRelease(&window, button, Qt::NoModifier, p); QTRY_VERIFY(!drag->active()); QTRY_COMPARE(blackRect->x(), 61.0); QCOMPARE(blackRect->y(), 61.0); @@ -414,7 +414,7 @@ void tst_QQuickMouseArea::dragSmoothed() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); @@ -422,17 +422,17 @@ void tst_QQuickMouseArea::dragSmoothed() mouseRegion->setAcceptedButtons(Qt::LeftButton); QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QTest::mouseMove(&window, QPoint(100, 102), 50); QTest::mouseMove(&window, QPoint(100, 106), 50); QTest::mouseMove(&window, QPoint(100, 122), 50); QTRY_COMPARE(blackRect->x(), 50.0); QTRY_COMPARE(blackRect->y(), 66.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,122)); // reset rect position blackRect->setX(50.0); @@ -441,14 +441,14 @@ void tst_QQuickMouseArea::dragSmoothed() // now try with smoothed disabled drag->setSmoothed(false); QVERIFY(!drag->active()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QTest::mouseMove(&window, QPoint(100, 102), 50); QTest::mouseMove(&window, QPoint(100, 106), 50); QTest::mouseMove(&window, QPoint(100, 122), 50); QTRY_COMPARE(blackRect->x(), 50.0); QTRY_COMPARE(blackRect->y(), 72.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 122)); } void tst_QQuickMouseArea::dragThreshold_data() @@ -468,7 +468,7 @@ void tst_QQuickMouseArea::dragThreshold() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); mouseRegion->setPreventStealing(preventStealing); @@ -478,10 +478,10 @@ void tst_QQuickMouseArea::dragThreshold() mouseRegion->setAcceptedButtons(Qt::LeftButton); QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); QCOMPARE(blackRect->y(), 50.0); @@ -500,18 +500,18 @@ void tst_QQuickMouseArea::dragThreshold() QTRY_VERIFY(drag->active()); QTRY_COMPARE(blackRect->x(), 50.0); QTRY_COMPARE(blackRect->y(), 66.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); QTRY_VERIFY(!drag->active()); // Immediate drag threshold drag->setThreshold(0); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::mouseMove(&window, QPoint(100, 122), 50); QVERIFY(!drag->active()); QTest::mouseMove(&window, QPoint(100, 123), 50); QVERIFY(drag->active()); QTest::mouseMove(&window, QPoint(100, 124), 50); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 124)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 124)); QTRY_VERIFY(!drag->active()); drag->resetThreshold(); } @@ -524,24 +524,24 @@ void tst_QQuickMouseArea::invalidDrag() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(acceptedButtons); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); - QTest::mousePress(&window, button, 0, QPoint(100,100)); + QTest::mousePress(&window, button, Qt::NoModifier, QPoint(100,100)); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -559,7 +559,7 @@ void tst_QQuickMouseArea::invalidDrag() QCOMPARE(blackRect->x(), 50.0); QCOMPARE(blackRect->y(), 50.0); - QTest::mouseRelease(&window, button, 0, QPoint(122,122)); + QTest::mouseRelease(&window, button, Qt::NoModifier, QPoint(122,122)); QTest::qWait(50); QVERIFY(!drag->active()); @@ -575,24 +575,24 @@ void tst_QQuickMouseArea::cancelDragging() window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(Qt::LeftButton); // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); QPoint p = QPoint(100,100); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -618,7 +618,7 @@ void tst_QQuickMouseArea::cancelDragging() QCOMPARE(blackRect->x(), 61.0); QCOMPARE(blackRect->y(), 61.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); } // QTBUG-58347 @@ -637,14 +637,14 @@ void tst_QQuickMouseArea::availableDistanceLessThanDragThreshold() QVERIFY(mouseArea); QPoint position(100, 100); - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); position.setX(301); QTest::mouseMove(&view, position); position.setX(501); QTest::mouseMove(&view, position); QVERIFY(mouseArea->drag()->active()); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!mouseArea->drag()->active()); QCOMPARE(mouseArea->x(), 200.0); @@ -656,8 +656,8 @@ void tst_QQuickMouseArea::setDragOnPressed() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("setDragOnPressed.qml"), true, &errorMessage), errorMessage.constData()); window.show(); - QTest::qWaitForWindowExposed(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(window.rootObject()); QVERIFY(mouseArea); @@ -667,7 +667,7 @@ void tst_QQuickMouseArea::setDragOnPressed() QVERIFY(target); QPoint p = QPoint(100, 100); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QQuickDrag *drag = mouseArea->drag(); QVERIFY(drag); @@ -688,7 +688,7 @@ void tst_QQuickMouseArea::setDragOnPressed() QTRY_COMPARE(target->x(), 61.0); QCOMPARE(target->y(), 50.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_VERIFY(!drag->active()); QCOMPARE(target->x(), 61.0); QCOMPARE(target->y(), 50.0); @@ -701,18 +701,18 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnClick() QVERIFY2(initView(window, testFileUrl("updateMousePosOnClick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); - QVERIFY(mouseRegion != 0); + QVERIFY(mouseRegion != nullptr); QQuickRectangle *rect = window.rootObject()->findChild<QQuickRectangle*>("ball"); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(mouseRegion->mouseX(), rect->x()); QCOMPARE(mouseRegion->mouseY(), rect->y()); - QMouseEvent event(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent event(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &event); QCOMPARE(mouseRegion->mouseX(), 100.0); @@ -729,18 +729,18 @@ void tst_QQuickMouseArea::updateMouseAreaPosOnResize() QVERIFY2(initView(window, testFileUrl("updateMousePosOnResize.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseRegion = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); - QVERIFY(mouseRegion != 0); + QVERIFY(mouseRegion != nullptr); QQuickRectangle *rect = window.rootObject()->findChild<QQuickRectangle*>("brother"); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(mouseRegion->mouseX(), 0.0); QCOMPARE(mouseRegion->mouseY(), 0.0); - QMouseEvent event(QEvent::MouseButtonPress, rect->position().toPoint(), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent event(QEvent::MouseButtonPress, rect->position().toPoint(), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &event); QVERIFY(!mouseRegion->property("emitPositionChanged").toBool()); @@ -765,11 +765,11 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() QVERIFY2(initView(window, testFileUrl("clickandhold.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea*>(window.rootObject()->children().first()); QVERIFY(mouseArea); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QCOMPARE(mouseArea->pressedButtons(), Qt::LeftButton); @@ -783,7 +783,7 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() QVERIFY(!window.rootObject()->property("clicked").toBool()); QVERIFY(window.rootObject()->property("held").toBool()); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QTRY_VERIFY(window.rootObject()->property("held").toBool()); @@ -797,16 +797,16 @@ void tst_QQuickMouseArea::noOnClickedWithPressAndHold() QVERIFY2(initView(window, testFileUrl("noclickandhold.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QVERIFY(!window.rootObject()->property("clicked").toBool()); QTest::qWait(1000); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QVERIFY(window.rootObject()->property("clicked").toBool()); @@ -820,7 +820,7 @@ void tst_QQuickMouseArea::onMousePressRejected() QVERIFY2(initView(window, testFileUrl("rejectEvent.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QVERIFY(window.rootObject()->property("enabled").toBool()); QVERIFY(!window.rootObject()->property("mr1_pressed").toBool()); @@ -830,7 +830,7 @@ void tst_QQuickMouseArea::onMousePressRejected() QVERIFY(!window.rootObject()->property("mr2_released").toBool()); QVERIFY(!window.rootObject()->property("mr2_canceled").toBool()); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QVERIFY(window.rootObject()->property("mr1_pressed").toBool()); @@ -842,7 +842,7 @@ void tst_QQuickMouseArea::onMousePressRejected() QTest::qWait(200); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QVERIFY(window.rootObject()->property("mr1_released").toBool()); @@ -867,7 +867,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QVERIFY2(initView(window, testFileUrl("pressedCanceled.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QVERIFY(!window.rootObject()->property("pressed").toBool()); QVERIFY(!window.rootObject()->property("canceled").toBool()); @@ -877,8 +877,8 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QCOMPARE(window.rootObject()->property("clicked").toInt(), expectedClicks); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); @@ -895,7 +895,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QCOMPARE(window.rootObject()->property("clicked").toInt(), ++expectedClicks); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent pressEvent2(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent2(QEvent::MouseButtonDblClick, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent2); QTRY_VERIFY(window.rootObject()->property("pressed").toBool()); @@ -908,7 +908,7 @@ void tst_QQuickMouseArea::pressedCanceledOnWindowDeactivate() QWindow *secondWindow = qvariant_cast<QWindow*>(window.rootObject()->property("secondWindow")); secondWindow->setProperty("visible", true); - QTest::qWaitForWindowExposed(secondWindow); + QVERIFY(QTest::qWaitForWindowExposed(secondWindow)); QTRY_VERIFY(!window.rootObject()->property("pressed").toBool()); QVERIFY(window.rootObject()->property("canceled").toBool()); @@ -940,7 +940,7 @@ void tst_QQuickMouseArea::doubleClick() QVERIFY2(initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mousearea"); QVERIFY(mouseArea); @@ -948,16 +948,16 @@ void tst_QQuickMouseArea::doubleClick() // The sequence for a double click is: // press, release, (click), press, double click, release - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("released").toInt(), 1); QGuiApplication::sendEvent(&window, &pressEvent); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0); + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QGuiApplication::sendEvent(&window, &releaseEvent); @@ -977,16 +977,16 @@ void tst_QQuickMouseArea::clickTwice() QVERIFY2(initView(window, testFileUrl("clicktwice.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mousearea"); QVERIFY(mouseArea); mouseArea->setAcceptedButtons(acceptedButtons); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("pressed").toInt(), 1); @@ -994,7 +994,7 @@ void tst_QQuickMouseArea::clickTwice() QCOMPARE(window.rootObject()->property("clicked").toInt(), 1); QGuiApplication::sendEvent(&window, &pressEvent); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0); + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QGuiApplication::sendEvent(&window, &releaseEvent); @@ -1013,7 +1013,7 @@ void tst_QQuickMouseArea::invalidClick() QVERIFY2(initView(window, testFileUrl("doubleclick.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mousearea"); QVERIFY(mouseArea); @@ -1021,16 +1021,16 @@ void tst_QQuickMouseArea::invalidClick() // The sequence for a double click is: // press, release, (click), press, double click, release - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("released").toInt(), 0); QGuiApplication::sendEvent(&window, &pressEvent); - pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, 0); + pressEvent = QMouseEvent(QEvent::MouseButtonDblClick, QPoint(100, 100), button, button, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QGuiApplication::sendEvent(&window, &releaseEvent); @@ -1046,16 +1046,16 @@ void tst_QQuickMouseArea::pressedOrdering() QVERIFY2(initView(window, testFileUrl("pressedOrdering.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QCOMPARE(window.rootObject()->property("value").toString(), QLatin1String("base")); - QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent pressEvent(QEvent::MouseButtonPress, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &pressEvent); QCOMPARE(window.rootObject()->property("value").toString(), QLatin1String("pressed")); - QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, 0); + QMouseEvent releaseEvent(QEvent::MouseButtonRelease, QPoint(100, 100), Qt::LeftButton, Qt::LeftButton, nullptr); QGuiApplication::sendEvent(&window, &releaseEvent); QCOMPARE(window.rootObject()->property("value").toString(), QLatin1String("toggled")); @@ -1072,18 +1072,18 @@ void tst_QQuickMouseArea::preventStealing() QVERIFY2(initView(window, testFileUrl("preventstealing.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window.rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mousearea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy mousePositionSpy(mouseArea, SIGNAL(positionChanged(QQuickMouseEvent*))); QPoint p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); // Without preventStealing, mouse movement over MouseArea would // cause the Flickable to steal mouse and trigger content movement. @@ -1106,13 +1106,13 @@ void tst_QQuickMouseArea::preventStealing() QCOMPARE(flickable->contentX(), 0.); QCOMPARE(flickable->contentY(), 0.); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); // Now allow stealing and confirm Flickable does its thing. window.rootObject()->setProperty("stealing", false); p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); // Without preventStealing, mouse movement over MouseArea would // cause the Flickable to steal mouse and trigger content movement. @@ -1135,7 +1135,7 @@ void tst_QQuickMouseArea::preventStealing() QTRY_COMPARE(flickable->contentX(), 20.); QCOMPARE(flickable->contentY(), 20.); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); } void tst_QQuickMouseArea::clickThrough() @@ -1146,27 +1146,27 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("clickThrough.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); // to avoid generating a double click. const int doubleClickInterval = qApp->styleHints()->mouseDoubleClickInterval() + 10; - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTRY_COMPARE(window->rootObject()->property("presses").toInt(), 0); QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1); QCOMPARE(window->rootObject()->property("doubleClicks").toInt(), 0); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTRY_COMPARE(window->rootObject()->property("presses").toInt(), 0); QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1); QTRY_COMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1180,24 +1180,24 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("clickThrough2.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QCOMPARE(window->rootObject()->property("clicks").toInt(), 0); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QCOMPARE(window->rootObject()->property("clicks").toInt(), 0); QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 0); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1207,22 +1207,22 @@ void tst_QQuickMouseArea::clickThrough() window->rootObject()->setProperty("letThrough", QVariant(true)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QTRY_COMPARE(window->rootObject()->property("clicks").toInt(), 1); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); QCOMPARE(window->rootObject()->property("clicks").toInt(), 1); QCOMPARE(window->rootObject()->property("pressAndHolds").toInt(), 1); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1232,15 +1232,15 @@ void tst_QQuickMouseArea::clickThrough() window->rootObject()->setProperty("noPropagation", QVariant(true)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); QTest::qWait(1000); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); - QTest::mouseDClick(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mouseDClick(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(100); QCOMPARE(window->rootObject()->property("presses").toInt(), 0); @@ -1254,18 +1254,18 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("qtbug34368.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 1); QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //Not disabled yet window->rootObject()->setProperty("disableLower", QVariant(true)); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100), doubleClickInterval); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100), doubleClickInterval); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window->rootObject()->property("clicksEnabled").toInt(), 2); QCOMPARE(window->rootObject()->property("clicksDisabled").toInt(), 1); //disabled, shouldn't increment @@ -1276,12 +1276,12 @@ void tst_QQuickMouseArea::clickThrough() QVERIFY2(initView(*window.data(), testFileUrl("qtbug49100.qml"), true, &errorMessage), errorMessage.constData()); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); } void tst_QQuickMouseArea::hoverPosition() @@ -1290,7 +1290,7 @@ void tst_QQuickMouseArea::hoverPosition() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverPosition.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QCOMPARE(root->property("mouseX").toReal(), qreal(0)); QCOMPARE(root->property("mouseY").toReal(), qreal(0)); @@ -1309,18 +1309,18 @@ void tst_QQuickMouseArea::hoverPropagation() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverPropagation.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QCOMPARE(root->property("point1").toBool(), false); QCOMPARE(root->property("point2").toBool(), false); - QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, 0); + QMouseEvent moveEvent(QEvent::MouseMove, QPoint(32, 32), Qt::NoButton, Qt::NoButton, nullptr); QGuiApplication::sendEvent(&window, &moveEvent); QCOMPARE(root->property("point1").toBool(), true); QCOMPARE(root->property("point2").toBool(), false); - QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, 0); + QMouseEvent moveEvent2(QEvent::MouseMove, QPoint(232, 32), Qt::NoButton, Qt::NoButton, nullptr); QGuiApplication::sendEvent(&window, &moveEvent2); QCOMPARE(root->property("point1").toBool(), false); QCOMPARE(root->property("point2").toBool(), true); @@ -1336,10 +1336,10 @@ void tst_QQuickMouseArea::hoverVisible() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverVisible.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseTracker = window.rootObject()->findChild<QQuickMouseArea*>("mousetracker"); - QVERIFY(mouseTracker != 0); + QVERIFY(mouseTracker != nullptr); QSignalSpy enteredSpy(mouseTracker, SIGNAL(entered())); @@ -1364,10 +1364,10 @@ void tst_QQuickMouseArea::hoverAfterPress() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("hoverAfterPress.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QTest::mouseMove(&window, QPoint(22,33)); QCOMPARE(mouseArea->hovered(), false); QTest::mouseMove(&window, QPoint(200,200)); @@ -1390,11 +1390,11 @@ void tst_QQuickMouseArea::subtreeHoverEnabled() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("qtbug54019.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = root->findChild<QQuickMouseArea*>(); QQuickItemPrivate *rootPrivate = QQuickItemPrivate::get(root); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QTest::mouseMove(&window, QPoint(10, 160)); QCOMPARE(mouseArea->hovered(), false); QVERIFY(rootPrivate->subtreeHoverEnabled); @@ -1411,12 +1411,12 @@ void tst_QQuickMouseArea::disableAfterPress() QVERIFY2(initView(window, testFileUrl("dragging.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseArea->drag(); - QVERIFY(mouseArea != 0); - QVERIFY(drag != 0); + QVERIFY(mouseArea != nullptr); + QVERIFY(drag != nullptr); QSignalSpy mousePositionSpy(mouseArea, SIGNAL(positionChanged(QQuickMouseEvent*))); QSignalSpy mousePressSpy(mouseArea, SIGNAL(pressed(QQuickMouseEvent*))); @@ -1424,12 +1424,12 @@ void tst_QQuickMouseArea::disableAfterPress() // target QQuickItem *blackRect = window.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); QPoint p = QPoint(100,100); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(mousePressSpy.count(), 1); QVERIFY(!drag->active()); @@ -1467,7 +1467,7 @@ void tst_QQuickMouseArea::disableAfterPress() QVERIFY(mouseArea->pressed()); QVERIFY(mouseArea->hovered()); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QTRY_COMPARE(mouseReleaseSpy.count(), 1); @@ -1486,7 +1486,7 @@ void tst_QQuickMouseArea::disableAfterPress() mousePositionSpy.clear(); mouseReleaseSpy.clear(); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QTest::qWait(50); QCOMPARE(mousePressSpy.count(), 0); @@ -1501,7 +1501,7 @@ void tst_QQuickMouseArea::disableAfterPress() QCOMPARE(blackRect->x(), 50.0); QCOMPARE(blackRect->y(), 50.0); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(122,122)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(122,122)); QTest::qWait(50); QCOMPARE(mouseReleaseSpy.count(), 0); @@ -1513,7 +1513,7 @@ void tst_QQuickMouseArea::onWheel() QByteArray errorMessage; QVERIFY2(initView(window, testFileUrl("wheel.qml"), true, &errorMessage), errorMessage.constData()); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QWheelEvent wheelEvent(QPoint(10, 32), QPoint(10, 32), QPoint(60, 20), QPoint(0, 120), 0, Qt::Vertical,Qt::NoButton, Qt::ControlModifier); @@ -1558,10 +1558,10 @@ void tst_QQuickMouseArea::transformedMouseArea() QVERIFY2(initView(window, testFileUrl("transformedMouseArea.qml"), true, &errorMessage), errorMessage.constData()); window.show(); QVERIFY(QTest::qWaitForWindowExposed(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea *>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); foreach (const QPoint &point, points) { // check hover @@ -1569,11 +1569,11 @@ void tst_QQuickMouseArea::transformedMouseArea() QTRY_COMPARE(mouseArea->property("containsMouse").toBool(), insideTarget); // check mouse press - QTest::mousePress(&window, Qt::LeftButton, 0, point); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, point); QTRY_COMPARE(mouseArea->property("pressed").toBool(), insideTarget); // check mouse release - QTest::mouseRelease(&window, Qt::LeftButton, 0, point); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, point); QTRY_COMPARE(mouseArea->property("pressed").toBool(), false); } } @@ -1592,7 +1592,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; pressed << true << true << true @@ -1600,7 +1600,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() pressedButtons << Qt::LeftButton << Qt::LeftButton << Qt::LeftButton - << 0; + << nullptr; QTest::newRow("Accept Left - Press left, Press Right, Release Right") << Qt::MouseButtons(Qt::LeftButton) << buttons << pressed << pressedButtons << 2; @@ -1610,15 +1610,15 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::RightButton - << 0; + << nullptr; pressed << true << true << false << false; pressedButtons << Qt::LeftButton << Qt::LeftButton - << 0 - << 0; + << nullptr + << nullptr; QTest::newRow("Accept Left - Press left, Press Right, Release Left") << Qt::MouseButtons(Qt::LeftButton) << buttons << pressed << pressedButtons << 2; @@ -1628,7 +1628,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; pressed << true << true << true @@ -1636,7 +1636,7 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() pressedButtons << Qt::LeftButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; QTest::newRow("Accept Left|Right - Press left, Press Right, Release Right") << (Qt::LeftButton | Qt::RightButton) << buttons << pressed << pressedButtons << 4; @@ -1646,15 +1646,15 @@ void tst_QQuickMouseArea::pressedMultipleButtons_data() buttons << Qt::RightButton << (Qt::LeftButton | Qt::RightButton) << Qt::LeftButton - << 0; + << nullptr; pressed << true << true << false << false; pressedButtons << Qt::RightButton << Qt::RightButton - << 0 - << 0; + << nullptr + << nullptr; QTest::newRow("Accept Right - Press Right, Press Left, Release Right") << Qt::MouseButtons(Qt::RightButton) << buttons << pressed << pressedButtons << 2; } @@ -1671,11 +1671,11 @@ void tst_QQuickMouseArea::pressedMultipleButtons() QByteArray errorMessage; QVERIFY2(initView(view, testFileUrl("simple.qml"), true, &errorMessage), errorMessage.constData()); view.show(); - QTest::qWaitForWindowExposed(&view); - QVERIFY(view.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowExposed(&view)); + QVERIFY(view.rootObject() != nullptr); QQuickMouseArea *mouseArea = view.rootObject()->findChild<QQuickMouseArea *>("mousearea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy pressedSpy(mouseArea, SIGNAL(pressedChanged())); QSignalSpy pressedButtonsSpy(mouseArea, SIGNAL(pressedButtonsChanged())); @@ -1687,13 +1687,13 @@ void tst_QQuickMouseArea::pressedMultipleButtons() int btns = buttons.at(i); // The windowsysteminterface takes care of sending releases - QTest::mousePress(&view, (Qt::MouseButton)btns, 0, point); + QTest::mousePress(&view, (Qt::MouseButton)btns, Qt::NoModifier, point); QCOMPARE(mouseArea->pressed(), pressed.at(i)); QCOMPARE(mouseArea->pressedButtons(), pressedButtons.at(i)); } - QTest::mousePress(&view, Qt::NoButton, 0, point); + QTest::mousePress(&view, Qt::NoButton, Qt::NoModifier, point); QCOMPARE(mouseArea->pressed(), false); QCOMPARE(pressedSpy.count(), 2); @@ -1707,25 +1707,25 @@ void tst_QQuickMouseArea::changeAxis() QVERIFY2(initView(view, testFileUrl("changeAxis.qml"), true, &errorMessage), errorMessage.constData()); view.show(); QVERIFY(QTest::qWaitForWindowExposed(&view)); - QTRY_VERIFY(view.rootObject() != 0); + QTRY_VERIFY(view.rootObject() != nullptr); QQuickMouseArea *mouseRegion = view.rootObject()->findChild<QQuickMouseArea*>("mouseregion"); QQuickDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); + QVERIFY(mouseRegion != nullptr); + QVERIFY(drag != nullptr); mouseRegion->setAcceptedButtons(Qt::LeftButton); // target QQuickItem *blackRect = view.rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, drag->target()); QVERIFY(!drag->active()); // Start a diagonal drag QPoint p = QPoint(100, 100); - QTest::mousePress(&view, Qt::LeftButton, 0, p); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, p); QVERIFY(!drag->active()); QCOMPARE(blackRect->x(), 50.0); @@ -1756,7 +1756,7 @@ void tst_QQuickMouseArea::changeAxis() QTRY_COMPARE(blackRect->y(), 94.0); QCOMPARE(blackRect->x(), 83.0); - QTest::mouseRelease(&view, Qt::LeftButton, 0, p); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, p); QTRY_VERIFY(!drag->active()); QCOMPARE(blackRect->x(), 83.0); @@ -1804,7 +1804,7 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress() QObject *root = window.rootObject(); QVERIFY(root); - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); // the press was not accepted, make sure there is no move or release event QTest::mouseMove(&window, QPoint(110,110), 50); @@ -1814,7 +1814,7 @@ void tst_QQuickMouseArea::moveAndReleaseWithoutPress() QTest::qWait(100); QCOMPARE(root->property("hadMove").toBool(), false); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(110,110)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(110,110)); QTest::qWait(100); QCOMPARE(root->property("hadRelease").toBool(), false); } @@ -1858,7 +1858,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() int &axis = transpose ? position.ry() : position.rx(); // drag toward the aligned boundary. Outer mouse area dragged. - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); axis += invert ? threshold * 2 : -threshold * 2; QTest::mouseMove(&view, position); @@ -1866,7 +1866,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() QTest::mouseMove(&view, position); QCOMPARE(outer->drag()->active(), true); QCOMPARE(inner->drag()->active(), false); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QVERIFY(!outer->drag()->active()); @@ -1875,7 +1875,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() outer->setY(50); // drag away from the aligned boundary. Inner mouse area dragged. - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); axis += invert ? -threshold * 2 : threshold * 2; QTest::mouseMove(&view, position); @@ -1883,7 +1883,7 @@ void tst_QQuickMouseArea::nestedStopAtBounds() QTest::mouseMove(&view, position); QTRY_COMPARE(outer->drag()->active(), false); QTRY_COMPARE(inner->drag()->active(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); } void tst_QQuickMouseArea::nestedFlickableStopAtBounds() @@ -1908,7 +1908,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() int &pos = position.ry(); // Drag up - should move the Flickable to end - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos -= threshold * 2; QTest::mouseMove(&view, position); @@ -1920,7 +1920,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QVERIFY(flickable->isDragging()); QVERIFY(!mouseArea->drag()->active()); QCOMPARE(flickable->isAtYEnd(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QTRY_VERIFY(!flickable->isMoving()); @@ -1928,7 +1928,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() // Drag up again - should activate MouseArea drag QVERIFY(!mouseArea->drag()->active()); - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos -= threshold * 2; QTest::mouseMove(&view, position); @@ -1940,12 +1940,12 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QVERIFY(mouseArea->drag()->active()); QCOMPARE(flickable->isAtYEnd(), true); QVERIFY(!flickable->isDragging()); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); // Drag to the top and verify that the MouseArea doesn't steal the grab when we drag back (QTBUG-56036) pos = 50; - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos += threshold; QTest::mouseMove(&view, position); @@ -1957,14 +1957,14 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QVERIFY(flickable->isDragging()); QVERIFY(!mouseArea->drag()->active()); QCOMPARE(flickable->isAtYBeginning(), true); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); QTRY_VERIFY(!flickable->isMoving()); pos = 280; // Drag up again - should not activate MouseArea drag - QTest::mousePress(&view, Qt::LeftButton, 0, position); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, position); QTest::qWait(10); pos -= threshold; QTest::mouseMove(&view, position); @@ -1975,7 +1975,7 @@ void tst_QQuickMouseArea::nestedFlickableStopAtBounds() QTest::mouseMove(&view, position); QVERIFY(flickable->isDragging()); QVERIFY(!mouseArea->drag()->active()); - QTest::mouseRelease(&view, Qt::LeftButton, 0, position); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, position); } void tst_QQuickMouseArea::containsPress_data() @@ -1997,10 +1997,10 @@ void tst_QQuickMouseArea::containsPress() window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy containsPressSpy(mouseArea, SIGNAL(containsPressChanged())); @@ -2061,7 +2061,7 @@ void tst_QQuickMouseArea::ignoreBySource() // MouseArea should grab the press because it's interested in non-synthesized mouse events QPoint p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QCOMPARE(window.mouseGrabberItem(), mouseArea); // That was a real mouse event QCOMPARE(root->property("lastEventSource").toInt(), int(Qt::MouseEventNotSynthesized)); @@ -2076,7 +2076,7 @@ void tst_QQuickMouseArea::ignoreBySource() QCOMPARE(flickable->contentX(), 0.); QCOMPARE(flickable->contentY(), 0.); - QTest::mouseRelease(&window, Qt::LeftButton, 0, p); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, p); QCOMPARE(window.mouseGrabberItem(), nullptr); // Now try touch events and confirm that MouseArea ignores them, while Flickable does its thing @@ -2112,7 +2112,7 @@ void tst_QQuickMouseArea::ignoreBySource() // MouseArea should ignore the press because it's interested in synthesized mouse events p = QPoint(80, 80); - QTest::mousePress(&window, Qt::LeftButton, 0, p); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, p); QVERIFY(window.mouseGrabberItem() != mouseArea); // That was a real mouse event QVERIFY(root->property("lastEventSource").toInt() == Qt::MouseEventNotSynthesized); @@ -2127,7 +2127,7 @@ void tst_QQuickMouseArea::ignoreBySource() QTRY_VERIFY(flickable->contentX() > 1); QVERIFY(flickable->contentY() > 1); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(47, 47)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(47, 47)); flickable->setContentX(0); flickable->setContentY(0); @@ -2157,7 +2157,7 @@ void tst_QQuickMouseArea::notPressedAfterStolenGrab() QQuickWindow window; window.resize(200, 200); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickMouseArea *ma = new QQuickMouseArea(window.contentItem()); ma->setSize(window.size()); @@ -2191,10 +2191,10 @@ void tst_QQuickMouseArea::pressAndHold() window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea = window.rootObject()->findChild<QQuickMouseArea*>("mouseArea"); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QSignalSpy pressAndHoldSpy(mouseArea, &QQuickMouseArea::pressAndHold); @@ -2289,19 +2289,19 @@ void tst_QQuickMouseArea::mask() window.requestActivate(); QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickItem *root = window.rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // click inside the mask, and verify it registers - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100,100)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100,100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100,100)); QCOMPARE(window.rootObject()->property("pressed").toInt(), 1); QCOMPARE(window.rootObject()->property("released").toInt(), 1); QCOMPARE(window.rootObject()->property("clicked").toInt(), 1); // click outside the mask (but inside the MouseArea), and verify it doesn't register - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(10,10)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(10,10)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(10,10)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(10,10)); QCOMPARE(window.rootObject()->property("pressed").toInt(), 1); QCOMPARE(window.rootObject()->property("released").toInt(), 1); diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp index 87acd67f6a..73f3cab318 100644 --- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp +++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp @@ -41,7 +41,7 @@ class tst_QQuickMultiPointTouchArea : public QQmlDataTest { Q_OBJECT public: - tst_QQuickMultiPointTouchArea() : device(0) { } + tst_QQuickMultiPointTouchArea() { } private slots: void initTestCase() { @@ -73,16 +73,16 @@ private slots: private: QQuickView *createAndShowView(const QString &file); - QTouchDevice *device; + QTouchDevice *device = nullptr; }; void tst_QQuickMultiPointTouchArea::properties() { QScopedPointer<QQuickView> window(createAndShowView("properties.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QCOMPARE(area->minimumTouchPoints(), 2); QCOMPARE(area->maximumTouchPoints(), 4); @@ -94,10 +94,10 @@ void tst_QQuickMultiPointTouchArea::properties() void tst_QQuickMultiPointTouchArea::signalTest() { QScopedPointer<QQuickView> window(createAndShowView("signalTest.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QPoint p1(20,100); QPoint p2(40,100); @@ -161,7 +161,7 @@ void tst_QQuickMultiPointTouchArea::signalTest() void tst_QQuickMultiPointTouchArea::release() { QScopedPointer<QQuickView> window(createAndShowView("basic.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point1 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); @@ -197,7 +197,7 @@ void tst_QQuickMultiPointTouchArea::release() void tst_QQuickMultiPointTouchArea::reuse() { QScopedPointer<QQuickView> window(createAndShowView("basic.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point1 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); QQuickTouchPoint *point2 = window->rootObject()->findChild<QQuickTouchPoint*>("point2"); @@ -264,7 +264,7 @@ void tst_QQuickMultiPointTouchArea::reuse() void tst_QQuickMultiPointTouchArea::nonOverlapping() { QScopedPointer<QQuickView> window(createAndShowView("nonOverlapping.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point11"); QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point12"); @@ -378,7 +378,7 @@ void tst_QQuickMultiPointTouchArea::nonOverlapping() void tst_QQuickMultiPointTouchArea::nested() { QScopedPointer<QQuickView> window(createAndShowView("nested.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point11"); QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point12"); @@ -574,13 +574,13 @@ void tst_QQuickMultiPointTouchArea::nested() void tst_QQuickMultiPointTouchArea::inFlickable() { QScopedPointer<QQuickView> window(createAndShowView("inFlickable.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable *>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>(); - QVERIFY(mpta != 0); + QVERIFY(mpta != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); QQuickTouchPoint *point12 = window->rootObject()->findChild<QQuickTouchPoint*>("point2"); @@ -623,7 +623,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() //moving two points vertically p1 = QPoint(20,100); QTest::touchEvent(window.data(), device).press(0, p1).press(1, p2); - QTest::mousePress(window.data(), Qt::LeftButton, 0, p1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QQuickTouchUtils::flush(window.data()); QCOMPARE(point11->pressed(), true); @@ -658,7 +658,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QCOMPARE(flickable->property("touchCount").toInt(), 0); QTest::touchEvent(window.data(), device).release(0, p1).release(1, p2); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QQuickTouchUtils::flush(window.data()); QTRY_VERIFY(!flickable->isMoving()); @@ -670,7 +670,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QQuickTouchUtils::flush(window.data()); // ensure that mouse events do not fall through to the Flickable mpta->setMaximumTouchPoints(3); - QTest::mousePress(window.data(), Qt::LeftButton, 0, p1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(point11->pressed(), true); QCOMPARE(point12->pressed(), true); @@ -720,7 +720,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable() QCOMPARE(point12->pressed(), true); QTest::touchEvent(window.data(), device).release(0, p1).release(1, p2); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QQuickTouchUtils::flush(window.data()); } @@ -728,10 +728,10 @@ void tst_QQuickMultiPointTouchArea::inFlickable() void tst_QQuickMultiPointTouchArea::inFlickable2() { QScopedPointer<QQuickView> window(createAndShowView("inFlickable2.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QQuickTouchPoint *point11 = window->rootObject()->findChild<QQuickTouchPoint*>("point1"); QVERIFY(point11); @@ -743,7 +743,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable2() // move point horizontally, out of Flickable area QTest::touchEvent(window.data(), device).press(0, p1); QQuickTouchUtils::flush(window.data()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, p1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, p1); p1 += QPoint(15,0); QTest::touchEvent(window.data(), device).move(0, p1); @@ -770,7 +770,7 @@ void tst_QQuickMultiPointTouchArea::inFlickable2() QTest::touchEvent(window.data(), device).release(0, p1); QQuickTouchUtils::flush(window.data()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QTest::qWait(50); QTRY_VERIFY(!flickable->isMoving()); @@ -813,13 +813,13 @@ void tst_QQuickMultiPointTouchArea::inFlickable2() void tst_QQuickMultiPointTouchArea::inMouseArea() { QScopedPointer<QQuickView> window(createAndShowView("inMouseArea.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMouseArea *mouseArea = qobject_cast<QQuickMouseArea *>(window->rootObject()); - QVERIFY(mouseArea != 0); + QVERIFY(mouseArea != nullptr); QQuickMultiPointTouchArea *mpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>("mpta"); - QVERIFY(mpta != 0); + QVERIFY(mpta != nullptr); QPoint innerPoint(40,100); QPoint outerPoint(10,100); @@ -829,15 +829,15 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() QTest::touchEvent(window.data(), device).release(0, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); @@ -854,10 +854,10 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() QVERIFY(!mpta->property("pressed").toBool()); // Right click should pass through - QTest::mousePress(window.data(), Qt::RightButton, 0, innerPoint); + QTest::mousePress(window.data(), Qt::RightButton, Qt::NoModifier, innerPoint); QVERIFY(mouseArea->property("pressed").toBool()); QVERIFY(!mpta->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::RightButton, 0, innerPoint); + QTest::mouseRelease(window.data(), Qt::RightButton, Qt::NoModifier, innerPoint); mpta->setProperty("mouseEnabled", false); @@ -868,15 +868,15 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, outerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, outerPoint); QVERIFY(!mouseArea->property("pressed").toBool()); - QTest::mousePress(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(mouseArea->property("pressed").toBool()); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, innerPoint); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, innerPoint); QVERIFY(!mpta->property("pressed").toBool()); QVERIFY(!mouseArea->property("pressed").toBool()); @@ -896,10 +896,10 @@ void tst_QQuickMultiPointTouchArea::inMouseArea() void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() { QScopedPointer<QQuickView> window(createAndShowView("dualGestures.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *dualmpta = window->rootObject()->findChild<QQuickMultiPointTouchArea*>("dualTouchArea"); - QVERIFY(dualmpta != 0); + QVERIFY(dualmpta != nullptr); QQuickItem *touch1rect = window->rootObject()->findChild<QQuickItem*>("touch1rect"); QQuickItem *touch2rect = window->rootObject()->findChild<QQuickItem*>("touch2rect"); @@ -923,18 +923,18 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); QTest::touchEvent(window.data(), device).release(1, touch1).move(2, touch2); touch1.setY(20); - QTest::mousePress(window.data(), Qt::LeftButton, 0, touch1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); QQuickTouchUtils::flush(window.data()); QCOMPARE(touch1rect->property("x").toInt(), touch1.x()); QCOMPARE(touch1rect->property("y").toInt(), touch1.y()); QCOMPARE(touch2rect->property("x").toInt(), touch2.x()); QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); QTest::touchEvent(window.data(), device).release(2, touch2); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, touch1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); QQuickTouchUtils::flush(window.data()); // Start with mouse, move it, touch second point, move it - QTest::mousePress(window.data(), Qt::LeftButton, 0, touch1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); touch1.setX(60); QTest::mouseMove(window.data(), touch1); QCOMPARE(touch1rect->property("x").toInt(), touch1.x()); @@ -963,7 +963,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); // Release all - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, touch1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, touch1); QTest::touchEvent(window.data(), device).release(3, touch2); QQuickTouchUtils::flush(window.data()); QTest::touchEvent(window.data(), device).release(4, touch3); @@ -982,7 +982,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QPoint touch3(340,100); QPoint touch4(540,10); - QTest::mousePress(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); QCOMPARE(touch1rect->property("x").toInt(), mouse1.x()); QCOMPARE(touch1rect->property("y").toInt(), mouse1.y()); QTest::touchEvent(window.data(), device).press(1, touch1); @@ -1006,7 +1006,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch5rect->property("y").toInt(), touch4.y()); // Release all - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); QTest::touchEvent(window.data(), device).release(1, touch1).release(2, touch2).release(3, touch3).release(4, touch4); QQuickTouchUtils::flush(window.data()); } @@ -1024,7 +1024,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() // Start with mouse, move it, touch a point, move it, touch another. // Mouse is ignored, both touch points are heeded. - QTest::mousePress(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); mouse1.setX(60); QTest::mouseMove(window.data(), mouse1); QCOMPARE(touch1rect->property("x").toInt(), 10); @@ -1047,7 +1047,7 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() QCOMPARE(touch2rect->property("y").toInt(), touch2.y()); // Release all - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, mouse1); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, mouse1); QTest::touchEvent(window.data(), device).release(1, touch1); QQuickTouchUtils::flush(window.data()); QTest::touchEvent(window.data(), device).release(2, touch2); @@ -1063,10 +1063,10 @@ void tst_QQuickMultiPointTouchArea::mouseAsTouchpoint() void tst_QQuickMultiPointTouchArea::invisible() { QScopedPointer<QQuickView> window(createAndShowView("signalTest.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); area->setVisible(false); @@ -1124,10 +1124,10 @@ void tst_QQuickMultiPointTouchArea::transformedTouchArea() QScopedPointer<QQuickView> view(createAndShowView("transformedMultiPointTouchArea.qml")); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QQuickMultiPointTouchArea *area = view->rootObject()->findChild<QQuickMultiPointTouchArea *>("touchArea"); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QTest::QTouchEventSequence sequence = QTest::touchEvent(view.data(), device); @@ -1143,7 +1143,7 @@ void tst_QQuickMultiPointTouchArea::transformedTouchArea() QQuickView *tst_QQuickMultiPointTouchArea::createAndShowView(const QString &file) { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl(file)); const QRect screenGeometry = window->screen()->availableGeometry(); const QSize size = window->size(); @@ -1171,16 +1171,16 @@ void tst_QQuickMultiPointTouchArea::mouseInteraction() QFETCH(int, accept); QScopedPointer<QQuickView> view(createAndShowView("mouse.qml")); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(view->rootObject()); - QVERIFY(area != 0); + QVERIFY(area != nullptr); QQuickTouchPoint *point1 = view->rootObject()->findChild<QQuickTouchPoint*>("point1"); QCOMPARE(point1->pressed(), false); QCOMPARE(area->property("touchCount").toInt(), 0); QPoint p1 = QPoint(100, 100); - QTest::mousePress(view.data(), (Qt::MouseButton) buttons, 0, p1); + QTest::mousePress(view.data(), (Qt::MouseButton) buttons, Qt::NoModifier, p1); QCOMPARE(area->property("touchCount").toInt(), accept); QCOMPARE(point1->pressed(), accept != 0); p1 += QPoint(10, 10); @@ -1199,7 +1199,7 @@ void tst_QQuickMultiPointTouchArea::mouseInteraction() void tst_QQuickMultiPointTouchArea::cancel() { QScopedPointer<QQuickView> window(createAndShowView("cancel.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMultiPointTouchArea *area = qobject_cast<QQuickMultiPointTouchArea *>(window->rootObject()); QTest::QTouchEventSequence sequence = QTest::touchEvent(window.data(), device); diff --git a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp index 1716bdeafb..2661762669 100644 --- a/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp +++ b/tests/auto/quick/qquickpainteditem/tst_qquickpainteditem.cpp @@ -61,9 +61,9 @@ class TestPaintedItem : public QQuickPaintedItem { Q_OBJECT public: - TestPaintedItem(QQuickItem *parent = 0) + TestPaintedItem(QQuickItem *parent = nullptr) : QQuickPaintedItem(parent) - , paintNode(0) + , paintNode(nullptr) , paintRequests(0) { } diff --git a/tests/auto/quick/qquickpath/tst_qquickpath.cpp b/tests/auto/quick/qquickpath/tst_qquickpath.cpp index 106d7afd85..12a8c673b0 100644 --- a/tests/auto/quick/qquickpath/tst_qquickpath.cpp +++ b/tests/auto/quick/qquickpath/tst_qquickpath.cpp @@ -53,7 +53,7 @@ void tst_QuickPath::arc() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("arc.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 0.); QCOMPARE(obj->startY(), 0.); @@ -62,7 +62,7 @@ void tst_QuickPath::arc() QCOMPARE(list.count(), 1); QQuickPathArc* arc = qobject_cast<QQuickPathArc*>(list.at(0)); - QVERIFY(arc != 0); + QVERIFY(arc != nullptr); QCOMPARE(arc->x(), 100.); QCOMPARE(arc->y(), 100.); QCOMPARE(arc->radiusX(), 100.); @@ -88,13 +88,13 @@ void tst_QuickPath::angleArc() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("anglearc.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QQmlListReference list(obj, "pathElements"); QCOMPARE(list.count(), 1); QQuickPathAngleArc* arc = qobject_cast<QQuickPathAngleArc*>(list.at(0)); - QVERIFY(arc != 0); + QVERIFY(arc != nullptr); QCOMPARE(arc->centerX(), 100.); QCOMPARE(arc->centerY(), 100.); QCOMPARE(arc->radiusX(), 50.); @@ -127,7 +127,7 @@ void tst_QuickPath::catmullromCurve() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("curve.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 0.); QCOMPARE(obj->startY(), 0.); @@ -136,12 +136,12 @@ void tst_QuickPath::catmullromCurve() QCOMPARE(list.count(), 3); QQuickPathCatmullRomCurve* curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(0)); - QVERIFY(curve != 0); + QVERIFY(curve != nullptr); QCOMPARE(curve->x(), 100.); QCOMPARE(curve->y(), 50.); curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(2)); - QVERIFY(curve != 0); + QVERIFY(curve != nullptr); QCOMPARE(curve->x(), 100.); QCOMPARE(curve->y(), 150.); @@ -163,7 +163,7 @@ void tst_QuickPath::closedCatmullromCurve() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("closedcurve.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 50.); QCOMPARE(obj->startY(), 50.); @@ -172,7 +172,7 @@ void tst_QuickPath::closedCatmullromCurve() QCOMPARE(list.count(), 3); QQuickPathCatmullRomCurve* curve = qobject_cast<QQuickPathCatmullRomCurve*>(list.at(2)); - QVERIFY(curve != 0); + QVERIFY(curve != nullptr); QCOMPARE(curve->x(), 50.); QCOMPARE(curve->y(), 50.); @@ -196,7 +196,7 @@ void tst_QuickPath::svg() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("svg.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 0.); QCOMPARE(obj->startY(), 0.); @@ -205,7 +205,7 @@ void tst_QuickPath::svg() QCOMPARE(list.count(), 1); QQuickPathSvg* svg = qobject_cast<QQuickPathSvg*>(list.at(0)); - QVERIFY(svg != 0); + QVERIFY(svg != nullptr); QCOMPARE(svg->path(), QLatin1String("M200,300 Q400,50 600,300 T1000,300")); QPainterPath path = obj->path(); diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 061f71aeb0..5f7f35b5d7 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -186,7 +186,7 @@ void tst_QQuickPathView::initValues() QQmlComponent c(&engine, testFileUrl("pathview1.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QVERIFY(!obj->path()); QVERIFY(!obj->delegate()); QCOMPARE(obj->model(), QVariant()); @@ -217,7 +217,7 @@ void tst_QQuickPathView::items() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->count(), model.count()); QCOMPARE(window->rootObject()->property("count").toInt(), model.count()); @@ -225,10 +225,10 @@ void tst_QQuickPathView::items() for (int i = 0; i < model.count(); ++i) { QQuickText *name = findItem<QQuickText>(pathview, "textName", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), model.name(i)); QQuickText *number = findItem<QQuickText>(pathview, "textNumber", i); - QVERIFY(number != 0); + QVERIFY(number != nullptr); QCOMPARE(number->text(), model.number(i)); } @@ -259,7 +259,7 @@ void tst_QQuickPathView::initialCurrentItem() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QVERIFY(pathview->currentIndex() != -1); QVERIFY(!window->rootObject()->property("currentItemIsNull").toBool()); } @@ -270,9 +270,9 @@ void tst_QQuickPathView::pathview2() QQmlComponent c(&engine, testFileUrl("pathview2.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->path() != nullptr); + QVERIFY(obj->delegate() != nullptr); QVERIFY(obj->model() != QVariant()); QCOMPARE(obj->currentIndex(), 0); QCOMPARE(obj->offset(), 0.); @@ -290,9 +290,9 @@ void tst_QQuickPathView::pathview3() QQmlComponent c(&engine, testFileUrl("pathview3.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->path() != nullptr); + QVERIFY(obj->delegate() != nullptr); QVERIFY(obj->model() != QVariant()); QCOMPARE(obj->currentIndex(), 7); QCOMPARE(obj->offset(), 1.0); @@ -310,9 +310,9 @@ void tst_QQuickPathView::initialCurrentIndex() QQmlComponent c(&engine, testFileUrl("initialCurrentIndex.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); + QVERIFY(obj != nullptr); + QVERIFY(obj->path() != nullptr); + QVERIFY(obj->delegate() != nullptr); QVERIFY(obj->model() != QVariant()); QCOMPARE(obj->currentIndex(), 3); QCOMPARE(obj->offset(), 5.0); @@ -392,7 +392,7 @@ void tst_QQuickPathView::insertModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode); @@ -485,7 +485,7 @@ void tst_QQuickPathView::removeModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode); @@ -578,7 +578,7 @@ void tst_QQuickPathView::moveModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode((QQuickPathView::HighlightRangeMode)mode); @@ -677,7 +677,7 @@ void tst_QQuickPathView::consecutiveModelChanges() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setHighlightRangeMode(mode); @@ -729,7 +729,7 @@ void tst_QQuickPathView::path() QQmlComponent c(&engine, testFileUrl("pathtest.qml")); QQuickPath *obj = qobject_cast<QQuickPath*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->startX(), 120.); QCOMPARE(obj->startY(), 100.); QVERIFY(obj->path() != QPainterPath()); @@ -738,28 +738,28 @@ void tst_QQuickPathView::path() QCOMPARE(list.count(), 5); QQuickPathAttribute* attr = qobject_cast<QQuickPathAttribute*>(list.at(0)); - QVERIFY(attr != 0); + QVERIFY(attr != nullptr); QCOMPARE(attr->name(), QString("scale")); QCOMPARE(attr->value(), 1.0); QQuickPathQuad* quad = qobject_cast<QQuickPathQuad*>(list.at(1)); - QVERIFY(quad != 0); + QVERIFY(quad != nullptr); QCOMPARE(quad->x(), 120.); QCOMPARE(quad->y(), 25.); QCOMPARE(quad->controlX(), 260.); QCOMPARE(quad->controlY(), 75.); QQuickPathPercent* perc = qobject_cast<QQuickPathPercent*>(list.at(2)); - QVERIFY(perc != 0); + QVERIFY(perc != nullptr); QCOMPARE(perc->value(), 0.3); QQuickPathLine* line = qobject_cast<QQuickPathLine*>(list.at(3)); - QVERIFY(line != 0); + QVERIFY(line != nullptr); QCOMPARE(line->x(), 120.); QCOMPARE(line->y(), 100.); QQuickPathCubic* cubic = qobject_cast<QQuickPathCubic*>(list.at(4)); - QVERIFY(cubic != 0); + QVERIFY(cubic != nullptr); QCOMPARE(cubic->x(), 180.); QCOMPARE(cubic->y(), 0.); QCOMPARE(cubic->control1X(), -10.); @@ -800,7 +800,7 @@ void tst_QQuickPathView::dataModel() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QMetaObject::invokeMethod(window->rootObject(), "checkProperties"); QVERIFY(!testObject->error()); @@ -837,7 +837,7 @@ void tst_QQuickPathView::dataModel() QTRY_COMPARE(findItems<QQuickItem>(pathview, "wrapper").count(), 5); QQuickRectangle *testItem = findItem<QQuickRectangle>(pathview, "wrapper", 4); - QVERIFY(testItem != 0); + QVERIFY(testItem != nullptr); testItem = findItem<QQuickRectangle>(pathview, "wrapper", 5); QVERIFY(!testItem); @@ -900,7 +900,7 @@ void tst_QQuickPathView::pathMoved() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0); QVERIFY(firstItem); @@ -988,7 +988,7 @@ void tst_QQuickPathView::setCurrentIndex() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickRectangle *firstItem = findItem<QQuickRectangle>(pathview, "wrapper", 0); QVERIFY(firstItem); @@ -1141,13 +1141,13 @@ void tst_QQuickPathView::resetModel() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(pathview, "displayText", i); - QVERIFY(display != 0); + QVERIFY(display != nullptr); QCOMPARE(display->text(), strings.at(i)); } @@ -1159,7 +1159,7 @@ void tst_QQuickPathView::resetModel() for (int i = 0; i < model.rowCount(); ++i) { QQuickText *display = findItem<QQuickText>(pathview, "displayText", i); - QVERIFY(display != 0); + QVERIFY(display != nullptr); QCOMPARE(display->text(), strings.at(i)); } @@ -1380,7 +1380,7 @@ void tst_QQuickPathView::emptyModel() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->offset(), qreal(0.0)); @@ -1394,7 +1394,7 @@ void tst_QQuickPathView::emptyPath() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); delete window; } @@ -1442,7 +1442,7 @@ void tst_QQuickPathView::visualDataModel() QQmlComponent c(&engine, testFileUrl("vdm.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->count(), 3); @@ -1465,7 +1465,7 @@ void tst_QQuickPathView::undefinedPath() QQmlComponent c(&engine, testFileUrl("undefinedpath.qml")); QQuickPathView *obj = qobject_cast<QQuickPathView*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->count(), 3); @@ -1483,7 +1483,7 @@ void tst_QQuickPathView::mouseDrag() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QSignalSpy movingSpy(pathview, SIGNAL(movingChanged())); QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted())); @@ -1494,7 +1494,7 @@ void tst_QQuickPathView::mouseDrag() int current = pathview->currentIndex(); - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,100)); QTest::qWait(100); { @@ -1531,7 +1531,7 @@ void tst_QQuickPathView::mouseDrag() QVERIFY(pathview->currentIndex() != current); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); QVERIFY(!pathview->isDragging()); QCOMPARE(draggingSpy.count(), 2); QCOMPARE(dragStartedSpy.count(), 1); @@ -1554,7 +1554,7 @@ void tst_QQuickPathView::nestedMouseAreaDrag() QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); // Dragging the child mouse area should move it and not animate the PathView flick(window.data(), QPoint(200,200), QPoint(400,200), 200); @@ -1577,7 +1577,7 @@ void tst_QQuickPathView::treeModel() window->setSource(testFileUrl("treemodel.qml")); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QCOMPARE(pathview->count(), 3); QQuickText *item = findItem<QQuickText>(pathview, "wrapper", 0); @@ -1603,7 +1603,7 @@ void tst_QQuickPathView::changePreferredHighlight() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); int current = pathview->currentIndex(); QCOMPARE(current, 0); @@ -1656,7 +1656,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() qApp->processEvents(); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setPreferredHighlightBegin(0.5); pathview->setPreferredHighlightEnd(0.5); @@ -1667,7 +1667,7 @@ void tst_QQuickPathView::currentOffsetOnInsertion() QCOMPARE(pathview->count(), model.count()); - QQuickRectangle *item = 0; + QQuickRectangle *item = nullptr; QTRY_VERIFY(item = findItem<QQuickRectangle>(pathview, "wrapper", 0)); QQuickPath *path = qobject_cast<QQuickPath*>(pathview->path()); @@ -1734,7 +1734,7 @@ void tst_QQuickPathView::asynchronous() QQuickItem *rootObject = qobject_cast<QQuickItem*>(window->rootObject()); QVERIFY(rootObject); - QQuickPathView *pathview = 0; + QQuickPathView *pathview = nullptr; while (!pathview) { bool b = false; controller.incubateWhile(&b); @@ -1743,8 +1743,8 @@ void tst_QQuickPathView::asynchronous() // items will be created one at a time for (int i = 0; i < 5; ++i) { - QVERIFY(findItem<QQuickItem>(pathview, "wrapper", i) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(pathview, "wrapper", i) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -1806,14 +1806,14 @@ void tst_QQuickPathView::cancelDrag() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QSignalSpy draggingSpy(pathview, SIGNAL(draggingChanged())); QSignalSpy dragStartedSpy(pathview, SIGNAL(dragStarted())); QSignalSpy dragEndedSpy(pathview, SIGNAL(dragEnded())); // drag between snap points - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(10,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(10,100)); QTest::qWait(100); QTest::mouseMove(window.data(), QPoint(80, 100)); QTest::mouseMove(window.data(), QPoint(130, 100)); @@ -1837,7 +1837,7 @@ void tst_QQuickPathView::cancelDrag() QCOMPARE(dragStartedSpy.count(), 1); QCOMPARE(dragEndedSpy.count(), 1); - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(40,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(40,100)); } @@ -1852,7 +1852,7 @@ void tst_QQuickPathView::maximumFlickVelocity() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); pathview->setMaximumFlickVelocity(700); flick(window.data(), QPoint(200,10), QPoint(10,10), 180); @@ -1899,7 +1899,7 @@ void tst_QQuickPathView::snapToItem() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); window->rootObject()->setProperty("enforceRange", enforceRange); QTRY_VERIFY(!pathview->isMoving()); // ensure stable @@ -1943,7 +1943,7 @@ void tst_QQuickPathView::snapOneItem() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); window->rootObject()->setProperty("enforceRange", enforceRange); @@ -1996,7 +1996,7 @@ void tst_QQuickPathView::positionViewAtIndex() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); window->rootObject()->setProperty("enforceRange", enforceRange); if (pathItemCount == -1) @@ -2059,9 +2059,9 @@ void tst_QQuickPathView::indexAt_itemAt() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); - QQuickItem *item = 0; + QQuickItem *item = nullptr; if (index >= 0) { item = findItem<QQuickItem>(pathview, "wrapper", index); QVERIFY(item); @@ -2093,7 +2093,7 @@ void tst_QQuickPathView::cacheItemCount() qApp->processEvents(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("orange"))); QMetaObject::invokeMethod(pathview, "addColor", Q_ARG(QVariant, QString("lightsteelblue"))); @@ -2119,8 +2119,8 @@ void tst_QQuickPathView::cacheItemCount() int i = 0; while (cached[i] >= 0) { // items will be created one at a time - QVERIFY(findItem<QQuickItem>(pathview, "wrapper", cached[i]) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(pathview, "wrapper", cached[i]) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -2147,8 +2147,8 @@ void tst_QQuickPathView::cacheItemCount() QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 11)); // one item prepended async. - QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 5) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(pathview, "wrapper", 5) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -2184,7 +2184,7 @@ void tst_QQuickPathView::changePathDuringRefill() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathView = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathView != 0); + QVERIFY(pathView != nullptr); testCurrentIndexChange(pathView, QStringList() << "delegateC" << "delegateA" << "delegateB"); @@ -2212,10 +2212,10 @@ void tst_QQuickPathView::nestedinFlickable() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = findItem<QQuickPathView>(window->rootObject(), "pathView"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(window->rootObject()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy movingSpy(pathview, SIGNAL(movingChanged())); QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted())); @@ -2227,7 +2227,7 @@ void tst_QQuickPathView::nestedinFlickable() int waitInterval = 5; - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(23,218)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(23,218)); QTest::mouseMove(window.data(), QPoint(25,218), waitInterval); QTest::mouseMove(window.data(), QPoint(26,218), waitInterval); @@ -2246,7 +2246,7 @@ void tst_QQuickPathView::nestedinFlickable() QCOMPARE(fflickEndedSpy.count(), 0); // no further moves after the initial move beyond threshold - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(73,219)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(73,219)); QTRY_COMPARE(movingSpy.count(), 2); QTRY_COMPARE(moveEndedSpy.count(), 1); QCOMPARE(moveStartedSpy.count(), 1); @@ -2267,10 +2267,10 @@ void tst_QQuickPathView::flickableDelegate() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(pathview->currentItem()); - QVERIFY(flickable != 0); + QVERIFY(flickable != nullptr); QSignalSpy movingSpy(pathview, SIGNAL(movingChanged())); QSignalSpy moveStartedSpy(pathview, SIGNAL(movementStarted())); @@ -2282,7 +2282,7 @@ void tst_QQuickPathView::flickableDelegate() int waitInterval = 5; - QTest::mousePress(window.data(), Qt::LeftButton, 0, QPoint(23,100)); + QTest::mousePress(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(23,100)); QTest::mouseMove(window.data(), QPoint(25,100), waitInterval); QTest::mouseMove(window.data(), QPoint(26,100), waitInterval); @@ -2301,7 +2301,7 @@ void tst_QQuickPathView::flickableDelegate() QCOMPARE(fflickEndedSpy.count(), 0); // no further moves after the initial move beyond threshold - QTest::mouseRelease(window.data(), Qt::LeftButton, 0, QPoint(53,100)); + QTest::mouseRelease(window.data(), Qt::LeftButton, Qt::NoModifier, QPoint(53,100)); QTRY_COMPARE(fflickingSpy.count(), 2); QTRY_COMPARE(fflickStartedSpy.count(), 1); QCOMPARE(fflickEndedSpy.count(), 1); @@ -2379,7 +2379,7 @@ void tst_QQuickPathView::qtbug42716() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathView = findItem<QQuickPathView>(window->rootObject(), "pathView"); - QVERIFY(pathView != 0); + QVERIFY(pathView != nullptr); int order1[] = {5,6,7,0,1,2,3}; int missing1 = 4; @@ -2498,7 +2498,7 @@ void tst_QQuickPathView::movementDirection() QCOMPARE(window.data(), qGuiApp->focusWindow()); QQuickPathView *pathview = window->rootObject()->findChild<QQuickPathView*>("view"); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QVERIFY(pathview->offset() == 0.0); QVERIFY(pathview->currentIndex() == 0); pathview->setMovementDirection(movementdirection); @@ -2514,7 +2514,7 @@ void tst_QQuickPathView::removePath() window->show(); QQuickPathView *pathview = qobject_cast<QQuickPathView*>(window->rootObject()); - QVERIFY(pathview != 0); + QVERIFY(pathview != nullptr); QVERIFY(QMetaObject::invokeMethod(pathview, "removePath")); QVERIFY(QMetaObject::invokeMethod(pathview, "setPath")); diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp index c1a51fd659..2571e4f288 100644 --- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp +++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp @@ -41,7 +41,7 @@ class tst_QQuickPinchArea: public QQmlDataTest { Q_OBJECT public: - tst_QQuickPinchArea() : device(0) { } + tst_QQuickPinchArea() { } private slots: void initTestCase(); void cleanupTestCase(); @@ -55,7 +55,7 @@ private slots: private: QQuickView *createView(); - QTouchDevice *device; + QTouchDevice *device = nullptr; }; void tst_QQuickPinchArea::initTestCase() { @@ -76,19 +76,19 @@ void tst_QQuickPinchArea::pinchProperties() QScopedPointer<QQuickView> window(createView()); window->setSource(testFileUrl("pinchproperties.qml")); window->show(); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QCOMPARE(blackRect, pinch->target()); QQuickItem *rootItem = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(rootItem != 0); + QVERIFY(rootItem != nullptr); QSignalSpy targetSpy(pinch, SIGNAL(targetChanged())); pinch->setTarget(rootItem); QCOMPARE(targetSpy.count(),1); @@ -201,20 +201,20 @@ void tst_QQuickPinchArea::scale() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -268,20 +268,20 @@ void tst_QQuickPinchArea::pan() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -374,23 +374,23 @@ void tst_QQuickPinchArea::retouch() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QSignalSpy startedSpy(pinchArea, SIGNAL(pinchStarted(QQuickPinchEvent*))); QSignalSpy finishedSpy(pinchArea, SIGNAL(pinchFinished(QQuickPinchEvent*))); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -465,20 +465,20 @@ void tst_QQuickPinchArea::cancel() window->setSource(testFileUrl("pinchproperties.qml")); window->show(); QVERIFY(QTest::qWaitForWindowExposed(window)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QQuickPinch *pinch = pinchArea->pinch(); - QVERIFY(pinchArea != 0); - QVERIFY(pinch != 0); + QVERIFY(pinchArea != nullptr); + QVERIFY(pinch != nullptr); QQuickItem *root = qobject_cast<QQuickItem*>(window->rootObject()); - QVERIFY(root != 0); + QVERIFY(root != nullptr); // target QQuickItem *blackRect = window->rootObject()->findChild<QQuickItem*>("blackrect"); - QVERIFY(blackRect != 0); + QVERIFY(blackRect != nullptr); QPoint p1(80, 80); QPoint p2(100, 100); @@ -558,11 +558,11 @@ void tst_QQuickPinchArea::transformedPinchArea() view->setSource(testFileUrl("transformedPinchArea.qml")); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); - QVERIFY(view->rootObject() != 0); + QVERIFY(view->rootObject() != nullptr); qApp->processEvents(); QQuickPinchArea *pinchArea = view->rootObject()->findChild<QQuickPinchArea*>("pinchArea"); - QVERIFY(pinchArea != 0); + QVERIFY(pinchArea != nullptr); const int threshold = qApp->styleHints()->startDragDistance(); @@ -588,7 +588,7 @@ void tst_QQuickPinchArea::transformedPinchArea() QQuickView *tst_QQuickPinchArea::createView() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setGeometry(0,0,240,320); return window; diff --git a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp index e854a109a1..bffaaf7c6e 100644 --- a/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp +++ b/tests/auto/quick/qquickpixmapcache/tst_qquickpixmapcache.cpp @@ -431,7 +431,7 @@ void tst_qquickpixmapcache::uncached() QUrl url("image://mypixmaps/mypix"); { QQuickPixmap p; - p.load(&engine, url, 0); + p.load(&engine, url, nullptr); QImage img = p.image(); QCOMPARE(img.pixel(0,0), qRgb(255, 0, 0)); } @@ -440,7 +440,7 @@ void tst_qquickpixmapcache::uncached() MyPixmapProvider::fillColor = qRgb(0, 255, 0); { QQuickPixmap p; - p.load(&engine, url, 0); + p.load(&engine, url, nullptr); QImage img = p.image(); QCOMPARE(img.pixel(0,0), qRgb(0, 255, 0)); } @@ -458,7 +458,7 @@ void tst_qquickpixmapcache::uncached() MyPixmapProvider::fillColor = qRgb(255, 0, 255); { QQuickPixmap p; - p.load(&engine, url, 0); + p.load(&engine, url, nullptr); QImage img = p.image(); QCOMPARE(img.pixel(0,0), qRgb(255, 0, 255)); } diff --git a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp index 1b3939401a..0395b08f10 100644 --- a/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp +++ b/tests/auto/quick/qquickpositioners/tst_qquickpositioners.cpp @@ -313,13 +313,13 @@ void tst_qquickpositioners::test_horizontal() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -357,13 +357,13 @@ void tst_qquickpositioners::test_horizontal_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -377,7 +377,7 @@ void tst_qquickpositioners::test_horizontal_padding() QCOMPARE(row->height(), 50.0); QQuickRow *obj = qobject_cast<QQuickRow*>(row); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(row->property("padding").toDouble(), 0.0); QCOMPARE(row->property("topPadding").toDouble(), 0.0); @@ -519,13 +519,13 @@ void tst_qquickpositioners::test_horizontal_rtl() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 60.0); QCOMPARE(one->y(), 0.0); @@ -598,13 +598,13 @@ void tst_qquickpositioners::test_horizontal_spacing() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -642,13 +642,13 @@ void tst_qquickpositioners::test_horizontal_spacing_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 80.0); QCOMPARE(one->y(), 0.0); @@ -686,13 +686,13 @@ void tst_qquickpositioners::test_horizontal_animated() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -739,13 +739,13 @@ void tst_qquickpositioners::test_horizontal_animated_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -803,13 +803,13 @@ void tst_qquickpositioners::test_horizontal_animated_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -858,13 +858,13 @@ void tst_qquickpositioners::test_horizontal_animated_rightToLeft_padding() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); //Note that they animate in QCOMPARE(one->x(), -100.0); @@ -922,13 +922,13 @@ void tst_qquickpositioners::test_horizontal_animated_disabled() QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated-disabled.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row"); QVERIFY(row); @@ -970,13 +970,13 @@ void tst_qquickpositioners::test_horizontal_animated_disabled_padding() QScopedPointer<QQuickView> window(createView(testFile("horizontal-animated-disabled.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickItem *row = window->rootObject()->findChild<QQuickItem*>("row"); QVERIFY(row); @@ -1037,7 +1037,7 @@ void tst_qquickpositioners::populateTransitions(const QString &positionerObjectN QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName); QVERIFY(positioner); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); qApp->processEvents(); if (!dynamicallyPopulate && usePopulateTransition) { @@ -1120,7 +1120,7 @@ void tst_qquickpositioners::addTransitions(const QString &positionerObjectName) ctxt->setContextProperty("testedPositioner", QString()); window->setSource(testFileUrl(qmlFile)); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); qApp->processEvents(); QQuickItem *positioner = window->rootObject()->findChild<QQuickItem*>(positionerObjectName); @@ -1243,7 +1243,7 @@ void tst_qquickpositioners::moveTransitions(const QString &positionerObjectName) ctxt->setContextProperty("testedPositioner", QString()); window->setSource(testFileUrl(qmlFile)); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); qApp->processEvents(); QList<QPair<QString,QString> > expectedDisplacedValues = expectedDisplacedIndexes.getModelDataValues(model); @@ -1390,7 +1390,7 @@ void tst_qquickpositioners::checkItemPositions(QQuickItem *positioner, QaimModel QVERIFY2(false, "Unknown positioner type"); } QQuickText *name = findItem<QQuickText>(positioner, "name", i); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QTRY_COMPARE(name->text(), model->name(i)); padding += i * incrementalSize; @@ -1403,13 +1403,13 @@ void tst_qquickpositioners::test_vertical() QScopedPointer<QQuickView> window(createView(testFile("vertical.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1446,13 +1446,13 @@ void tst_qquickpositioners::test_vertical_padding() QScopedPointer<QQuickView> window(createView(testFile("vertical.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1467,7 +1467,7 @@ void tst_qquickpositioners::test_vertical_padding() QCOMPARE(column->width(), 50.0); QQuickColumn *obj = qobject_cast<QQuickColumn*>(column); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(column->property("padding").toDouble(), 0.0); QCOMPARE(column->property("topPadding").toDouble(), 0.0); @@ -1607,13 +1607,13 @@ void tst_qquickpositioners::test_vertical_spacing() QScopedPointer<QQuickView> window(createView(testFile("vertical-spacing.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1650,15 +1650,15 @@ void tst_qquickpositioners::test_vertical_animated() //Note that they animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->y(), -100.0); QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn @@ -1699,15 +1699,15 @@ void tst_qquickpositioners::test_vertical_animated_padding() //Note that they animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->y(), -100.0); QVERIFY(QTest::qWaitForWindowExposed(window.data())); //It may not relayout until the next frame, so it needs to be drawn @@ -1758,15 +1758,15 @@ void tst_qquickpositioners::test_grid() QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1811,15 +1811,15 @@ void tst_qquickpositioners::test_grid_padding() QScopedPointer<QQuickView> window(createView(testFile("gridtest.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -1999,15 +1999,15 @@ void tst_qquickpositioners::test_grid_topToBottom() QScopedPointer<QQuickView> window(createView(testFile("grid-toptobottom.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2054,15 +2054,15 @@ void tst_qquickpositioners::test_grid_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 50.0); QCOMPARE(one->y(), 0.0); @@ -2154,15 +2154,15 @@ void tst_qquickpositioners::test_grid_spacing() QScopedPointer<QQuickView> window(createView(testFile("grid-spacing.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2206,15 +2206,15 @@ void tst_qquickpositioners::test_grid_row_column_spacing() QScopedPointer<QQuickView> window(createView(testFile("grid-row-column-spacing.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2261,27 +2261,27 @@ void tst_qquickpositioners::test_grid_animated() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2345,27 +2345,27 @@ void tst_qquickpositioners::test_grid_animated_padding() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2439,27 +2439,27 @@ void tst_qquickpositioners::test_grid_animated_rightToLeft() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2523,27 +2523,27 @@ void tst_qquickpositioners::test_grid_animated_rightToLeft_padding() //Note that all animate in QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QCOMPARE(one->x(), -100.0); QCOMPARE(one->y(), -100.0); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QCOMPARE(two->x(), -100.0); QCOMPARE(two->y(), -100.0); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(three->x(), -100.0); QCOMPARE(three->y(), -100.0); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QCOMPARE(four->x(), -100.0); QCOMPARE(four->y(), -100.0); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(five->x(), -100.0); QCOMPARE(five->y(), -100.0); @@ -2614,15 +2614,15 @@ void tst_qquickpositioners::test_grid_zero_columns() QScopedPointer<QQuickView> window(createView(testFile("gridzerocolumns.qml"))); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2668,15 +2668,15 @@ void tst_qquickpositioners::test_grid_H_alignment() window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2747,15 +2747,15 @@ void tst_qquickpositioners::test_grid_H_alignment_padding() window->rootObject()->setProperty("testHAlignment", QQuickGrid::AlignHCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2836,15 +2836,15 @@ void tst_qquickpositioners::test_grid_V_alignment() window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignVCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -2879,15 +2879,15 @@ void tst_qquickpositioners::test_grid_V_alignment_padding() window->rootObject()->setProperty("testVAlignment", QQuickGrid::AlignVCenter); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QQuickItem *grid = window->rootObject()->findChild<QQuickItem*>("grid"); QCOMPARE(grid->width(), 100.0); @@ -2934,7 +2934,7 @@ void tst_qquickpositioners::test_propertychanges() QScopedPointer<QQuickView> window(createView(testFile("propertychangestest.qml"))); QQuickGrid *grid = qobject_cast<QQuickGrid*>(window->rootObject()); - QVERIFY(grid != 0); + QVERIFY(grid != nullptr); QQuickTransition *rowTransition = window->rootObject()->findChild<QQuickTransition*>("rowTransition"); QQuickTransition *columnTransition = window->rootObject()->findChild<QQuickTransition*>("columnTransition"); @@ -2963,8 +2963,8 @@ void tst_qquickpositioners::test_propertychanges() QCOMPARE(addSpy.count(),1); QCOMPARE(moveSpy.count(),1); - grid->setAdd(0); - grid->setMove(0); + grid->setAdd(nullptr); + grid->setMove(nullptr); QCOMPARE(addSpy.count(),2); QCOMPARE(moveSpy.count(),2); @@ -2992,13 +2992,13 @@ void tst_qquickpositioners::test_repeater() QScopedPointer<QQuickView> window(createView(testFile("repeatertest.qml"))); QQuickRectangle *one = findItem<QQuickRectangle>(window->contentItem(), "one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = findItem<QQuickRectangle>(window->contentItem(), "two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = findItem<QQuickRectangle>(window->contentItem(), "three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3014,13 +3014,13 @@ void tst_qquickpositioners::test_repeater_padding() QScopedPointer<QQuickView> window(createView(testFile("repeatertest-padding.qml"))); QQuickRectangle *one = findItem<QQuickRectangle>(window->contentItem(), "one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = findItem<QQuickRectangle>(window->contentItem(), "two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = findItem<QQuickRectangle>(window->contentItem(), "three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QCOMPARE(one->x(), 3.0); QCOMPARE(one->y(), 2.0); @@ -3038,15 +3038,15 @@ void tst_qquickpositioners::test_flow() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3093,15 +3093,15 @@ void tst_qquickpositioners::test_flow_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3120,7 +3120,7 @@ void tst_qquickpositioners::test_flow_padding() QCOMPARE(flow->height(), 120.0); QQuickFlow *obj = qobject_cast<QQuickFlow*>(flow); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(flow->property("padding").toDouble(), 0.0); QCOMPARE(flow->property("topPadding").toDouble(), 0.0); @@ -3286,15 +3286,15 @@ void tst_qquickpositioners::test_flow_rightToLeft() window->rootObject()->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 40.0); QCOMPARE(one->y(), 0.0); @@ -3341,15 +3341,15 @@ void tst_qquickpositioners::test_flow_topToBottom() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3393,15 +3393,15 @@ void tst_qquickpositioners::test_flow_topToBottom_padding() window->rootObject()->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 0.0); QCOMPARE(one->y(), 0.0); @@ -3469,15 +3469,15 @@ void tst_qquickpositioners::test_flow_resize() root->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QTRY_COMPARE(one->x(), 0.0); QTRY_COMPARE(one->y(), 0.0); @@ -3502,15 +3502,15 @@ void tst_qquickpositioners::test_flow_resize_padding() root->setProperty("testRightToLeft", false); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QVERIFY(one != 0); + QVERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QTRY_COMPARE(one->x(), 3.0); QTRY_COMPARE(one->y(), 2.0); @@ -3535,15 +3535,15 @@ void tst_qquickpositioners::test_flow_resize_rightToLeft() root->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QTRY_VERIFY(one != 0); + QTRY_VERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 75.0); QCOMPARE(one->y(), 0.0); @@ -3568,15 +3568,15 @@ void tst_qquickpositioners::test_flow_resize_rightToLeft_padding() root->setProperty("testRightToLeft", true); QQuickRectangle *one = window->rootObject()->findChild<QQuickRectangle*>("one"); - QTRY_VERIFY(one != 0); + QTRY_VERIFY(one != nullptr); QQuickRectangle *two = window->rootObject()->findChild<QQuickRectangle*>("two"); - QVERIFY(two != 0); + QVERIFY(two != nullptr); QQuickRectangle *three = window->rootObject()->findChild<QQuickRectangle*>("three"); - QVERIFY(three != 0); + QVERIFY(three != nullptr); QQuickRectangle *four = window->rootObject()->findChild<QQuickRectangle*>("four"); - QVERIFY(four != 0); + QVERIFY(four != nullptr); QQuickRectangle *five = window->rootObject()->findChild<QQuickRectangle*>("five"); - QVERIFY(five != 0); + QVERIFY(five != nullptr); QCOMPARE(one->x(), 71.0); QCOMPARE(one->y(), 2.0); @@ -3594,10 +3594,10 @@ void tst_qquickpositioners::test_flow_resize_rightToLeft_padding() void tst_qquickpositioners::test_flow_implicit_resize() { QScopedPointer<QQuickView> window(createView(testFile("flow-testimplicitsize.qml"))); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow"); - QVERIFY(flow != 0); + QVERIFY(flow != nullptr); QCOMPARE(flow->width(), 100.0); QCOMPARE(flow->height(), 120.0); @@ -3622,10 +3622,10 @@ void tst_qquickpositioners::test_flow_implicit_resize() void tst_qquickpositioners::test_flow_implicit_resize_padding() { QScopedPointer<QQuickView> window(createView(testFile("flow-testimplicitsize.qml"))); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow"); - QVERIFY(flow != 0); + QVERIFY(flow != nullptr); QCOMPARE(flow->width(), 100.0); QCOMPARE(flow->height(), 120.0); @@ -3841,7 +3841,7 @@ void tst_qquickpositioners::test_allInvisible() QVERIFY(root); QQuickRow *row = window->rootObject()->findChild<QQuickRow*>("row"); - QVERIFY(row != 0); + QVERIFY(row != nullptr); QCOMPARE(row->width(), qreal(0)); QCOMPARE(row->height(), qreal(0)); @@ -3856,7 +3856,7 @@ void tst_qquickpositioners::test_allInvisible() QCOMPARE(row->width(), 7.0); QQuickColumn *column = window->rootObject()->findChild<QQuickColumn*>("column"); - QVERIFY(column != 0); + QVERIFY(column != nullptr); QCOMPARE(column->width(), qreal(0)); QCOMPARE(column->height(), qreal(0)); @@ -3871,7 +3871,7 @@ void tst_qquickpositioners::test_allInvisible() QCOMPARE(column->width(), 7.0); QQuickGrid *grid = window->rootObject()->findChild<QQuickGrid*>("grid"); - QVERIFY(grid != 0); + QVERIFY(grid != nullptr); QCOMPARE(grid->width(), qreal(0)); QCOMPARE(grid->height(), qreal(0)); @@ -3886,7 +3886,7 @@ void tst_qquickpositioners::test_allInvisible() QCOMPARE(grid->width(), 7.0); QQuickFlow *flow = window->rootObject()->findChild<QQuickFlow*>("flow"); - QVERIFY(flow != 0); + QVERIFY(flow != nullptr); QCOMPARE(flow->width(), qreal(0)); QCOMPARE(flow->height(), qreal(0)); @@ -3906,10 +3906,10 @@ void tst_qquickpositioners::test_attachedproperties() QFETCH(QString, filename); QScopedPointer<QQuickView> window(createView(filename)); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickRectangle *greenRect = window->rootObject()->findChild<QQuickRectangle *>("greenRect"); - QVERIFY(greenRect != 0); + QVERIFY(greenRect != nullptr); int posIndex = greenRect->property("posIndex").toInt(); QCOMPARE(posIndex, 0); @@ -3919,7 +3919,7 @@ void tst_qquickpositioners::test_attachedproperties() QVERIFY(!isLast); QQuickRectangle *yellowRect = window->rootObject()->findChild<QQuickRectangle *>("yellowRect"); - QVERIFY(yellowRect != 0); + QVERIFY(yellowRect != nullptr); posIndex = yellowRect->property("posIndex").toInt(); QCOMPARE(posIndex, -1); @@ -3952,13 +3952,13 @@ void tst_qquickpositioners::test_attachedproperties_data() void tst_qquickpositioners::test_attachedproperties_dynamic() { QScopedPointer<QQuickView> window(createView(testFile("attachedproperties-dynamic.qml"))); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickRow *row = window->rootObject()->findChild<QQuickRow *>("pos"); - QVERIFY(row != 0); + QVERIFY(row != nullptr); QQuickRectangle *rect0 = window->rootObject()->findChild<QQuickRectangle *>("rect0"); - QVERIFY(rect0 != 0); + QVERIFY(rect0 != nullptr); int posIndex = rect0->property("index").toInt(); QCOMPARE(posIndex, 0); @@ -3968,7 +3968,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() QVERIFY(!isLast); QQuickRectangle *rect1 = window->rootObject()->findChild<QQuickRectangle *>("rect1"); - QVERIFY(rect1 != 0); + QVERIFY(rect1 != nullptr); posIndex = rect1->property("index").toInt(); QCOMPARE(posIndex, 1); @@ -3984,7 +3984,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() QTRY_VERIFY(!rect1->property("lastItem").toBool()); QQuickRectangle *rect2 = window->rootObject()->findChild<QQuickRectangle *>("rect2"); - QVERIFY(rect2 != 0); + QVERIFY(rect2 != nullptr); posIndex = rect2->property("index").toInt(); QCOMPARE(posIndex, 2); @@ -3995,7 +3995,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() row->metaObject()->invokeMethod(row, "destroySubRect"); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QTRY_COMPARE(rect1->property("index").toInt(), 1); @@ -4006,7 +4006,7 @@ void tst_qquickpositioners::test_attachedproperties_dynamic() QQuickView *tst_qquickpositioners::createView(const QString &filename, bool wait) { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); qDebug() << "1"; window->setSource(QUrl::fromLocalFile(filename)); diff --git a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp index 3519c53cb7..0499e2f9a6 100644 --- a/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp +++ b/tests/auto/quick/qquickrepeater/tst_qquickrepeater.cpp @@ -119,7 +119,7 @@ void tst_QQuickRepeater::numberModel() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QCOMPARE(repeater->parentItem()->childItems().count(), 5+1); QVERIFY(!repeater->itemAt(-1)); @@ -160,7 +160,7 @@ void tst_QQuickRepeater::objectList() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data QCOMPARE(repeater->property("instantiated").toInt(), 100); @@ -201,10 +201,10 @@ void tst_QQuickRepeater::stringList() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), data.count() + 3); @@ -213,7 +213,7 @@ void tst_QQuickRepeater::stringList() if (i == 0) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Zero")); } else if (i == container->childItems().count() - 2) { // The repeater itself @@ -223,11 +223,11 @@ void tst_QQuickRepeater::stringList() continue; } else if (i == container->childItems().count() - 1) { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), QLatin1String("Last")); } else { QQuickText *name = qobject_cast<QQuickText*>(container->childItems().at(i)); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), data.at(i-1)); } } @@ -249,9 +249,9 @@ void tst_QQuickRepeater::dataModel_adding() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QVERIFY(!repeater->itemAt(0)); @@ -331,9 +331,9 @@ void tst_QQuickRepeater::dataModel_removing() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), repeater->count()+1); QSignalSpy countSpy(repeater, SIGNAL(countChanged())); @@ -397,9 +397,9 @@ void tst_QQuickRepeater::dataModel_changes() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), repeater->count()+1); // Check that model changes are propagated @@ -431,10 +431,10 @@ void tst_QQuickRepeater::itemModel() qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(container->childItems().count(), 1); @@ -474,9 +474,9 @@ void tst_QQuickRepeater::resetModel() window->setSource(testFileUrl("repeater1.qml")); qApp->processEvents(); QQuickRepeater *repeater = findItem<QQuickRepeater>(window->rootObject(), "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(window->rootObject(), "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(repeater->count(), dataA.count()); for (int i=0; i<repeater->count(); i++) @@ -567,9 +567,9 @@ void tst_QQuickRepeater::modelReset() QVERIFY(rootItem); QQuickRepeater *repeater = findItem<QQuickRepeater>(rootItem, "repeater"); - QVERIFY(repeater != 0); + QVERIFY(repeater != nullptr); QQuickItem *container = findItem<QQuickItem>(rootItem, "container"); - QVERIFY(container != 0); + QVERIFY(container != nullptr); QCOMPARE(repeater->count(), 0); @@ -701,7 +701,7 @@ void tst_QQuickRepeater::asynchronous() container = findItem<QQuickItem>(rootObject, "container"); } - QQuickRepeater *repeater = 0; + QQuickRepeater *repeater = nullptr; while (!repeater) { bool b = false; controller.incubateWhile(&b); @@ -713,8 +713,8 @@ void tst_QQuickRepeater::asynchronous() for (int i = 9; i >= 0; --i) { QString name("delegate"); name += QString::number(i); - QVERIFY(findItem<QQuickItem>(container, name) == 0); - QQuickItem *item = 0; + QVERIFY(findItem<QQuickItem>(container, name) == nullptr); + QQuickItem *item = nullptr; while (!item) { bool b = false; controller.incubateWhile(&b); @@ -804,7 +804,7 @@ void tst_QQuickRepeater::invalidContextCrash() // deleted first and then the repeater. During deletion the QML context // has been deleted already and is invalid. model->setParent(root.data()); - repeater->setParent(0); + repeater->setParent(nullptr); repeater->setParent(root.data()); QCOMPARE(root->children().count(), 2); @@ -813,7 +813,7 @@ void tst_QQuickRepeater::invalidContextCrash() // Delete the root object, which will invalidate/delete the QML context // and then delete the child QObjects, which may try to access the context. - root.reset(0); + root.reset(nullptr); } void tst_QQuickRepeater::jsArrayChange() diff --git a/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp index 1731253da6..f601f520bb 100644 --- a/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp +++ b/tests/auto/quick/qquickshadereffect/tst_qquickshadereffect.cpp @@ -280,7 +280,7 @@ void tst_qquickshadereffect::lookThroughShaderCode() void tst_qquickshadereffect::deleteSourceItem() { // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash - QQuickView *view = new QQuickView(0); + QQuickView *view = new QQuickView(nullptr); view->setSource(QUrl::fromLocalFile(testFile("deleteSourceItem.qml"))); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -295,7 +295,7 @@ void tst_qquickshadereffect::deleteSourceItem() void tst_qquickshadereffect::deleteShaderEffectSource() { // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash - QQuickView *view = new QQuickView(0); + QQuickView *view = new QQuickView(nullptr); view->setSource(QUrl::fromLocalFile(testFile("deleteShaderEffectSource.qml"))); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); @@ -310,7 +310,7 @@ void tst_qquickshadereffect::deleteShaderEffectSource() void tst_qquickshadereffect::twoImagesOneShaderEffect() { // purely to ensure that deleting the sourceItem of a shader doesn't cause a crash - QQuickView *view = new QQuickView(0); + QQuickView *view = new QQuickView(nullptr); view->setSource(QUrl::fromLocalFile(testFile("twoImagesOneShaderEffect.qml"))); view->show(); QVERIFY(QTest::qWaitForWindowExposed(view)); diff --git a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp index d78a38a662..14d2e858e8 100644 --- a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp +++ b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp @@ -64,7 +64,7 @@ void tst_qquicksmoothedanimation::defaultValues() QQmlComponent c(&engine, testFileUrl("smoothedanimation1.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 0.); QCOMPARE(obj->velocity(), 200.); @@ -81,7 +81,7 @@ void tst_qquicksmoothedanimation::values() QQmlComponent c(&engine, testFileUrl("smoothedanimation2.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 10.); QCOMPARE(obj->velocity(), 200.); @@ -98,7 +98,7 @@ void tst_qquicksmoothedanimation::disabled() QQmlComponent c(&engine, testFileUrl("smoothedanimation3.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 10.); QCOMPARE(obj->velocity(), 250.); @@ -259,7 +259,7 @@ void tst_qquicksmoothedanimation::noStart() QQmlComponent c(&engine, testFileUrl("smoothedanimation1.qml")); QQuickSmoothedAnimation *obj = qobject_cast<QQuickSmoothedAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); obj->start(); QCOMPARE(obj->isRunning(), false); diff --git a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp index b4184ba1d3..9042e94c75 100644 --- a/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp +++ b/tests/auto/quick/qquickspringanimation/tst_qquickspringanimation.cpp @@ -59,7 +59,7 @@ void tst_qquickspringanimation::defaultValues() QQmlComponent c(&engine, testFileUrl("springanimation1.qml")); QQuickSpringAnimation *obj = qobject_cast<QQuickSpringAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 0.); QCOMPARE(obj->velocity(), 0.); @@ -81,7 +81,7 @@ void tst_qquickspringanimation::values() QQuickSpringAnimation *obj = root->findChild<QQuickSpringAnimation*>(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 1.44); QCOMPARE(obj->velocity(), 0.9); @@ -103,7 +103,7 @@ void tst_qquickspringanimation::disabled() QQmlComponent c(&engine, testFileUrl("springanimation3.qml")); QQuickSpringAnimation *obj = qobject_cast<QQuickSpringAnimation*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->to(), 1.44); QCOMPARE(obj->velocity(), 0.9); diff --git a/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp b/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp index 08674c528a..e5d55a6871 100644 --- a/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp +++ b/tests/auto/quick/qquickspritesequence/tst_qquickspritesequence.cpp @@ -47,7 +47,7 @@ private slots: void tst_qquickspritesequence::test_properties() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("basic.qml")); window->show(); @@ -75,7 +75,7 @@ void tst_qquickspritesequence::test_huge() The large allocations of memory involved and separate codepath does make a doesn't crash test worthwhile. */ - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("huge.qml")); window->show(); @@ -90,7 +90,7 @@ void tst_qquickspritesequence::test_huge() void tst_qquickspritesequence::test_framerateAdvance() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("advance.qml")); window->show(); @@ -106,7 +106,7 @@ void tst_qquickspritesequence::test_framerateAdvance() void tst_qquickspritesequence::test_jumpToCrash() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("crashonstart.qml")); window->show(); @@ -118,7 +118,7 @@ void tst_qquickspritesequence::test_jumpToCrash() void tst_qquickspritesequence::test_spriteBeforeGoal() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("spritebeforegoal.qml")); window->show(); @@ -130,7 +130,7 @@ void tst_qquickspritesequence::test_spriteBeforeGoal() void tst_qquickspritesequence::test_spriteAfterGoal() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(testFileUrl("spriteaftergoal.qml")); window->show(); diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index 9b152b0676..073fe33e20 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -158,7 +158,7 @@ void tst_qquickstates::basicChanges() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -173,7 +173,7 @@ void tst_qquickstates::basicChanges() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -194,7 +194,7 @@ void tst_qquickstates::basicChanges() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1.0); @@ -231,7 +231,7 @@ void tst_qquickstates::basicChanges() QVERIFY(component.isReady()); MyRect *rect = qobject_cast<MyRect*>(component.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QMetaProperty prop = rect->metaObject()->property(rect->metaObject()->indexOfProperty("propertyWithNotify")); QVERIFY(prop.hasNotifySignal()); @@ -253,7 +253,7 @@ void tst_qquickstates::attachedPropertyChanges() QVERIFY(component.isReady()); QQuickItem *item = qobject_cast<QQuickItem*>(component.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QCOMPARE(item->width(), 50.0); // Ensure attached property has been changed @@ -274,7 +274,7 @@ void tst_qquickstates::basicExtension() QQmlComponent rectComponent(&engine, testFileUrl("basicExtension.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); QCOMPARE(rect->border()->width(),1.0); @@ -308,7 +308,7 @@ void tst_qquickstates::basicExtension() QQmlComponent rectComponent(&engine, testFileUrl("fakeExtension.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -340,7 +340,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -368,7 +368,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -399,7 +399,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); rect->setProperty("sourceColor", QColor("green")); @@ -424,7 +424,7 @@ void tst_qquickstates::basicBinding() QQmlComponent rectComponent(&engine, testFileUrl("basicBinding4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -456,7 +456,7 @@ void tst_qquickstates::signalOverride() { QQmlComponent rectComponent(&engine, testFileUrl("signalOverride.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); rect->doSomething(); @@ -472,7 +472,7 @@ void tst_qquickstates::signalOverride() { QQmlComponent rectComponent(&engine, testFileUrl("signalOverride2.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("white")); rect->doSomething(); @@ -495,7 +495,7 @@ void tst_qquickstates::signalOverrideCrash() QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash.qml")); MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("overridden"); rect->doSomething(); @@ -507,7 +507,7 @@ void tst_qquickstates::signalOverrideCrash2() QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("state1"); QQuickItemPrivate::get(rect)->setState("state2"); @@ -522,7 +522,7 @@ void tst_qquickstates::signalOverrideCrash3() QQmlComponent rectComponent(&engine, testFileUrl("signalOverrideCrash3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("state1"); QQuickItemPrivate::get(rect)->setState(""); @@ -537,7 +537,7 @@ void tst_qquickstates::signalOverrideCrash4() QQmlEngine engine; QQmlComponent c(&engine, testFileUrl("signalOverrideCrash4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); @@ -557,20 +557,20 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange1.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickParentChange *pChange = qobject_cast<QQuickParentChange*>(state->operationAt(0)); - QVERIFY(pChange != 0); + QVERIFY(pChange != nullptr); QQuickItem *nParent = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("NewParent")); - QVERIFY(nParent != 0); + QVERIFY(nParent != nullptr); QCOMPARE(pChange->parent(), nParent); @@ -584,10 +584,10 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); rectPrivate->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(15)); @@ -599,10 +599,10 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); rectPrivate->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(-37)); @@ -621,10 +621,10 @@ void tst_qquickstates::parentChange() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange6.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItemPrivate::get(rect)->setState("reparented"); QCOMPARE(innerRect->rotation(), qreal(180)); @@ -641,10 +641,10 @@ void tst_qquickstates::parentChangeErrors() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange4.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under non-uniform scale"); QQuickItemPrivate::get(rect)->setState("reparented"); @@ -657,10 +657,10 @@ void tst_qquickstates::parentChangeErrors() { QQmlComponent rectComponent(&engine, testFileUrl("parentChange5.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QTest::ignoreMessage(QtWarningMsg, fullDataPath("parentChange5.qml") + ":25:9: QML ParentChange: Unable to preserve appearance under complex transform"); QQuickItemPrivate::get(rect)->setState("reparented"); @@ -677,19 +677,19 @@ void tst_qquickstates::anchorChanges() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges1.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QCOMPARE(aChanges->anchors()->left().isUndefinedLiteral(), true); QVERIFY(!aChanges->anchors()->left().isEmpty()); @@ -714,11 +714,11 @@ void tst_qquickstates::anchorChanges2() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); rectPrivate->setState("right"); QCOMPARE(innerRect->x(), qreal(150)); @@ -735,25 +735,25 @@ void tst_qquickstates::anchorChanges3() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QVERIFY(!aChanges->anchors()->top().isEmpty()); QVERIFY(!aChanges->anchors()->bottom().isEmpty()); @@ -789,24 +789,24 @@ void tst_qquickstates::anchorChanges4() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges4.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QVERIFY(!aChanges->anchors()->horizontalCenter().isEmpty()); QVERIFY(!aChanges->anchors()->verticalCenter().isEmpty()); @@ -827,24 +827,24 @@ void tst_qquickstates::anchorChanges5() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges5.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); QVERIFY(!aChanges->anchors()->baseline().isEmpty()); @@ -873,20 +873,20 @@ void tst_qquickstates::anchorChangesRTL() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges1.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); mirrorAnchors(innerRect); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); rectPrivate->setState("right"); QCOMPARE(innerRect->x(), offsetRTL(rect, innerRect) - qreal(150)); @@ -907,11 +907,11 @@ void tst_qquickstates::anchorChangesRTL2() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); mirrorAnchors(innerRect); rectPrivate->setState("right"); @@ -929,26 +929,26 @@ void tst_qquickstates::anchorChangesRTL3() QQmlComponent rectComponent(&engine, testFileUrl("anchorChanges3.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *innerRect = qobject_cast<QQuickRectangle*>(rect->findChild<QQuickRectangle*>("MyRect")); - QVERIFY(innerRect != 0); + QVERIFY(innerRect != nullptr); mirrorAnchors(innerRect); QQuickItem *leftGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); + QVERIFY(leftGuideline != nullptr); QQuickItem *bottomGuideline = qobject_cast<QQuickItem*>(rect->findChild<QQuickItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); + QVERIFY(bottomGuideline != nullptr); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickAnchorChanges *aChanges = qobject_cast<QQuickAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); + QVERIFY(aChanges != nullptr); rectPrivate->setState("reanchored"); QCOMPARE(aChanges->object(), qobject_cast<QQuickItem*>(innerRect)); @@ -984,7 +984,7 @@ void tst_qquickstates::anchorChangesCrash() QQmlComponent rectComponent(&engine, testFileUrl("anchorChangesCrash.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate::get(rect)->setState("reanchored"); @@ -1002,11 +1002,11 @@ void tst_qquickstates::anchorRewindBug() QVERIFY(QTest::qWaitForWindowExposed(view)); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(view->rootObject()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItem * column = rect->findChild<QQuickItem*>("column"); - QVERIFY(column != 0); + QVERIFY(column != nullptr); QVERIFY(!QQuickItemPrivate::get(column)->heightValid); QVERIFY(!QQuickItemPrivate::get(column)->widthValid); QCOMPARE(column->height(), 200.0); @@ -1036,11 +1036,11 @@ void tst_qquickstates::anchorRewindBug2() QQmlComponent rectComponent(&engine, testFileUrl("anchorRewindBug2.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *mover = rect->findChild<QQuickRectangle*>("mover"); - QVERIFY(mover != 0); + QVERIFY(mover != nullptr); QCOMPARE(mover->y(), qreal(0.0)); QCOMPARE(mover->width(), qreal(50.0)); @@ -1062,7 +1062,7 @@ void tst_qquickstates::script() { QQmlComponent rectComponent(&engine, testFileUrl("script.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); @@ -1080,7 +1080,7 @@ void tst_qquickstates::restoreEntryValues() QQmlComponent rectComponent(&engine, testFileUrl("restoreEntryValues.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); @@ -1097,15 +1097,15 @@ void tst_qquickstates::explicitChanges() QQmlComponent rectComponent(&engine, testFileUrl("explicit.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQmlListReference list(rect, "states"); QQuickState *state = qobject_cast<QQuickState*>(list.at(0)); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QQuickPropertyChanges *changes = qobject_cast<QQuickPropertyChanges*>(rect->findChild<QQuickPropertyChanges*>("changes")); - QVERIFY(changes != 0); + QVERIFY(changes != nullptr); QVERIFY(changes->isExplicit()); QCOMPARE(rect->color(),QColor("red")); @@ -1130,7 +1130,7 @@ void tst_qquickstates::propertyErrors() QQmlEngine engine; QQmlComponent rectComponent(&engine, testFileUrl("propertyErrors.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QCOMPARE(rect->color(),QColor("red")); @@ -1145,7 +1145,7 @@ void tst_qquickstates::incorrectRestoreBug() QQmlComponent rectComponent(&engine, testFileUrl("basicChanges.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rect->color(),QColor("red")); @@ -1172,7 +1172,7 @@ void tst_qquickstates::autoStateAtStartupRestoreBug() QQmlComponent component(&engine, testFileUrl("autoStateAtStartupRestoreBug.qml")); QObject *obj = component.create(); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QCOMPARE(obj->property("test").toInt(), 3); obj->setProperty("input", 2); @@ -1188,7 +1188,7 @@ void tst_qquickstates::deletingChange() QQmlComponent rectComponent(&engine, testFileUrl("deleting.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); rectPrivate->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); @@ -1199,11 +1199,11 @@ void tst_qquickstates::deletingChange() QCOMPARE(rect->radius(),qreal(0)); QQuickPropertyChanges *pc = rect->findChild<QQuickPropertyChanges*>("pc1"); - QVERIFY(pc != 0); + QVERIFY(pc != nullptr); delete pc; QQuickState *state = rect->findChild<QQuickState*>(); - QVERIFY(state != 0); + QVERIFY(state != nullptr); qmlExecuteDeferred(state); QCOMPARE(state->operationCount(), 1); @@ -1220,11 +1220,11 @@ void tst_qquickstates::deletingState() QQmlComponent rectComponent(&engine, testFileUrl("deletingState.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickStateGroup *sg = rect->findChild<QQuickStateGroup*>(); - QVERIFY(sg != 0); - QVERIFY(sg->findState("blue") != 0); + QVERIFY(sg != nullptr); + QVERIFY(sg->findState("blue") != nullptr); sg->setState("blue"); QCOMPARE(rect->color(),QColor("blue")); @@ -1233,7 +1233,7 @@ void tst_qquickstates::deletingState() QCOMPARE(rect->color(),QColor("red")); QQuickState *state = rect->findChild<QQuickState*>(); - QVERIFY(state != 0); + QVERIFY(state != nullptr); delete state; QVERIFY(!sg->findState("blue")); @@ -1251,7 +1251,7 @@ void tst_qquickstates::tempState() QQmlComponent rectComponent(&engine, testFileUrl("legalTempState.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QTest::ignoreMessage(QtDebugMsg, "entering placed"); QTest::ignoreMessage(QtDebugMsg, "entering idle"); @@ -1265,7 +1265,7 @@ void tst_qquickstates::illegalTempState() QQmlComponent rectComponent(&engine, testFileUrl("illegalTempState.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML StateGroup: Can't apply a state change as part of a state definition."); rectPrivate->setState("placed"); @@ -1278,7 +1278,7 @@ void tst_qquickstates::nonExistantProperty() QQmlComponent rectComponent(&engine, testFileUrl("nonExistantProp.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QTest::ignoreMessage(QtWarningMsg, fullDataPath("nonExistantProp.qml") + ":9:9: QML PropertyChanges: Cannot assign to non-existent property \"colr\""); rectPrivate->setState("blue"); @@ -1291,10 +1291,10 @@ void tst_qquickstates::reset() QQmlComponent c(&engine, testFileUrl("reset.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickImage *image = rect->findChild<QQuickImage*>(); - QVERIFY(image != 0); + QVERIFY(image != nullptr); QCOMPARE(image->width(), qreal(40.)); QCOMPARE(image->height(), qreal(20.)); @@ -1325,7 +1325,7 @@ void tst_qquickstates::whenOrdering() QQmlComponent c(&engine, testFileUrl("whenOrdering.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rectPrivate->state(), QLatin1String("")); @@ -1348,13 +1348,13 @@ void tst_qquickstates::urlResolution() QQmlComponent c(&engine, testFileUrl("urlResolution.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItem *myType = rect->findChild<QQuickItem*>("MyType"); QQuickImage *image1 = rect->findChild<QQuickImage*>("image1"); QQuickImage *image2 = rect->findChild<QQuickImage*>("image2"); QQuickImage *image3 = rect->findChild<QQuickImage*>("image3"); - QVERIFY(myType != 0 && image1 != 0 && image2 != 0 && image3 != 0); + QVERIFY(myType != nullptr && image1 != nullptr && image2 != nullptr && image3 != nullptr); QQuickItemPrivate::get(myType)->setState("SetImageState"); QUrl resolved = testFileUrl("Implementation/images/qt-logo.png"); @@ -1371,7 +1371,7 @@ void tst_qquickstates::unnamedWhen() QQmlComponent c(&engine, testFileUrl("unnamedWhen.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rectPrivate->state(), QLatin1String("")); @@ -1390,7 +1390,7 @@ void tst_qquickstates::returnToBase() QQmlComponent c(&engine, testFileUrl("returnToBase.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QCOMPARE(rectPrivate->state(), QLatin1String("")); @@ -1410,7 +1410,7 @@ void tst_qquickstates::extendsBug() QQmlComponent c(&engine, testFileUrl("extendsBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickRectangle *greenRect = rect->findChild<QQuickRectangle*>("greenRect"); @@ -1425,30 +1425,30 @@ void tst_qquickstates::editProperties() QQmlComponent c(&engine, testFileUrl("editProperties.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); QQuickStateGroup *stateGroup = rectPrivate->_states(); - QVERIFY(stateGroup != 0); + QVERIFY(stateGroup != nullptr); qmlExecuteDeferred(stateGroup); QQuickState *blueState = stateGroup->findState("blue"); - QVERIFY(blueState != 0); + QVERIFY(blueState != nullptr); qmlExecuteDeferred(blueState); QQuickPropertyChanges *propertyChangesBlue = qobject_cast<QQuickPropertyChanges*>(blueState->operationAt(0)); - QVERIFY(propertyChangesBlue != 0); + QVERIFY(propertyChangesBlue != nullptr); QQuickState *greenState = stateGroup->findState("green"); - QVERIFY(greenState != 0); + QVERIFY(greenState != nullptr); qmlExecuteDeferred(greenState); QQuickPropertyChanges *propertyChangesGreen = qobject_cast<QQuickPropertyChanges*>(greenState->operationAt(0)); - QVERIFY(propertyChangesGreen != 0); + QVERIFY(propertyChangesGreen != nullptr); QQuickRectangle *childRect = rect->findChild<QQuickRectangle*>("rect2"); - QVERIFY(childRect != 0); + QVERIFY(childRect != nullptr); QCOMPARE(childRect->width(), qreal(402)); QVERIFY(QQmlPropertyPrivate::binding(QQmlProperty(childRect, "width"))); QCOMPARE(childRect->height(), qreal(200)); @@ -1553,7 +1553,7 @@ void tst_qquickstates::QTBUG_14830() QQmlComponent c(&engine, testFileUrl("QTBUG-14830.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItem *item = rect->findChild<QQuickItem*>("area"); QCOMPARE(item->width(), qreal(170)); @@ -1566,7 +1566,7 @@ void tst_qquickstates::avoidFastForward() //shouldn't fast forward if there isn't a transition QQmlComponent c(&engine, testFileUrl("avoidFastForward.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); rectPrivate->setState("a"); @@ -1580,7 +1580,7 @@ void tst_qquickstates::revertListBug() QQmlComponent c(&engine, testFileUrl("revertListBug.qml")); QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); - QVERIFY(rect != 0); + QVERIFY(rect != nullptr); QQuickRectangle *rect1 = rect->findChild<QQuickRectangle*>("rect1"); QQuickRectangle *rect2 = rect->findChild<QQuickRectangle*>("rect2"); @@ -1621,7 +1621,7 @@ void tst_qquickstates::QTBUG_38492() QQmlComponent rectComponent(&engine, testFileUrl("QTBUG-38492.qml")); QQuickItem *item = qobject_cast<QQuickItem*>(rectComponent.create()); - QVERIFY(item != 0); + QVERIFY(item != nullptr); QQuickItemPrivate::get(item)->setState("apply"); diff --git a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp index 045029c3b6..6ca5ad2653 100644 --- a/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp +++ b/tests/auto/quick/qquickstyledtext/tst_qquickstyledtext.cpp @@ -162,7 +162,7 @@ void tst_qquickstyledtext::textOutput() QTextLayout layout; QList<QQuickStyledTextImgTag*> imgTags; bool fontSizeModified = false; - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), output); @@ -191,7 +191,7 @@ void tst_qquickstyledtext::anchors() QTextLayout layout; QList<QQuickStyledTextImgTag*> imgTags; bool fontSizeModified = false; - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), output); @@ -229,11 +229,11 @@ void tst_qquickstyledtext::longString() bool fontSizeModified = false; QString input(9999999, QChar('.')); - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), input); input = QString(9999999, QChar('\t')); // whitespace - QQuickStyledText::parse(input, layout, imgTags, QUrl(), 0, false, &fontSizeModified); + QQuickStyledText::parse(input, layout, imgTags, QUrl(), nullptr, false, &fontSizeModified); QCOMPARE(layout.text(), QString("")); } diff --git a/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp index 136cfa9a80..071dcafc97 100644 --- a/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp +++ b/tests/auto/quick/qquicksystempalette/tst_qquicksystempalette.cpp @@ -62,7 +62,7 @@ void tst_qquicksystempalette::activePalette() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QPalette palette; palette.setCurrentColorGroup(QPalette::Active); @@ -91,7 +91,7 @@ void tst_qquicksystempalette::inactivePalette() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->colorGroup(), QQuickSystemPalette::Inactive); QPalette palette; @@ -121,7 +121,7 @@ void tst_qquicksystempalette::disabledPalette() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QCOMPARE(object->colorGroup(), QQuickSystemPalette::Disabled); QPalette palette; @@ -152,7 +152,7 @@ void tst_qquicksystempalette::paletteChanged() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickSystemPalette *object = qobject_cast<QQuickSystemPalette*>(component.create()); - QVERIFY(object != 0); + QVERIFY(object != nullptr); QPalette p; p.setCurrentColorGroup(QPalette::Active); diff --git a/tests/auto/quick/qquicktext/tst_qquicktext.cpp b/tests/auto/quick/qquicktext/tst_qquicktext.cpp index 6fa898e9fb..609a84ce82 100644 --- a/tests/auto/quick/qquicktext/tst_qquicktext.cpp +++ b/tests/auto/quick/qquicktext/tst_qquicktext.cpp @@ -238,7 +238,7 @@ tst_qquicktext::tst_qquicktext() QQuickView *tst_qquicktext::createView(const QString &filename) { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setSource(QUrl::fromLocalFile(filename)); return window; @@ -251,7 +251,7 @@ void tst_qquicktext::text() textComponent.setData("import QtQuick 2.0\nText { text: \"\" }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->text(), QString("")); QCOMPARE(textObject->width(), qreal(0)); @@ -266,7 +266,7 @@ void tst_qquicktext::text() QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->text(), standard.at(i)); QVERIFY(textObject->width() > 0); @@ -280,7 +280,7 @@ void tst_qquicktext::text() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QString expected = richText.at(i); QCOMPARE(textObject->text(), expected.replace("\\\"", "\"")); QVERIFY(textObject->width() > 0); @@ -297,7 +297,7 @@ void tst_qquicktext::width() textComponent.setData("import QtQuick 2.0\nText { text: \"\" }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 0.); delete textObject; @@ -344,7 +344,7 @@ void tst_qquicktext::width() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QVERIFY(textObject->boundingRect().width() > 0); QCOMPARE(textObject->width(), qreal(metricWidth)); QVERIFY(textObject->textFormat() == QQuickText::AutoText); // setting text doesn't change format @@ -360,14 +360,14 @@ void tst_qquicktext::width() QQmlComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->extra.isAllocated()); QTextDocument *doc = textPrivate->extra->doc; - QVERIFY(doc != 0); + QVERIFY(doc != nullptr); QCOMPARE(int(textObject->width()), int(doc->idealWidth())); QCOMPARE(textObject->textFormat(), QQuickText::RichText); @@ -386,7 +386,7 @@ void tst_qquicktext::wrap() QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); textHeight = textObject->height(); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->wrapMode(), QQuickText::WordWrap); QCOMPARE(textObject->width(), 300.); @@ -400,7 +400,7 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); @@ -418,7 +418,7 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); @@ -437,16 +437,16 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->extra.isAllocated()); QTextDocument *doc = textPrivate->extra->doc; - QVERIFY(doc != 0); + QVERIFY(doc != nullptr); textObject->setWidth(doc->idealWidth()); QCOMPARE(textObject->width(), doc->idealWidth()); QVERIFY(textObject->height() > textHeight); @@ -466,7 +466,7 @@ void tst_qquicktext::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->implicitHeight() > textHeight); @@ -567,7 +567,7 @@ void tst_qquicktext::multilineElide() QScopedPointer<QQuickView> window(createView(testFile("multilineelide.qml"))); QQuickText *myText = qobject_cast<QQuickText*>(window->rootObject()); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); myText->setTextFormat(format); QCOMPARE(myText->lineCount(), 3); @@ -667,11 +667,11 @@ void tst_qquicktext::textFormat() textComponent.setData("import QtQuick 2.0\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickText::RichText); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->richText); delete textObject; @@ -681,11 +681,11 @@ void tst_qquicktext::textFormat() textComponent.setData("import QtQuick 2.0\nText { text: \"<b>Hello</b>\" }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickText::AutoText); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->styledText); delete textObject; @@ -695,7 +695,7 @@ void tst_qquicktext::textFormat() textComponent.setData("import QtQuick 2.0\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickText::PlainText); delete textObject; @@ -821,11 +821,11 @@ void tst_qquicktext::horizontalAlignment_RightToLeft() { QScopedPointer<QQuickView> window(createView(testFile("horizontalAlignment_RightToLeft.qml"))); QQuickText *text = window->rootObject()->findChild<QQuickText*>("text"); - QVERIFY(text != 0); + QVERIFY(text != nullptr); window->showNormal(); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(text); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QTRY_VERIFY(textPrivate->layout.lineCount()); @@ -965,7 +965,7 @@ void tst_qquicktext::hAlignImplicitWidth() QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *text = view.rootObject()->findChild<QQuickText*>("textItem"); - QVERIFY(text != 0); + QVERIFY(text != nullptr); // Try to check whether alignment works by checking the number of black // pixels in the thirds of the grabbed image. @@ -1032,7 +1032,7 @@ void tst_qquicktext::verticalAlignment() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); delete textObject; @@ -1048,7 +1048,7 @@ void tst_qquicktext::verticalAlignment() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); delete textObject; @@ -1444,7 +1444,7 @@ void tst_qquicktext::weight() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().weight(), (int)QQuickFontValueType::Normal); delete textObject; @@ -1455,7 +1455,7 @@ void tst_qquicktext::weight() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().weight(), (int)QQuickFontValueType::Bold); delete textObject; @@ -1469,7 +1469,7 @@ void tst_qquicktext::underline() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().overline(), false); QCOMPARE(textObject->font().underline(), true); QCOMPARE(textObject->font().strikeOut(), false); @@ -1482,7 +1482,7 @@ void tst_qquicktext::overline() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().overline(), true); QCOMPARE(textObject->font().underline(), false); QCOMPARE(textObject->font().strikeOut(), false); @@ -1495,7 +1495,7 @@ void tst_qquicktext::strikeout() view.requestActivate(); QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickText *textObject = view.rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().overline(), false); QCOMPARE(textObject->font().underline(), false); QCOMPARE(textObject->font().strikeOut(), true); @@ -1509,7 +1509,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::MixedCase); delete textObject; @@ -1520,7 +1520,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::AllUppercase); delete textObject; @@ -1531,7 +1531,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::AllLowercase); delete textObject; @@ -1542,7 +1542,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::SmallCaps); delete textObject; @@ -1553,7 +1553,7 @@ void tst_qquicktext::capitalization() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().capitalization(), (int)QQuickFontValueType::Capitalize); delete textObject; @@ -1568,7 +1568,7 @@ void tst_qquicktext::letterSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().letterSpacing(), 0.0); delete textObject; @@ -1579,7 +1579,7 @@ void tst_qquicktext::letterSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().letterSpacing(), -2.); delete textObject; @@ -1590,7 +1590,7 @@ void tst_qquicktext::letterSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().letterSpacing(), 3.); delete textObject; @@ -1605,7 +1605,7 @@ void tst_qquicktext::wordSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().wordSpacing(), 0.0); delete textObject; @@ -1616,7 +1616,7 @@ void tst_qquicktext::wordSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().wordSpacing(), -50.); delete textObject; @@ -1627,7 +1627,7 @@ void tst_qquicktext::wordSpacing() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->font().wordSpacing(), 200.); delete textObject; @@ -2024,7 +2024,7 @@ void tst_qquicktext::linkInteraction() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); LinkTest test; QObject::connect(textObject, SIGNAL(linkActivated(QString)), &test, SLOT(linkClicked(QString))); @@ -2146,7 +2146,7 @@ void tst_qquicktext::embeddedImages() QVERIFY(QTest::qWaitForWindowActive(view)); QQuickText *textObject = qobject_cast<QQuickText*>(view->rootObject()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QTRY_COMPARE(textObject->resourcesLoading(), 0); QPixmap pm(testFile("http/exists.png")); @@ -2167,7 +2167,7 @@ void tst_qquicktext::lineCount() QScopedPointer<QQuickView> window(createView(testFile("lineCount.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QVERIFY(myText->lineCount() > 1); QVERIFY(!myText->truncated()); @@ -2194,7 +2194,7 @@ void tst_qquicktext::lineHeight() QScopedPointer<QQuickView> window(createView(testFile("lineHeight.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QCOMPARE(myText->lineHeight(), qreal(1)); QCOMPARE(myText->lineHeightMode(), QQuickText::ProportionalHeight); @@ -2792,10 +2792,10 @@ void tst_qquicktext::lineLaidOut() QScopedPointer<QQuickView> window(createView(testFile("lineLayout.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(!textPrivate->extra.isAllocated()); @@ -2820,10 +2820,10 @@ void tst_qquicktext::lineLaidOutRelayout() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(!textPrivate->extra.isAllocated()); @@ -2848,10 +2848,10 @@ void tst_qquicktext::lineLaidOutHAlign() QScopedPointer<QQuickView> window(createView(testFile("lineLayoutHAlign.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QCOMPARE(textPrivate->layout.lineCount(), 1); @@ -2978,11 +2978,11 @@ void tst_qquicktext::imgTagsAlign() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(".")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->height(), qreal(imgHeight)); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QRectF br = textPrivate->layout.boundingRect(); if (align == "bottom") @@ -3003,11 +3003,11 @@ void tst_qquicktext::imgTagsMultipleImages() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(".")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->height(), qreal(85)); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QCOMPARE(textPrivate->extra->visibleImgTags.count(), 2); delete textObject; @@ -3017,10 +3017,10 @@ void tst_qquicktext::imgTagsElide() { QScopedPointer<QQuickView> window(createView(testFile("imgTagsElide.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QCOMPARE(textPrivate->extra->visibleImgTags.count(), 0); myText->setMaximumLineCount(20); QTRY_COMPARE(textPrivate->extra->visibleImgTags.count(), 1); @@ -3032,12 +3032,12 @@ void tst_qquicktext::imgTagsUpdates() { QScopedPointer<QQuickView> window(createView(testFile("imgTagsUpdates.qml"))); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); QSignalSpy spy(myText, SIGNAL(contentSizeChanged())); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(myText); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); myText->setText("This is a heart<img src=\"images/heart200.png\">."); QCOMPARE(textPrivate->extra->visibleImgTags.count(), 1); @@ -3063,7 +3063,7 @@ void tst_qquicktext::imgTagsError() textComponent.setData(componentStr.toLatin1(), QUrl("file:")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); delete textObject; } @@ -3082,7 +3082,7 @@ void tst_qquicktext::fontSizeMode() window->show(); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); myText->setText(text); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -3325,7 +3325,7 @@ void tst_qquicktext::fontSizeModeMultiline() window->show(); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); myText->setText(text); QTRY_COMPARE(QQuickItemPrivate::get(myText)->polishScheduled, false); @@ -3573,7 +3573,7 @@ void tst_qquicktext::multilengthStrings() window->show(); QQuickText *myText = window->rootObject()->findChild<QQuickText*>("myText"); - QVERIFY(myText != 0); + QVERIFY(myText != nullptr); const QString longText = "the quick brown fox jumped over the lazy dog"; const QString mediumText = "the brown fox jumped over the dog"; @@ -3653,8 +3653,8 @@ void tst_qquicktext::fontFormatSizes() QQuickText *qtext = view->rootObject()->findChild<QQuickText*>("text"); QQuickText *qtextWithTag = view->rootObject()->findChild<QQuickText*>("textWithTag"); - QVERIFY(qtext != 0); - QVERIFY(qtextWithTag != 0); + QVERIFY(qtext != nullptr); + QVERIFY(qtextWithTag != nullptr); qtext->setText(text); qtextWithTag->setText(textWithTag); @@ -3672,8 +3672,8 @@ void tst_qquicktext::fontFormatSizes() view->setSource(testFileUrl("pixelFontSizes.qml")); QQuickText *qtext = view->rootObject()->findChild<QQuickText*>("text"); QQuickText *qtextWithTag = view->rootObject()->findChild<QQuickText*>("textWithTag"); - QVERIFY(qtext != 0); - QVERIFY(qtextWithTag != 0); + QVERIFY(qtext != nullptr); + QVERIFY(qtextWithTag != nullptr); qtext->setText(text); qtextWithTag->setText(textWithTag); @@ -4039,10 +4039,10 @@ void tst_qquicktext::htmlLists() QQuickText *textObject = view->rootObject()->findChild<QQuickText*>("myText"); QQuickTextPrivate *textPrivate = QQuickTextPrivate::get(textObject); - QVERIFY(textPrivate != 0); + QVERIFY(textPrivate != nullptr); QVERIFY(textPrivate->extra.isAllocated()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); textObject->setText(text); view->show(); @@ -4139,7 +4139,7 @@ void tst_qquicktext::padding() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickText *obj = qobject_cast<QQuickText*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); qreal cw = obj->contentWidth(); qreal ch = obj->contentHeight(); @@ -4227,7 +4227,7 @@ void tst_qquicktext::hintingPreference() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().hintingPreference(), (int)QFont::PreferDefaultHinting); delete textObject; @@ -4238,7 +4238,7 @@ void tst_qquicktext::hintingPreference() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickText *textObject = qobject_cast<QQuickText*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE((int)textObject->font().hintingPreference(), (int)QFont::PreferNoHinting); delete textObject; diff --git a/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp index 7507938589..e9c699db6a 100644 --- a/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp +++ b/tests/auto/quick/qquicktextdocument/tst_qquicktextdocument.cpp @@ -58,7 +58,7 @@ void tst_qquicktextdocument::textDocumentWriter() QVERIFY(edit); QQuickTextDocument* quickDocument = qobject_cast<QQuickTextDocument*>(edit->property("textDocument").value<QObject*>()); - QVERIFY(quickDocument->textDocument() != 0); + QVERIFY(quickDocument->textDocument() != nullptr); QBuffer output; output.open(QBuffer::ReadWrite); @@ -73,7 +73,7 @@ void tst_qquicktextdocument::textDocumentWriter() void tst_qquicktextdocument::textDocumentWithImage() { - QQuickTextDocumentWithImageResources document(0); + QQuickTextDocumentWithImageResources document(nullptr); QImage image(1, 1, QImage::Format_Mono); image.fill(1); diff --git a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp index d0031e397b..da15ca6b48 100644 --- a/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp +++ b/tests/auto/quick/qquicktextedit/tst_qquicktextedit.cpp @@ -210,7 +210,7 @@ private: void simulateKeys(QWindow *window, const QList<Key> &keys); void simulateKeys(QWindow *window, const QKeySequence &sequence); - void simulateKey(QWindow *, int key, Qt::KeyboardModifiers modifiers = 0); + void simulateKey(QWindow *, int key, Qt::KeyboardModifiers modifiers = nullptr); QStringList standard; QStringList richText; @@ -336,7 +336,7 @@ void tst_qquicktextedit::cleanup() { // ensure not even skipped tests with custom input context leave it dangling QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } void tst_qquicktextedit::text() @@ -346,7 +346,7 @@ void tst_qquicktextedit::text() texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\" }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), QString("")); QCOMPARE(textEditObject->length(), 0); } @@ -358,7 +358,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); QCOMPARE(textEditObject->length(), standard.at(i).length()); } @@ -371,7 +371,7 @@ void tst_qquicktextedit::text() QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString expected = richText.at(i); expected.replace(QRegExp("\\\\(.)"),"\\1"); @@ -386,7 +386,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString actual = textEditObject->text(); QString expected = standard.at(i); @@ -404,7 +404,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString actual = textEditObject->text(); QString expected = richText.at(i); actual.replace(QRegExp(".*<body[^>]*>"),""); @@ -423,7 +423,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->text(), standard.at(i)); QCOMPARE(textEditObject->length(), standard.at(i).length()); } @@ -435,7 +435,7 @@ void tst_qquicktextedit::text() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QString actual = textEditObject->text(); QString expected = richText.at(i); actual.replace(QRegExp(".*<body[^>]*>"),""); @@ -456,7 +456,7 @@ void tst_qquicktextedit::width() texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\" }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 0.0); } @@ -492,7 +492,7 @@ void tst_qquicktextedit::width() qreal metricWidth = layout.boundingRect().width(); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), metricWidth); } @@ -511,7 +511,7 @@ void tst_qquicktextedit::width() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), documentWidth); } } @@ -524,7 +524,7 @@ void tst_qquicktextedit::wrap() texteditComponent.setData("import QtQuick 2.0\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 300.); } @@ -535,7 +535,7 @@ void tst_qquicktextedit::wrap() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 300.); } @@ -546,7 +546,7 @@ void tst_qquicktextedit::wrap() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->width(), 300.); } { @@ -581,7 +581,7 @@ void tst_qquicktextedit::textFormat() textComponent.setData("import QtQuick 2.0\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickTextEdit::RichText); } { @@ -589,7 +589,7 @@ void tst_qquicktextedit::textFormat() textComponent.setData("import QtQuick 2.0\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->textFormat(), QQuickTextEdit::PlainText); } { @@ -679,7 +679,7 @@ void tst_qquicktextedit::hAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); } } @@ -693,7 +693,7 @@ void tst_qquicktextedit::hAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); } } @@ -708,7 +708,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() QQuickView window(testFileUrl("horizontalAlignment_RightToLeft.qml")); QQuickTextEdit *textEdit = window.rootObject()->findChild<QQuickTextEdit*>("text"); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); window.showNormal(); const QString rtlText = textEdit->text(); @@ -790,7 +790,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() QVERIFY(textEdit->positionToRectangle(0).x() < window.width()/2); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); textEdit->setText(QString()); @@ -853,7 +853,7 @@ void tst_qquicktextedit::hAlign_RightToLeft() // make sure editor doesn't rely on input for updating size QQuickTextEdit *emptyEdit = window.rootObject()->findChild<QQuickTextEdit*>("emptyTextEdit"); - QVERIFY(emptyEdit != 0); + QVERIFY(emptyEdit != nullptr); platformInputContext.setInputDirection(Qt::RightToLeft); emptyEdit->setFocus(true); QCOMPARE(emptyEdit->hAlign(), QQuickTextEdit::AlignRight); @@ -891,7 +891,7 @@ void tst_qquicktextedit::hAlignVisual() QVERIFY(QTest::qWaitForWindowExposed(&view)); QQuickText *text = view.rootObject()->findChild<QQuickText*>("textItem"); - QVERIFY(text != 0); + QVERIFY(text != nullptr); // Try to check whether alignment works by checking the number of black // pixels in the thirds of the grabbed image. @@ -987,7 +987,7 @@ void tst_qquicktextedit::vAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); } } @@ -1001,7 +1001,7 @@ void tst_qquicktextedit::vAlign() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); } } @@ -1012,7 +1012,7 @@ void tst_qquicktextedit::vAlign() "TextEdit { width: 100; height: 100; text: \"Hello World\" }", QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->vAlign(), QQuickTextEdit::AlignTop); QVERIFY(textEditObject->cursorRectangle().bottom() < 50); @@ -1055,7 +1055,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().pointSize(), 40); QCOMPARE(textEditObject->font().bold(), false); QCOMPARE(textEditObject->font().italic(), false); @@ -1067,7 +1067,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().bold(), true); QCOMPARE(textEditObject->font().italic(), false); } @@ -1078,7 +1078,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().italic(), true); QCOMPARE(textEditObject->font().bold(), false); } @@ -1089,7 +1089,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().family(), QString("Helvetica")); QCOMPARE(textEditObject->font().bold(), false); QCOMPARE(textEditObject->font().italic(), false); @@ -1101,7 +1101,7 @@ void tst_qquicktextedit::font() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->font().family(), QString("")); } } @@ -1166,7 +1166,7 @@ void tst_qquicktextedit::color() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i)); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->color(), QColor(colorStrings.at(i))); } @@ -1177,7 +1177,7 @@ void tst_qquicktextedit::color() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->selectionColor(), QColor(colorStrings.at(i))); } @@ -1188,7 +1188,7 @@ void tst_qquicktextedit::color() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->selectedTextColor(), QColor(colorStrings.at(i))); } @@ -1202,7 +1202,7 @@ void tst_qquicktextedit::color() texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->color(), testColor); } } @@ -1214,7 +1214,7 @@ void tst_qquicktextedit::textMargin() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->textMargin(), i); } } @@ -1224,7 +1224,7 @@ void tst_qquicktextedit::persistentSelection() QQuickView window(testFileUrl("persistentSelection.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(window.rootObject()); QVERIFY(edit); @@ -1267,7 +1267,7 @@ void tst_qquicktextedit::selectionOnFocusOut() QQuickView window(testFileUrl("focusOutSelection.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QPoint p1(25, 35); QPoint p2(25, 85); @@ -1275,14 +1275,14 @@ void tst_qquicktextedit::selectionOnFocusOut() QQuickTextEdit *edit1 = window.rootObject()->findChild<QQuickTextEdit*>("text1"); QQuickTextEdit *edit2 = window.rootObject()->findChild<QQuickTextEdit*>("text2"); - QTest::mouseClick(&window, Qt::LeftButton, 0, p1); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p1); QVERIFY(edit1->hasActiveFocus()); QVERIFY(!edit2->hasActiveFocus()); edit1->selectAll(); QCOMPARE(edit1->selectedText(), QLatin1String("text 1")); - QTest::mouseClick(&window, Qt::LeftButton, 0, p2); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, p2); QCOMPARE(edit1->selectedText(), QLatin1String("")); QVERIFY(!edit1->hasActiveFocus()); @@ -1318,7 +1318,7 @@ void tst_qquicktextedit::focusOnPress() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QCOMPARE(textEditObject->focusOnPress(), true); QCOMPARE(textEditObject->hasFocus(), false); @@ -1335,13 +1335,13 @@ void tst_qquicktextedit::focusOnPress() textEditObject->setParentItem(window.contentItem()); window.showNormal(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(textEditObject->hasFocus(), false); QCOMPARE(textEditObject->hasActiveFocus(), false); QPoint centerPoint(window.width()/2, window.height()/2); - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = nullptr; QTest::mousePress(&window, Qt::LeftButton, noModifiers, centerPoint); QGuiApplication::processEvents(); QCOMPARE(textEditObject->hasFocus(), true); @@ -1396,7 +1396,7 @@ void tst_qquicktextedit::selection() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); //Test selection follows cursor @@ -1479,7 +1479,7 @@ void tst_qquicktextedit::overwriteMode() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QSignalSpy spy(textEdit, SIGNAL(overwriteModeChanged(bool))); @@ -1487,7 +1487,7 @@ void tst_qquicktextedit::overwriteMode() textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); @@ -1603,13 +1603,13 @@ void tst_qquicktextedit::keySelection() QQuickView window(testFileUrl("navigation.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QVERIFY(input->hasActiveFocus()); QSignalSpy spy(input, SIGNAL(selectedTextChanged())); @@ -1805,7 +1805,7 @@ void tst_qquicktextedit::moveCursorSelection() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit*>(textinputComponent.create()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); texteditObject->setCursorPosition(cursorPosition); texteditObject->moveCursorSelection(movePosition, mode); @@ -1964,7 +1964,7 @@ void tst_qquicktextedit::moveCursorSelectionSequence() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit*>(texteditComponent.create()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); texteditObject->setCursorPosition(cursorPosition); @@ -2060,11 +2060,11 @@ void tst_qquicktextedit::mouseSelection() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); textEditObject->setFocus(focus); textEditObject->setFocusOnPress(focusOnPress); @@ -2107,19 +2107,19 @@ void tst_qquicktextedit::dragMouseSelection() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // press-and-drag-and-release from x1 to x2 int x1 = 10; int x2 = 70; int y = QFontMetrics(textEditObject->font()).height() / 2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str1; QTRY_VERIFY((str1 = textEditObject->selectedText()).length() > 3); @@ -2127,9 +2127,9 @@ void tst_qquicktextedit::dragMouseSelection() // press and drag the current selection. x1 = 40; x2 = 100; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QTest::qWait(300); QString str2; QTRY_VERIFY((str2 = textEditObject->selectedText()).length() > 3); @@ -2160,19 +2160,19 @@ void tst_qquicktextedit::mouseSelectionMode() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // press-and-drag-and-release from x1 to x2 int x1 = 10; int x2 = 70; int y = textEditObject->height()/2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str = textEditObject->selectedText(); if (selectWords) { QTRY_COMPARE(textEditObject->selectedText(), text); @@ -2345,7 +2345,7 @@ void tst_qquicktextedit::keyboardSelection() edit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(edit->hasActiveFocus()); simulateKeys(&window, standardKey); @@ -2383,9 +2383,9 @@ void tst_qquicktextedit::inputMethodHints() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText); QSignalSpy inputMethodHintSpy(textEditObject, SIGNAL(inputMethodHintsChanged())); textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); @@ -2419,13 +2419,13 @@ void tst_qquicktextedit::positionAt() QFETCH(QQuickTextEdit::VAlignment, verticalAlignment); QQuickView window(testFileUrl("positionAt.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); texteditObject->setHAlign(horizontalAlignment); texteditObject->setVAlign(verticalAlignment); @@ -2509,13 +2509,13 @@ void tst_qquicktextedit::positionAt() void tst_qquicktextedit::linkInteraction() { QQuickView window(testFileUrl("linkInteraction.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *texteditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(texteditObject != 0); + QVERIFY(texteditObject != nullptr); QSignalSpy spy(texteditObject, SIGNAL(linkActivated(QString))); QSignalSpy hover(texteditObject, SIGNAL(linkHovered(QString))); @@ -2525,7 +2525,7 @@ void tst_qquicktextedit::linkInteraction() const QPointF linkPos = texteditObject->positionToRectangle(7).center(); const QPointF textPos = texteditObject->positionToRectangle(2).center(); - QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(hover.count(), 1); QCOMPARE(spy.last()[0].toString(), link); @@ -2533,7 +2533,7 @@ void tst_qquicktextedit::linkInteraction() QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); - QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(hover.count(), 2); QCOMPARE(hover.last()[0].toString(), QString()); @@ -2542,7 +2542,7 @@ void tst_qquicktextedit::linkInteraction() texteditObject->setReadOnly(true); - QTest::mouseClick(&window, Qt::LeftButton, 0, linkPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, linkPos.toPoint()); QTRY_COMPARE(spy.count(), 2); QTRY_COMPARE(hover.count(), 3); QCOMPARE(spy.last()[0].toString(), link); @@ -2550,7 +2550,7 @@ void tst_qquicktextedit::linkInteraction() QCOMPARE(texteditObject->hoveredLink(), link); QCOMPARE(texteditObject->linkAt(linkPos.x(), linkPos.y()), link); - QTest::mouseClick(&window, Qt::LeftButton, 0, textPos.toPoint()); + QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, textPos.toPoint()); QTRY_COMPARE(spy.count(), 2); QTRY_COMPARE(hover.count(), 4); QCOMPARE(hover.last()[0].toString(), QString()); @@ -2572,9 +2572,9 @@ void tst_qquicktextedit::cursorDelegate() QQuickView view(source); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // Delegate creation is deferred until focus in or cursor visibility is forced. QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance")); QVERIFY(!textEditObject->isCursorVisible()); @@ -2596,7 +2596,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setCursorPosition(0); const QPoint point1 = textEditObject->positionToRectangle(5).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, point1); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, point1); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); @@ -2606,10 +2606,10 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setCursorPosition(0); const QPoint point2 = textEditObject->positionToRectangle(10).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mousePress(&view, Qt::LeftButton, 0, point1); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, point1); QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(&view, &mv); - QTest::mouseRelease(&view, Qt::LeftButton, 0, point2); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, point2); QTest::qWait(50); QTRY_COMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textEditObject->cursorRectangle().y(), delegateObject->y()); @@ -2617,7 +2617,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setReadOnly(true); textEditObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); @@ -2625,7 +2625,7 @@ void tst_qquicktextedit::cursorDelegate() textEditObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textEditObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textEditObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textEditObject->cursorPosition() != 0); QCOMPARE(textEditObject->cursorRectangle().x(), delegateObject->x()); @@ -2671,7 +2671,7 @@ void tst_qquicktextedit::cursorDelegate() } //Test Delegate gets deleted - textEditObject->setCursorDelegate(0); + textEditObject->setCursorDelegate(nullptr); QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance")); } @@ -2687,9 +2687,9 @@ void tst_qquicktextedit::remoteCursorDelegate() view.setSource(testFileUrl("cursorTestRemote.qml")); view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); // Delegate is created on demand, and so won't be available immediately. Focus in or // setCursorVisible(true) will trigger creation. @@ -2713,7 +2713,7 @@ void tst_qquicktextedit::cursorVisible() QQuickView view(testFileUrl("cursorVisible.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(&view, qGuiApp->focusWindow()); QCOMPARE(edit.isCursorVisible(), false); @@ -2745,13 +2745,13 @@ void tst_qquicktextedit::cursorVisible() QWindow alternateView; alternateView.show(); alternateView.requestActivate(); - QTest::qWaitForWindowActive(&alternateView); + QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(edit.isCursorVisible(), false); QCOMPARE(spy.count(), 6); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(edit.isCursorVisible(), true); QCOMPARE(spy.count(), 7); @@ -2834,7 +2834,7 @@ void tst_qquicktextedit::delegateLoading() QTRY_VERIFY(view.rootObject());//Wait for loading to finish. QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); // view.rootObject()->dumpObjectTree(); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); textEditObject->setFocus(true); QQuickItem *delegate; delegate = view.rootObject()->findChild<QQuickItem*>("delegateOkay"); @@ -2858,7 +2858,7 @@ void tst_qquicktextedit::cursorDelegateHeight() QQuickView view(testFileUrl("cursorHeight.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *textEditObject = view.rootObject()->findChild<QQuickTextEdit*>("textEditObject"); QVERIFY(textEditObject); // Delegate creation is deferred until focus in or cursor visibility is forced. @@ -2886,7 +2886,7 @@ void tst_qquicktextedit::cursorDelegateHeight() QCOMPARE(delegateObject->height(), textEditObject->cursorRectangle().height()); // Test that the delegate gets deleted - textEditObject->setCursorDelegate(0); + textEditObject->setCursorDelegate(nullptr); QVERIFY(!textEditObject->findChild<QQuickItem*>("cursorInstance")); } @@ -2900,11 +2900,11 @@ void tst_qquicktextedit::navigation() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QTRY_VERIFY(input->hasActiveFocus()); simulateKey(&window, Qt::Key_Left); QVERIFY(!input->hasActiveFocus()); @@ -2938,7 +2938,7 @@ void tst_qquicktextedit::copyAndPaste() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); // copy and paste QCOMPARE(textEdit->text().length(), 12); @@ -3014,7 +3014,7 @@ void tst_qquicktextedit::canPaste() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); // check initial value - QTBUG-17765 QTextDocument document; @@ -3032,7 +3032,7 @@ void tst_qquicktextedit::canPasteEmpty() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); // check initial value - QTBUG-17765 QTextDocument document; @@ -3051,11 +3051,11 @@ void tst_qquicktextedit::middleClickPaste() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *textEditObject = qobject_cast<QQuickTextEdit *>(window.rootObject()); - QVERIFY(textEditObject != 0); + QVERIFY(textEditObject != nullptr); textEditObject->setFocus(true); @@ -3087,11 +3087,11 @@ void tst_qquicktextedit::readOnly() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(edit != 0); + QVERIFY(edit != nullptr); QTRY_VERIFY(edit->hasActiveFocus()); QVERIFY(edit->isReadOnly()); QString initial = edit->text(); @@ -3122,7 +3122,7 @@ void tst_qquicktextedit::textInput() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); QVERIFY(edit->hasActiveFocus()); @@ -3175,7 +3175,7 @@ void tst_qquicktextedit::inputMethodUpdate() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); QVERIFY(edit->hasActiveFocus()); @@ -3265,7 +3265,7 @@ void tst_qquicktextedit::openInputPanel() QQuickView view(testFileUrl("openInputPanel.qml")); view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); @@ -3279,7 +3279,7 @@ void tst_qquicktextedit::openInputPanel() // input panel should open on focus QPoint centerPoint(view.width()/2, view.height()/2); - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = Qt::NoModifier; QTest::mousePress(&view, Qt::LeftButton, noModifiers, centerPoint); QGuiApplication::processEvents(); QVERIFY(edit->hasActiveFocus()); @@ -3330,7 +3330,7 @@ void tst_qquicktextedit::openInputPanel() QTest::mouseRelease(&view, Qt::LeftButton, noModifiers, centerPoint); QCOMPARE(qApp->inputMethod()->isVisible(), false); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } void tst_qquicktextedit::geometrySignals() @@ -3351,7 +3351,7 @@ void tst_qquicktextedit::pastingRichText_QTBUG_14003() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickTextEdit *obj = qobject_cast<QQuickTextEdit*>(component.create()); - QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj != nullptr); QTRY_COMPARE(obj->textFormat(), QQuickTextEdit::PlainText); QMimeData *mData = new QMimeData; @@ -3463,7 +3463,7 @@ void tst_qquicktextedit::implicitSizeBinding() void tst_qquicktextedit::signal_editingfinished() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); window->setBaseSize(QSize(800,600)); window->setSource(testFileUrl("signal_editingfinished.qml")); @@ -3472,7 +3472,7 @@ void tst_qquicktextedit::signal_editingfinished() QVERIFY(QTest::qWaitForWindowActive(window)); QCOMPARE(QGuiApplication::focusWindow(), window); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTextEdit *input1 = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window->rootObject()->property("input1"))); QVERIFY(input1); @@ -3663,7 +3663,7 @@ void tst_qquicktextedit::preeditCursorRectangle() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); @@ -3746,7 +3746,7 @@ void tst_qquicktextedit::inputMethodComposing() QQuickView view(testFileUrl("inputContext.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextEdit *edit = qobject_cast<QQuickTextEdit *>(view.rootObject()); QVERIFY(edit); @@ -3860,7 +3860,7 @@ void tst_qquicktextedit::cursorRectangleSize() QFETCH(bool, useCursorDelegate); QQuickView *window = new QQuickView(testFileUrl("positionAt.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit *>(window->rootObject()); QQmlComponent cursorDelegate(window->engine()); @@ -3873,11 +3873,11 @@ void tst_qquicktextedit::cursorRectangleSize() textEdit->setX(10); textEdit->setY(10); textEdit->setCursorPosition(3); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setFocus(true); window->show(); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QInputMethodQueryEvent event(Qt::ImCursorRectangle); qApp->sendEvent(textEdit, &event); @@ -4011,7 +4011,7 @@ void tst_qquicktextedit::getText() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QCOMPARE(textEdit->getText(start, end), expectedText); } @@ -4112,7 +4112,7 @@ void tst_qquicktextedit::getFormattedText() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->setText(text); @@ -4238,7 +4238,7 @@ void tst_qquicktextedit::append() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); @@ -4453,7 +4453,7 @@ void tst_qquicktextedit::insert() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); @@ -4695,7 +4695,7 @@ void tst_qquicktextedit::remove() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); textEdit->setTextFormat(textFormat); textEdit->select(selectionStart, selectionEnd); @@ -4876,13 +4876,13 @@ void tst_qquicktextedit::keySequence() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); @@ -5038,13 +5038,13 @@ void tst_qquicktextedit::undo() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); QVERIFY(!textEdit->canUndo()); @@ -5124,13 +5124,13 @@ void tst_qquicktextedit::redo() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); QVERIFY(!textEdit->canUndo()); @@ -5345,13 +5345,13 @@ void tst_qquicktextedit::undo_keypressevents() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); simulateKeys(&window, keys); @@ -5369,13 +5369,13 @@ void tst_qquicktextedit::clear() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QQuickWindow window; textEdit->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textEdit->hasActiveFocus()); QSignalSpy spy(textEdit, SIGNAL(canUndoChanged())); @@ -5479,7 +5479,7 @@ void tst_qquicktextedit::embeddedImages() QQmlComponent textComponent(&engine, qmlfile); QQuickTextEdit *textObject = qobject_cast<QQuickTextEdit*>(textComponent.beginCreate(engine.rootContext())); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); const int baseUrlPropertyIndex = textObject->metaObject()->indexOfProperty("serverBaseUrl"); if (baseUrlPropertyIndex != -1) { @@ -5507,11 +5507,11 @@ void tst_qquicktextedit::embeddedImages() void tst_qquicktextedit::emptytags_QTBUG_22058() { QQuickView window(testFileUrl("qtbug-22058.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextEdit *input = qobject_cast<QQuickTextEdit *>(qvariant_cast<QObject *>(window.rootObject()->property("inputField"))); QVERIFY(input->hasActiveFocus()); @@ -5530,7 +5530,7 @@ void tst_qquicktextedit::cursorRectangle_QTBUG_38947() window.show(); window.requestActivate(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QQuickTextEdit *edit = window.rootObject()->findChild<QQuickTextEdit *>("textedit"); QVERIFY(edit); @@ -5568,7 +5568,7 @@ void tst_qquicktextedit::doubleSelect_QTBUG_38704() QQmlComponent textEditComponent(&engine); textEditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextEdit *textEdit = qobject_cast<QQuickTextEdit*>(textEditComponent.create()); - QVERIFY(textEdit != 0); + QVERIFY(textEdit != nullptr); QSignalSpy selectionSpy(textEdit, SIGNAL(selectedTextChanged())); @@ -5592,7 +5592,7 @@ void tst_qquicktextedit::padding() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickTextEdit *obj = qobject_cast<QQuickTextEdit*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); qreal cw = obj->contentWidth(); qreal ch = obj->contentHeight(); diff --git a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp index 06b76d129c..65c9c9e8ad 100644 --- a/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp +++ b/tests/auto/quick/qquicktextinput/tst_qquicktextinput.cpp @@ -300,7 +300,7 @@ void tst_qquicktextinput::cleanup() { // ensure not even skipped tests with custom input context leave it dangling QInputMethodPrivate *inputMethodPrivate = QInputMethodPrivate::get(qApp->inputMethod()); - inputMethodPrivate->testContext = 0; + inputMethodPrivate->testContext = nullptr; } tst_qquicktextinput::tst_qquicktextinput() @@ -332,7 +332,7 @@ void tst_qquicktextinput::text() textinputComponent.setData("import QtQuick 2.0\nTextInput { text: \"\" }", QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->text(), QString("")); QCOMPARE(textinputObject->length(), 0); @@ -346,7 +346,7 @@ void tst_qquicktextinput::text() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->text(), standard.at(i)); QCOMPARE(textinputObject->length(), standard.at(i).length()); @@ -363,7 +363,7 @@ void tst_qquicktextinput::width() textinputComponent.setData("import QtQuick 2.0\nTextInput { text: \"\" }", QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->width(), 0.0); delete textinputObject; @@ -401,7 +401,7 @@ void tst_qquicktextinput::width() qreal metricWidth = ceil(layout.boundingRect().width()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); int delta = abs(int(int(textinputObject->width()) - metricWidth)); QVERIFY(delta <= 3.0); // As best as we can hope for cross-platform. @@ -418,7 +418,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().pointSize(), 40); QCOMPARE(textinputObject->font().bold(), false); QCOMPARE(textinputObject->font().italic(), false); @@ -432,7 +432,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().bold(), true); QCOMPARE(textinputObject->font().italic(), false); @@ -445,7 +445,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().italic(), true); QCOMPARE(textinputObject->font().bold(), false); @@ -458,7 +458,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().family(), QString("Helvetica")); QCOMPARE(textinputObject->font().bold(), false); QCOMPARE(textinputObject->font().italic(), false); @@ -472,7 +472,7 @@ void tst_qquicktextinput::font() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->font().family(), QString("")); delete textinputObject; @@ -539,7 +539,7 @@ void tst_qquicktextinput::color() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i))); delete textinputObject; @@ -552,7 +552,7 @@ void tst_qquicktextinput::color() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->selectionColor(), QColor(colorStrings.at(i))); delete textinputObject; @@ -565,7 +565,7 @@ void tst_qquicktextinput::color() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->selectedTextColor(), QColor(colorStrings.at(i))); delete textinputObject; @@ -581,7 +581,7 @@ void tst_qquicktextinput::color() textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QCOMPARE(textinputObject->color(), testColor); delete textinputObject; @@ -598,7 +598,7 @@ void tst_qquicktextinput::wrap() QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create()); textHeight = textObject->height(); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->wrapMode(), QQuickTextInput::WrapAnywhere); QCOMPARE(textObject->width(), 300.); @@ -611,7 +611,7 @@ void tst_qquicktextinput::wrap() textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QQuickTextInput *textObject = qobject_cast<QQuickTextInput*>(textComponent.create()); - QVERIFY(textObject != 0); + QVERIFY(textObject != nullptr); QCOMPARE(textObject->width(), 30.); QVERIFY(textObject->height() > textHeight); @@ -653,7 +653,7 @@ void tst_qquicktextinput::selection() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); //Test selection follows cursor @@ -750,7 +750,7 @@ void tst_qquicktextinput::persistentSelection() QQuickView window(testFileUrl("persistentSelection.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(window.rootObject()); QVERIFY(input); @@ -793,7 +793,7 @@ void tst_qquicktextinput::overwriteMode() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QSignalSpy spy(textInput, SIGNAL(overwriteModeChanged(bool))); @@ -801,7 +801,7 @@ void tst_qquicktextinput::overwriteMode() textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); @@ -1071,7 +1071,7 @@ void tst_qquicktextinput::moveCursorSelection() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); textinputObject->setCursorPosition(cursorPosition); textinputObject->moveCursorSelection(movePosition, mode); @@ -1279,7 +1279,7 @@ void tst_qquicktextinput::moveCursorSelectionSequence() QQmlComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); textinputObject->setCursorPosition(cursorPosition); @@ -1304,19 +1304,19 @@ void tst_qquicktextinput::dragMouseSelection() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); // press-and-drag-and-release from x1 to x2 int x1 = 10; int x2 = 70; int y = textInputObject->height()/2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str1; QTRY_VERIFY((str1 = textInputObject->selectedText()).length() > 3); QTRY_VERIFY(str1.length() > 3); @@ -1324,9 +1324,9 @@ void tst_qquicktextinput::dragMouseSelection() // press and drag the current selection. x1 = 40; x2 = 100; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2, y)); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); QString str2 = textInputObject->selectedText(); QTRY_VERIFY(str2.length() > 3); @@ -1365,11 +1365,11 @@ void tst_qquicktextinput::mouseSelectionMode() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); textInputObject->setFocus(focus); textInputObject->setFocusOnPress(focusOnPress); @@ -1378,9 +1378,9 @@ void tst_qquicktextinput::mouseSelectionMode() int x1 = 10; int x2 = 70; int y = textInputObject->height()/2; - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(x1,y)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x1,y)); QTest::mouseMove(&window, QPoint(x2,y)); // doesn't work - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(x2,y)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(x2,y)); if (selectWords) { QTRY_COMPARE(textInputObject->selectedText(), text); } else { @@ -1471,7 +1471,7 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() QQuickView window(testFileUrl("horizontalAlignment_RightToLeft.qml")); QQuickTextInput *textInput = window.rootObject()->findChild<QQuickTextInput*>("text"); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); window.show(); const QString rtlText = textInput->text(); @@ -1545,7 +1545,7 @@ void tst_qquicktextinput::horizontalAlignment_RightToLeft() QCOMPARE(textInput->boundingRect().left(), qreal(0)); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); // If there is no committed text, the preedit text should determine the alignment. @@ -1618,7 +1618,7 @@ void tst_qquicktextinput::verticalAlignment() { QQuickView window(testFileUrl("horizontalAlignment.qml")); QQuickTextInput *textInput = window.rootObject()->findChild<QQuickTextInput*>("text"); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); window.showNormal(); QCOMPARE(textInput->vAlign(), QQuickTextInput::AlignTop); @@ -1805,13 +1805,13 @@ void tst_qquicktextinput::boundingRect() void tst_qquicktextinput::positionAt() { QQuickView window(testFileUrl("positionAt.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); // Check autoscrolled... @@ -1895,13 +1895,13 @@ void tst_qquicktextinput::positionAt() void tst_qquicktextinput::maxLength() { QQuickView window(testFileUrl("maxLength.qml")); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QVERIFY(textinputObject->text().isEmpty()); QCOMPARE(textinputObject->maxLength(), 10); foreach (const QString &str, standard) { @@ -1927,9 +1927,9 @@ void tst_qquicktextinput::masks() QQuickView window(testFileUrl("masks.qml")); window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textinputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textinputObject != 0); + QVERIFY(textinputObject != nullptr); QTRY_VERIFY(textinputObject->hasActiveFocus()); QCOMPARE(textinputObject->text().length(), 0); QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; ")); @@ -1957,9 +1957,9 @@ void tst_qquicktextinput::validators() QQuickView window(testFileUrl("validators.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QLocale defaultLocale; QLocale enLocale("en"); @@ -2247,12 +2247,12 @@ void tst_qquicktextinput::inputMethods() QQuickView window(testFileUrl("inputmethods.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); // test input method hints - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QVERIFY(input->inputMethodHints() & Qt::ImhNoPredictiveText); QSignalSpy inputMethodHintSpy(input, SIGNAL(inputMethodHintsChanged())); input->setInputMethodHints(Qt::ImhUppercaseOnly); @@ -2339,9 +2339,9 @@ void tst_qquicktextinput::signal_accepted() QQuickView window(testFileUrl("signal_accepted.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("input"))); QVERIFY(input); @@ -2381,9 +2381,9 @@ void tst_qquicktextinput::signal_editingfinished() QQuickView window(testFileUrl("signal_editingfinished.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input1 = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("input1"))); QVERIFY(input1); @@ -2451,7 +2451,7 @@ void tst_qquicktextinput::signal_textEdited() QQuickWindow window; window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *input = new QQuickTextInput(window.contentItem()); QVERIFY(input); @@ -2508,11 +2508,11 @@ void tst_qquicktextinput::navigation() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); input->setCursorPosition(0); QTRY_VERIFY(input->hasActiveFocus()); simulateKey(&window, Qt::Key_Left); @@ -2557,11 +2557,11 @@ void tst_qquicktextinput::navigation_RTL() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); const quint16 arabic_str[] = { 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0638, 0x0643, 0x00646, 0x0647, 0x0633, 0x0647}; input->setText(QString::fromUtf16(arabic_str, 11)); @@ -2598,7 +2598,7 @@ void tst_qquicktextinput::copyAndPaste() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); // copy and paste QCOMPARE(textInput->text().length(), 12); @@ -2696,13 +2696,13 @@ void tst_qquicktextinput::copyAndPasteKeySequence() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); // copy and paste QVERIFY(textInput->hasActiveFocus()); @@ -2763,7 +2763,7 @@ void tst_qquicktextinput::canPasteEmpty() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; QCOMPARE(textInput->canPaste(), cp); @@ -2779,7 +2779,7 @@ void tst_qquicktextinput::canPaste() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); bool cp = !textInput->isReadOnly() && QGuiApplication::clipboard()->text().length() != 0; QCOMPARE(textInput->canPaste(), cp); @@ -2796,11 +2796,11 @@ void tst_qquicktextinput::middleClickPaste() window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput *>(window.rootObject()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); textInputObject->setFocus(true); @@ -2835,7 +2835,7 @@ void tst_qquicktextinput::passwordCharacter() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setPasswordCharacter("X"); qreal implicitWidth = textInput->implicitWidth(); @@ -2861,9 +2861,9 @@ void tst_qquicktextinput::cursorDelegate() QQuickView view(source); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject"); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); // Delegate is created on demand, and so won't be available immediately. Focus in or // setCursorVisible(true) will trigger creation. QTRY_VERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance")); @@ -2889,7 +2889,7 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setCursorPosition(0); const QPoint point1 = textInputObject->positionToRectangle(5).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, point1); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, point1); QTest::qWait(50); QTRY_VERIFY(textInputObject->cursorPosition() != 0); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); @@ -2899,10 +2899,10 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setCursorPosition(0); const QPoint point2 = textInputObject->positionToRectangle(10).center().toPoint(); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mousePress(&view, Qt::LeftButton, 0, point1); + QTest::mousePress(&view, Qt::LeftButton, Qt::NoModifier, point1); QMouseEvent mv(QEvent::MouseMove, point2, Qt::LeftButton, Qt::LeftButton,Qt::NoModifier); QGuiApplication::sendEvent(&view, &mv); - QTest::mouseRelease(&view, Qt::LeftButton, 0, point2); + QTest::mouseRelease(&view, Qt::LeftButton, Qt::NoModifier, point2); QTest::qWait(50); QTRY_COMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); QCOMPARE(textInputObject->cursorRectangle().y(), delegateObject->y()); @@ -2910,7 +2910,7 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setReadOnly(true); textInputObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textInputObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textInputObject->cursorPosition() != 0); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); @@ -2918,7 +2918,7 @@ void tst_qquicktextinput::cursorDelegate() textInputObject->setCursorPosition(0); QTest::qWait(400); //ensure this isn't treated as a double-click - QTest::mouseClick(&view, Qt::LeftButton, 0, textInputObject->positionToRectangle(5).center().toPoint()); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, textInputObject->positionToRectangle(5).center().toPoint()); QTest::qWait(50); QTRY_VERIFY(textInputObject->cursorPosition() != 0); QCOMPARE(textInputObject->cursorRectangle().x(), delegateObject->x()); @@ -2964,7 +2964,7 @@ void tst_qquicktextinput::cursorDelegate() } //Test Delegate gets deleted - textInputObject->setCursorDelegate(0); + textInputObject->setCursorDelegate(nullptr); QVERIFY(!textInputObject->findChild<QQuickItem*>("cursorInstance")); } @@ -2979,9 +2979,9 @@ void tst_qquicktextinput::remoteCursorDelegate() view.setSource(testFileUrl("cursorTestRemote.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *textInputObject = view.rootObject()->findChild<QQuickTextInput*>("textInputObject"); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); // Delegate is created on demand, and so won't be available immediately. Focus in or // setCursorVisible(true) will trigger creation. @@ -3006,7 +3006,7 @@ void tst_qquicktextinput::cursorVisible() QQuickView view(testFileUrl("cursorVisible.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(input.isCursorVisible(), false); @@ -3037,13 +3037,13 @@ void tst_qquicktextinput::cursorVisible() QQuickView alternateView; alternateView.show(); alternateView.requestActivate(); - QTest::qWaitForWindowActive(&alternateView); + QVERIFY(QTest::qWaitForWindowActive(&alternateView)); QCOMPARE(input.isCursorVisible(), false); QCOMPARE(spy.count(), 6); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QCOMPARE(input.isCursorVisible(), true); QCOMPARE(spy.count(), 7); @@ -3307,11 +3307,11 @@ void tst_qquicktextinput::readOnly() window.show(); window.requestActivate(); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QTRY_VERIFY(input->hasActiveFocus()); QVERIFY(input->isReadOnly()); QVERIFY(!input->isCursorVisible()); @@ -3335,13 +3335,13 @@ void tst_qquicktextinput::echoMode() QQuickView window(testFileUrl("echoMode.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); - QVERIFY(input != 0); + QVERIFY(input != nullptr); QTRY_VERIFY(input->hasActiveFocus()); QString initial = input->text(); Qt::InputMethodHints ref; @@ -3411,9 +3411,9 @@ void tst_qquicktextinput::passwordEchoDelay() QQuickView window(testFileUrl("echoMode.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); - QVERIFY(window.rootObject() != 0); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(qvariant_cast<QObject *>(window.rootObject()->property("myInput"))); QVERIFY(input); @@ -3478,8 +3478,8 @@ void tst_qquicktextinput::passwordEchoDelay() void tst_qquicktextinput::simulateKey(QWindow *view, int key) { - QKeyEvent press(QKeyEvent::KeyPress, key, 0); - QKeyEvent release(QKeyEvent::KeyRelease, key, 0); + QKeyEvent press(QKeyEvent::KeyPress, key, nullptr); + QKeyEvent release(QKeyEvent::KeyRelease, key, nullptr); QGuiApplication::sendEvent(view, &press); QGuiApplication::sendEvent(view, &release); @@ -3500,7 +3500,7 @@ void tst_qquicktextinput::focusOnPress() QQmlComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInputObject = qobject_cast<QQuickTextInput*>(texteditComponent.create()); - QVERIFY(textInputObject != 0); + QVERIFY(textInputObject != nullptr); QCOMPARE(textInputObject->focusOnPress(), true); QCOMPARE(textInputObject->hasFocus(), false); @@ -3517,12 +3517,12 @@ void tst_qquicktextinput::focusOnPress() textInputObject->setParentItem(window.contentItem()); window.showNormal(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QCOMPARE(textInputObject->hasFocus(), false); QCOMPARE(textInputObject->hasActiveFocus(), false); - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = Qt::NoModifier; QTest::mousePress(&window, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QCOMPARE(textInputObject->hasFocus(), true); @@ -3575,7 +3575,7 @@ void tst_qquicktextinput::focusOnPressOnlyOneItem() QQuickView window(testFileUrl("focusOnlyOneOnPress.qml")); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *first = window.rootObject()->findChild<QQuickTextInput*>("first"); QQuickTextInput *second = window.rootObject()->findChild<QQuickTextInput*>("second"); @@ -3596,7 +3596,7 @@ void tst_qquicktextinput::focusOnPressOnlyOneItem() // // this is a contrived example to be sure, but at the end of this, the // important thing is that only one thing should have activeFocus. - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = nullptr; QTest::mousePress(&window, Qt::LeftButton, noModifiers, QPoint(10, 10)); // make sure the press is processed. @@ -3619,7 +3619,7 @@ void tst_qquicktextinput::openInputPanel() QQuickView view(testFileUrl("openInputPanel.qml")); view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); @@ -3631,7 +3631,7 @@ void tst_qquicktextinput::openInputPanel() QCOMPARE(qApp->inputMethod()->isVisible(), false); // input panel should open on focus - Qt::KeyboardModifiers noModifiers = 0; + Qt::KeyboardModifiers noModifiers = nullptr; QTest::mousePress(&view, Qt::LeftButton, noModifiers); QGuiApplication::processEvents(); QVERIFY(input->hasActiveFocus()); @@ -3687,7 +3687,7 @@ void tst_qquicktextinput::openInputPanel() class MyTextInput : public QQuickTextInput { public: - MyTextInput(QQuickItem *parent = 0) : QQuickTextInput(parent) + MyTextInput(QQuickItem *parent = nullptr) : QQuickTextInput(parent) { nbPaint = 0; } @@ -3708,7 +3708,7 @@ void tst_qquicktextinput::setHAlignClearCache() input.setParentItem(view.contentItem()); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTRY_COMPARE(input.nbPaint, 1); input.setHAlign(QQuickTextInput::AlignRight); //Changing the alignment should trigger a repaint @@ -3728,7 +3728,7 @@ void tst_qquicktextinput::focusOutClearSelection() input2.componentComplete(); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QVERIFY(input.hasActiveFocus()); input.select(2,5); //The selection should work @@ -3749,7 +3749,7 @@ void tst_qquicktextinput::focusOutNotClearSelection() input.componentComplete(); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QVERIFY(input.hasActiveFocus()); input.select(2,5); @@ -3842,7 +3842,7 @@ void tst_qquicktextinput::preeditAutoScroll() QQuickView view(testFileUrl("preeditAutoScroll.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -3928,7 +3928,7 @@ void tst_qquicktextinput::preeditCursorRectangle() QQuickView view(testFileUrl("inputMethodEvent.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -4011,7 +4011,7 @@ void tst_qquicktextinput::inputContextMouseHandler() view.showNormal(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QTextLayout layout(text); layout.setFont(input->font()); @@ -4047,7 +4047,7 @@ void tst_qquicktextinput::inputMethodComposing() QQuickView view(testFileUrl("inputContext.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -4153,7 +4153,7 @@ void tst_qquicktextinput::inputMethodUpdate() QQuickView view(testFileUrl("inputContext.qml")); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput *input = qobject_cast<QQuickTextInput *>(view.rootObject()); QVERIFY(input); QVERIFY(input->hasActiveFocus()); @@ -4232,18 +4232,18 @@ void tst_qquicktextinput::inputMethodUpdate() void tst_qquicktextinput::cursorRectangleSize() { QQuickView *window = new QQuickView(testFileUrl("positionAt.qml")); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickTextInput *textInput = qobject_cast<QQuickTextInput *>(window->rootObject()); // make sure cursor rectangle is not at (0,0) textInput->setX(10); textInput->setY(10); textInput->setCursorPosition(3); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setFocus(true); window->show(); window->requestActivate(); - QTest::qWaitForWindowActive(window); + QVERIFY(QTest::qWaitForWindowActive(window)); QVERIFY(textInput->hasActiveFocus()); QInputMethodQueryEvent event(Qt::ImCursorRectangle); @@ -4275,7 +4275,7 @@ void tst_qquicktextinput::tripleClickSelectsAll() QQuickView view(QUrl::fromLocalFile(qmlfile)); view.show(); view.requestActivate(); - QTest::qWaitForWindowActive(&view); + QVERIFY(QTest::qWaitForWindowActive(&view)); QQuickTextInput* input = qobject_cast<QQuickTextInput*>(view.rootObject()); QVERIFY(input); @@ -4287,24 +4287,24 @@ void tst_qquicktextinput::tripleClickSelectsAll() // Clicking on the same point inside TextInput three times in a row // should trigger a triple click, thus selecting all the text. QPoint pointInside = input->position().toPoint() + QPoint(2,2); - QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside); - QTest::mouseClick(&view, Qt::LeftButton, 0, pointInside); + QTest::mouseDClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); QGuiApplication::processEvents(); QCOMPARE(input->selectedText(), hello); // Now it simulates user moving the mouse between the second and the third click. // In this situation, we don't expect a triple click. QPoint pointInsideButFar = QPoint(input->width(),input->height()) - QPoint(2,2); - QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside); - QTest::mouseClick(&view, Qt::LeftButton, 0, pointInsideButFar); + QTest::mouseDClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, pointInsideButFar); QGuiApplication::processEvents(); QVERIFY(input->selectedText().isEmpty()); // And now we press the third click too late, so no triple click event is triggered. - QTest::mouseDClick(&view, Qt::LeftButton, 0, pointInside); + QTest::mouseDClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); QGuiApplication::processEvents(); QTest::qWait(qApp->styleHints()->mouseDoubleClickInterval() + 1); - QTest::mouseClick(&view, Qt::LeftButton, 0, pointInside); + QTest::mouseClick(&view, Qt::LeftButton, Qt::NoModifier, pointInside); QGuiApplication::processEvents(); QVERIFY(input->selectedText().isEmpty()); } @@ -4374,7 +4374,7 @@ void tst_qquicktextinput::getText() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QCOMPARE(textInput->getText(start, end), expectedText); } @@ -4714,7 +4714,7 @@ void tst_qquicktextinput::insert() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->select(selectionStart, selectionEnd); @@ -5069,7 +5069,7 @@ void tst_qquicktextinput::remove() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->select(selectionStart, selectionEnd); @@ -5264,14 +5264,14 @@ void tst_qquicktextinput::keySequence() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setEchoMode(echoMode); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKey(&window, layoutDirection); @@ -5426,13 +5426,13 @@ void tst_qquicktextinput::undo() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); QVERIFY(!textInput->canUndo()); @@ -5512,13 +5512,13 @@ void tst_qquicktextinput::redo() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); QVERIFY(!textInput->canUndo()); @@ -5844,13 +5844,13 @@ void tst_qquicktextinput::undo_keypressevents() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKeys(&window, keys); @@ -5868,13 +5868,13 @@ void tst_qquicktextinput::clear() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); QVERIFY(!textInput->canUndo()); @@ -5922,7 +5922,7 @@ void tst_qquicktextinput::backspaceSurrogatePairs() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); textInput->setText(text); textInput->setCursorPosition(text.length()); @@ -5956,8 +5956,8 @@ void tst_qquicktextinput::QTBUG_19956() QQuickView window(testFileUrl(url)); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowActive(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject()); QVERIFY(input); input->setFocus(true); @@ -5995,8 +5995,8 @@ void tst_qquicktextinput::QTBUG_19956_regexp() QQuickView window(url); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); - QVERIFY(window.rootObject() != 0); + QVERIFY(QTest::qWaitForWindowActive(&window)); + QVERIFY(window.rootObject() != nullptr); QQuickTextInput *input = qobject_cast<QQuickTextInput*>(window.rootObject()); QVERIFY(input); input->setFocus(true); @@ -6181,13 +6181,13 @@ void tst_qquicktextinput::keypress_inputMask_withValidator() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKeys(&window, keys); @@ -6411,7 +6411,7 @@ void tst_qquicktextinput::setInputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); // then either insert using insert() or keyboard if (insert_text) { @@ -6421,7 +6421,7 @@ void tst_qquicktextinput::setInputMask() textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKey(&window, Qt::Key_Home); @@ -6468,7 +6468,7 @@ void tst_qquicktextinput::inputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QCOMPARE(textInput->inputMask(), expectedMask); } @@ -6479,7 +6479,7 @@ void tst_qquicktextinput::clearInputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QVERIFY(!textInput->inputMask().isEmpty()); textInput->setInputMask(QString()); @@ -6551,13 +6551,13 @@ void tst_qquicktextinput::keypress_inputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); simulateKeys(&window, keys); @@ -6574,13 +6574,13 @@ void tst_qquicktextinput::keypress_inputMethod_inputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); QQuickWindow window; textInput->setParentItem(window.contentItem()); window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QVERIFY(textInput->hasActiveFocus()); { @@ -6639,7 +6639,7 @@ void tst_qquicktextinput::hasAcceptableInputMask() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); // test that invalid input (for required) work for optionalMask textInput->setText(invalid); @@ -6693,7 +6693,7 @@ void tst_qquicktextinput::maskCharacter() QQmlComponent textInputComponent(&engine); textInputComponent.setData(componentStr.toLatin1(), QUrl()); QQuickTextInput *textInput = qobject_cast<QQuickTextInput*>(textInputComponent.create()); - QVERIFY(textInput != 0); + QVERIFY(textInput != nullptr); for (int i = 0; i < input.size(); ++i) { QString in = QString(input.at(i)); @@ -6706,7 +6706,7 @@ void tst_qquicktextinput::maskCharacter() class TestValidator : public QValidator { public: - TestValidator(QObject *parent = 0) : QValidator(parent) { } + TestValidator(QObject *parent = nullptr) : QValidator(parent) { } State validate(QString &input, int &) const { return input == QStringLiteral("ok") ? Acceptable : Intermediate; } void fixup(QString &input) const { input = QStringLiteral("ok"); } @@ -6717,7 +6717,7 @@ void tst_qquicktextinput::fixup() QQuickWindow window; window.show(); window.requestActivate(); - QTest::qWaitForWindowActive(&window); + QVERIFY(QTest::qWaitForWindowActive(&window)); QQuickTextInput *input = new QQuickTextInput(window.contentItem()); input->setValidator(new TestValidator(input)); @@ -6926,7 +6926,7 @@ void tst_qquicktextinput::padding() QQuickItem *root = window->rootObject(); QVERIFY(root); QQuickTextInput *obj = qobject_cast<QQuickTextInput*>(root); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); qreal cw = obj->contentWidth(); qreal ch = obj->contentHeight(); diff --git a/tests/auto/quick/qquickview/tst_qquickview.cpp b/tests/auto/quick/qquickview/tst_qquickview.cpp index 5849d35353..e259ed1ae7 100644 --- a/tests/auto/quick/qquickview/tst_qquickview.cpp +++ b/tests/auto/quick/qquickview/tst_qquickview.cpp @@ -212,11 +212,11 @@ void tst_QQuickView::engine() QQmlEngine *engine = new QQmlEngine; QVERIFY(!engine->incubationController()); - QQuickView *view = new QQuickView(engine, 0); + QQuickView *view = new QQuickView(engine, nullptr); QVERIFY(view); QCOMPARE(engine->incubationController(), view->incubationController()); - QQuickView *view2 = new QQuickView(engine, 0); + QQuickView *view2 = new QQuickView(engine, nullptr); QVERIFY(view); QCOMPARE(engine->incubationController(), view->incubationController()); delete view; @@ -228,7 +228,7 @@ void tst_QQuickView::engine() QVERIFY(!engine->incubationController()); QQuickView *view3 = new QQuickView; - QQuickView *view4 = new QQuickView(view3->engine(), 0); + QQuickView *view4 = new QQuickView(view3->engine(), nullptr); QVERIFY(view3->engine()); QVERIFY(view4->engine()); diff --git a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp index bf43e976ab..da227b871b 100644 --- a/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp +++ b/tests/auto/quick/qquickvisualdatamodel/tst_qquickvisualdatamodel.cpp @@ -76,13 +76,13 @@ class SingleRoleModel : public QAbstractItemModel public: struct Branch; struct Node { - Node(const QString &display = QString()) : branch(0), display(display) {} + Node(const QString &display = QString()) : branch(nullptr), display(display) {} Branch *branch; QString display; }; struct Branch { - Branch(Branch *parent = 0) : parent(parent) {} + Branch(Branch *parent = nullptr) : parent(parent) {} ~Branch() { foreach (const Node &child, children) delete child.branch; } int indexOf(Branch *branch) const { for (int i = 0; i < children.count(); ++i) { @@ -96,7 +96,7 @@ public: }; - SingleRoleModel(const QStringList &list = QStringList(), const QByteArray &role = "name", QObject *parent = 0) + SingleRoleModel(const QStringList &list = QStringList(), const QByteArray &role = "name", QObject *parent = nullptr) : QAbstractItemModel(parent), m_role(role) { foreach (const QString &string, list) @@ -255,7 +255,7 @@ class StandardItemModel : public QStandardItemModel Q_PROPERTY(QQmlListProperty<StandardItem> items READ items CONSTANT) Q_CLASSINFO("DefaultProperty", "items") public: - QQmlListProperty<StandardItem> items() { return QQmlListProperty<StandardItem>(this, 0, append, 0, 0, 0); } + QQmlListProperty<StandardItem> items() { return QQmlListProperty<StandardItem>(this, nullptr, append, nullptr, nullptr, nullptr); } static void append(QQmlListProperty<StandardItem> *property, StandardItem *item) { @@ -270,7 +270,7 @@ class DataSubObject : public QObject Q_PROPERTY(QString subName READ subName WRITE setSubName NOTIFY subNameChanged) public: - DataSubObject(QObject *parent=0) : QObject(parent) {} + DataSubObject(QObject *parent=nullptr) : QObject(parent) {} QString subName() const { return m_subName; } void setSubName(const QString &name) { @@ -296,8 +296,8 @@ class DataObject : public QObject Q_PROPERTY(QObject *object READ object) public: - DataObject(QObject *parent=0) : QObject(parent) {} - DataObject(const QString &name, const QString &color, QObject *parent=0) + DataObject(QObject *parent=nullptr) : QObject(parent) {} + DataObject(const QString &name, const QString &color, QObject *parent=nullptr) : QObject(parent), m_name(name), m_color(color), m_object(new DataSubObject(this)) { } @@ -336,11 +336,11 @@ class ItemRequester : public QObject { Q_OBJECT public: - ItemRequester(QObject *parent = 0) + ItemRequester(QObject *parent = nullptr) : QObject(parent) - , itemInitialized(0) - , itemCreated(0) - , itemDestroyed(0) + , itemInitialized(nullptr) + , itemCreated(nullptr) + , itemDestroyed(nullptr) , indexInitialized(-1) , indexCreated(-1) { @@ -511,7 +511,7 @@ void tst_qquickvisualdatamodel::rootIndex() engine.rootContext()->setContextProperty("myModel", &model); QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QMetaObject::invokeMethod(obj, "setRoot"); QCOMPARE(qvariant_cast<QModelIndex>(obj->rootIndex()), model.index(0,0)); @@ -549,10 +549,10 @@ void tst_qquickvisualdatamodel::updateLayout() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "display", 0); QVERIFY(name); @@ -599,10 +599,10 @@ void tst_qquickvisualdatamodel::childChanged() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel"); vdm->setRootIndex(QVariant::fromValue(model.indexFromItem(model.item(1,0)))); @@ -624,7 +624,7 @@ void tst_qquickvisualdatamodel::childChanged() listview->forceLayout(); name = findItem<QQuickText>(contentItem, "display", 1); - QVERIFY(name != 0); + QVERIFY(name != nullptr); QCOMPARE(name->text(), QString("Row 2 Child Item 2")); model.item(1,0)->takeRow(1); @@ -662,10 +662,10 @@ void tst_qquickvisualdatamodel::objectListModel() view.setSource(testFileUrl("objectlist.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 0); QCOMPARE(name->text(), QString("Item 1")); @@ -701,10 +701,10 @@ void tst_qquickvisualdatamodel::singleRole() view.setSource(testFileUrl("singlerole1.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 1); QCOMPARE(name->text(), QString("two")); @@ -723,10 +723,10 @@ void tst_qquickvisualdatamodel::singleRole() view.setSource(testFileUrl("singlerole2.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 1); QCOMPARE(name->text(), QString("two")); @@ -745,10 +745,10 @@ void tst_qquickvisualdatamodel::singleRole() view.setSource(testFileUrl("singlerole2.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickText *name = findItem<QQuickText>(contentItem, "name", 1); QCOMPARE(name->text(), QString("two")); @@ -771,10 +771,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(testFileUrl("modelproperties.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1); QVERIFY(delegate); @@ -804,10 +804,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(testFileUrl("modelproperties.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1); QVERIFY(delegate); @@ -833,10 +833,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(testFileUrl("modelproperties.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 0); QVERIFY(delegate); @@ -875,10 +875,10 @@ void tst_qquickvisualdatamodel::modelProperties() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQuickItem *delegate = findItem<QQuickItem>(contentItem, "delegate", 1); QVERIFY(delegate); @@ -917,13 +917,13 @@ void tst_qquickvisualdatamodel::noDelegate() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQmlDelegateModel *vdm = listview->findChild<QQmlDelegateModel*>("visualModel"); - QVERIFY(vdm != 0); + QVERIFY(vdm != nullptr); QCOMPARE(vdm->count(), 3); - vdm->setDelegate(0); + vdm->setDelegate(nullptr); QCOMPARE(vdm->count(), 0); } @@ -955,7 +955,7 @@ void tst_qquickvisualdatamodel::itemsDestroyed() QVERIFY(delegate = findItem<QQuickItem>(view.contentItem(), "delegate", 1)); } - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QVERIFY(!delegate); } @@ -975,16 +975,16 @@ void tst_qquickvisualdatamodel::packagesDestroyed() qApp->processEvents(); QQuickListView *leftview = findItem<QQuickListView>(view.rootObject(), "leftList"); - QTRY_VERIFY(leftview != 0); + QTRY_VERIFY(leftview != nullptr); QQuickListView *rightview = findItem<QQuickListView>(view.rootObject(), "rightList"); - QTRY_VERIFY(rightview != 0); + QTRY_VERIFY(rightview != nullptr); QQuickItem *leftContent = leftview->contentItem(); - QTRY_VERIFY(leftContent != 0); + QTRY_VERIFY(leftContent != nullptr); QQuickItem *rightContent = rightview->contentItem(); - QTRY_VERIFY(rightContent != 0); + QTRY_VERIFY(rightContent != nullptr); leftview->forceLayout(); rightview->forceLayout(); @@ -1052,7 +1052,7 @@ void tst_qquickvisualdatamodel::qaimRowsMoved() engine.rootContext()->setContextProperty("myModel", &model); QQmlDelegateModel *obj = qobject_cast<QQmlDelegateModel*>(c.create()); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QSignalSpy spy(obj, SIGNAL(modelUpdated(QQmlChangeSet,bool))); model.emitMove(sourceFirst, sourceLast, destinationChild); @@ -1217,7 +1217,7 @@ void tst_qquickvisualdatamodel::watchedRoles() QQuickItem *item = qobject_cast<QQuickItem*>(vdm->object(0)); QVERIFY(item); vdm->release(item); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. QSignalSpy spy(vdm, SIGNAL(modelUpdated(QQmlChangeSet,bool))); QQmlChangeSet changeSet; @@ -1305,7 +1305,7 @@ void tst_qquickvisualdatamodel::hasModelChildren() QCOMPARE(vdm->count(), 4); - QQuickItem *item = 0; + QQuickItem *item = nullptr; item = qobject_cast<QQuickItem*>(vdm->object(0)); QVERIFY(item); @@ -1326,7 +1326,7 @@ void tst_qquickvisualdatamodel::hasModelChildren() QVERIFY(item); QCOMPARE(item->property("modelChildren").toBool(), false); vdm->release(item); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. QCOMPARE(vdm->stringValue(0, QLatin1String("hasModelChildren")), QVariant(true).toString()); QCOMPARE(vdm->stringValue(1, QLatin1String("hasModelChildren")), QVariant(false).toString()); @@ -1355,7 +1355,7 @@ void tst_qquickvisualdatamodel::setValue() QCOMPARE(vdm->count(), 3); - QQuickItem *item = 0; + QQuickItem *item = nullptr; item = qobject_cast<QQuickItem*>(vdm->object(0)); QVERIFY(item); @@ -1366,7 +1366,7 @@ void tst_qquickvisualdatamodel::setValue() vdm->release(item); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); // Ensure released items are deleted before test exits. } void tst_qquickvisualdatamodel::remove_data() @@ -1406,10 +1406,10 @@ void tst_qquickvisualdatamodel::remove() view.setSource(testFileUrl("groups.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -1515,10 +1515,10 @@ void tst_qquickvisualdatamodel::move() view.setSource(testFileUrl("groups.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -1704,10 +1704,10 @@ void tst_qquickvisualdatamodel::groups() view.setSource(source); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = listview->findChild<QQmlDelegateModel *>("visualModel"); QVERIFY(visualModel); @@ -2024,10 +2024,10 @@ void tst_qquickvisualdatamodel::get() view.setSource(testFileUrl("groups.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -2317,10 +2317,10 @@ void tst_qquickvisualdatamodel::create() view.setSource(testFileUrl("create.qml")); QQuickListView *listview = qobject_cast<QQuickListView*>(view.rootObject()); - QVERIFY(listview != 0); + QVERIFY(listview != nullptr); QQuickItem *contentItem = listview->contentItem(); - QVERIFY(contentItem != 0); + QVERIFY(contentItem != nullptr); QQmlDelegateModel *visualModel = qobject_cast<QQmlDelegateModel *>(qvariant_cast<QObject *>(listview->model())); QVERIFY(visualModel); @@ -3151,7 +3151,7 @@ void tst_qquickvisualdatamodel::insert() QCOMPARE(evaluate<int>(visualModel, get + ".selectedIndex"), selected && i > index ? 1 : 0); } - QObject *item = 0; + QObject *item = nullptr; if (inItems) item = evaluate<QObject *>(visualModel, QString("items.create(%1)").arg(index)); @@ -3615,7 +3615,7 @@ void tst_qquickvisualdatamodel::resolve() QCOMPARE(evaluate<int>(visualModel, get + ".selectedIndex"), selected && i > index ? 1 : 0); } - QObject *item = 0; + QObject *item = nullptr; if (inItems) item = evaluate<QObject *>(visualModel, QString("items.create(%1)").arg(index)); diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp index fe9e8bb1fa..cd3486f95f 100644 --- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp +++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp @@ -73,10 +73,10 @@ static QTouchEvent::TouchPoint makeTouchPoint(QQuickItem *item, const QPointF &p return tp; } -static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states = 0, +static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states = nullptr, const QList<QTouchEvent::TouchPoint>& touchPoints = QList<QTouchEvent::TouchPoint>()) { - TouchEventData d = { type, 0, w, states, touchPoints }; + TouchEventData d = { type, nullptr, w, states, touchPoints }; return d; } static TouchEventData makeTouchData(QEvent::Type type, QWindow *w, Qt::TouchPointStates states, const QTouchEvent::TouchPoint &touchPoint) @@ -114,7 +114,7 @@ class RootItemAccessor : public QQuickItem public: RootItemAccessor() : m_rootItemDestroyed(false) - , m_rootItem(0) + , m_rootItem(nullptr) { } Q_INVOKABLE QQuickItem *contentItem() @@ -141,7 +141,7 @@ class TestTouchItem : public QQuickRectangle { Q_OBJECT public: - TestTouchItem(QQuickItem *parent = 0) + TestTouchItem(QQuickItem *parent = nullptr) : QQuickRectangle(parent), acceptTouchEvents(true), acceptMouseEvents(true), mousePressCount(0), mouseMoveCount(0), spinLoopWhenPressed(false), touchEventCount(0), @@ -157,7 +157,7 @@ public: setEnabled(true); setVisible(true); - lastEvent = makeTouchData(QEvent::None, window(), 0, QList<QTouchEvent::TouchPoint>());//CHECK_VALID + lastEvent = makeTouchData(QEvent::None, window(), nullptr, QList<QTouchEvent::TouchPoint>());//CHECK_VALID lastVelocity = lastVelocityFromMouseMove = QVector2D(); lastMousePos = QPointF(); @@ -281,14 +281,14 @@ class ConstantUpdateItem : public QQuickItem { Q_OBJECT public: - ConstantUpdateItem(QQuickItem *parent = 0) : QQuickItem(parent), iterations(0) {setFlag(ItemHasContents);} + ConstantUpdateItem(QQuickItem *parent = nullptr) : QQuickItem(parent), iterations(0) {setFlag(ItemHasContents);} int iterations; protected: QSGNode* updatePaintNode(QSGNode *, UpdatePaintNodeData *){ iterations++; update(); - return 0; + return nullptr; } }; @@ -490,7 +490,7 @@ void tst_qquickwindow::openglContextCreatedSignal() window.setTitle(QTest::currentTestFunction()); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); if (window.rendererInterface()->graphicsApi() != QSGRendererInterface::OpenGL) QSKIP("Skipping OpenGL context test due to not running with OpenGL"); @@ -506,7 +506,7 @@ void tst_qquickwindow::aboutToStopSignal() QQuickWindow window; window.setTitle(QTest::currentTestFunction()); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QSignalSpy spy(&window, SIGNAL(sceneGraphAboutToStop())); @@ -578,7 +578,7 @@ void tst_qquickwindow::constantUpdatesOnWindow() bool ok = connect(&window, signal.constData(), &window, SLOT(update()), Qt::DirectConnection); Q_ASSERT(ok); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); FrameCounter counter; connect(&window, SIGNAL(frameSwapped()), &counter, SLOT(incr()), Qt::DirectConnection); @@ -896,7 +896,7 @@ void tst_qquickwindow::touchEvent_cancel() COMPARE_TOUCH_DATA(item->lastEvent, d); item->reset(); - QWindowSystemInterface::handleTouchCancelEvent(0, touchDevice); + QWindowSystemInterface::handleTouchCancelEvent(nullptr, touchDevice); QCoreApplication::processEvents(); d = makeTouchData(QEvent::TouchCancel, window); COMPARE_TOUCH_DATA(item->lastEvent, d); @@ -930,7 +930,7 @@ void tst_qquickwindow::touchEvent_cancelClearsMouseGrab() QTRY_COMPARE(item->mousePressCount, 1); QTRY_COMPARE(item->mouseUngrabEventCount, 0); - QWindowSystemInterface::handleTouchCancelEvent(0, touchDevice); + QWindowSystemInterface::handleTouchCancelEvent(nullptr, touchDevice); QCoreApplication::processEvents(); QTRY_COMPARE(item->mouseUngrabEventCount, 1); @@ -1283,7 +1283,7 @@ void tst_qquickwindow::mouseFiltering() QPoint pos(100, 100); - QTest::mousePress(window, Qt::LeftButton, 0, pos); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos); // Mouse filtering propagates down the stack, so the // correct order is @@ -1295,7 +1295,7 @@ void tst_qquickwindow::mouseFiltering() QTRY_COMPARE(topItem->mousePressCount, 3); QCOMPARE(siblingItem->mousePressCount, 0); - QTest::mouseRelease(window, Qt::LeftButton, 0, pos); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, pos); topItem->clearMouseEventCounters(); middleItem->clearMouseEventCounters(); bottomItem->clearMouseEventCounters(); @@ -1304,7 +1304,7 @@ void tst_qquickwindow::mouseFiltering() // Repeat, but this time have the top item accept the press topItem->acceptMouseEvents = true; - QTest::mousePress(window, Qt::LeftButton, 0, pos); + QTest::mousePress(window, Qt::LeftButton, Qt::NoModifier, pos); // Mouse filtering propagates down the stack, so the // correct order is @@ -1327,7 +1327,7 @@ void tst_qquickwindow::mouseFiltering() QCOMPARE(siblingItem->mouseMoveCount, 0); // clean up mouse press state for the next tests - QTest::mouseRelease(window, Qt::LeftButton, 0, pos); + QTest::mouseRelease(window, Qt::LeftButton, Qt::NoModifier, pos); } void tst_qquickwindow::qmlCreation() @@ -1395,7 +1395,7 @@ void tst_qquickwindow::defaultState() QQuickWindow cppWindow; cppWindow.show(); - QTest::qWaitForWindowExposed(&cppWindow); + QVERIFY(QTest::qWaitForWindowExposed(&cppWindow)); QCOMPARE(qmlWindow->windowState(), cppWindow.windowState()); } @@ -1602,7 +1602,7 @@ void tst_qquickwindow::noUpdateWhenNothingChanges() QQuickRectangle rect(window.contentItem()); window.showNormal(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); // Many platforms are broken in the sense that that they follow up // the initial expose with a second expose or more. Let these go // through before we let the test continue. @@ -1752,7 +1752,7 @@ void tst_qquickwindow::ownershipRootItem() QVERIFY(accessor); engine.collectGarbage(); - QCoreApplication::sendPostedEvents(0, QEvent::DeferredDelete); + QCoreApplication::sendPostedEvents(nullptr, QEvent::DeferredDelete); QCoreApplication::processEvents(); QVERIFY(!accessor->isRootItemDestroyed()); } @@ -1859,7 +1859,7 @@ void tst_qquickwindow::cursor() QCOMPARE(window.cursor().shape(), Qt::WaitCursor); // Try with the mouse pressed. - QTest::mousePress(&window, Qt::LeftButton, 0, QPoint(100, 100)); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 100)); QTest::mouseMove(&window, QPoint(20, 20)); QCOMPARE(window.cursor().shape(), Qt::IBeamCursor); QTest::mouseMove(&window, QPoint(125, 125)); @@ -1870,12 +1870,12 @@ void tst_qquickwindow::cursor() QCOMPARE(window.cursor().shape(), Qt::ArrowCursor); QTest::mouseMove(&window, QPoint(100, 100)); QCOMPARE(window.cursor().shape(), Qt::WaitCursor); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 100)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 100)); // Remove the cursor item from the scene. Theoretically this should make parentItem the // cursorItem, but given the situation will correct itself after the next mouse move it // simply unsets the window cursor for now. - childItem.setParentItem(0); + childItem.setParentItem(nullptr); QCOMPARE(window.cursor().shape(), Qt::ArrowCursor); parentItem.setCursor(Qt::SizeAllCursor); @@ -1891,7 +1891,7 @@ void tst_qquickwindow::cursor() QCOMPARE(childItem.cursor().shape(), Qt::ArrowCursor); QCOMPARE(window.cursor().shape(), Qt::ArrowCursor); - QTest::mouseRelease(&window, Qt::LeftButton, 0, QPoint(100, 101)); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, QPoint(100, 101)); QCOMPARE(window.cursor().shape(), Qt::SizeAllCursor); } #endif @@ -1912,8 +1912,8 @@ void tst_qquickwindow::hideThenDelete() QFETCH(bool, persistentSG); QFETCH(bool, persistentGL); - QSignalSpy *openglDestroyed = 0; - QSignalSpy *sgInvalidated = 0; + QSignalSpy *openglDestroyed = nullptr; + QSignalSpy *sgInvalidated = nullptr; { QQuickWindow window; @@ -1927,7 +1927,7 @@ void tst_qquickwindow::hideThenDelete() window.resize(400, 300); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); const bool threaded = QQuickWindowPrivate::get(&window)->context->thread() != QGuiApplication::instance()->thread(); const bool isGL = window.rendererInterface()->graphicsApi() == QSGRendererInterface::OpenGL; #if QT_CONFIG(opengl) @@ -2051,7 +2051,7 @@ void tst_qquickwindow::requestActivate() QString warning = QString::fromLatin1("Mouse event MousePress not accepted by receiving window"); QWARN(warning.toLatin1().data()); } - me = QMouseEvent(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, 0, Qt::NoModifier); + me = QMouseEvent(QEvent::MouseButtonPress, pos, window1->mapToGlobal(pos), Qt::LeftButton, nullptr, Qt::NoModifier); QSpontaneKeyEvent::setSpontaneous(&me); if (!qApp->notify(window1.data(), &me)) { QString warning = QString::fromLatin1("Mouse event MouseRelease not accepted by receiving window"); @@ -2077,7 +2077,7 @@ void tst_qquickwindow::testWindowVisibilityOrder() QVERIFY(window2); QVERIFY(window3); - QTest::qWaitForWindowExposed(window3); + QVERIFY(QTest::qWaitForWindowExposed(window3)); QWindowList windows = QGuiApplication::topLevelWindows(); QTRY_COMPARE(windows.size(), 5); @@ -2099,7 +2099,7 @@ void tst_qquickwindow::testWindowVisibilityOrder() window4->setVisible(true); - QTest::qWaitForWindowExposed(window5); + QVERIFY(QTest::qWaitForWindowExposed(window5)); QVERIFY(window4->isVisible()); QVERIFY(window5->isVisible()); } @@ -2113,7 +2113,7 @@ void tst_qquickwindow::blockClosing() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->isVisible()); QWindowSystemInterface::handleCloseEvent(window.data()); QVERIFY(window->isVisible()); @@ -2133,7 +2133,7 @@ void tst_qquickwindow::blockCloseMethod() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QVERIFY(window->isVisible()); QVERIFY(QMetaObject::invokeMethod(window.data(), "close", Qt::DirectConnection)); QVERIFY(window->isVisible()); @@ -2154,7 +2154,7 @@ void tst_qquickwindow::crashWhenHoverItemDeleted() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowActive(window.data()); + QVERIFY(QTest::qWaitForWindowActive(window.data())); // Simulate a move from the first rectangle to the second. Crash will happen in here // Moving instantaneously from (0, 99) to (0, 102) does not cause the crash @@ -2173,10 +2173,10 @@ void tst_qquickwindow::unloadSubWindow() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QPointer<QQuickWindow> transient; QTRY_VERIFY(transient = window->property("transientWindow").value<QQuickWindow*>()); - QTest::qWaitForWindowExposed(transient); + QVERIFY(QTest::qWaitForWindowExposed(transient)); // Unload the inner window (in nested Loaders) and make sure it doesn't crash QQuickLoader *loader = window->property("loader1").value<QQuickLoader*>(); @@ -2194,13 +2194,13 @@ void tst_qquickwindow::changeVisibilityInCompleted() QVERIFY(!window.isNull()); window->setTitle(QTest::currentTestFunction()); window->show(); - QTest::qWaitForWindowExposed(window.data()); + QVERIFY(QTest::qWaitForWindowExposed(window.data())); QPointer<QQuickWindow> winVisible; QTRY_VERIFY(winVisible = window->property("winVisible").value<QQuickWindow*>()); QPointer<QQuickWindow> winVisibility; QTRY_VERIFY(winVisibility = window->property("winVisibility").value<QQuickWindow*>()); - QTest::qWaitForWindowExposed(winVisible); - QTest::qWaitForWindowExposed(winVisibility); + QVERIFY(QTest::qWaitForWindowExposed(winVisible)); + QVERIFY(QTest::qWaitForWindowExposed(winVisibility)); QVERIFY(winVisible->isVisible()); QCOMPARE(winVisibility->visibility(), QWindow::Windowed); @@ -2412,7 +2412,7 @@ void tst_qquickwindow::attachedProperty() QCOMPARE(text->property("windowHeight").toInt(), innerWindow->height()); QCOMPARE(text->property("window").value<QQuickWindow*>(), innerWindow); - text->setParentItem(0); + text->setParentItem(nullptr); QVERIFY(!text->property("contentItem").value<QQuickItem*>()); QCOMPARE(text->property("windowWidth").toInt(), 0); QCOMPARE(text->property("windowHeight").toInt(), 0); @@ -2435,7 +2435,7 @@ public: class GlRenderJob : public QRunnable { public: - GlRenderJob(GLubyte *buf) : readPixel(buf), mutex(0), condition(0) {} + GlRenderJob(GLubyte *buf) : readPixel(buf), mutex(nullptr), condition(nullptr) {} ~GlRenderJob() {} void run() { QOpenGLContext::currentContext()->functions()->glClearColor(1.0f, 0, 0, 1.0f); @@ -2546,7 +2546,7 @@ void tst_qquickwindow::testRenderJob() class EventCounter : public QQuickRectangle { public: - EventCounter(QQuickItem *parent = 0) + EventCounter(QQuickItem *parent = nullptr) : QQuickRectangle(parent) { } @@ -2654,7 +2654,7 @@ class HoverTimestampConsumer : public QQuickItem { Q_OBJECT public: - HoverTimestampConsumer(QQuickItem *parent = 0) + HoverTimestampConsumer(QQuickItem *parent = nullptr) : QQuickItem(parent) { setAcceptHoverEvents(true); @@ -2737,7 +2737,7 @@ void tst_qquickwindow::testHoverTimestamp() class CircleItem : public QQuickRectangle { public: - CircleItem(QQuickItem *parent = 0) : QQuickRectangle(parent) { } + CircleItem(QQuickItem *parent = nullptr) : QQuickRectangle(parent) { } void setRadius(qreal radius) { const qreal diameter = radius*2; @@ -2795,7 +2795,7 @@ void tst_qquickwindow::test_circleMapItem() QSignalSpy topSpy(mat, SIGNAL(clicked(QQuickMouseEvent *))); window.show(); - QTest::qWaitForWindowExposed(&window); + QVERIFY(QTest::qWaitForWindowExposed(&window)); QTest::qWait(1000); QPoint pos(50, 50); @@ -2883,7 +2883,7 @@ class TestDropTarget : public QQuickItem { Q_OBJECT public: - TestDropTarget(QQuickItem *parent = 0) + TestDropTarget(QQuickItem *parent = nullptr) : QQuickItem(parent) , enterDropAction(Qt::CopyAction) , moveDropAction(Qt::CopyAction) @@ -2944,10 +2944,10 @@ public: ~DragEventTester() { qDeleteAll(events); events.clear(); - enterEvent = 0; - moveEvent = 0; - dropEvent = 0; - leaveEvent = 0; + enterEvent = nullptr; + moveEvent = nullptr; + dropEvent = nullptr; + leaveEvent = nullptr; } void addEnterEvent() @@ -3494,7 +3494,7 @@ void tst_qquickwindow::testChildMouseEventFilter() DeliveryRecordVector &actualDeliveryOrder = EventItem::deliveryList(); actualDeliveryOrder.clear(); - QTest::mousePress(&window, Qt::LeftButton, 0, mousePos); + QTest::mousePress(&window, Qt::LeftButton, Qt::NoModifier, mousePos); // Check if event got delivered to the root item. If so, append it to the list of items the event got delivered to if (rootFilter->events.contains(QEvent::MouseButtonPress)) @@ -3511,7 +3511,7 @@ void tst_qquickwindow::testChildMouseEventFilter() } // "restore" mouse state - QTest::mouseRelease(&window, Qt::LeftButton, 0, mousePos); + QTest::mouseRelease(&window, Qt::LeftButton, Qt::NoModifier, mousePos); } diff --git a/tests/auto/quick/rendernode/tst_rendernode.cpp b/tests/auto/quick/rendernode/tst_rendernode.cpp index d6e1982b1e..0e06ee6f50 100644 --- a/tests/auto/quick/rendernode/tst_rendernode.cpp +++ b/tests/auto/quick/rendernode/tst_rendernode.cpp @@ -120,7 +120,7 @@ private: class MessUpNode : public QSGRenderNode, protected QOpenGLFunctions { public: - MessUpNode() : initialized(false) { } + MessUpNode() {} StateFlags changedStates() const override { @@ -157,7 +157,7 @@ public: glBindFramebuffer(GL_FRAMEBUFFER, fbo); } - bool initialized; + bool initialized = false; }; class MessUpItem : public QQuickItem diff --git a/tests/auto/quick/scenegraph/tst_scenegraph.cpp b/tests/auto/quick/scenegraph/tst_scenegraph.cpp index d8d9cd26e0..2479450287 100644 --- a/tests/auto/quick/scenegraph/tst_scenegraph.cpp +++ b/tests/auto/quick/scenegraph/tst_scenegraph.cpp @@ -116,7 +116,7 @@ private slots: private: bool m_brokenMipmapSupport; - QQuickView *createView(const QString &file, QWindow *parent = 0, int x = -1, int y = -1, int w = -1, int h = -1); + QQuickView *createView(const QString &file, QWindow *parent = nullptr, int x = -1, int y = -1, int w = -1, int h = -1); bool isRunningOnOpenGL(); }; @@ -231,7 +231,7 @@ void tst_SceneGraph::manyWindows_data() #if QT_CONFIG(opengl) struct ShareContextResetter { public: - ~ShareContextResetter() { qt_gl_set_global_share_context(0); } + ~ShareContextResetter() { qt_gl_set_global_share_context(nullptr); } }; #endif @@ -269,7 +269,7 @@ void tst_SceneGraph::manyWindows() } for (int i=0; i<COUNT; ++i) { QQuickView *view = views.at(i); - QTest::qWaitForWindowExposed(view); + QVERIFY(QTest::qWaitForWindowExposed(view)); QImage content = view->grabWindow(); if (i == 0) { baseLine = content; @@ -282,7 +282,7 @@ void tst_SceneGraph::manyWindows() // Wipe and recreate one (scope pointer delets it...) delete views.takeLast(); QQuickView *last = createView(file, parent.data(), 100, 100, 100, 100); - QTest::qWaitForWindowExposed(last); + QVERIFY(QTest::qWaitForWindowExposed(last)); views << last; QVERIFY(compareImages(baseLine, last->grabWindow())); @@ -295,7 +295,7 @@ void tst_SceneGraph::manyWindows() } for (int i=0; i<COUNT; ++i) { QQuickView *view = views.at(i); - QTest::qWaitForWindowExposed(view); + QVERIFY(QTest::qWaitForWindowExposed(view)); QImage content = view->grabWindow(); QVERIFY(compareImages(content, baseLine)); } @@ -548,7 +548,7 @@ void tst_SceneGraph::createTextureFromImage() QQuickView view; view.show(); - QTest::qWaitForWindowExposed(&view); + QVERIFY(QTest::qWaitForWindowExposed(&view)); QTRY_VERIFY(view.isSceneGraphInitialized()); QScopedPointer<QSGTexture> texture(view.createTextureFromImage(image, (QQuickWindow::CreateTextureOptions) flags)); diff --git a/tests/auto/quick/sharedimage/tst_sharedimage.cpp b/tests/auto/quick/sharedimage/tst_sharedimage.cpp index b91fc8a0de..afadb76ad0 100644 --- a/tests/auto/quick/sharedimage/tst_sharedimage.cpp +++ b/tests/auto/quick/sharedimage/tst_sharedimage.cpp @@ -90,7 +90,7 @@ void tst_sharedimage::compareToPlainLoad() engine.loadData(i ? sharedScript : plainScript); QVERIFY(engine.rootObjects().size()); QQuickImage *obj = qobject_cast<QQuickImage*>(engine.rootObjects().at(0)); - QVERIFY(obj != 0); + QVERIFY(obj != nullptr); QTRY_VERIFY(!obj->image().isNull()); images[i] = obj->image(); } diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 646317078b..a79ff4e78f 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -86,8 +86,8 @@ Q_SIGNALS: void onTouchEvent(QQuickItem *receiver); public: - EventItem(QQuickItem *parent = 0) - : QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1) + EventItem(QQuickItem *parent = nullptr) + : QQuickItem(parent) { setAcceptedMouseButtons(Qt::LeftButton); #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) @@ -140,10 +140,10 @@ public: } QList<Event> eventList; - int touchUngrabCount; - bool acceptMouse; - bool acceptTouch; - bool filterTouch; // when used as event filter + int touchUngrabCount = 0; + bool acceptMouse = false; + bool acceptTouch = false; + bool filterTouch = false; // when used as event filter bool eventFilter(QObject *, QEvent *event) { @@ -162,7 +162,7 @@ public: } return false; } - int point0; + int point0 = -1; }; class tst_TouchMouse : public QQmlDataTest @@ -220,7 +220,7 @@ private: QQuickView *tst_TouchMouse::createView() { - QQuickView *window = new QQuickView(0); + QQuickView *window = new QQuickView(nullptr); return window; } @@ -240,7 +240,7 @@ void tst_TouchMouse::simpleTouchEvent() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -402,7 +402,7 @@ void tst_TouchMouse::mouse() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -432,7 +432,7 @@ void tst_TouchMouse::touchOverMouse() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -472,7 +472,7 @@ void tst_TouchMouse::mouseOverTouch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *eventItem1 = window->rootObject()->findChild<EventItem*>("eventItem1"); QVERIFY(eventItem1); @@ -513,7 +513,7 @@ void tst_TouchMouse::buttonOnFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); QVERIFY(flickable); @@ -631,7 +631,7 @@ void tst_TouchMouse::touchButtonOnFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); QVERIFY(flickable); @@ -708,7 +708,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickFlickable *flickable = window->rootObject()->findChild<QQuickFlickable*>("flickable"); QVERIFY(flickable); @@ -806,7 +806,7 @@ void tst_TouchMouse::buttonOnTouch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QVERIFY(pinchArea); @@ -848,7 +848,7 @@ void tst_TouchMouse::buttonOnTouch() eventItem1->eventList.clear(); // Normal mouse click - QTest::mouseClick(window.data(), Qt::LeftButton, 0, p1); + QTest::mouseClick(window.data(), Qt::LeftButton, Qt::NoModifier, p1); QCOMPARE(eventItem1->eventList.size(), 3); QCOMPARE(eventItem1->eventList.at(0).type, QEvent::MouseButtonPress); QCOMPARE(eventItem1->eventList.at(1).type, QEvent::MouseButtonRelease); @@ -942,7 +942,7 @@ void tst_TouchMouse::pinchOnFlickable() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QVERIFY(pinchArea); @@ -1023,7 +1023,7 @@ void tst_TouchMouse::flickableOnPinch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickPinchArea *pinchArea = window->rootObject()->findChild<QQuickPinchArea*>("pincharea"); QVERIFY(pinchArea); @@ -1102,7 +1102,7 @@ void tst_TouchMouse::mouseOnFlickableOnPinch() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QRect windowRect = QRect(window->position(), window->size()); QCursor::setPos(windowRect.center()); @@ -1235,7 +1235,7 @@ void tst_TouchMouse::tapOnDismissiveTopMouseAreaClicksBottomOne() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); QQuickMouseArea *bottomMouseArea = window->rootObject()->findChild<QQuickMouseArea*>("rear mouseArea"); @@ -1275,7 +1275,7 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab() window->show(); QQuickViewTestUtil::centerOnScreen(window.data()); QVERIFY(QTest::qWaitForWindowActive(window.data())); - QVERIFY(window->rootObject() != 0); + QVERIFY(window->rootObject() != nullptr); EventItem *leftItem = window->rootObject()->findChild<EventItem*>("leftItem"); QVERIFY(leftItem); @@ -1309,7 +1309,7 @@ void tst_TouchMouse::touchGrabCausesMouseUngrab() // has been grabbed by another item. QCOMPARE(leftItem->eventList.size(), 1); QCOMPARE(leftItem->eventList.at(0).type, QEvent::UngrabMouse); - QCOMPARE(window->mouseGrabberItem(), (QQuickItem*)0); + QCOMPARE(window->mouseGrabberItem(), (QQuickItem*)nullptr); } void tst_TouchMouse::touchPointDeliveryOrder() @@ -1425,13 +1425,13 @@ void tst_TouchMouse::hoverEnabled() window->show(); QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); QQuickMouseArea *mouseArea1 = root->findChild<QQuickMouseArea*>("mouseArea1"); - QVERIFY(mouseArea1 != 0); + QVERIFY(mouseArea1 != nullptr); QQuickMouseArea *mouseArea2 = root->findChild<QQuickMouseArea*>("mouseArea2"); - QVERIFY(mouseArea2 != 0); + QVERIFY(mouseArea2 != nullptr); QSignalSpy enterSpy1(mouseArea1, SIGNAL(entered())); QSignalSpy exitSpy1(mouseArea1, SIGNAL(exited())); @@ -1508,7 +1508,7 @@ void tst_TouchMouse::implicitUngrab() QVERIFY(QTest::qWaitForWindowActive(window.data())); QQuickItem *root = window->rootObject(); - QVERIFY(root != 0); + QVERIFY(root != nullptr); EventItem *eventItem = root->findChild<EventItem*>("eventItem1"); eventItem->acceptMouse = true; QPoint p1(20, 20); |