diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index fbd8b46466..ea27405fb3 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -211,6 +211,10 @@ private slots: void findWithRegExpReturnsFalseIfNoMoreResults(); #endif +#ifndef QT_NO_WHEELEVENT + void wheelEvent(); +#endif + private: void createSelection(); int blockCount() const; @@ -2564,5 +2568,39 @@ void tst_QTextEdit::findWithRegExpReturnsFalseIfNoMoreResults() } #endif +#ifndef QT_NO_WHEELEVENT + +class TextEdit : public QTextEdit +{ +public: + TextEdit(QWidget *parent = 0) + : QTextEdit(parent) + {} + void wheelEvent(QWheelEvent *event) + { + QTextEdit::wheelEvent(event); + } +}; + +void tst_QTextEdit::wheelEvent() +{ + TextEdit ed(0); + ed.setPlainText(QStringLiteral("Line\nLine\nLine\n")); + ed.setReadOnly(true); + + float defaultFontSize = ed.font().pointSizeF(); + QWheelEvent wheelUp(QPointF(), QPointF(), QPoint(), QPoint(0, 120), 120, Qt::Vertical, Qt::NoButton, Qt::ControlModifier); + ed.wheelEvent(&wheelUp); + + QCOMPARE(defaultFontSize + 1, ed.font().pointSizeF()); + + QWheelEvent wheelHalfDown(QPointF(), QPointF(), QPoint(), QPoint(0, -60), -60, Qt::Vertical, Qt::NoButton, Qt::ControlModifier); + ed.wheelEvent(&wheelHalfDown); + + QCOMPARE(defaultFontSize + 0.5, ed.font().pointSizeF()); +} + +#endif + QTEST_MAIN(tst_QTextEdit) #include "tst_qtextedit.moc" |