summaryrefslogtreecommitdiffstats
path: root/tests/auto/qcolumnview
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:13:44 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2009-07-07 13:14:58 (GMT)
commite5e2f9fd5c1554337a576374ec6744f953d2404d (patch)
treef64fffb41f469a5318267d233cad4890b860006a /tests/auto/qcolumnview
parentf5392a4290e5f7ae2bdf268c1fa8c037e776fdae (diff)
downloadQt-e5e2f9fd5c1554337a576374ec6744f953d2404d.zip
Qt-e5e2f9fd5c1554337a576374ec6744f953d2404d.tar.gz
Qt-e5e2f9fd5c1554337a576374ec6744f953d2404d.tar.bz2
QColumnView: didn't react to addition of rows/cols in the current view
Task-number: 246999
Diffstat (limited to 'tests/auto/qcolumnview')
-rw-r--r--tests/auto/qcolumnview/tst_qcolumnview.cpp42
1 files changed, 35 insertions, 7 deletions
diff --git a/tests/auto/qcolumnview/tst_qcolumnview.cpp b/tests/auto/qcolumnview/tst_qcolumnview.cpp
index 0216e0f..0b3ba7a 100644
--- a/tests/auto/qcolumnview/tst_qcolumnview.cpp
+++ b/tests/auto/qcolumnview/tst_qcolumnview.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <qstandarditemmodel.h>
+#include <qitemdelegate.h>
#include <qcolumnview.h>
#include "../../../src/gui/itemviews/qcolumnviewgrip_p.h"
#include "../../../src/gui/dialogs/qfilesystemmodel_p.h"
@@ -87,6 +88,8 @@ private slots:
void setSelectionModel();
void visualRegionForSelection();
+ void dynamicModelChanges();
+
// grip
void moveGrip_basic();
void moveGrip_data();
@@ -133,16 +136,10 @@ public:
inline QModelIndex thirdLevel() { return index(0, 0, secondLevel()); }
};
-class ColumnViewPrivate : public QColumnViewPrivate
-{
-public:
- ColumnViewPrivate() : QColumnViewPrivate() {}
-};
-
class ColumnView : public QColumnView {
public:
- ColumnView(QWidget *parent = 0) : QColumnView(*new ColumnViewPrivate, parent){}
+ ColumnView(QWidget *parent = 0) : QColumnView(parent){}
QList<QPointer<QAbstractItemView> > createdColumns;
void ScrollContentsBy(int x, int y) {scrollContentsBy(x,y); }
@@ -1002,6 +999,37 @@ void tst_QColumnView::pullRug()
// don't crash
}
+void tst_QColumnView::dynamicModelChanges()
+{
+ struct MyItemDelegate : public QItemDelegate
+ {
+ void paint(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const
+ {
+ paintedIndexes += index;
+ QItemDelegate::paint(painter, option, index);
+ }
+
+ mutable QSet<QModelIndex> paintedIndexes;
+
+ } delegate;;
+ QStandardItemModel model;
+ ColumnView view;
+ view.setModel(&model);
+ view.setItemDelegate(&delegate);
+ view.show();
+
+ QStandardItem *item = new QStandardItem(QLatin1String("item"));
+ model.appendRow(item);
+
+ QTest::qWait(200); //let the time for painting to occur
+ QCOMPARE(delegate.paintedIndexes.count(), 1);
+ QCOMPARE(*delegate.paintedIndexes.begin(), model.index(0,0));
+
+
+}
+
QTEST_MAIN(tst_QColumnView)
#include "tst_qcolumnview.moc"