summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreewidget/tst_qtreewidget.cpp
diff options
context:
space:
mode:
authorKent Hansen <khansen@trolltech.com>2009-10-23 12:57:30 (GMT)
committerKent Hansen <khansen@trolltech.com>2009-10-23 12:57:30 (GMT)
commit4ff3e1ca7ce8afab49e5c52a1ae0141abfc8a841 (patch)
tree592d015d93478525504f8e09154b633fa2abdae2 /tests/auto/qtreewidget/tst_qtreewidget.cpp
parentc21d3a0094b0692f2f888b04e258229234200e3c (diff)
parent05aaab72d69a7fa9c23811c1d3ee7d91a9174e46 (diff)
downloadQt-4ff3e1ca7ce8afab49e5c52a1ae0141abfc8a841.zip
Qt-4ff3e1ca7ce8afab49e5c52a1ae0141abfc8a841.tar.gz
Qt-4ff3e1ca7ce8afab49e5c52a1ae0141abfc8a841.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/qt into qscriptprogram
Conflicts: src/script/api/qscriptengine.cpp tests/auto/qscriptengineagent/tst_qscriptengineagent.cpp
Diffstat (limited to 'tests/auto/qtreewidget/tst_qtreewidget.cpp')
-rw-r--r--tests/auto/qtreewidget/tst_qtreewidget.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp
index 11c4543..6defd7b 100644
--- a/tests/auto/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp
@@ -49,6 +49,9 @@
#include <qheaderview.h>
#include <qlineedit.h>
#include <QScrollBar>
+#include <QStyledItemDelegate>
+
+#include "../../shared/util.h"
//TESTED_CLASS=
@@ -163,6 +166,7 @@ private slots:
void task217309();
void setCurrentItemExpandsParent();
void task239150_editorWidth();
+ void setTextUpdate();
public slots:
void itemSelectionChanged();
@@ -3233,6 +3237,41 @@ void tst_QTreeWidget::task239150_editorWidth()
+void tst_QTreeWidget::setTextUpdate()
+{
+ QTreeWidget treeWidget;
+ treeWidget.setColumnCount(2);
+
+ class MyItemDelegate : public QStyledItemDelegate
+ {
+ public:
+ MyItemDelegate() : numPaints(0) { }
+ void paint(QPainter *painter,
+ const QStyleOptionViewItem &option, const QModelIndex &index) const
+ {
+ numPaints++;
+ QStyledItemDelegate::paint(painter, option, index);
+ }
+
+ mutable int numPaints;
+ } delegate;
+
+ treeWidget.setItemDelegate(&delegate);
+ treeWidget.show();
+ QStringList strList;
+ strList << "variable1" << "0";
+ QTreeWidgetItem *item = new QTreeWidgetItem(strList);
+ treeWidget.insertTopLevelItem(0, item);
+ QTest::qWait(50);
+ QTRY_VERIFY(delegate.numPaints > 0);
+ delegate.numPaints = 0;
+
+ item->setText(1, "42");
+ QApplication::processEvents();
+ QTRY_VERIFY(delegate.numPaints > 0);
+}
+
+
QTEST_MAIN(tst_QTreeWidget)
#include "tst_qtreewidget.moc"