summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-04-17 19:45:20 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-26 15:20:30 +0200
commit99a620d2e2d5225f2b5e29d52617a8a5328081fd (patch)
treeb6e232f6c4d489e81e19ad893f814c123ac5d4dc /tests/auto/widgets
parent62932faef003ea84fdab02b479e7be69f3a43f1b (diff)
Take account of spanned items in QTreeView when dragging.
Also remove some code which has been unused since it was introduced in 32182d107fa75e5619ecc91a81f50626f429ebe1 Task-number: QTBUG-25140 Change-Id: Ic7053d68d8200f845c1ae330342d27af7275e057 Reviewed-by: Tarja Sundqvist <tarja.sundqvist@digia.com> Reviewed-by: David Faure <faure@kde.org>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
index 6936d5acfc..4155000262 100644
--- a/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp
@@ -210,6 +210,8 @@ private slots:
void indexRowSizeHint();
void addRowsWhileSectionsAreHidden();
void filterProxyModelCrash();
+ void renderToPixmap_data();
+ void renderToPixmap();
void styleOptionViewItem();
void keyboardNavigationWithDisabled();
@@ -2890,6 +2892,37 @@ void tst_QTreeView::filterProxyModelCrash()
view.repaint(); //used to crash
}
+void tst_QTreeView::renderToPixmap_data()
+{
+ QTest::addColumn<int>("row");
+ QTest::newRow("row-0") << 0;
+ QTest::newRow("row-1") << 1;
+}
+
+void tst_QTreeView::renderToPixmap()
+{
+ QFETCH(int, row);
+ PublicView view;
+ QStandardItemModel model;
+
+ model.appendRow(new QStandardItem("Spanning"));
+ model.appendRow(QList<QStandardItem*>() << new QStandardItem("Not") << new QStandardItem("Spanning"));
+
+ view.setModel(&model);
+ view.setFirstColumnSpanned(0, QModelIndex(), true);
+
+#ifdef QT_BUILD_INTERNAL
+ {
+ // We select the index at row=0 because it spans the
+ // column (regression test for an assert)
+ // We select the index at row=1 for coverage.
+ QItemSelection sel(model.index(row,0), model.index(row,1));
+ QRect rect;
+ view.aiv_priv()->renderToPixmap(sel.indexes(), &rect);
+ }
+#endif
+}
+
void tst_QTreeView::styleOptionViewItem()
{
class MyDelegate : public QStyledItemDelegate