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();
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()

View File

@ -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()

View File

@ -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

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{

View File

@ -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()
{