summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@qt.io>2020-11-04 22:10:35 +0100
committerShawn Rutledge <shawn.rutledge@qt.io>2020-11-07 06:24:38 +0100
commit9a1a15b42fb526ad4f80944afb7761bfff1b5c9d (patch)
tree058dd55dff01b3d6a429ff863132e33c05d019be /tests/auto/gui
parentbdec189ecbc2cabbfa803a571b49533f190f053d (diff)
Introduce QEvent::isSinglePointEvent()
This makes high-level event dispatching easier: for example we often need to cast an event to access getters like button() and buttons(). We can so far assume that any QPointerEvent that is not a QTouchEvent is a QSinglePointEvent; but more explicit type-checking looks safer. Implemented in a similar way as c7f727996909338c3689396160f3060480521846. Change-Id: I980d759e2a7538b6b30fd3bdc3be0c351ec6c246 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
Diffstat (limited to 'tests/auto/gui')
-rw-r--r--tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp2
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp1
2 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
index 42a5f4d593..67fca910b9 100644
--- a/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
+++ b/tests/auto/gui/kernel/qmouseevent/tst_qmouseevent.cpp
@@ -159,6 +159,7 @@ void tst_QMouseEvent::mouseEventBasic()
QMouseEvent me(QEvent::MouseButtonPress, local, scene, screen, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
QVERIFY(me.isInputEvent());
QVERIFY(me.isPointerEvent());
+ QVERIFY(me.isSinglePointEvent());
QCOMPARE(me.isAccepted(), true);
QCOMPARE(me.button(), Qt::LeftButton);
QCOMPARE(me.buttons(), Qt::LeftButton);
@@ -183,6 +184,7 @@ void tst_QMouseEvent::mouseEventBasic()
QMouseEvent copy(me);
QVERIFY(copy.isInputEvent());
QVERIFY(copy.isPointerEvent());
+ QVERIFY(copy.isSinglePointEvent());
QVERIFY(!copy.isBeginEvent());
QVERIFY(copy.isEndEvent());
QCOMPARE(copy.position(), local);
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index bbd7cb22a0..58e7fd2eed 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -343,6 +343,7 @@ void tst_QTouchEvent::state()
QVERIFY(!touchEvent.isEndEvent());
QVERIFY(touchEvent.isInputEvent());
QVERIFY(touchEvent.isPointerEvent());
+ QVERIFY(!touchEvent.isSinglePointEvent());
touchEvent = QTouchEvent(QEvent::TouchBegin, touchScreenDevice,
Qt::NoModifier, QList<QEventPoint>() <<