summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-08-10 18:30:19 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-10 22:02:11 +0200
commitc1df856d6b7fbbf3f21e294cdb481aeaec8110e4 (patch)
tree476213367e49bf6a23f6d43ede8e5ccb9356bd2a /tests
parent4fa544c8cd28907958e2f18e960d54ce0e0770d9 (diff)
Make rowIntersectsSelection take account of the parent argument.
Task-number: QTBUG-22370 Change-Id: I497194793eab624b760deea93dac0df767850330 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 94a81b981e..2a7180cd8b 100644
--- a/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -79,6 +79,7 @@ private slots:
void splitOnInsert();
void rowIntersectsSelection1();
void rowIntersectsSelection2();
+ void rowIntersectsSelection3();
void unselectable();
void selectedIndexes();
void layoutChanged();
@@ -2037,6 +2038,30 @@ void tst_QItemSelectionModel::rowIntersectsSelection2()
QVERIFY(!selected.columnIntersectsSelection(5, QModelIndex()));
}
+void tst_QItemSelectionModel::rowIntersectsSelection3()
+{
+ QStandardItemModel model;
+ QStandardItem *parentItem = model.invisibleRootItem();
+ for (int i = 0; i < 4; ++i) {
+ QStandardItem *item = new QStandardItem(QString("item %0").arg(i));
+ parentItem->appendRow(item);
+ parentItem = item;
+ }
+
+ QItemSelectionModel selectionModel(&model);
+
+ selectionModel.select(model.index(0, 0, model.index(0, 0)), QItemSelectionModel::Select);
+
+ QModelIndex parent;
+ QVERIFY(!selectionModel.rowIntersectsSelection(0, parent));
+ parent = model.index(0, 0, parent);
+ QVERIFY(selectionModel.rowIntersectsSelection(0, parent));
+ parent = model.index(0, 0, parent);
+ QVERIFY(!selectionModel.rowIntersectsSelection(0, parent));
+ parent = model.index(0, 0, parent);
+ QVERIFY(!selectionModel.rowIntersectsSelection(0, parent));
+}
+
void tst_QItemSelectionModel::unselectable()
{
QTreeWidget w;