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>
This commit is contained in:
parent
34943a6f70
commit
875a7fad52
@ -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()
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user