summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcombobox
diff options
context:
space:
mode:
authorStian Sandvik Thomassen <stian.thomassen@nokia.com>2009-05-20 01:18:01 (GMT)
committerStian Sandvik Thomassen <stian.thomassen@nokia.com>2009-05-20 01:18:01 (GMT)
commit82a5d55502f465f17e1a6f16d9c64a19aa9dfe5e (patch)
treeefd72794171e2e9e495f9ea4d08cd69b3af45c75 /tests/auto/qcombobox
parent19845ac3f4f7e3288cfdf7add68754758cd3145b (diff)
downloadQt-82a5d55502f465f17e1a6f16d9c64a19aa9dfe5e.zip
Qt-82a5d55502f465f17e1a6f16d9c64a19aa9dfe5e.tar.gz
Qt-82a5d55502f465f17e1a6f16d9c64a19aa9dfe5e.tar.bz2
Added auto-test for QComboBox::setItemDelegate and task 253944
Diffstat (limited to 'tests/auto/qcombobox')
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index 6a87e3c..2fff6d0 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -76,6 +76,7 @@
#endif
#include <qabstractitemview.h>
#include "../../shared/util.h"
+#include <qstyleditemdelegate.h>
//TESTED_CLASS=
//TESTED_FILES=
@@ -141,6 +142,8 @@ private slots:
void setModelColumn();
void noScrollbar_data();
void noScrollbar();
+ void setItemDelegate();
+ void task253944_itemDelegateIsReset();
protected slots:
void onEditTextChanged( const QString &newString );
@@ -2206,5 +2209,26 @@ void tst_QComboBox::noScrollbar()
}
}
+void tst_QComboBox::setItemDelegate()
+{
+ QComboBox comboBox;
+ QStyledItemDelegate *itemDelegate = new QStyledItemDelegate;
+ comboBox.setItemDelegate(itemDelegate);
+ QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+}
+
+void tst_QComboBox::task253944_itemDelegateIsReset()
+{
+ QComboBox comboBox;
+ QStyledItemDelegate *itemDelegate = new QStyledItemDelegate;
+ comboBox.setItemDelegate(itemDelegate);
+
+ comboBox.setEditable(true);
+ QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+
+ comboBox.setStyleSheet("QComboBox { border: 1px solid gray; }");
+ QCOMPARE(comboBox.itemDelegate(), itemDelegate);
+}
+
QTEST_MAIN(tst_QComboBox)
#include "tst_qcombobox.moc"