tests/auto/qtreeview/tst_qtreeview.cpp
branchRCL_3
changeset 4 3b1da2848fc7
parent 3 41300fa6a67c
child 7 3f74d0d4af4c
--- a/tests/auto/qtreeview/tst_qtreeview.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp	Fri Feb 19 23:40:16 2010 +0200
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -236,6 +236,7 @@
     void task248022_changeSelection();
     void task245654_changeModelAndExpandAll();
     void doubleClickedWithSpans();
+    void taskQTBUG_6450_selectAllWith1stColumnHidden();
 };
 
 class QtTestModel: public QAbstractItemModel
@@ -3678,5 +3679,26 @@
     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"