summaryrefslogtreecommitdiffstats
path: root/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2012-07-26 18:48:56 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-02 17:25:37 +0200
commit5ac4a1304b44283bb0ddf593b08e7e44ed9a107f (patch)
tree632ffbe48e35227ca25faa6797f2e75901e673e6 /tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
parent4c4ba15a409737abe7cc07bdc452d556ec9ecbdc (diff)
Make tests compile without gui-private
Add new qt_handleXXX functions that forward to the QWindowSystemInterface functions, and use those in the testlib inline functions. Remove use of struct QWindowSystemInterface::TouchPoint from the testlib header files (requiring some slight increase in ugliness in the two tests that use that struct). Also remove the qmake hack that adds private headers to all tests Change-Id: Iec23537e55a44802f6e9cd463f7a0f82007c5250 Reviewed-by: Paul Olav Tvete <paul.tvete@nokia.com>
Diffstat (limited to 'tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp')
-rw-r--r--tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp51
1 files changed, 39 insertions, 12 deletions
diff --git a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
index a261d05ef3..694a76f355 100644
--- a/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
+++ b/tests/auto/gui/kernel/qtouchevent/tst_qtouchevent.cpp
@@ -42,6 +42,33 @@
#include <QtGui>
#include <QtWidgets>
#include <QtTest>
+#include <QtGui/QWindowSystemInterface>
+
+static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt)
+{
+ QWindowSystemInterface::TouchPoint p;
+ p.id = pt.id();
+ p.flags = pt.flags();
+ p.normalPosition = pt.normalizedPos();
+ p.area = pt.screenRect();
+ p.pressure = pt.pressure();
+ p.state = pt.state();
+ p.velocity = pt.velocity();
+ p.rawPositions = pt.rawScreenPositions();
+ return p;
+}
+
+static QList<struct QWindowSystemInterface::TouchPoint> touchPointList(const QList<QTouchEvent::TouchPoint>& pointList)
+{
+ QList<struct QWindowSystemInterface::TouchPoint> newList;
+
+ Q_FOREACH (QTouchEvent::TouchPoint p, pointList)
+ {
+ newList.append(touchPoint(p));
+ }
+ return newList;
+}
+
class tst_QTouchEventWidget : public QWidget
{
@@ -602,7 +629,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
timestamp,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(
+ touchPointList(
QList<QTouchEvent::TouchPoint>() << rawTouchPoint));
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
@@ -639,7 +666,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(QList<QTouchEvent::TouchPoint>() << rawTouchPoint));
+ touchPointList(QList<QTouchEvent::TouchPoint>() << rawTouchPoint));
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
@@ -672,7 +699,7 @@ void tst_QTouchEvent::basicRawEventTranslation()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(QList<QTouchEvent::TouchPoint>() << rawTouchPoint));
+ touchPointList(QList<QTouchEvent::TouchPoint>() << rawTouchPoint));
QCoreApplication::processEvents();
QVERIFY(touchWidget.seenTouchBegin);
QVERIFY(touchWidget.seenTouchUpdate);
@@ -740,7 +767,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
@@ -805,7 +832,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
@@ -870,7 +897,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchScreen()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
@@ -967,7 +994,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchPadDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
@@ -1032,7 +1059,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchPadDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
@@ -1097,7 +1124,7 @@ void tst_QTouchEvent::multiPointRawEventTranslationOnTouchPad()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchPadDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
QVERIFY(!touchWidget.seenTouchBegin);
QVERIFY(!touchWidget.seenTouchUpdate);
@@ -1359,7 +1386,7 @@ void tst_QTouchEvent::deleteInRawEventTranslation()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
QVERIFY(pl.isNull() && !pc.isNull() && !pr.isNull());
@@ -1370,7 +1397,7 @@ void tst_QTouchEvent::deleteInRawEventTranslation()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
// generate end events on all widget, the right widget should die
@@ -1380,7 +1407,7 @@ void tst_QTouchEvent::deleteInRawEventTranslation()
QWindowSystemInterface::handleTouchEvent(touchWidget.windowHandle(),
0,
touchScreenDevice,
- QTest::QTouchEventSequence::touchPointList(rawTouchPoints));
+ touchPointList(rawTouchPoints));
QCoreApplication::processEvents();
}