summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qsortfilterproxymodel/qsortfilterproxymodel.pro5
-rw-r--r--tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp39
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"