diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmldelegatemodel/data/qtbug_86017.qml | 32 | ||||
-rw-r--r-- | tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp | 16 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmldelegatemodel/data/qtbug_86017.qml b/tests/auto/qml/qqmldelegatemodel/data/qtbug_86017.qml new file mode 100644 index 0000000000..02d737e37f --- /dev/null +++ b/tests/auto/qml/qqmldelegatemodel/data/qtbug_86017.qml @@ -0,0 +1,32 @@ +import QtQuick 2.8 +import QtQml.Models 2.1 + +DelegateModel { + id: visualModel + model: ListModel { + id: myLM + ListElement { + name: "Apple" + } + ListElement { + name: "Orange" + } + } + + filterOnGroup: "selected" + + groups: [ + DelegateModelGroup { + name: "selected" + includeByDefault: true + } + ] + + delegate: Text { + Component.onCompleted: { + DelegateModel.inPersistedItems = true + DelegateModel.inSelected = false + } + text: "item " + index + } +} diff --git a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp index 87f42c0c8a..8e6d147028 100644 --- a/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp +++ b/tests/auto/qml/qqmldelegatemodel/tst_qqmldelegatemodel.cpp @@ -42,6 +42,7 @@ public: private slots: void valueWithoutCallingObjectFirst_data(); void valueWithoutCallingObjectFirst(); + void qtbug_86017(); }; class AbstractItemModel : public QAbstractItemModel @@ -134,6 +135,21 @@ void tst_QQmlDelegateModel::valueWithoutCallingObjectFirst() QCOMPARE(model->variantValue(index, role), expectedValue); } +void tst_QQmlDelegateModel::qtbug_86017() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.loadUrl(testFileUrl("qtbug_86017.qml")); + QScopedPointer<QObject> root(component.create()); + QVERIFY2(root, qPrintable(component.errorString())); + QTRY_VERIFY(component.isReady()); + QQmlDelegateModel *model = qobject_cast<QQmlDelegateModel*>(root.data()); + + QVERIFY(model); + QCOMPARE(model->count(), 2); + QCOMPARE(model->filterGroup(), "selected"); +} + QTEST_MAIN(tst_QQmlDelegateModel) #include "tst_qqmldelegatemodel.moc" |