From 64481bcc671892cd140ce5415eaec7fef3e2a35d Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 9 Dec 2015 16:57:54 -0800 Subject: QWidgetWindow: The alien widget should be from the window's hierarchy This partially reverts commit 025d6a778ceb377e688f1. Change-Id: I7b964b0d598abe46137c22177fe2b5dcca5bb812 Task-number: QTBUG-49831 Reviewed-by: Gabriel de Dietrich Reviewed-by: Andy Shaw --- .../widgets/widgets/qcombobox/tst_qcombobox.cpp | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'tests') 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(); + QVERIFY(container); + QTest::qWaitForWindowShown(container); + + QList scrollers = container->findChildren(); + // 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" -- cgit v1.2.3