summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@digia.com>2014-08-26 15:46:48 +0200
committerFriedemann Kleint <Friedemann.Kleint@digia.com>2014-08-26 19:58:56 +0200
commit92c7cb815522ad1b31e98cc1e7adeabde58057da (patch)
treec22223885daa915504eb6273cfb1393483acbd95 /tests/auto
parent0475822d0181382e13cd98747d5a793d73be7166 (diff)
Close popup widgets when wheel events are received
Task-number: QTBUG-40656 Change-Id: I134b07705744c23af9718dee486ab5e9ad4352cf Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index c38c254b9a..40496dbebb 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -53,6 +53,7 @@
#include <qdialog.h>
#include <qevent.h>
#include <qlineedit.h>
+#include <qlabel.h>
#include <qlistview.h>
#include <qheaderview.h>
#include <qlistwidget.h>
@@ -131,6 +132,7 @@ private slots:
void pixmapIcon();
void mouseWheel_data();
void mouseWheel();
+ void wheelClosingPopup();
void layoutDirection();
void itemListPosition();
void separatorItem_data();
@@ -2041,6 +2043,32 @@ void tst_QComboBox::mouseWheel()
}
}
+void tst_QComboBox::wheelClosingPopup()
+{
+ // QTBUG-40656, combo and other popups should close when the main window gets a wheel event.
+ QScrollArea scrollArea;
+ scrollArea.move(300, 300);
+ QWidget *widget = new QWidget;
+ scrollArea.setWidget(widget);
+ QVBoxLayout *layout = new QVBoxLayout(widget);
+ layout->setSizeConstraint(QLayout::SetMinAndMaxSize);
+ layout->addSpacing(100);
+ QComboBox *comboBox = new QComboBox;
+ comboBox->addItems(QStringList() << QStringLiteral("Won") << QStringLiteral("Too")
+ << QStringLiteral("3") << QStringLiteral("fore"));
+ layout->addWidget(comboBox);
+ layout->addSpacing(100);
+ const QPoint sizeP(scrollArea.width(), scrollArea.height());
+ scrollArea.move(QGuiApplication::primaryScreen()->availableGeometry().center() - sizeP / 2);
+ scrollArea.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&scrollArea));
+ comboBox->showPopup();
+ QTRY_VERIFY(comboBox->view() && comboBox->view()->isVisible());
+ QWheelEvent event(QPointF(10, 10), WHEEL_DELTA, Qt::NoButton, Qt::NoModifier);
+ QVERIFY(QCoreApplication::sendEvent(scrollArea.windowHandle(), &event));
+ QTRY_VERIFY(!comboBox->view()->isVisible());
+}
+
void tst_QComboBox::layoutDirection()
{
QComboBox box;