diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-02-27 10:22:36 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2015-03-03 13:30:39 +0000 |
commit | 877032bfdf0376cb5e438b3abe3fe5f45ce982c0 (patch) | |
tree | 1399f8841235294384c1cd04056f2307e0b5f01d | |
parent | 34a58b0eb7c0c40be87e62251bc714d63293d51a (diff) |
autotests: fix the build in case of QT_NO_WHEELEVENT
Wheel event tests aren't possible if there's no wheel event.
Change-Id: Ibe380c01fbf6cebfd2f43c6ecb52863134ea3c01
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
7 files changed, 34 insertions, 1 deletions
diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index c1027dac18..f8d852888c 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -123,7 +123,9 @@ private slots: void resizeEvent_data(); void resizeEvent(); void paintEvent(); +#ifndef QT_NO_WHEELEVENT void wheelEvent(); +#endif void sizeHint_data(); void sizeHint(); void sizePolicy(); @@ -260,6 +262,7 @@ public: int focusOut; }; +#ifndef QT_NO_WHEELEVENT class WheelWidget : public QWidget { public: @@ -269,6 +272,7 @@ public: bool wheelEventCalled; }; +#endif // !QT_NO_WHEELEVENT // This will be called before the first test function is executed. // It is only called once. @@ -1308,6 +1312,7 @@ void tst_QGraphicsProxyWidget::paintEvent() } +#ifndef QT_NO_WHEELEVENT void tst_QGraphicsProxyWidget::wheelEvent() { QGraphicsScene scene; @@ -1331,6 +1336,7 @@ void tst_QGraphicsProxyWidget::wheelEvent() QVERIFY(event.isAccepted()); QVERIFY(wheelWidget->wheelEventCalled); } +#endif // !QT_NO_WHEELEVENT Q_DECLARE_METATYPE(Qt::SizeHint) void tst_QGraphicsProxyWidget::sizeHint_data() diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 783395fed4..119e9dfecb 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -198,7 +198,9 @@ private slots: void mapFromScenePoly(); void mapFromScenePath(); void sendEvent(); +#ifndef QT_NO_WHEELEVENT void wheelEvent(); +#endif #ifndef QTEST_NO_CURSOR void cursor(); void cursor2(); @@ -2172,6 +2174,7 @@ void tst_QGraphicsView::sendEvent() QCOMPARE(item->events.last(), QEvent::KeyPress); } +#ifndef QT_NO_WHEELEVENT class MouseWheelScene : public QGraphicsScene { public: @@ -2228,6 +2231,7 @@ void tst_QGraphicsView::wheelEvent() QCOMPARE(spy.count(), 2); QVERIFY(widget->hasFocus()); } +#endif // !QT_NO_WHEELEVENT #ifndef QTEST_NO_CURSOR void tst_QGraphicsView::cursor() diff --git a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp index 4bea53c926..a11d423896 100644 --- a/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp +++ b/tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp @@ -195,15 +195,19 @@ private slots: void task191545_dragSelectRows(); void taskQTBUG_5062_spansInconsistency(); void taskQTBUG_4516_clickOnRichTextLabel(); +#ifndef QT_NO_WHEELEVENT void taskQTBUG_5237_wheelEventOnHeader(); +#endif void taskQTBUG_8585_crashForNoGoodReason(); void taskQTBUG_7774_RtoLVisualRegionForSelection(); void taskQTBUG_8777_scrollToSpans(); void taskQTBUG_10169_sizeHintForRow(); void taskQTBUG_30653_doItemsLayout(); +#ifndef QT_NO_WHEELEVENT void mouseWheel_data(); void mouseWheel(); +#endif void addColumnWhileEditing(); void task234926_setHeaderSorting(); @@ -3994,7 +3998,7 @@ void tst_QTableView::task248688_autoScrollNavigation() } } - +#ifndef QT_NO_WHEELEVENT void tst_QTableView::mouseWheel_data() { QTest::addColumn<int>("scrollMode"); @@ -4051,6 +4055,7 @@ void tst_QTableView::mouseWheel() QApplication::sendEvent(view.viewport(), &verticalEvent); QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10); } +#endif // !QT_NO_WHEELEVENT void tst_QTableView::addColumnWhileEditing() { @@ -4311,6 +4316,7 @@ void tst_QTableView::changeHeaderData() QVERIFY(view.verticalHeader()->width() > textWidth); } +#ifndef QT_NO_WHEELEVENT void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader() { QTableView view; @@ -4327,6 +4333,7 @@ void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader() int sbValueAfter = view.verticalScrollBar()->value(); QVERIFY(sbValueBefore != sbValueAfter); } +#endif class TestTableView : public QTableView { Q_OBJECT diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index c3e8b51ccd..c9a1a64135 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -149,7 +149,9 @@ private slots: void execAfterExit(); +#ifndef QT_NO_WHEELEVENT void wheelScrollLines(); +#endif void task109149(); @@ -1844,6 +1846,7 @@ void tst_QApplication::execAfterExit() QCOMPARE(exitCode, 0); } +#ifndef QT_NO_WHEELEVENT void tst_QApplication::wheelScrollLines() { int argc = 1; @@ -1851,6 +1854,7 @@ void tst_QApplication::wheelScrollLines() // If wheelScrollLines returns 0, the mose wheel will be disabled. QVERIFY(app.wheelScrollLines() > 0); } +#endif // !QT_NO_WHEELEVENT void tst_QApplication::style() { diff --git a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp index 7cb15fab3f..3c150e77b9 100644 --- a/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/widgets/widgets/qabstractslider/tst_qabstractslider.cpp @@ -79,8 +79,10 @@ private slots: void minimum_maximum(); void keyPressed_data(); void keyPressed(); +#ifndef QT_NO_WHEELEVENT void wheelEvent_data(); void wheelEvent(); +#endif void sliderPressedReleased_data(); void sliderPressedReleased(); void setOrientation(); @@ -691,6 +693,7 @@ void tst_QAbstractSlider::keyPressed() QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted); } +#ifndef QT_NO_WHEELEVENT void tst_QAbstractSlider::wheelEvent_data() { QTest::addColumn<int>("initialSliderPosition"); @@ -894,6 +897,7 @@ void tst_QAbstractSlider::wheelEvent() if (expectedSignalCount) QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp); } +#endif // !QT_NO_WHEELEVENT void tst_QAbstractSlider::sliderPressedReleased_data() { diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 2a012f0dcd..7b4b65e841 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -122,9 +122,11 @@ private slots: void flaggedItems_data(); void flaggedItems(); void pixmapIcon(); +#ifndef QT_NO_WHEELEVENT void mouseWheel_data(); void mouseWheel(); void popupWheelHandling(); +#endif // !QT_NO_WHEELEVENT void layoutDirection(); void itemListPosition(); void separatorItem_data(); @@ -2004,6 +2006,7 @@ void tst_QComboBox::pixmapIcon() QCOMPARE( box.itemIcon(1).isNull(), false ); } +#ifndef QT_NO_WHEELEVENT // defined to be 120 by the wheel mouse vendors according to the docs #define WHEEL_DELTA 120 @@ -2094,6 +2097,7 @@ void tst_QComboBox::popupWheelHandling() QVERIFY(comboBox->view()->isVisible()); QCOMPARE(comboBox->view()->pos(), popupPos); } +#endif // !QT_NO_WHEELEVENT void tst_QComboBox::layoutDirection() { diff --git a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp index 8f6d54e325..c9ae60dd76 100644 --- a/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp +++ b/tests/auto/widgets/widgets/qdatetimeedit/tst_qdatetimeedit.cpp @@ -236,7 +236,9 @@ private slots: void reverseTest(); void ddMMMMyyyy(); +#ifndef QT_NO_WHEELEVENT void wheelEvent(); +#endif void specialValueCornerCase(); void cursorPositionOnInit(); @@ -3028,6 +3030,7 @@ void tst_QDateTimeEdit::ddMMMMyyyy() QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200"); } +#ifndef QT_NO_WHEELEVENT void tst_QDateTimeEdit::wheelEvent() { testWidget->setDisplayFormat("dddd/MM"); @@ -3040,6 +3043,7 @@ void tst_QDateTimeEdit::wheelEvent() qApp->sendEvent(testWidget, &w); QCOMPARE(testWidget->date(), QDate(2000, 3, 22)); } +#endif // !QT_NO_WHEELEVENT void tst_QDateTimeEdit::specialValueCornerCase() { |