summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-03-21 20:42:50 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-28 02:02:07 +0200
commitdc6a1d186eb2060f549ef55b74711b54ed66ade7 (patch)
tree56787f009fafc2e5c2ec5d434b45c82d568ffa2a /tests/auto/widgets/itemviews
parentc3e1abad4e141e6e9d876e5cff194c473a2654eb (diff)
Remove workaround for QComboBox not having a USER property.
QComboBox does in fact have a user property since b1b87a73012342dc1619a8e907ea9954d59ca564. Change-Id: I24eb2ef267cec5d8a9f7348954b703fa6df04fa5 Reviewed-by: Girish Ramakrishnan <girish.1.ramakrishnan@nokia.com> Reviewed-by: Thorbjørn Lund Martsum <tmartsum@gmail.com> Reviewed-by: David Faure <faure@kde.org>
Diffstat (limited to 'tests/auto/widgets/itemviews')
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 497cdfdeee..2ee166c4a2 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -58,6 +58,7 @@
#include <qtreewidget.h>
#include <QItemDelegate>
+#include <QComboBox>
#include <QAbstractItemDelegate>
#include <QTextEdit>
#include <QPlainTextEdit>
@@ -228,6 +229,7 @@ private slots:
void editorEvent();
void enterKey_data();
void enterKey();
+ void comboBox();
void task257859_finalizeEdit();
void QTBUG4435_keepSelectionOnCheck();
@@ -1205,6 +1207,35 @@ void tst_QItemDelegate::QTBUG4435_keepSelectionOnCheck()
QCOMPARE(model.item(0)->checkState(), Qt::Checked);
}
+void tst_QItemDelegate::comboBox()
+{
+ QTableWidgetItem *item1 = new QTableWidgetItem;
+ item1->setData(Qt::DisplayRole, true);
+
+ QTableWidget widget(1, 1);
+ widget.setItem(0, 0, item1);
+ widget.show();
+
+ widget.editItem(item1);
+
+ QTestEventLoop::instance().enterLoop(1);
+
+ QComboBox *boolEditor = qFindChild<QComboBox*>(widget.viewport());
+ QVERIFY(boolEditor);
+ QCOMPARE(boolEditor->currentIndex(), 1); // True is selected initially.
+ // The data must actually be different in order for the model
+ // to be updated.
+ boolEditor->setCurrentIndex(0);
+ QCOMPARE(boolEditor->currentIndex(), 0); // Changed to false.
+
+ widget.clearFocus();
+ widget.setFocus();
+
+ QVariant data = item1->data(Qt::EditRole);
+ QCOMPARE(data.userType(), (int)QMetaType::Bool);
+ QCOMPARE(data.toBool(), false);
+}
+
// ### _not_ covered: