summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp56
1 files changed, 38 insertions, 18 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index c38c254b9a..54cf1af5d3 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -5,36 +5,28 @@
**
** This file is part of the test suite of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL$
+** $QT_BEGIN_LICENSE:LGPL21$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and Digia. For licensing terms and
-** conditions see http://qt.digia.com/licensing. For further information
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 2.1 requirements
-** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
-** rights. These rights are described in the Digia Qt LGPL Exception
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3.0 as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU General Public License version 3.0 requirements will be
-** met: http://www.gnu.org/copyleft/gpl.html.
-**
-**
** $QT_END_LICENSE$
**
****************************************************************************/
@@ -53,6 +45,7 @@
#include <qdialog.h>
#include <qevent.h>
#include <qlineedit.h>
+#include <qlabel.h>
#include <qlistview.h>
#include <qheaderview.h>
#include <qlistwidget.h>
@@ -131,6 +124,7 @@ private slots:
void pixmapIcon();
void mouseWheel_data();
void mouseWheel();
+ void wheelClosingPopup();
void layoutDirection();
void itemListPosition();
void separatorItem_data();
@@ -2041,6 +2035,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;