diff options
author | Paul Olav Tvete <paul.tvete@nokia.com> | 2012-07-26 18:48:56 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-02 17:25:37 +0200 |
commit | 5ac4a1304b44283bb0ddf593b08e7e44ed9a107f (patch) | |
tree | 632ffbe48e35227ca25faa6797f2e75901e673e6 /tests/auto | |
parent | 4c4ba15a409737abe7cc07bdc452d556ec9ecbdc (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')
12 files changed, 101 insertions, 37 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro index e433e95401..8c26529170 100644 --- a/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro +++ b/tests/auto/gui/kernel/qguiapplication/qguiapplication.pro @@ -1,5 +1,5 @@ CONFIG += testcase TARGET = tst_qguiapplication -QT += core gui testlib +QT += core gui gui-private testlib SOURCES = tst_qguiapplication.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index 8eb0234c2c..f7f0f8d28c 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -43,6 +43,8 @@ #include <QtTest/QtTest> #include <QtGui/QGuiApplication> #include <QtGui/QWindow> +#include <QtGui/QWindowSystemInterface> + #include <QDebug> class tst_QGuiApplication: public QObject diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp index e6c28867c6..8a0246c71e 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <qscreen.h> +#include <QtGui/QWindowSystemInterface> #include <QtTest/QtTest> diff --git a/tests/auto/gui/kernel/qtouchevent/qtouchevent.pro b/tests/auto/gui/kernel/qtouchevent/qtouchevent.pro index 83978cb318..c6e9aa8a2e 100644 --- a/tests/auto/gui/kernel/qtouchevent/qtouchevent.pro +++ b/tests/auto/gui/kernel/qtouchevent/qtouchevent.pro @@ -1,4 +1,4 @@ SOURCES=tst_qtouchevent.cpp TARGET=tst_qtouchevent -QT += testlib widgets +QT += testlib widgets gui-private DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 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(); } diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index f2393f905e..0346284e61 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <qwindow.h> +#include <QtGui/QWindowSystemInterface> #include <QtTest/QtTest> diff --git a/tests/auto/other/gestures/gestures.pro b/tests/auto/other/gestures/gestures.pro index a4e78ef4b4..fa87dbddfb 100644 --- a/tests/auto/other/gestures/gestures.pro +++ b/tests/auto/other/gestures/gestures.pro @@ -1,5 +1,5 @@ CONFIG += testcase TARGET = tst_gestures -QT += widgets testlib +QT += widgets testlib gui-private SOURCES += tst_gestures.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/other/gestures/tst_gestures.cpp b/tests/auto/other/gestures/tst_gestures.cpp index db10877b8a..fb27df5555 100644 --- a/tests/auto/other/gestures/tst_gestures.cpp +++ b/tests/auto/other/gestures/tst_gestures.cpp @@ -52,6 +52,7 @@ #include <qgraphicswidget.h> #include <qgraphicsview.h> #include <qmainwindow.h> +#include <QtGui/QWindowSystemInterface> #include <qdebug.h> diff --git a/tests/auto/other/qaccessibility/qaccessibility.pro b/tests/auto/other/qaccessibility/qaccessibility.pro index 13c9c361ce..919c24d80b 100644 --- a/tests/auto/other/qaccessibility/qaccessibility.pro +++ b/tests/auto/other/qaccessibility/qaccessibility.pro @@ -1,7 +1,7 @@ CONFIG += testcase TARGET = tst_qaccessibility requires(contains(QT_CONFIG,accessibility)) -QT += widgets testlib +QT += widgets testlib gui-private SOURCES += tst_qaccessibility.cpp unix:!mac:LIBS+=-lm diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 2df89c076b..f98946d794 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -69,7 +69,37 @@ #include <windows.h> #endif +#include <QtGui/QWindowSystemInterface> + + QT_BEGIN_NAMESPACE +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; +} + + + extern bool Q_GUI_EXPORT qt_tab_all_widgets; // from qapplication.cpp QT_END_NAMESPACE @@ -1926,11 +1956,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!window.seenTouchEvent); QVERIFY(window.seenMouseEvent); // Since QApplication transforms ignored touch events in mouse events @@ -1940,11 +1970,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(window.seenTouchEvent); QVERIFY(window.seenMouseEvent); @@ -1954,11 +1984,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(window.seenTouchEvent); QVERIFY(!window.seenMouseEvent); @@ -1978,11 +2008,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); QVERIFY(widget.seenMouseEvent); @@ -1995,11 +2025,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(widget.seenTouchEvent); QVERIFY(widget.seenMouseEvent); @@ -2012,11 +2042,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(widget.seenTouchEvent); QVERIFY(widget.seenMouseEvent); @@ -2029,11 +2059,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(widget.seenTouchEvent); QVERIFY(!widget.seenMouseEvent); @@ -2047,11 +2077,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); QVERIFY(widget.seenMouseEvent); @@ -2064,11 +2094,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); QVERIFY(widget.seenMouseEvent); @@ -2082,11 +2112,11 @@ void tst_QApplication::touchEventPropagation() QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(pressedTouchPoints)); + touchPointList(pressedTouchPoints)); QWindowSystemInterface::handleTouchEvent(window.windowHandle(), 0, device, - QTest::QTouchEventSequence::touchPointList(releasedTouchPoints)); + touchPointList(releasedTouchPoints)); QCoreApplication::processEvents(); QVERIFY(!widget.seenTouchEvent); QVERIFY(widget.seenMouseEvent); diff --git a/tests/auto/widgets/util/qscroller/qscroller.pro b/tests/auto/widgets/util/qscroller/qscroller.pro index 9895ec661e..6f999f62c6 100644 --- a/tests/auto/widgets/util/qscroller/qscroller.pro +++ b/tests/auto/widgets/util/qscroller/qscroller.pro @@ -2,6 +2,6 @@ CONFIG += testcase CONFIG += parallel_test TARGET = tst_qscroller -QT += widgets testlib +QT += widgets testlib gui-private SOURCES += tst_qscroller.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 diff --git a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp index 1eabbdf43f..67117eb51a 100644 --- a/tests/auto/widgets/util/qscroller/tst_qscroller.cpp +++ b/tests/auto/widgets/util/qscroller/tst_qscroller.cpp @@ -42,6 +42,8 @@ #include <QtGui> #include <QtWidgets> #include <QtTest> +#include <QtGui/QWindowSystemInterface> + // #include <QDebug> class tst_QScrollerWidget : public QWidget |