aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/touchmouse
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2018-02-21 10:41:54 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2018-02-26 07:13:18 +0000
commit499ec43937e926e4f2fa57a9baa455fcb3862262 (patch)
tree206c90d47387f8322b68f5e3db613189397e1af3 /tests/auto/quick/touchmouse
parent53d1e9ed21d25e65a2f13606af479838f5f21fe7 (diff)
use nullptr consistently (clang-tidy)
From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/quick/touchmouse')
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp42
1 files changed, 21 insertions, 21 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index 646317078b..67a7c56099 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -86,7 +86,7 @@ Q_SIGNALS:
void onTouchEvent(QQuickItem *receiver);
public:
- EventItem(QQuickItem *parent = 0)
+ EventItem(QQuickItem *parent = nullptr)
: QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1)
{
setAcceptedMouseButtons(Qt::LeftButton);
@@ -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);