summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Kelly <stephen.kelly@kdab.com>2012-09-26 18:16:08 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-02 16:25:02 +0100
commit9dfba89c28bbff3316cb7aed6c07f90c0f2d5a22 (patch)
tree1a9643ef367a24f836ec0a552229106b3776b7dd /tests
parent000025ca1ecabe363934bdc8794b01ffb926af66 (diff)
Add implementations of QAIM::sibling in public APIs.
Change-Id: I2248641f2ed8735c28bd9572470520995a4a5b62 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp11
-rw-r--r--tests/auto/other/modeltest/modeltest.cpp11
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
index 72a5c4a57b..633812f935 100644
--- a/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
+++ b/tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp
@@ -392,6 +392,8 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent,
int rows = currentModel->rowCount(parent);
int columns = currentModel->columnCount(parent);
+ const QModelIndex topLeftChild = currentModel->index( 0, 0, parent );
+
QCOMPARE(rows > 0, (currentModel->hasChildren(parent)));
// Some reasuring testing against rows(),columns(), and hasChildren()
@@ -423,6 +425,15 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent,
QModelIndex b = currentModel->index(r, c, parent);
QVERIFY(a == b);
+ {
+ const QModelIndex sibling = currentModel->sibling( r, c, topLeftChild );
+ QVERIFY( index == sibling );
+ }
+ {
+ const QModelIndex sibling = topLeftChild.sibling( r, c );
+ QVERIFY( index == sibling );
+ }
+
// Some basic checking on the index that is returned
QVERIFY(index.model() == currentModel);
QCOMPARE(index.row(), r);
diff --git a/tests/auto/other/modeltest/modeltest.cpp b/tests/auto/other/modeltest/modeltest.cpp
index f8338dc6fa..17f164b638 100644
--- a/tests/auto/other/modeltest/modeltest.cpp
+++ b/tests/auto/other/modeltest/modeltest.cpp
@@ -339,6 +339,8 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
//qDebug() << "parent:" << model->data(parent).toString() << "rows:" << rows
// << "columns:" << columns << "parent column:" << parent.column();
+ const QModelIndex topLeftChild = model->index( 0, 0, parent );
+
QVERIFY( !model->hasIndex ( rows + 1, 0, parent ) );
for ( int r = 0; r < rows; ++r ) {
if ( model->canFetchMore ( parent ) ) {
@@ -362,6 +364,15 @@ void ModelTest::checkChildren ( const QModelIndex &parent, int currentDepth )
QModelIndex b = model->index ( r, c, parent );
QVERIFY( a == b );
+ {
+ const QModelIndex sibling = model->sibling( r, c, topLeftChild );
+ QVERIFY( index == sibling );
+ }
+ {
+ const QModelIndex sibling = topLeftChild.sibling( r, c );
+ QVERIFY( index == sibling );
+ }
+
// Some basic checking on the index that is returned
QVERIFY( index.model() == model );
QCOMPARE( index.row(), r );