summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@digia.com>2013-07-02 15:49:50 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-08 05:58:31 +0200
commit737abb8a5e51d75c0f2f93d5f7b42b05400034a9 (patch)
tree28eb60b253fb6b90b4b8793bb8ba1bdb3cf5e45d /tests
parentd0c8fc3b2831de809bdb562db0924673c1abcc84 (diff)
QComboBox: fix item activation via completer
Task-number: QTBUG-31146 Change-Id: I64291f397d80bf934152f63e629810540abf466e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 0bfd4baa0c..82d3fae0fa 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 maxVisibleItems();
void task_QTBUG_10491_currentIndexAndModelColumn();
void highlightedSignal();
+ void task_QTBUG_31146_popupCompletion();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -2755,5 +2756,39 @@ void tst_QComboBox::highlightedSignal()
QCOMPARE(spy.size(), 1);
}
+void tst_QComboBox::task_QTBUG_31146_popupCompletion()
+{
+ QComboBox comboBox;
+ comboBox.setEditable(true);
+ comboBox.setAutoCompletion(true);
+ comboBox.setInsertPolicy(QComboBox::NoInsert);
+ comboBox.completer()->setCaseSensitivity(Qt::CaseInsensitive);
+ comboBox.completer()->setCompletionMode(QCompleter::PopupCompletion);
+
+ comboBox.addItems(QStringList() << QStringLiteral("item") << QStringLiteral("item"));
+
+ comboBox.show();
+ comboBox.activateWindow();
+ QVERIFY(QTest::qWaitForWindowActive(&comboBox));
+
+ QCOMPARE(comboBox.currentIndex(), 0);
+
+ comboBox.lineEdit()->selectAll();
+ QTest::keyClicks(comboBox.lineEdit(), "item");
+
+ QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Down);
+ QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Down);
+ QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Enter);
+ QCOMPARE(comboBox.currentIndex(), 1);
+
+ comboBox.lineEdit()->selectAll();
+ QTest::keyClicks(comboBox.lineEdit(), "item");
+
+ QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Up);
+ QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Up);
+ QTest::keyClick(comboBox.completer()->popup(), Qt::Key_Enter);
+ QCOMPARE(comboBox.currentIndex(), 0);
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"