diff options
Diffstat (limited to 'tests/auto/quick/qquickpathview')
-rw-r--r-- | tests/auto/quick/qquickpathview/tst_qquickpathview.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp index 0e9994899f..992b2347dd 100644 --- a/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp +++ b/tests/auto/quick/qquickpathview/tst_qquickpathview.cpp @@ -139,6 +139,7 @@ private slots: void changePathDuringRefill(); void nestedinFlickable(); void flickableDelegate(); + void jsArrayChange(); }; class TestObject : public QObject @@ -2290,6 +2291,33 @@ void tst_QQuickPathView::flickableDelegate() QCOMPARE(moveStartedSpy.count(), 0); } +void tst_QQuickPathView::jsArrayChange() +{ + QQmlEngine engine; + QQmlComponent component(&engine); + component.setData("import QtQuick 2.4; PathView {}", QUrl()); + + QScopedPointer<QQuickPathView> view(qobject_cast<QQuickPathView *>(component.create())); + QVERIFY(!view.isNull()); + + QSignalSpy spy(view.data(), SIGNAL(modelChanged())); + QVERIFY(spy.isValid()); + + QJSValue array1 = engine.newArray(3); + QJSValue array2 = engine.newArray(3); + for (int i = 0; i < 3; ++i) { + array1.setProperty(i, i); + array2.setProperty(i, i); + } + + view->setModel(QVariant::fromValue(array1)); + QCOMPARE(spy.count(), 1); + + // no change + view->setModel(QVariant::fromValue(array2)); + QCOMPARE(spy.count(), 1); +} + QTEST_MAIN(tst_QQuickPathView) #include "tst_qquickpathview.moc" |