diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-03-31 10:03:31 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-03-31 10:03:31 +0200 |
commit | ce9519593a0b3deb99d1dd2529770f7e9fffef92 (patch) | |
tree | c9bca05230dd68f49494240ae930bad1fe0c5956 /tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | |
parent | 509f77cca28aa3edea5523c5869bae4412ed2ccc (diff) | |
parent | 7baaec17edb06634f1d6235a55c7adbd112cba3e (diff) |
Merge remote-tracking branch 'origin/5.4' into 5.5
Conflicts:
mkspecs/android-g++/qmake.conf
qmake/generators/unix/unixmake2.cpp
src/gui/image/qimage_conversions.cpp
Change-Id: Ib76264b8c2d29a0228438ec02bd97d4b97545be0
Diffstat (limited to 'tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp')
-rw-r--r-- | tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 7b4b65e841..97416135db 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -160,6 +160,7 @@ private slots: void highlightedSignal(); void itemData(); void task_QTBUG_31146_popupCompletion(); + void task_QTBUG_41288_completerChangesCurrentIndex(); void keyboardSelection(); void setCustomModelAndView(); void updateDelegateOnEditableChange(); @@ -3059,6 +3060,44 @@ void tst_QComboBox::task_QTBUG_31146_popupCompletion() QCOMPARE(comboBox.currentIndex(), 0); } +void tst_QComboBox::task_QTBUG_41288_completerChangesCurrentIndex() +{ + QComboBox comboBox; + comboBox.setEditable(true); + + comboBox.addItems(QStringList() << QStringLiteral("111") << QStringLiteral("222")); + + comboBox.show(); + comboBox.activateWindow(); + QVERIFY(QTest::qWaitForWindowActive(&comboBox)); + + { + // change currentIndex() by keyboard + comboBox.lineEdit()->selectAll(); + QTest::keyClicks(comboBox.lineEdit(), "222"); + QTest::keyClick(comboBox.lineEdit(), Qt::Key_Enter); + QCOMPARE(comboBox.currentIndex(), 1); + + QTest::keyClick(&comboBox, Qt::Key_Up); + comboBox.lineEdit()->selectAll(); + QTest::keyClick(comboBox.lineEdit(), Qt::Key_Enter); + QCOMPARE(comboBox.currentIndex(), 0); + } + + { + // change currentIndex() programmatically + comboBox.lineEdit()->selectAll(); + QTest::keyClicks(comboBox.lineEdit(), "222"); + QTest::keyClick(comboBox.lineEdit(), Qt::Key_Enter); + QCOMPARE(comboBox.currentIndex(), 1); + + comboBox.setCurrentIndex(0); + comboBox.lineEdit()->selectAll(); + QTest::keyClick(comboBox.lineEdit(), Qt::Key_Enter); + QCOMPARE(comboBox.currentIndex(), 0); + } +} + void tst_QComboBox::keyboardSelection() { QComboBox comboBox; |