From 9dfba89c28bbff3316cb7aed6c07f90c0f2d5a22 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 26 Sep 2012 18:16:08 +0200 Subject: Add implementations of QAIM::sibling in public APIs. Change-Id: I2248641f2ed8735c28bd9572470520995a4a5b62 Reviewed-by: Marc Mutz Reviewed-by: Stephen Kelly --- tests/auto/corelib/itemmodels/qitemmodel/tst_qitemmodel.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/corelib/itemmodels/qitemmodel') 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); -- cgit v1.2.3