summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp')
-rw-r--r--tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
index dbafedbb5d..35ae7f4a7f 100644
--- a/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
+++ b/tests/auto/corelib/itemmodels/qsortfilterproxymodel_recursive/tst_qsortfilterproxymodel_recursive.cpp
@@ -715,6 +715,38 @@ private Q_SLOTS:
}
+ void testChildrenFiltering_data()
+ {
+ QTest::addColumn<QString>("sourceStr");
+ QTest::addColumn<QString>("noChildrenProxyStr");
+ QTest::addColumn<QString>("childrenProxyStr");
+ QTest::addColumn<QString>("noParentProxyStr");
+
+ QTest::newRow("filter_parent") << "[1*[1.1 1.2[1.2.1]]]" << "[1*]" << "[1*[1.1 1.2[1.2.1]]]" << "[1*[1.1 1.2[1.2.1]]]";
+ QTest::newRow("filter_child") << "[1[1.1 1.2*[1.2.1]]]" << "[1[1.2*]]" << "[1[1.2*[1.2.1]]]" << "";
+
+ }
+
+ void testChildrenFiltering()
+ {
+ QFETCH(QString, sourceStr);
+ QFETCH(QString, noChildrenProxyStr);
+ QFETCH(QString, childrenProxyStr);
+ QFETCH(QString, noParentProxyStr);
+
+ QStandardItemModel model;
+ fillModel(model, sourceStr);
+
+ TestModel proxy(&model);
+ QCOMPARE(treeAsString(proxy), noChildrenProxyStr);
+
+ proxy.setAutoAcceptChildRows(true);
+ QCOMPARE(treeAsString(proxy), childrenProxyStr);
+
+ proxy.setRecursiveFilteringEnabled(false);
+ QCOMPARE(treeAsString(proxy), noParentProxyStr);
+ }
+
private:
QStandardItem *itemByText(const QStandardItemModel& model, const QString &text) const {
QModelIndexList list = model.match(model.index(0, 0), Qt::DisplayRole, text, 1, Qt::MatchRecursive);