summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-21 14:01:49 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2020-10-22 02:43:26 +0200
commit875a7fad52e88a86eb963b534e9a7c3e27d7e7ce (patch)
tree0e376f66e5795b30b8674cad020cf5fe206678d0 /tests/auto
parent34943a6f708ae7580e1fcbf5368623ba642a4644 (diff)
Fix a bunch of compiler warnings in event handling test cases
Leave the normalizedPos warnings, there is no equivalent function. Change-Id: I50c72ab24b4855e36941aafdee30cdb0e94c1684 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp21
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp4
-rw-r--r--tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp20
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp2
4 files changed, 25 insertions, 22 deletions
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index dd36a28854..8d07718156 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -78,9 +78,9 @@ public:
if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin");
seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd;
auto touchEvent = static_cast<QTouchEvent *>(event);
- touchBeginPoints = touchEvent->touchPoints();
+ touchBeginPoints = touchEvent->points();
Q_ASSERT(touchBeginPoints.first().device() == touchEvent->pointingDevice());
- for (const QEventPoint &pt : touchEvent->touchPoints())
+ for (const QEventPoint &pt : qAsConst(touchBeginPoints))
lastNormalizedPositions << pt.normalizedPos();
timestamp = touchEvent->timestamp();
deviceFromEvent = touchEvent->pointingDevice();
@@ -95,8 +95,8 @@ public:
if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate");
seenTouchUpdate = seenTouchBegin && !seenTouchEnd;
auto touchEvent = static_cast<QTouchEvent *>(event);
- touchUpdatePoints = touchEvent->touchPoints();
- for (const QEventPoint &pt : touchEvent->touchPoints())
+ touchUpdatePoints = touchEvent->points();
+ for (const QEventPoint &pt : qAsConst(touchUpdatePoints))
lastNormalizedPositions << pt.normalizedPos();
timestamp = touchEvent->timestamp();
deviceFromEvent = touchEvent->pointingDevice();
@@ -111,8 +111,8 @@ public:
if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd");
seenTouchEnd = seenTouchBegin && !seenTouchEnd;
auto touchEvent = static_cast<QTouchEvent *>(event);
- touchEndPoints = touchEvent->touchPoints();
- for (const QEventPoint &pt : touchEvent->touchPoints())
+ touchEndPoints = touchEvent->points();
+ for (const QEventPoint &pt : qAsConst(touchEndPoints))
lastNormalizedPositions << pt.normalizedPos();
timestamp = touchEvent->timestamp();
deviceFromEvent = touchEvent->pointingDevice();
@@ -177,7 +177,7 @@ public:
if (seenTouchEnd) qWarning("TouchBegin: TouchEnd cannot happen before TouchBegin");
seenTouchBegin = !seenTouchBegin && !seenTouchUpdate && !seenTouchEnd;
++touchBeginCounter;
- touchBeginPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ touchBeginPoints = static_cast<QTouchEvent *>(event)->points();
event->setAccepted(acceptTouchBegin);
if (deleteInTouchBegin)
delete this;
@@ -188,7 +188,7 @@ public:
if (seenTouchEnd) qWarning("TouchUpdate: TouchEnd cannot happen before TouchUpdate");
seenTouchUpdate = seenTouchBegin && !seenTouchEnd;
++touchUpdateCounter;
- touchUpdatePoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ touchUpdatePoints = static_cast<QTouchEvent *>(event)->points();
event->setAccepted(acceptTouchUpdate);
if (deleteInTouchUpdate)
delete this;
@@ -199,7 +199,7 @@ public:
if (seenTouchEnd) qWarning("TouchEnd: already seen a TouchEnd");
seenTouchEnd = seenTouchBegin && !seenTouchEnd;
++touchEndCounter;
- touchEndPoints = static_cast<QTouchEvent *>(event)->touchPoints();
+ touchEndPoints = static_cast<QTouchEvent *>(event)->points();
event->setAccepted(acceptTouchEnd);
if (deleteInTouchEnd)
delete this;
@@ -363,6 +363,9 @@ void tst_QTouchEvent::state()
QVERIFY(!touchEvent.isBeginEvent());
QVERIFY(!touchEvent.isUpdateEvent());
QVERIFY(touchEvent.isEndEvent());
+ QT_WARNING_PUSH QT_WARNING_DISABLE_DEPRECATED // test Qt 5 compatibility wrappers
+ QCOMPARE(touchEvent.touchPoints(), touchEvent.points());
+ QT_WARNING_POP
}
void tst_QTouchEvent::touchDisabledByDefault()
diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
index 280b12b173..ab89a94a10 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -10989,11 +10989,11 @@ protected:
{
switch (ev->type()) {
case QEvent::TouchBegin:
- m_touchBeginPoints.append(static_cast<const QTouchEvent *>(ev)->touchPoints().constFirst());
+ m_touchBeginPoints.append(static_cast<const QTouchEvent *>(ev)->points().constFirst());
ev->accept();
return true;
case QEvent::TouchUpdate:
- m_touchUpdatePoints.append(static_cast<const QTouchEvent *>(ev)->touchPoints().constFirst());
+ m_touchUpdatePoints.append(static_cast<const QTouchEvent *>(ev)->points().constFirst());
ev->accept();
return true;
default:
diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
index 94130e25bf..21f1bee537 100644
--- a/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/widgets/graphicsview/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -2281,8 +2281,8 @@ void tst_QGraphicsScene::dragAndDrop_simple()
QCOMPARE(item->eventList.size(), 2);
QCOMPARE(item->eventList.at(0), QEvent::GraphicsSceneDragEnter);
QCOMPARE(item->eventList.at(1), QEvent::GraphicsSceneDragMove);
- QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos()));
- QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos()));
+ QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint()));
+ QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint()));
QVERIFY(item->lastEvent->isAccepted());
QCOMPARE(item->lastEvent->dropAction(), Qt::IgnoreAction);
}
@@ -2294,8 +2294,8 @@ void tst_QGraphicsScene::dragAndDrop_simple()
QCOMPARE(dragMove.dropAction(), Qt::IgnoreAction);
QCOMPARE(item->eventList.size(), 3);
QCOMPARE(item->eventList.at(2), QEvent::GraphicsSceneDragMove);
- QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos()));
- QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos()));
+ QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint()));
+ QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint()));
QVERIFY(item->lastEvent->isAccepted());
QCOMPARE(item->lastEvent->dropAction(), Qt::IgnoreAction);
}
@@ -2307,8 +2307,8 @@ void tst_QGraphicsScene::dragAndDrop_simple()
QCOMPARE(dragMove.dropAction(), Qt::CopyAction);
QCOMPARE(item->eventList.size(), 4);
QCOMPARE(item->eventList.at(3), QEvent::GraphicsSceneDragLeave);
- QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos()));
- QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos()));
+ QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint()));
+ QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint()));
QVERIFY(item->lastEvent->isAccepted());
QCOMPARE(item->lastEvent->dropAction(), Qt::CopyAction);
}
@@ -2321,8 +2321,8 @@ void tst_QGraphicsScene::dragAndDrop_simple()
QCOMPARE(item->eventList.size(), 6);
QCOMPARE(item->eventList.at(4), QEvent::GraphicsSceneDragEnter);
QCOMPARE(item->eventList.at(5), QEvent::GraphicsSceneDragMove);
- QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.pos()));
- QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.pos()));
+ QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(dragMove.position().toPoint()));
+ QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(dragMove.position().toPoint()));
QVERIFY(item->lastEvent->isAccepted());
QCOMPARE(item->lastEvent->dropAction(), Qt::IgnoreAction);
}
@@ -2334,8 +2334,8 @@ void tst_QGraphicsScene::dragAndDrop_simple()
QCOMPARE(drop.dropAction(), Qt::CopyAction);
QCOMPARE(item->eventList.size(), 7);
QCOMPARE(item->eventList.at(6), QEvent::GraphicsSceneDrop);
- QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(drop.pos()));
- QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(drop.pos()));
+ QCOMPARE(item->lastEvent->screenPos(), view.mapToGlobal(drop.position().toPoint()));
+ QCOMPARE(item->lastEvent->scenePos(), view.mapToScene(drop.position().toPoint()));
QVERIFY(item->lastEvent->isAccepted());
QCOMPARE(item->lastEvent->dropAction(), Qt::CopyAction);
}
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index dbeebfa523..7c42937a46 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -11495,7 +11495,7 @@ public:
protected:
void tabletEvent(QTabletEvent *event) override {
++tabletEventCount;
- uid = event->uniqueId();
+ uid = event->pointingDevice()->uniqueId().numericId();
switch (event->type()) {
case QEvent::TabletMove:
++moveEventCount;