diff options
Diffstat (limited to 'tests/auto/qtreeview/tst_qtreeview.cpp')
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index d269cc3..fd4815e 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -236,6 +236,7 @@ private slots: void task248022_changeSelection(); void task245654_changeModelAndExpandAll(); void doubleClickedWithSpans(); + void taskQTBUG_6450_selectAllWith1stColumnHidden(); }; class QtTestModel: public QAbstractItemModel @@ -3678,5 +3679,26 @@ void tst_QTreeView::doubleClickedWithSpans() QTRY_COMPARE(spy.count(), 2); } +void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden() +{ + QTreeWidget tree; + tree.setSelectionMode(QAbstractItemView::MultiSelection); + tree.setColumnCount(2); + QList<QTreeWidgetItem *> items; + const int nrRows = 10; + for (int i = 0; i < nrRows; ++i) { + items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i)))); + items.last()->setText(1, QString("is an item")); + } + tree.insertTopLevelItems(0, items); + + tree.hideColumn(0); + tree.selectAll(); + + QVERIFY(tree.selectionModel()->hasSelection()); + for (int i = 0; i < nrRows; ++i) + QVERIFY(tree.selectionModel()->isRowSelected(i, QModelIndex())); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" |