diff options
author | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-24 08:30:32 (GMT) |
---|---|---|
committer | Bradley T. Hughes <bradley.hughes@nokia.com> | 2009-06-24 08:30:32 (GMT) |
commit | 0580be5026ec66409259ea546454cbd11666bb75 (patch) | |
tree | 70d87d8841524755be511db5d97feb28d602a0dc | |
parent | d8b81cad37e9477e609bbbedf0e666163bbbd813 (diff) | |
download | Qt-0580be5026ec66409259ea546454cbd11666bb75.zip Qt-0580be5026ec66409259ea546454cbd11666bb75.tar.gz Qt-0580be5026ec66409259ea546454cbd11666bb75.tar.bz2 |
Fix pressure "emulation"
Update the auto test for QTouchEvent to make sure the pressure is set to 1 for
Pressed/Moved/Stationary, but for 0 for Released.
-rw-r--r-- | src/gui/kernel/qapplication.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qtouchevent/tst_qtouchevent.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 9a22fd5..ed6405a 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -5363,7 +5363,7 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, touchPoint.setStartNormalizedPos(previousTouchPoint.startNormalizedPos()); touchPoint.setLastNormalizedPos(previousTouchPoint.normalizedPos()); if (touchPoint.pressure() < qreal(0.)) - touchPoint.setPressure(qreal(0.)); + touchPoint.setPressure(qreal(1.)); d->appCurrentTouchPoints[touchPoint.id()] = touchPoint; break; } diff --git a/tests/auto/qtouchevent/tst_qtouchevent.cpp b/tests/auto/qtouchevent/tst_qtouchevent.cpp index b21ba40..a9206bd 100644 --- a/tests/auto/qtouchevent/tst_qtouchevent.cpp +++ b/tests/auto/qtouchevent/tst_qtouchevent.cpp @@ -284,7 +284,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QCOMPARE(touchBeginPoint.rect(), QRectF(pos, QSizeF(0, 0))); QCOMPARE(touchBeginPoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchBeginPoint.sceneRect(), touchBeginPoint.screenRect()); - QCOMPARE(touchBeginPoint.pressure(), qreal(-1.)); + QCOMPARE(touchBeginPoint.pressure(), qreal(1.)); // moving the point should translate to TouchUpdate rawTouchPoint.setState(Qt::TouchPointMoved); @@ -314,7 +314,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QCOMPARE(touchUpdatePoint.rect(), QRectF(pos + delta, QSizeF(0, 0))); QCOMPARE(touchUpdatePoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchUpdatePoint.sceneRect(), touchUpdatePoint.screenRect()); - QCOMPARE(touchUpdatePoint.pressure(), qreal(-1.)); + QCOMPARE(touchUpdatePoint.pressure(), qreal(1.)); // releasing the point translates to TouchEnd rawTouchPoint.setState(Qt::TouchPointReleased); @@ -344,7 +344,7 @@ void tst_QTouchEvent::basicRawEventTranslation() QCOMPARE(touchEndPoint.rect(), QRectF(pos + delta + delta, QSizeF(0, 0))); QCOMPARE(touchEndPoint.screenRect(), QRectF(rawTouchPoint.screenPos(), QSizeF(0, 0))); QCOMPARE(touchEndPoint.sceneRect(), touchEndPoint.screenRect()); - QCOMPARE(touchEndPoint.pressure(), qreal(-1.)); + QCOMPARE(touchEndPoint.pressure(), qreal(0.)); } QTEST_MAIN(tst_QTouchEvent) |