aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-03-26 16:50:40 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-06-23 17:44:03 +0200
commitd0ae3a312a03c118a1aa25a4c6c0352375d569fc (patch)
tree01df3e8ea22c8a1ecd969a6e9e6d7014c635da9f /tests/auto
parentd5d6a56809032796444fe63c220a2e940ce237c0 (diff)
Remove QQuickPointerDevice in favor of QPointingDevice
...and generally deal with changes immediately required after adding QInputDevice and QPointingDevice. Also fixed a few usages of deprecated accessors that weren't taken care of in 212c2bffbb041aee0e3c9a7f0551ef151ed2d3ad. Task-number: QTBUG-46412 Task-number: QTBUG-69433 Task-number: QTBUG-72167 Change-Id: I93a2643162878afa216556f10808fd92e0b20071 Reviewed-by: Jan Arve Sæther <jan-arve.saether@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp2
-rw-r--r--tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp9
-rw-r--r--tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp11
-rw-r--r--tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp18
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp17
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp6
-rw-r--r--tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp10
-rw-r--r--tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp3
-rw-r--r--tests/auto/quick/qquickflickable/tst_qquickflickable.cpp3
-rw-r--r--tests/auto/quick/qquickitem/tst_qquickitem.cpp7
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp5
-rw-r--r--tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp14
-rw-r--r--tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp12
-rw-r--r--tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp15
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp26
-rw-r--r--tests/auto/quick/touchmouse/tst_touchmouse.cpp13
-rw-r--r--tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp2
17 files changed, 55 insertions, 118 deletions
diff --git a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp
index f4ed051e1f..2cdbaf3bf6 100644
--- a/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp
+++ b/tests/auto/quick/pointerhandlers/flickableinterop/tst_flickableinterop.cpp
@@ -82,7 +82,7 @@ private slots:
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
- QTouchDevice *touchDevice;
+ QPointingDevice *touchDevice;
};
void tst_FlickableInterop::createView(QScopedPointer<QQuickView> &window, const char *fileName)
diff --git a/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp b/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp
index 794562fea0..26b6e0540b 100644
--- a/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp
+++ b/tests/auto/quick/pointerhandlers/mousearea_interop/tst_mousearea_interop.cpp
@@ -45,8 +45,6 @@ class tst_MouseAreaInterop : public QQmlDataTest
Q_OBJECT
public:
tst_MouseAreaInterop()
- : touchDevice(QTest::createTouchDevice())
- , touchPointerDevice(QQuickPointerDevice::touchDevice(touchDevice))
{}
private slots:
@@ -56,8 +54,7 @@ private slots:
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
- QTouchDevice *touchDevice;
- QQuickPointerDevice *touchPointerDevice;
+ QPointingDevice *touchDevice = QTest::createTouchDevice();
};
void tst_MouseAreaInterop::createView(QScopedPointer<QQuickView> &window, const char *fileName)
@@ -79,7 +76,7 @@ void tst_MouseAreaInterop::dragHandlerInSiblingStealingGrabFromMouseAreaViaMouse
QScopedPointer<QQuickView> windowPtr;
createView(windowPtr, "dragTakeOverFromSibling.qml");
QQuickView * window = windowPtr.data();
- auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(QQuickPointerDevice::genericMouseDevice());
+ auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(QPointingDevice::primaryPointingDevice());
QPointer<QQuickPointerHandler> handler = window->rootObject()->findChild<QQuickPointerHandler*>();
QVERIFY(handler);
@@ -127,7 +124,7 @@ void tst_MouseAreaInterop::dragHandlerInSiblingStealingGrabFromMouseAreaViaTouch
QScopedPointer<QQuickView> windowPtr;
createView(windowPtr, "dragTakeOverFromSibling.qml");
QQuickView * window = windowPtr.data();
- auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchPointerDevice);
+ auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchDevice);
QPointer<QQuickPointerHandler> handler = window->rootObject()->findChild<QQuickPointerHandler*>();
QVERIFY(handler);
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 4a7a132be2..82e9b4e71f 100644
--- a/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
+++ b/tests/auto/quick/pointerhandlers/multipointtoucharea_interop/tst_multipointtoucharea_interop.cpp
@@ -46,8 +46,6 @@ class tst_MptaInterop : public QQmlDataTest
Q_OBJECT
public:
tst_MptaInterop()
- : touchDevice(QTest::createTouchDevice())
- , touchPointerDevice(QQuickPointerDevice::touchDevice(touchDevice))
{}
private slots:
@@ -60,8 +58,7 @@ private slots:
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
- QTouchDevice *touchDevice;
- QQuickPointerDevice *touchPointerDevice;
+ QPointingDevice *touchDevice = QTest::createTouchDevice();
};
void tst_MptaInterop::createView(QScopedPointer<QQuickView> &window, const char *fileName)
@@ -111,7 +108,7 @@ void tst_MptaInterop::touchDrag()
QPoint p1 = mpta->mapToScene(QPointF(20, 20)).toPoint();
touch.press(1, p1).commit();
QQuickTouchUtils::flush(window);
- auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchPointerDevice);
+ auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchDevice);
QCOMPARE(tp.at(0)->property("pressed").toBool(), true);
QTRY_VERIFY(pointerEvent->point(0)->passiveGrabbers().contains(drag));
@@ -153,7 +150,7 @@ void tst_MptaInterop::touchesThenPinch()
QSignalSpy mptaReleasedSpy(mpta, SIGNAL(released(QList<QObject*>)));
QSignalSpy mptaCanceledSpy(mpta, SIGNAL(canceled(QList<QObject*>)));
QTest::QTouchEventSequence touch = QTest::touchEvent(window, touchDevice);
- auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchPointerDevice);
+ auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchDevice);
// Press one touchpoint:
// DragHandler gets a passive grab
@@ -307,7 +304,7 @@ void tst_MptaInterop::dragHandlerInParentStealingGrabFromItem() // QTBUG-75025
QScopedPointer<QQuickView> windowPtr;
createView(windowPtr, "dragParentOfMPTA.qml");
QQuickView * window = windowPtr.data();
- auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(QQuickPointerDevice::genericMouseDevice());
+ auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(QPointingDevice::primaryPointingDevice());
QPointer<QQuickPointerHandler> handler = window->rootObject()->findChild<QQuickPointerHandler*>();
QVERIFY(handler);
diff --git a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
index 47cfd27817..f6faa97b37 100644
--- a/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickdraghandler/tst_qquickdraghandler.cpp
@@ -72,7 +72,7 @@ private slots:
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
QSet<QQuickPointerHandler *> passiveGrabbers(QQuickWindow *window, int pointId = 0);
- QTouchDevice *touchDevice;
+ QPointingDevice *touchDevice;
};
void tst_DragHandler::createView(QScopedPointer<QQuickView> &window, const char *fileName)
@@ -92,15 +92,13 @@ QSet<QQuickPointerHandler*> tst_DragHandler::passiveGrabbers(QQuickWindow *windo
{
QSet<QQuickPointerHandler*> result;
QQuickWindowPrivate *winp = QQuickWindowPrivate::get(window);
- if (QQuickPointerDevice* device = QQuickPointerDevice::touchDevice(touchDevice)) {
- QQuickPointerEvent *pointerEvent = winp->pointerEventInstance(device);
- for (int i = 0; i < pointerEvent->pointCount(); ++i) {
- QQuickEventPoint *eventPoint = pointerEvent->point(i);
- QVector<QPointer <QQuickPointerHandler> > passives = eventPoint->passiveGrabbers();
- if (!pointId || eventPoint->pointId() == pointId) {
- for (auto it = passives.constBegin(); it != passives.constEnd(); ++it)
- result << it->data();
- }
+ QQuickPointerEvent *pointerEvent = winp->pointerEventInstance(touchDevice);
+ for (int i = 0; i < pointerEvent->pointCount(); ++i) {
+ QQuickEventPoint *eventPoint = pointerEvent->point(i);
+ QVector<QPointer <QQuickPointerHandler> > passives = eventPoint->passiveGrabbers();
+ if (!pointId || eventPoint->pointId() == pointId) {
+ for (auto it = passives.constBegin(); it != passives.constEnd(); ++it)
+ result << it->data();
}
}
return result;
diff --git a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp
index 19fdae3b44..0c300cfd4e 100644
--- a/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickpinchhandler/tst_qquickpinchhandler.cpp
@@ -43,9 +43,8 @@ class tst_QQuickPinchHandler: public QQmlDataTest
{
Q_OBJECT
public:
- tst_QQuickPinchHandler() : device(0) { }
+ tst_QQuickPinchHandler() { }
private slots:
- void initTestCase();
void cleanupTestCase();
void pinchProperties();
void scale();
@@ -60,17 +59,8 @@ private slots:
private:
QQuickView *createView();
- QTouchDevice *device;
+ QPointingDevice *device = QTest::createTouchDevice();
};
-void tst_QQuickPinchHandler::initTestCase()
-{
- QQmlDataTest::initTestCase();
- if (!device) {
- device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
- }
-}
void tst_QQuickPinchHandler::cleanupTestCase()
{
@@ -677,8 +667,7 @@ void tst_QQuickPinchHandler::cancel()
QSKIP("cancel is not supported atm");
- QTouchEvent cancelEvent(QEvent::TouchCancel);
- cancelEvent.setDevice(device);
+ QTouchEvent cancelEvent(QEvent::TouchCancel, device);
QCoreApplication::sendEvent(window, &cancelEvent);
QQuickTouchUtils::flush(window);
diff --git a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp
index 7bfaac318f..cb20168c1d 100644
--- a/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickpointerhandler/tst_qquickpointerhandler.cpp
@@ -230,7 +230,7 @@ class tst_PointerHandlers : public QQmlDataTest
Q_OBJECT
public:
tst_PointerHandlers()
- :touchDevice(QTest::createTouchDevice())
+ : touchDevice(QTest::createTouchDevice())
{}
private slots:
@@ -271,7 +271,7 @@ protected:
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
- QTouchDevice *touchDevice;
+ QPointingDevice *touchDevice;
QList<Event> filteredEventList;
};
@@ -343,7 +343,7 @@ void tst_PointerHandlers::touchEventDelivery()
QCOMPARE(eventItem1->eventList.size(), 2);
QCOMPARE_EVENT(0, Event::HandlerDestination, QEvent::Pointer, Qt::TouchPointPressed, NoGrab);
QCOMPARE_EVENT(1, Event::TouchDestination, QEvent::TouchBegin, Qt::TouchPointPressed, QQuickEventPoint::GrabExclusive);
- auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0));
+ auto pointerEvent = QQuickWindowPrivate::get(window)->pointerEventInstance(touchDevice);
QCOMPARE(pointerEvent->point(0)->exclusiveGrabber(), eventItem1);
p1 += QPoint(10, 0);
QTest::touchEvent(window, touchDevice).move(0, p1, window);
diff --git a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp
index ca6463f365..900202f132 100644
--- a/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquickpointhandler/tst_qquickpointhandler.cpp
@@ -62,7 +62,7 @@ private slots:
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
- QTouchDevice *touchDevice;
+ QPointingDevice *touchDevice;
};
void tst_PointHandler::createView(QScopedPointer<QQuickView> &window, const char *fileName)
@@ -145,7 +145,7 @@ void tst_PointHandler::tabletStylus()
QQuickView * window = windowPtr.data();
QQuickPointHandler *handler = window->rootObject()->findChild<QQuickPointHandler *>("pointHandler");
QVERIFY(handler);
- handler->setAcceptedDevices(QQuickPointerDevice::Stylus);
+ handler->setAcceptedDevices(QInputDevice::DeviceType::Stylus);
QSignalSpy activeSpy(handler, SIGNAL(activeChanged()));
QSignalSpy pointSpy(handler, SIGNAL(pointChanged()));
@@ -155,7 +155,7 @@ void tst_PointHandler::tabletStylus()
const qint64 stylusId = 1234567890;
QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point),
- QTabletEvent::Stylus, QTabletEvent::Pen, Qt::LeftButton, 0.5, 25, 35, 0.6, 12.3, 3, stylusId, Qt::NoModifier);
+ int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::LeftButton, 0.5, 25, 35, 0.6, 12.3, 3, stylusId, Qt::NoModifier);
QTRY_COMPARE(handler->active(), true);
QCOMPARE(activeSpy.count(), 1);
QCOMPARE(pointSpy.count(), 1);
@@ -170,7 +170,7 @@ void tst_PointHandler::tabletStylus()
point += QPoint(10, 10);
QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point),
- QTabletEvent::Stylus, QTabletEvent::Pen, Qt::LeftButton, 0.45, 23, 33, 0.57, 15.6, 3.4, stylusId, Qt::NoModifier);
+ int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::LeftButton, 0.45, 23, 33, 0.57, 15.6, 3, stylusId, Qt::NoModifier);
QTRY_COMPARE(pointSpy.count(), 2);
QCOMPARE(handler->active(), true);
QCOMPARE(activeSpy.count(), 1);
@@ -188,7 +188,7 @@ void tst_PointHandler::tabletStylus()
QCOMPARE(translationSpy.count(), 2);
QWindowSystemInterface::handleTabletEvent(window, point, window->mapToGlobal(point),
- QTabletEvent::Stylus, QTabletEvent::Pen, Qt::NoButton, 0, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier);
+ int(QInputDevice::DeviceType::Stylus), int(QPointingDevice::PointerType::Pen), Qt::NoButton, 0, 0, 0, 0, 0, 0, stylusId, Qt::NoModifier);
QTRY_COMPARE(handler->active(), false);
QCOMPARE(activeSpy.count(), 2);
QCOMPARE(pointSpy.count(), 3);
diff --git a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
index 419afed3ac..32a68293c2 100644
--- a/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
+++ b/tests/auto/quick/pointerhandlers/qquicktaphandler/tst_qquicktaphandler.cpp
@@ -51,7 +51,6 @@ class tst_TapHandler : public QQmlDataTest
Q_OBJECT
public:
tst_TapHandler()
- :touchDevice(QTest::createTouchDevice())
{}
private slots:
@@ -74,7 +73,7 @@ private slots:
private:
void createView(QScopedPointer<QQuickView> &window, const char *fileName);
- QTouchDevice *touchDevice;
+ QPointingDevice *touchDevice = QTest::createTouchDevice();
};
void tst_TapHandler::createView(QScopedPointer<QQuickView> &window, const char *fileName)
diff --git a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
index 9f7cfa842e..dcf5a0b09e 100644
--- a/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
+++ b/tests/auto/quick/qquickflickable/tst_qquickflickable.cpp
@@ -149,7 +149,6 @@ class tst_qquickflickable : public QQmlDataTest
Q_OBJECT
public:
tst_qquickflickable()
- : touchDevice(QTest::createTouchDevice())
{}
private slots:
@@ -209,7 +208,7 @@ private slots:
private:
void flickWithTouch(QQuickWindow *window, const QPoint &from, const QPoint &to);
- QTouchDevice *touchDevice;
+ QPointingDevice *touchDevice = QTest::createTouchDevice();
};
void tst_qquickflickable::initTestCase()
diff --git a/tests/auto/quick/qquickitem/tst_qquickitem.cpp b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
index 77f183ad2a..924a1d2c4e 100644
--- a/tests/auto/quick/qquickitem/tst_qquickitem.cpp
+++ b/tests/auto/quick/qquickitem/tst_qquickitem.cpp
@@ -1337,12 +1337,7 @@ void tst_qquickitem::touchEventAcceptIgnore()
item->setParentItem(window.contentItem());
item->acceptIncomingTouchEvents = itemSupportsTouch;
- static QTouchDevice* device = nullptr;
- if (!device) {
- device =new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
- }
+ static QPointingDevice* device = QTest::createTouchDevice();
// Send Begin, Update & End touch sequence
{
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index 56c3f370d2..4f504103d4 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -352,7 +352,7 @@ private:
QQuickView *m_view;
QString testForView;
- QTouchDevice *touchDevice = QTest::createTouchDevice();
+ QPointingDevice *touchDevice = QTest::createTouchDevice();
};
class TestObject : public QObject
@@ -9673,8 +9673,7 @@ void tst_QQuickListView::touchCancel() // QTBUG-74679
// and because Flickable filtered it, QQuickFlickablePrivate::pressed
// should be true, but it's not easily tested here
- QTouchEvent cancelEvent(QEvent::TouchCancel);
- cancelEvent.setDevice(touchDevice);
+ QTouchEvent cancelEvent(QEvent::TouchCancel, touchDevice);
QCoreApplication::sendEvent(window.data(), &cancelEvent);
// now QQuickWindowPrivate::sendUngrabEvent() will be called, Flickable will filter it,
// QQuickFlickablePrivate::pressed will be set to false, and that will allow setCurrentIndex() to make it move
diff --git a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
index 5879fc6897..1d22680261 100644
--- a/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
+++ b/tests/auto/quick/qquickmousearea/tst_qquickmousearea.cpp
@@ -94,14 +94,12 @@ class tst_QQuickMouseArea: public QQmlDataTest
Q_OBJECT
public:
tst_QQuickMouseArea()
- : device(nullptr)
{
qmlRegisterType<CircleMask>("Test", 1, 0, "CircleMask");
qmlRegisterType<EventSender>("Test", 1, 0, "EventSender");
}
private slots:
- void initTestCase() override;
void dragProperties();
void resetDrag();
void dragging_data() { acceptedButton_data(); }
@@ -166,22 +164,12 @@ private:
}
void acceptedButton_data();
void rejectedButton_data();
- QTouchDevice *device;
+ QPointingDevice *device = QTest::createTouchDevice();
};
Q_DECLARE_METATYPE(Qt::MouseButton)
Q_DECLARE_METATYPE(Qt::MouseButtons)
-void tst_QQuickMouseArea::initTestCase()
-{
- QQmlDataTest::initTestCase();
- if (!device) {
- device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
- }
-}
-
void tst_QQuickMouseArea::acceptedButton_data()
{
QTest::addColumn<Qt::MouseButtons>("acceptedButtons");
diff --git a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
index c18a220996..04a44a2c10 100644
--- a/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
+++ b/tests/auto/quick/qquickmultipointtoucharea/tst_qquickmultipointtoucharea.cpp
@@ -47,14 +47,6 @@ public:
tst_QQuickMultiPointTouchArea() { }
private slots:
- void initTestCase() {
- QQmlDataTest::initTestCase();
- if (!device) {
- device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
- }
- }
void cleanupTestCase() {}
void properties();
@@ -80,7 +72,7 @@ private slots:
private:
QQuickView *createAndShowView(const QString &file);
- QTouchDevice *device = nullptr;
+ QPointingDevice *device = QTest::createTouchDevice();
};
void tst_QQuickMultiPointTouchArea::properties()
@@ -838,7 +830,7 @@ void tst_QQuickMultiPointTouchArea::inFlickableWithPressDelay() // QTBUG-78818
QTest::touchEvent(window.data(), device).press(0, p1);
QQuickTouchUtils::flush(window.data());
QTRY_COMPARE(point11->pressed(), true);
- auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0));
+ auto pointerEvent = windowPriv->pointerEventInstance(device);
QCOMPARE(pointerEvent->point(0)->exclusiveGrabber(), mpta);
// release: MPTA receives TouchEnd (which is asymmetric with mouse press); does NOT emit canceled.
diff --git a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
index 5b7108d96b..3213d49dd5 100644
--- a/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
+++ b/tests/auto/quick/qquickpincharea/tst_qquickpincharea.cpp
@@ -43,7 +43,6 @@ class tst_QQuickPinchArea: public QQmlDataTest
public:
tst_QQuickPinchArea() { }
private slots:
- void initTestCase();
void cleanupTestCase();
void pinchProperties();
void scale();
@@ -55,17 +54,8 @@ private slots:
private:
QQuickView *createView();
- QTouchDevice *device = nullptr;
+ QPointingDevice *device = QTest::createTouchDevice();
};
-void tst_QQuickPinchArea::initTestCase()
-{
- QQmlDataTest::initTestCase();
- if (!device) {
- device = new QTouchDevice;
- device->setType(QTouchDevice::TouchScreen);
- QWindowSystemInterface::registerTouchDevice(device);
- }
-}
void tst_QQuickPinchArea::cleanupTestCase()
{
@@ -510,8 +500,7 @@ void tst_QQuickPinchArea::cancel()
QCOMPARE(root->property("center").toPointF(), QPointF(40, 40)); // blackrect is at 50,50
QCOMPARE(blackRect->scale(), 1.5);
- QTouchEvent cancelEvent(QEvent::TouchCancel);
- cancelEvent.setDevice(device);
+ QTouchEvent cancelEvent(QEvent::TouchCancel, device);
QCoreApplication::sendEvent(window, &cancelEvent);
QQuickTouchUtils::flush(window);
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index c957d2d702..39cb911647 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -171,7 +171,7 @@ public:
lastVelocity = lastVelocityFromMouseMove = QVector2D();
lastMousePos = QPointF();
- lastMouseCapabilityFlags = 0;
+ lastMouseCapabilityFlags = {};
touchEventCount = 0;
mouseMoveCount = 0;
mouseUngrabEventCount = 0;
@@ -199,7 +199,7 @@ public:
QVector2D lastVelocity;
QVector2D lastVelocityFromMouseMove;
QPointF lastMousePos;
- int lastMouseCapabilityFlags;
+ QInputDevice::Capabilities lastMouseCapabilityFlags;
void touchEvent(QTouchEvent *event) {
if (!acceptTouchEvents) {
@@ -208,7 +208,7 @@ public:
}
++touchEventCount;
lastEvent = makeTouchData(event->type(), event->window(), event->touchPointStates(), event->touchPoints());
- if (event->device()->capabilities().testFlag(QTouchDevice::Velocity) && !event->touchPoints().isEmpty()) {
+ if (event->device()->capabilities().testFlag(QPointingDevice::Capability::Velocity) && !event->touchPoints().isEmpty()) {
lastVelocity = event->touchPoints().first().velocity();
} else {
lastVelocity = QVector2D();
@@ -225,7 +225,7 @@ public:
}
mousePressCount = ++mousePressNum;
lastMousePos = e->position().toPoint();
- lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
+ lastMouseCapabilityFlags = e->device()->capabilities();
}
void mouseMoveEvent(QMouseEvent *e) {
@@ -235,7 +235,7 @@ public:
}
mouseMoveCount = ++mouseMoveNum;
lastVelocityFromMouseMove = QGuiApplicationPrivate::mouseEventVelocity(e);
- lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
+ lastMouseCapabilityFlags = e->device()->capabilities();
lastMousePos = e->position().toPoint();
}
@@ -246,7 +246,7 @@ public:
}
++mouseReleaseNum;
lastMousePos = e->position().toPoint();
- lastMouseCapabilityFlags = QGuiApplicationPrivate::mouseEventCaps(e);
+ lastMouseCapabilityFlags = e->device()->capabilities();
}
void mouseUngrabEvent() {
@@ -382,10 +382,10 @@ class tst_qquickwindow : public QQmlDataTest
public:
tst_qquickwindow()
: touchDevice(QTest::createTouchDevice())
- , touchDeviceWithVelocity(QTest::createTouchDevice())
+ , touchDeviceWithVelocity(QTest::createTouchDevice(QInputDevice::DeviceType::TouchScreen,
+ QInputDevice::Capability::Position | QPointingDevice::Capability::Velocity))
{
QQuickWindow::setDefaultAlphaBuffer(true);
- touchDeviceWithVelocity->setCapabilities(QTouchDevice::Position | QTouchDevice::Velocity);
}
private slots:
@@ -501,8 +501,8 @@ private slots:
void rendererInterfaceWithRenderControl();
private:
- QTouchDevice *touchDevice;
- QTouchDevice *touchDeviceWithVelocity;
+ QPointingDevice *touchDevice;
+ QPointingDevice *touchDeviceWithVelocity;
};
#if QT_CONFIG(opengl)
@@ -1185,7 +1185,7 @@ void tst_qquickwindow::mouseFromTouch_basic()
QCOMPARE(item->mouseReleaseNum, 1);
QCOMPARE(item->lastMousePos.toPoint(), item->mapFromScene(points[0].position()).toPoint());
QCOMPARE(item->lastVelocityFromMouseMove, velocity);
- QVERIFY((item->lastMouseCapabilityFlags & QTouchDevice::Velocity) != 0);
+// QVERIFY(item->lastMouseCapabilityFlags.testFlag(QInputDevice::Capability::Velocity)); // TODO
// Now the same with a transformation.
item->setRotation(90); // clockwise
@@ -2850,7 +2850,7 @@ void tst_qquickwindow::pointerEventTypeAndPointCount()
QList<QTouchEvent::TouchPoint>() << QTouchEvent::TouchPoint(1));
- QQuickPointerMouseEvent pme(nullptr, QQuickPointerDevice::genericMouseDevice());
+ QQuickPointerMouseEvent pme(nullptr, QPointingDevice::primaryPointingDevice());
pme.reset(&me);
QCOMPARE(pme.asMouseEvent(localPosition), &me);
QVERIFY(pme.asPointerMouseEvent());
@@ -2862,7 +2862,7 @@ void tst_qquickwindow::pointerEventTypeAndPointCount()
QCOMPARE(pme.asMouseEvent(localPosition)->position(), localPosition);
QCOMPARE(pme.asMouseEvent(localPosition)->globalPosition(), screenPosition);
- QQuickPointerTouchEvent pte(nullptr, QQuickPointerDevice::touchDevice(touchDevice));
+ QQuickPointerTouchEvent pte(nullptr, touchDevice);
pte.reset(&te);
QCOMPARE(pte.asTouchEvent(), &te);
QVERIFY(!pte.asPointerMouseEvent());
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
index b0d31e9121..9117df812a 100644
--- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp
+++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp
@@ -173,7 +173,6 @@ class tst_TouchMouse : public QQmlDataTest
Q_OBJECT
public:
tst_TouchMouse()
- :device(QTest::createTouchDevice())
{}
private slots:
@@ -218,7 +217,7 @@ protected:
private:
QQuickView *createView();
- QTouchDevice *device;
+ QPointingDevice *device = QTest::createTouchDevice();
QList<Event> filteredEventList;
};
@@ -613,7 +612,7 @@ void tst_TouchMouse::buttonOnFlickable()
QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data());
QVERIFY(windowPriv->touchMouseId != -1);
- auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0));
+ auto pointerEvent = windowPriv->pointerEventInstance(device);
QCOMPARE(pointerEvent->point(0)->exclusiveGrabber(), eventItem1);
QCOMPARE(window->mouseGrabberItem(), eventItem1);
@@ -674,7 +673,7 @@ void tst_TouchMouse::touchButtonOnFlickable()
QQuickWindowPrivate *windowPriv = QQuickWindowPrivate::get(window.data());
QVERIFY(windowPriv->touchMouseId == -1);
- auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0));
+ auto pointerEvent = windowPriv->pointerEventInstance(device);
QCOMPARE(pointerEvent->point(0)->grabberItem(), eventItem2);
QCOMPARE(window->mouseGrabberItem(), nullptr);
@@ -808,7 +807,7 @@ void tst_TouchMouse::buttonOnDelayedPressFlickable()
// for the touchMouseId to the new grabber.
QCOMPARE(window->mouseGrabberItem(), flickable);
QVERIFY(windowPriv->touchMouseId != -1);
- auto pointerEvent = windowPriv->pointerEventInstance(QQuickPointerDevice::touchDevices().at(0));
+ auto pointerEvent = windowPriv->pointerEventInstance(device);
QCOMPARE(pointerEvent->point(0)->grabberItem(), flickable);
}
@@ -1464,10 +1463,6 @@ void tst_TouchMouse::touchPointDeliveryOrder()
void tst_TouchMouse::hoverEnabled()
{
- // QTouchDevice *device = new QTouchDevice;
- // device->setType(QTouchDevice::TouchScreen);
- // QWindowSystemInterface::registerTouchDevice(device);
-
QScopedPointer<QQuickView> window(createView());
window->setSource(testFileUrl("hoverMouseAreas.qml"));
QQuickViewTestUtil::centerOnScreen(window.data());
diff --git a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
index 3f67006554..e205d2e8f2 100644
--- a/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
+++ b/tests/auto/quickwidgets/qquickwidget/tst_qquickwidget.cpp
@@ -146,7 +146,7 @@ private slots:
void resizeOverlay();
private:
- QTouchDevice *device = QTest::createTouchDevice();
+ QPointingDevice *device = QTest::createTouchDevice();
const QRect m_availableGeometry = QGuiApplication::primaryScreen()->availableGeometry();
};