diff options
author | Stephen Kelly <steveire@gmail.com> | 2009-12-18 13:17:44 (GMT) |
---|---|---|
committer | Olivier Goffart <ogoffart@trolltech.com> | 2009-12-18 13:37:05 (GMT) |
commit | 315c09c3873f7c5d8b785443372bf975bae47ee7 (patch) | |
tree | 77fcbe5a16ec41b87192c7f1beb601f5abd50d0c /tests/auto/modeltest/tst_modeltest.cpp | |
parent | 1aa7d5922930c4195bc8747a19524a7e5021c4e6 (diff) | |
download | Qt-315c09c3873f7c5d8b785443372bf975bae47ee7.zip Qt-315c09c3873f7c5d8b785443372bf975bae47ee7.tar.gz Qt-315c09c3873f7c5d8b785443372bf975bae47ee7.tar.bz2 |
Make sure mappings are created for columns when indexes newly become parents.
Also move the modeltest related tests to the modeltest subdirectory
Merge-request: 2262
Reviewed-by: Olivier Goffart <ogoffart@trolltech.com>
Diffstat (limited to 'tests/auto/modeltest/tst_modeltest.cpp')
-rw-r--r-- | tests/auto/modeltest/tst_modeltest.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/tests/auto/modeltest/tst_modeltest.cpp b/tests/auto/modeltest/tst_modeltest.cpp index a719168..78aa79f 100644 --- a/tests/auto/modeltest/tst_modeltest.cpp +++ b/tests/auto/modeltest/tst_modeltest.cpp @@ -44,6 +44,7 @@ #include <QtGui/QtGui> #include "modeltest.h" +#include "dynamictreemodel.h" class tst_ModelTest : public QObject @@ -64,6 +65,7 @@ private slots: void stringListModel(); void treeWidgetModel(); void standardItemModel(); + void testInsertThroughProxy(); }; @@ -143,7 +145,38 @@ void tst_ModelTest::standardItemModel() model.insertRows(0,5, model.index(1,1)); model.insertColumns(0,5, model.index(1,3)); - +} + +void tst_ModelTest::testInsertThroughProxy() +{ + DynamicTreeModel *model = new DynamicTreeModel(this); + + QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this); + proxy->setSourceModel(model); + + new ModelTest(proxy, this); + + ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this); + insertCommand->setNumCols(4); + insertCommand->setStartRow(0); + insertCommand->setEndRow(9); + // Parent is QModelIndex() + insertCommand->doCommand(); + + insertCommand = new ModelInsertCommand(model, this); + insertCommand->setNumCols(4); + insertCommand->setAncestorRowNumbers(QList<int>() << 5); + insertCommand->setStartRow(0); + insertCommand->setEndRow(9); + insertCommand->doCommand(); + + ModelMoveCommand *moveCommand = new ModelMoveCommand(model, this); + moveCommand->setNumCols(4); + moveCommand->setStartRow(0); + moveCommand->setEndRow(0); + moveCommand->setDestRow(9); + moveCommand->setDestAncestors(QList<int>() << 5); + moveCommand->doCommand(); } QTEST_MAIN(tst_ModelTest) |