diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-23 09:35:57 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-03-23 09:36:58 (GMT) |
commit | 27380de043105379002075543fffdd67718138ca (patch) | |
tree | 6e14332436df34d81d7781754ccb2251540346ba /tests/auto | |
parent | fcb738161efc965e91c3d528c31ac77d3a05ac64 (diff) | |
download | Qt-27380de043105379002075543fffdd67718138ca.zip Qt-27380de043105379002075543fffdd67718138ca.tar.gz Qt-27380de043105379002075543fffdd67718138ca.tar.bz2 |
Adding the autotest for the task
Task-number: QTBUG-2804
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp index 6ef4305..3b2a716 100644 --- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp +++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp @@ -93,6 +93,7 @@ private slots: void task232634_childrenDeselectionSignal(); void task260134_layoutChangedWithAllSelected(); void QTBUG5671_layoutChangedWithAllSelected(); + void QTBUG2804_layoutChangedTreeSelection(); private: QAbstractItemModel *model; @@ -2327,5 +2328,31 @@ void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected() QVERIFY(selection.isSelected(index)); } +void tst_QItemSelectionModel::QTBUG2804_layoutChangedTreeSelection() +{ + QStandardItemModel model; + QStandardItem top1("Child1"), top2("Child2"), top3("Child3"); + QStandardItem sub11("Alpha"), sub12("Beta"), sub13("Gamma"), sub14("Delta"), + sub21("Alpha"), sub22("Beta"), sub23("Gamma"), sub24("Delta"); + top1.appendColumn(QList<QStandardItem*>() << &sub11 << &sub12 << &sub13 << &sub14); + top2.appendColumn(QList<QStandardItem*>() << &sub21 << &sub22 << &sub23 << &sub24); + model.appendColumn(QList<QStandardItem*>() << &top1 << &top2 << &top3); + + QItemSelectionModel selModel(&model); + + selModel.select(sub11.index(), QItemSelectionModel::Select); + selModel.select(sub12.index(), QItemSelectionModel::Select); + selModel.select(sub21.index(), QItemSelectionModel::Select); + selModel.select(sub23.index(), QItemSelectionModel::Select); + + QModelIndexList list = selModel.selectedIndexes(); + QCOMPARE(list.count(), 4); + + model.sort(0); //this will provoke a relayout + + QCOMPARE(selModel.selectedIndexes().count(), 4); +} + + QTEST_MAIN(tst_QItemSelectionModel) #include "tst_qitemselectionmodel.moc" |