summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/widgets/qcombobox
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/widgets/qcombobox')
-rw-r--r--tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
index 1ae33ef7a1..816fe1faba 100644
--- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp
@@ -153,6 +153,7 @@ private slots:
void itemData();
void task_QTBUG_31146_popupCompletion();
void task_QTBUG_41288_completerChangesCurrentIndex();
+ void task_QTBUG_54191_slotOnEditTextChangedSetsComboBoxToReadOnly();
void keyboardSelection();
void setCustomModelAndView();
void updateDelegateOnEditableChange();
@@ -3111,6 +3112,30 @@ void tst_QComboBox::task_QTBUG_41288_completerChangesCurrentIndex()
}
}
+namespace {
+ struct SetReadOnly {
+ QComboBox *cb;
+ explicit SetReadOnly(QComboBox *cb) : cb(cb) {}
+ void operator()() const
+ { cb->setEditable(false); }
+ };
+}
+
+void tst_QComboBox::task_QTBUG_54191_slotOnEditTextChangedSetsComboBoxToReadOnly()
+{
+ QComboBox cb;
+ cb.addItems(QStringList() << "one" << "two");
+ cb.setEditable(true);
+ cb.setCurrentIndex(0);
+
+ connect(&cb, &QComboBox::editTextChanged,
+ SetReadOnly(&cb));
+
+ cb.setCurrentIndex(1);
+ // the real test is that it didn't crash...
+ QCOMPARE(cb.currentIndex(), 1);
+}
+
void tst_QComboBox::keyboardSelection()
{
QComboBox comboBox;