tests/auto/qtreeview/tst_qtreeview.cpp
changeset 18 2f34d5167611
parent 3 41300fa6a67c
child 8 3f74d0d4af4c
equal deleted inserted replaced
3:41300fa6a67c 18:2f34d5167611
     1 /****************************************************************************
     1 /****************************************************************************
     2 **
     2 **
     3 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     4 ** All rights reserved.
     4 ** All rights reserved.
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     5 ** Contact: Nokia Corporation (qt-info@nokia.com)
     6 **
     6 **
     7 ** This file is part of the test suite of the Qt Toolkit.
     7 ** This file is part of the test suite of the Qt Toolkit.
     8 **
     8 **
   234     void task239271_addRowsWithFirstColumnHidden();
   234     void task239271_addRowsWithFirstColumnHidden();
   235     void task254234_proxySort();
   235     void task254234_proxySort();
   236     void task248022_changeSelection();
   236     void task248022_changeSelection();
   237     void task245654_changeModelAndExpandAll();
   237     void task245654_changeModelAndExpandAll();
   238     void doubleClickedWithSpans();
   238     void doubleClickedWithSpans();
       
   239     void taskQTBUG_6450_selectAllWith1stColumnHidden();
   239 };
   240 };
   240 
   241 
   241 class QtTestModel: public QAbstractItemModel
   242 class QtTestModel: public QAbstractItemModel
   242 {
   243 {
   243 public:
   244 public:
  3676     QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p);
  3677     QTest::mouseDClick(view.viewport(), Qt::LeftButton, 0, p);
  3677     QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p);
  3678     QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, p);
  3678     QTRY_COMPARE(spy.count(), 2);
  3679     QTRY_COMPARE(spy.count(), 2);
  3679 }
  3680 }
  3680 
  3681 
       
  3682 void tst_QTreeView::taskQTBUG_6450_selectAllWith1stColumnHidden()
       
  3683 {
       
  3684     QTreeWidget tree;
       
  3685     tree.setSelectionMode(QAbstractItemView::MultiSelection);
       
  3686     tree.setColumnCount(2);
       
  3687     QList<QTreeWidgetItem *> items;
       
  3688     const int nrRows = 10;
       
  3689     for (int i = 0; i < nrRows; ++i) {
       
  3690         items.append(new QTreeWidgetItem((QTreeWidget*)0, QStringList(QString("item: %1").arg(i))));
       
  3691         items.last()->setText(1, QString("is an item"));
       
  3692     }
       
  3693     tree.insertTopLevelItems(0, items);
       
  3694 
       
  3695     tree.hideColumn(0);
       
  3696     tree.selectAll();
       
  3697 
       
  3698     QVERIFY(tree.selectionModel()->hasSelection());
       
  3699     for (int i = 0; i < nrRows; ++i)
       
  3700         QVERIFY(tree.selectionModel()->isRowSelected(i, QModelIndex()));
       
  3701 }
       
  3702 
  3681 QTEST_MAIN(tst_QTreeView)
  3703 QTEST_MAIN(tst_QTreeView)
  3682 #include "tst_qtreeview.moc"
  3704 #include "tst_qtreeview.moc"