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.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 f6928f0b35..ac32ee4968 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 task_QTBUG_31146_popupCompletion();
void keyboardSelection();
void setCustomModelAndView();
+ void updateDelegateOnEditableChange();
};
class MyAbstractItemDelegate : public QAbstractItemDelegate
@@ -3049,5 +3050,32 @@ void tst_QComboBox::keyboardSelection()
QCOMPARE(comboBox.currentText(), list.at(1));
}
+void tst_QComboBox::updateDelegateOnEditableChange()
+{
+
+ QComboBox box;
+ box.addItem(QStringLiteral("Foo"));
+ box.addItem(QStringLiteral("Bar"));
+ box.setEditable(false);
+
+ QComboBoxPrivate *d = static_cast<QComboBoxPrivate *>(QComboBoxPrivate::get(&box));
+
+ {
+ bool menuDelegateBefore = qobject_cast<QComboMenuDelegate *>(box.itemDelegate()) != 0;
+ d->updateDelegate();
+ bool menuDelegateAfter = qobject_cast<QComboMenuDelegate *>(box.itemDelegate()) != 0;
+ QCOMPARE(menuDelegateAfter, menuDelegateBefore);
+ }
+
+ box.setEditable(true);
+
+ {
+ bool menuDelegateBefore = qobject_cast<QComboMenuDelegate *>(box.itemDelegate()) != 0;
+ d->updateDelegate();
+ bool menuDelegateAfter = qobject_cast<QComboMenuDelegate *>(box.itemDelegate()) != 0;
+ QCOMPARE(menuDelegateAfter, menuDelegateBefore);
+ }
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"