aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-05 09:02:17 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-05 09:02:17 +0200
commit45f79dc7e572c1a1e4c40633d5055d0c6741cfbe (patch)
tree61147ab31b0be97647417649934461b07ffa6983 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
parent6839f03051d2950e4721cbb5ee88fa7b07109588 (diff)
parentffe113ab628adf6c22e96a22cf0bcda8e80c290d (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.cpp src/plugins/qmltooling/qmldbg_debugger/qv4debugservice.h Change-Id: I1e6a9424e7f87d9e4ac1ea387ec70e151106f1c7
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r--tests/auto/quick/qquicklistview/tst_qquicklistview.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
index bf9df7850d..b0d903908f 100644
--- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
+++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp
@@ -250,6 +250,7 @@ private slots:
void QTBUG_50105();
void keyNavigationEnabled();
void QTBUG_50097_stickyHeader_positionViewAtIndex();
+ void itemFiltered();
private:
template <class T> void items(const QUrl &source);
@@ -8343,6 +8344,37 @@ void tst_QQuickListView::QTBUG_50097_stickyHeader_positionViewAtIndex()
QTRY_COMPARE(listview->contentY(), -100.0); // back to the same position: header visible, items not under the header.
}
+void tst_QQuickListView::itemFiltered()
+{
+ QStringListModel model(QStringList() << "one" << "two" << "three" << "four" << "five" << "six");
+ QSortFilterProxyModel proxy1;
+ proxy1.setSourceModel(&model);
+ proxy1.setSortRole(Qt::DisplayRole);
+ proxy1.setDynamicSortFilter(true);
+ proxy1.sort(0);
+
+ QSortFilterProxyModel proxy2;
+ proxy2.setSourceModel(&proxy1);
+ proxy2.setFilterRole(Qt::DisplayRole);
+ proxy2.setFilterRegExp("^[^ ]*$");
+ proxy2.setDynamicSortFilter(true);
+
+ QScopedPointer<QQuickView> window(createView());
+ window->engine()->rootContext()->setContextProperty("_model", &proxy2);
+ QQmlComponent component(window->engine());
+ component.setData("import QtQuick 2.4; ListView { "
+ "anchors.fill: parent; model: _model; delegate: Text { width: parent.width;"
+ "text: model.display; } }",
+ QUrl());
+ window->setContent(QUrl(), &component, component.create());
+
+ window->show();
+ QTest::qWaitForWindowExposed(window.data());
+
+ // this should not crash
+ model.setData(model.index(2), QStringLiteral("modified three"), Qt::DisplayRole);
+}
+
QTEST_MAIN(tst_QQuickListView)
#include "tst_qquicklistview.moc"