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>
This commit is contained in:
Shawn Rutledge 2015-02-27 10:22:36 +01:00
parent 34a58b0eb7
commit 877032bfdf
7 changed files with 34 additions and 1 deletions

View File

@ -123,7 +123,9 @@ private slots:
void resizeEvent_data(); void resizeEvent_data();
void resizeEvent(); void resizeEvent();
void paintEvent(); void paintEvent();
#ifndef QT_NO_WHEELEVENT
void wheelEvent(); void wheelEvent();
#endif
void sizeHint_data(); void sizeHint_data();
void sizeHint(); void sizeHint();
void sizePolicy(); void sizePolicy();
@ -260,6 +262,7 @@ public:
int focusOut; int focusOut;
}; };
#ifndef QT_NO_WHEELEVENT
class WheelWidget : public QWidget class WheelWidget : public QWidget
{ {
public: public:
@ -269,6 +272,7 @@ public:
bool wheelEventCalled; bool wheelEventCalled;
}; };
#endif // !QT_NO_WHEELEVENT
// This will be called before the first test function is executed. // This will be called before the first test function is executed.
// It is only called once. // It is only called once.
@ -1308,6 +1312,7 @@ void tst_QGraphicsProxyWidget::paintEvent()
} }
#ifndef QT_NO_WHEELEVENT
void tst_QGraphicsProxyWidget::wheelEvent() void tst_QGraphicsProxyWidget::wheelEvent()
{ {
QGraphicsScene scene; QGraphicsScene scene;
@ -1331,6 +1336,7 @@ void tst_QGraphicsProxyWidget::wheelEvent()
QVERIFY(event.isAccepted()); QVERIFY(event.isAccepted());
QVERIFY(wheelWidget->wheelEventCalled); QVERIFY(wheelWidget->wheelEventCalled);
} }
#endif // !QT_NO_WHEELEVENT
Q_DECLARE_METATYPE(Qt::SizeHint) Q_DECLARE_METATYPE(Qt::SizeHint)
void tst_QGraphicsProxyWidget::sizeHint_data() void tst_QGraphicsProxyWidget::sizeHint_data()

View File

@ -198,7 +198,9 @@ private slots:
void mapFromScenePoly(); void mapFromScenePoly();
void mapFromScenePath(); void mapFromScenePath();
void sendEvent(); void sendEvent();
#ifndef QT_NO_WHEELEVENT
void wheelEvent(); void wheelEvent();
#endif
#ifndef QTEST_NO_CURSOR #ifndef QTEST_NO_CURSOR
void cursor(); void cursor();
void cursor2(); void cursor2();
@ -2172,6 +2174,7 @@ void tst_QGraphicsView::sendEvent()
QCOMPARE(item->events.last(), QEvent::KeyPress); QCOMPARE(item->events.last(), QEvent::KeyPress);
} }
#ifndef QT_NO_WHEELEVENT
class MouseWheelScene : public QGraphicsScene class MouseWheelScene : public QGraphicsScene
{ {
public: public:
@ -2228,6 +2231,7 @@ void tst_QGraphicsView::wheelEvent()
QCOMPARE(spy.count(), 2); QCOMPARE(spy.count(), 2);
QVERIFY(widget->hasFocus()); QVERIFY(widget->hasFocus());
} }
#endif // !QT_NO_WHEELEVENT
#ifndef QTEST_NO_CURSOR #ifndef QTEST_NO_CURSOR
void tst_QGraphicsView::cursor() void tst_QGraphicsView::cursor()

View File

@ -195,15 +195,19 @@ private slots:
void task191545_dragSelectRows(); void task191545_dragSelectRows();
void taskQTBUG_5062_spansInconsistency(); void taskQTBUG_5062_spansInconsistency();
void taskQTBUG_4516_clickOnRichTextLabel(); void taskQTBUG_4516_clickOnRichTextLabel();
#ifndef QT_NO_WHEELEVENT
void taskQTBUG_5237_wheelEventOnHeader(); void taskQTBUG_5237_wheelEventOnHeader();
#endif
void taskQTBUG_8585_crashForNoGoodReason(); void taskQTBUG_8585_crashForNoGoodReason();
void taskQTBUG_7774_RtoLVisualRegionForSelection(); void taskQTBUG_7774_RtoLVisualRegionForSelection();
void taskQTBUG_8777_scrollToSpans(); void taskQTBUG_8777_scrollToSpans();
void taskQTBUG_10169_sizeHintForRow(); void taskQTBUG_10169_sizeHintForRow();
void taskQTBUG_30653_doItemsLayout(); void taskQTBUG_30653_doItemsLayout();
#ifndef QT_NO_WHEELEVENT
void mouseWheel_data(); void mouseWheel_data();
void mouseWheel(); void mouseWheel();
#endif
void addColumnWhileEditing(); void addColumnWhileEditing();
void task234926_setHeaderSorting(); void task234926_setHeaderSorting();
@ -3994,7 +3998,7 @@ void tst_QTableView::task248688_autoScrollNavigation()
} }
} }
#ifndef QT_NO_WHEELEVENT
void tst_QTableView::mouseWheel_data() void tst_QTableView::mouseWheel_data()
{ {
QTest::addColumn<int>("scrollMode"); QTest::addColumn<int>("scrollMode");
@ -4051,6 +4055,7 @@ void tst_QTableView::mouseWheel()
QApplication::sendEvent(view.viewport(), &verticalEvent); QApplication::sendEvent(view.viewport(), &verticalEvent);
QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10); QVERIFY(qAbs(view.verticalScrollBar()->value() - verticalPosition) < 10);
} }
#endif // !QT_NO_WHEELEVENT
void tst_QTableView::addColumnWhileEditing() void tst_QTableView::addColumnWhileEditing()
{ {
@ -4311,6 +4316,7 @@ void tst_QTableView::changeHeaderData()
QVERIFY(view.verticalHeader()->width() > textWidth); QVERIFY(view.verticalHeader()->width() > textWidth);
} }
#ifndef QT_NO_WHEELEVENT
void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader() void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
{ {
QTableView view; QTableView view;
@ -4327,6 +4333,7 @@ void tst_QTableView::taskQTBUG_5237_wheelEventOnHeader()
int sbValueAfter = view.verticalScrollBar()->value(); int sbValueAfter = view.verticalScrollBar()->value();
QVERIFY(sbValueBefore != sbValueAfter); QVERIFY(sbValueBefore != sbValueAfter);
} }
#endif
class TestTableView : public QTableView { class TestTableView : public QTableView {
Q_OBJECT Q_OBJECT

View File

@ -149,7 +149,9 @@ private slots:
void execAfterExit(); void execAfterExit();
#ifndef QT_NO_WHEELEVENT
void wheelScrollLines(); void wheelScrollLines();
#endif
void task109149(); void task109149();
@ -1844,6 +1846,7 @@ void tst_QApplication::execAfterExit()
QCOMPARE(exitCode, 0); QCOMPARE(exitCode, 0);
} }
#ifndef QT_NO_WHEELEVENT
void tst_QApplication::wheelScrollLines() void tst_QApplication::wheelScrollLines()
{ {
int argc = 1; int argc = 1;
@ -1851,6 +1854,7 @@ void tst_QApplication::wheelScrollLines()
// If wheelScrollLines returns 0, the mose wheel will be disabled. // If wheelScrollLines returns 0, the mose wheel will be disabled.
QVERIFY(app.wheelScrollLines() > 0); QVERIFY(app.wheelScrollLines() > 0);
} }
#endif // !QT_NO_WHEELEVENT
void tst_QApplication::style() void tst_QApplication::style()
{ {

View File

@ -79,8 +79,10 @@ private slots:
void minimum_maximum(); void minimum_maximum();
void keyPressed_data(); void keyPressed_data();
void keyPressed(); void keyPressed();
#ifndef QT_NO_WHEELEVENT
void wheelEvent_data(); void wheelEvent_data();
void wheelEvent(); void wheelEvent();
#endif
void sliderPressedReleased_data(); void sliderPressedReleased_data();
void sliderPressedReleased(); void sliderPressedReleased();
void setOrientation(); void setOrientation();
@ -691,6 +693,7 @@ void tst_QAbstractSlider::keyPressed()
QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted); QCOMPARE(slider->sliderPosition(), expectedSliderPositionVerticalInverted);
} }
#ifndef QT_NO_WHEELEVENT
void tst_QAbstractSlider::wheelEvent_data() void tst_QAbstractSlider::wheelEvent_data()
{ {
QTest::addColumn<int>("initialSliderPosition"); QTest::addColumn<int>("initialSliderPosition");
@ -894,6 +897,7 @@ void tst_QAbstractSlider::wheelEvent()
if (expectedSignalCount) if (expectedSignalCount)
QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp); QVERIFY(actionTriggeredTimeStamp < valueChangedTimeStamp);
} }
#endif // !QT_NO_WHEELEVENT
void tst_QAbstractSlider::sliderPressedReleased_data() void tst_QAbstractSlider::sliderPressedReleased_data()
{ {

View File

@ -122,9 +122,11 @@ private slots:
void flaggedItems_data(); void flaggedItems_data();
void flaggedItems(); void flaggedItems();
void pixmapIcon(); void pixmapIcon();
#ifndef QT_NO_WHEELEVENT
void mouseWheel_data(); void mouseWheel_data();
void mouseWheel(); void mouseWheel();
void popupWheelHandling(); void popupWheelHandling();
#endif // !QT_NO_WHEELEVENT
void layoutDirection(); void layoutDirection();
void itemListPosition(); void itemListPosition();
void separatorItem_data(); void separatorItem_data();
@ -2004,6 +2006,7 @@ void tst_QComboBox::pixmapIcon()
QCOMPARE( box.itemIcon(1).isNull(), false ); QCOMPARE( box.itemIcon(1).isNull(), false );
} }
#ifndef QT_NO_WHEELEVENT
// defined to be 120 by the wheel mouse vendors according to the docs // defined to be 120 by the wheel mouse vendors according to the docs
#define WHEEL_DELTA 120 #define WHEEL_DELTA 120
@ -2094,6 +2097,7 @@ void tst_QComboBox::popupWheelHandling()
QVERIFY(comboBox->view()->isVisible()); QVERIFY(comboBox->view()->isVisible());
QCOMPARE(comboBox->view()->pos(), popupPos); QCOMPARE(comboBox->view()->pos(), popupPos);
} }
#endif // !QT_NO_WHEELEVENT
void tst_QComboBox::layoutDirection() void tst_QComboBox::layoutDirection()
{ {

View File

@ -236,7 +236,9 @@ private slots:
void reverseTest(); void reverseTest();
void ddMMMMyyyy(); void ddMMMMyyyy();
#ifndef QT_NO_WHEELEVENT
void wheelEvent(); void wheelEvent();
#endif
void specialValueCornerCase(); void specialValueCornerCase();
void cursorPositionOnInit(); void cursorPositionOnInit();
@ -3028,6 +3030,7 @@ void tst_QDateTimeEdit::ddMMMMyyyy()
QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200"); QCOMPARE(testWidget->lineEdit()->text(), "01." + QDate::longMonthName(1) + ".200");
} }
#ifndef QT_NO_WHEELEVENT
void tst_QDateTimeEdit::wheelEvent() void tst_QDateTimeEdit::wheelEvent()
{ {
testWidget->setDisplayFormat("dddd/MM"); testWidget->setDisplayFormat("dddd/MM");
@ -3040,6 +3043,7 @@ void tst_QDateTimeEdit::wheelEvent()
qApp->sendEvent(testWidget, &w); qApp->sendEvent(testWidget, &w);
QCOMPARE(testWidget->date(), QDate(2000, 3, 22)); QCOMPARE(testWidget->date(), QDate(2000, 3, 22));
} }
#endif // !QT_NO_WHEELEVENT
void tst_QDateTimeEdit::specialValueCornerCase() void tst_QDateTimeEdit::specialValueCornerCase()
{ {