diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-12-09 15:05:23 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-12-09 15:05:23 (GMT) |
commit | 460d52bfa85318610576d1ab75eae4799865e064 (patch) | |
tree | c78dbf227b372e3d4d1d6dfd236f3b9ef9385576 /tests/auto | |
parent | 91577a693d1bc3a123ee1f4c6e73b8a49be03aef (diff) | |
parent | 694ef883b3ab40806bfe3356278c639942c8c69d (diff) | |
download | Qt-460d52bfa85318610576d1ab75eae4799865e064.zip Qt-460d52bfa85318610576d1ab75eae4799865e064.tar.gz Qt-460d52bfa85318610576d1ab75eae4799865e064.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-water-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-water-staging:
Remove whitespace and leading tab from documentation change
Updating merge request 2512
QGraphicsLayoutItem - fix invalidating sizehint-with-constraints cache
Fix integer overflow in bitfield
Fix documentation for QML extended types
Removes the reseting of the QMenu offset.
Adding warning to QMenu documentation
Fix filtering of columns in QSFPM.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro | 5 | ||||
-rw-r--r-- | tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp | 39 |
2 files changed, 42 insertions, 2 deletions
diff --git a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro index d2c1147..7edd4a5 100644 --- a/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro +++ b/tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro @@ -1,6 +1,7 @@ load(qttest_p4) -SOURCES += tst_qsortfilterproxymodel.cpp - +INCLUDEPATH += $$PWD/../modeltest +SOURCES += tst_qsortfilterproxymodel.cpp ../modeltest/dynamictreemodel.cpp ../modeltest/modeltest.cpp +HEADERS += ../modeltest/dynamictreemodel.h ../modeltest/modeltest.h diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 66caf4a..93b9d30 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -43,6 +43,9 @@ #include <QtTest/QtTest> #include "../../shared/util.h" +#include "dynamictreemodel.h" +#include "modeltest.h" + #include <QtCore> #include <QtGui> @@ -144,6 +147,7 @@ private slots: void testMultipleProxiesWithSelection(); void mapSelectionFromSource(); + void filteredColumns(); protected: void buildHierarchy(const QStringList &data, QAbstractItemModel *model); @@ -3174,5 +3178,40 @@ void tst_QSortFilterProxyModel::taskQTBUG_10287_unnecessaryMapCreation() // No assert failure, it passes. } +class FilteredColumnProxyModel : public QSortFilterProxyModel +{ + Q_OBJECT +public: + FilteredColumnProxyModel(QObject *parent = 0) + : QSortFilterProxyModel(parent) + { + + } + +protected: + bool filterAcceptsColumn(int column, const QModelIndex &source_parent) const + { + return column % 2 != 0; + } +}; + +void tst_QSortFilterProxyModel::filteredColumns() +{ + DynamicTreeModel *model = new DynamicTreeModel(this); + + FilteredColumnProxyModel *proxy = new FilteredColumnProxyModel(this); + proxy->setSourceModel(model); + + new ModelTest(proxy, this); + + ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this); + insertCommand->setNumCols(2); + insertCommand->setStartRow(0); + insertCommand->setEndRow(0); + // Parent is QModelIndex() + insertCommand->doCommand(); + +} + QTEST_MAIN(tst_QSortFilterProxyModel) #include "tst_qsortfilterproxymodel.moc" |