summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtouchevent
diff options
context:
space:
mode:
authorBradley T. Hughes <bradley.hughes@nokia.com>2009-06-24 12:34:31 +0200
committerBradley T. Hughes <bradley.hughes@nokia.com>2009-06-24 12:34:31 +0200
commitd3ce585a235e6a92b8a662c06f8686da977daa49 (patch)
tree92532e67293b2fde9ba44867ff4ffb1e966efaa3 /tests/auto/qtouchevent
parentd8b81cad37e9477e609bbbedf0e666163bbbd813 (diff)
Add QTouchEvent::DeviceType and deviceType()
This enum indicates what kind of device generated the touch event (TouchScreen or TouchPad). We use this information to control how touch events are sent, specifically we restrict touch events to a single widget/QGraphicsItem on touch-pads, since there is no direct relationship between the physical touch location on the pad and the on- using the touch-pad).
Diffstat (limited to 'tests/auto/qtouchevent')
-rw-r--r--tests/auto/qtouchevent/tst_qtouchevent.cpp33
1 files changed, 27 insertions, 6 deletions
diff --git a/tests/auto/qtouchevent/tst_qtouchevent.cpp b/tests/auto/qtouchevent/tst_qtouchevent.cpp
index b21ba40956..dee059b3fb 100644
--- a/tests/auto/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/qtouchevent/tst_qtouchevent.cpp
@@ -109,6 +109,7 @@ private slots:
void touchBeginPropagatesWhenIgnored();
void touchUpdateAndEndNeverPropagate();
void basicRawEventTranslation();
+ void multiPointRawEventTranslation();
};
void tst_QTouchEvent::touchDisabledByDefault()
@@ -121,6 +122,7 @@ void tst_QTouchEvent::touchDisabledByDefault()
QList<QTouchEvent::TouchPoint> touchPoints;
touchPoints.append(QTouchEvent::TouchPoint(0));
QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
touchPoints);
@@ -140,6 +142,7 @@ void tst_QTouchEvent::touchEventAcceptedByDefault()
QList<QTouchEvent::TouchPoint> touchPoints;
touchPoints.append(QTouchEvent::TouchPoint(0));
QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
touchPoints);
@@ -171,6 +174,7 @@ void tst_QTouchEvent::touchBeginPropagatesWhenIgnored()
QList<QTouchEvent::TouchPoint> touchPoints;
touchPoints.append(QTouchEvent::TouchPoint(0));
QTouchEvent touchEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
touchPoints);
@@ -210,6 +214,7 @@ void tst_QTouchEvent::touchUpdateAndEndNeverPropagate()
QList<QTouchEvent::TouchPoint> touchPoints;
touchPoints.append(QTouchEvent::TouchPoint(0));
QTouchEvent touchBeginEvent(QEvent::TouchBegin,
+ QTouchEvent::TouchScreen,
Qt::NoModifier,
Qt::TouchPointPressed,
touchPoints);
@@ -221,6 +226,7 @@ void tst_QTouchEvent::touchUpdateAndEndNeverPropagate()
// send the touch update to the child, but ignore it, it doesn't propagate
QTouchEvent touchUpdateEvent(QEvent::TouchUpdate,
+ QTouchEvent::TouchScreen,
Qt::NoModifier,
Qt::TouchPointMoved,
touchPoints);
@@ -232,9 +238,10 @@ void tst_QTouchEvent::touchUpdateAndEndNeverPropagate()
// send the touch end, same thing should happen as with touch update
QTouchEvent touchEndEvent(QEvent::TouchEnd,
- Qt::NoModifier,
- Qt::TouchPointReleased,
- touchPoints);
+ QTouchEvent::TouchScreen,
+ Qt::NoModifier,
+ Qt::TouchPointReleased,
+ touchPoints);
res = QApplication::sendEvent(&child, &touchEndEvent);
QVERIFY(res);
QVERIFY(!touchEndEvent.isAccepted());
@@ -261,7 +268,9 @@ void tst_QTouchEvent::basicRawEventTranslation()
rawTouchPoint.setScreenPos(screenPos);
rawTouchPoint.setNormalizedPos(QPointF(rawTouchPoint.pos().x() / screenGeometry.width(),
rawTouchPoint.pos().y() / screenGeometry.height()));
- qt_translateRawTouchEvent(QList<QTouchEvent::TouchPoint>() << rawTouchPoint, &touchWidget);
+ qt_translateRawTouchEvent(&touchWidget,
+ QTouchEvent::TouchScreen,
+ QList<QTouchEvent::TouchPoint>() << rawTouchPoint);
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd);
@@ -291,7 +300,9 @@ void tst_QTouchEvent::basicRawEventTranslation()
rawTouchPoint.setScreenPos(screenPos + delta);
rawTouchPoint.setNormalizedPos(QPointF(rawTouchPoint.pos().x() / screenGeometry.width(),
rawTouchPoint.pos().y() / screenGeometry.height()));
- qt_translateRawTouchEvent(QList<QTouchEvent::TouchPoint>() << rawTouchPoint, &touchWidget);
+ qt_translateRawTouchEvent(&touchWidget,
+ QTouchEvent::TouchScreen,
+ QList<QTouchEvent::TouchPoint>() << rawTouchPoint);
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(!touchWidget.seenTouchEnd);
@@ -321,7 +332,9 @@ void tst_QTouchEvent::basicRawEventTranslation()
rawTouchPoint.setScreenPos(screenPos + delta + delta);
rawTouchPoint.setNormalizedPos(QPointF(rawTouchPoint.pos().x() / screenGeometry.width(),
rawTouchPoint.pos().y() / screenGeometry.height()));
- qt_translateRawTouchEvent(QList<QTouchEvent::TouchPoint>() << rawTouchPoint, &touchWidget);
+ qt_translateRawTouchEvent(&touchWidget,
+ QTouchEvent::TouchScreen,
+ QList<QTouchEvent::TouchPoint>() << rawTouchPoint);
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
QVERIFY(touchWidget.seenTouchEnd);
@@ -347,6 +360,14 @@ void tst_QTouchEvent::basicRawEventTranslation()
QCOMPARE(touchEndPoint.pressure(), qreal(-1.));
}
+void tst_QTouchEvent::multiPointRawEventTranslation()
+{
+
+
+
+
+}
+
QTEST_MAIN(tst_QTouchEvent)
#include "tst_qtouchevent.moc"