summaryrefslogtreecommitdiffstats
path: root/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
diff options
context:
space:
mode:
authorLorn Potter <lorn.potter@nokia.com>2010-03-24 23:06:43 (GMT)
committerLorn Potter <lorn.potter@nokia.com>2010-03-24 23:06:43 (GMT)
commitd20510dd91e01b15e2346c0cb12e352080b6a093 (patch)
tree83554f5c96f69df6fe6d9d5c2a9f529a3b1316d8 /tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
parentf727f993c3c4e3f548b06d57b3ee0da4f3914bae (diff)
parent8218a16815d883823d3411be9896332b997f3e91 (diff)
downloadQt-d20510dd91e01b15e2346c0cb12e352080b6a093.zip
Qt-d20510dd91e01b15e2346c0cb12e352080b6a093.tar.gz
Qt-d20510dd91e01b15e2346c0cb12e352080b6a093.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
Conflicts: src/plugins/bearer/corewlan/qcorewlanengine.mm
Diffstat (limited to 'tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp')
-rw-r--r--tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp27
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"