diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 21446de069..00636e50a8 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -165,6 +165,7 @@ private slots: void setCustomModelAndView(); void updateDelegateOnEditableChange(); void task_QTBUG_39088_inputMethodHints(); + void task_QTBUG_49831_scrollerNotActivated(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -3184,5 +3185,36 @@ void tst_QComboBox::task_QTBUG_39088_inputMethodHints() QCOMPARE(box.lineEdit()->inputMethodHints(), Qt::ImhNoPredictiveText); } +void tst_QComboBox::task_QTBUG_49831_scrollerNotActivated() +{ + QStringList modelData; + for (int i = 0; i < 1000; i++) + modelData << QStringLiteral("Item %1").arg(i); + QStringListModel model(modelData); + + QComboBox box; + box.setModel(&model); + box.setCurrentIndex(500); + box.show(); + QTest::qWaitForWindowShown(&box); + QTest::mouseMove(&box, QPoint(5, 5), 100); + box.showPopup(); + QFrame *container = box.findChild<QComboBoxPrivateContainer *>(); + QVERIFY(container); + QTest::qWaitForWindowShown(container); + + QList<QComboBoxPrivateScroller *> scrollers = container->findChildren<QComboBoxPrivateScroller *>(); + // Not all styles support scrollers. We rely only on those platforms that do to catch any regression. + if (!scrollers.isEmpty()) { + Q_FOREACH (QComboBoxPrivateScroller *scroller, scrollers) { + if (scroller->isVisible()) { + QSignalSpy doScrollSpy(scroller, SIGNAL(doScroll(int))); + QTest::mouseMove(scroller, QPoint(5, 5), 500); + QTRY_VERIFY(doScrollSpy.count() > 0); + } + } + } +} + QTEST_MAIN(tst_QComboBox) #include "tst_qcombobox.moc" |