From 5e37d73ad9d00180dec179119e07f2387d45f335 Mon Sep 17 00:00:00 2001 From: JiDe Zhang Date: Wed, 26 May 2021 10:05:14 +0800 Subject: Use QEventPoint::State instead of Qt::TouchPointState Also fix compile warnings about -Wenum-compare. Pick-to: 6.2 6.1 6.0 5.15 Change-Id: I5e94fc028c727b155d5db4c7def35d518c497c5c Reviewed-by: Liang Qi Reviewed-by: Shawn Rutledge --- tests/auto/client/seatv5/tst_seatv5.cpp | 43 +++++++++++++++++---------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'tests') diff --git a/tests/auto/client/seatv5/tst_seatv5.cpp b/tests/auto/client/seatv5/tst_seatv5.cpp index 69c52ed5..7e59dbdd 100644 --- a/tests/auto/client/seatv5/tst_seatv5.cpp +++ b/tests/auto/client/seatv5/tst_seatv5.cpp @@ -29,6 +29,7 @@ #include "mockcompositor.h" #include #include +#include using namespace MockCompositor; @@ -449,14 +450,14 @@ void tst_seatv5::singleTap() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); } @@ -480,14 +481,14 @@ void tst_seatv5::singleTapFloat() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released); QCOMPARE(e.touchPoints.length(), 1); QCOMPARE(e.touchPoints.first().position(), QPointF(32.75-window.frameMargins().left(), 32.25-window.frameMargins().top())); } @@ -523,13 +524,13 @@ void tst_seatv5::multiTouch() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPointStates, QEventPoint::State::Pressed); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed); QCOMPARE(e.touchPoints[0].position(), QPointF(32-window.frameMargins().left(), 32-window.frameMargins().top())); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Pressed); QCOMPARE(e.touchPoints[1].position(), QPointF(48-window.frameMargins().left(), 48-window.frameMargins().top())); } { @@ -537,30 +538,30 @@ void tst_seatv5::multiTouch() QCOMPARE(e.type, QEvent::TouchUpdate); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Updated); QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Updated); QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchUpdate); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased | Qt::TouchPointState::TouchPointStationary); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released | QEventPoint::State::Stationary); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); QCOMPARE(e.touchPoints[0].position(), QPointF(33-window.frameMargins().left(), 32-window.frameMargins().top())); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointStationary); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Stationary); QCOMPARE(e.touchPoints[1].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); - QCOMPARE(e.touchPointStates, Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPointStates, QEventPoint::State::Released); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); QCOMPARE(e.touchPoints[0].position(), QPointF(49-window.frameMargins().left(), 48-window.frameMargins().top())); } } @@ -595,21 +596,21 @@ void tst_seatv5::multiTouchUpAndMotionFrame() { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Pressed); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchUpdate); QCOMPARE(e.touchPoints.length(), 2); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); - QCOMPARE(e.touchPoints[1].state(), Qt::TouchPointState::TouchPointMoved); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); + QCOMPARE(e.touchPoints[1].state(), QEventPoint::State::Updated); } { auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchEnd); QCOMPARE(e.touchPoints.length(), 1); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointReleased); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Released); } QVERIFY(window.m_events.empty()); } @@ -637,13 +638,13 @@ void tst_seatv5::tapAndMoveInSameFrame() auto e = window.m_events.takeFirst(); QCOMPARE(e.type, QEvent::TouchBegin); QCOMPARE(e.touchPoints.size(), 1); - QCOMPARE(e.touchPoints[0].state(), Qt::TouchPointState::TouchPointPressed); + QCOMPARE(e.touchPoints[0].state(), QEventPoint::State::Pressed); // Position isn't that important, we just want to make sure we actually get the pressed event } // Make sure we eventually release QTRY_VERIFY(!window.m_events.empty()); - QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), Qt::TouchPointState::TouchPointReleased); + QTRY_COMPARE(window.m_events.last().touchPoints.first().state(), QEventPoint::State::Released); } QCOMPOSITOR_TEST_MAIN(tst_seatv5) -- cgit v1.2.1