aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickgridview
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@theqtcompany.com>2014-10-31 20:20:43 +0100
committerSimon Hausmann <simon.hausmann@theqtcompany.com>2014-10-31 20:21:09 +0100
commit473ef83dba6976250a1ff27175716aa1af970f2f (patch)
tree922044c8be598f76945af1599196c7f379df280e /tests/auto/quick/qquickgridview
parentbeb6667d4e65dfe2ec9e7f554837524416c0f4dc (diff)
parent0704d2be63b484cb579c1507223db3f914b1338a (diff)
Merge remote-tracking branch 'origin/5.4' into dev
Diffstat (limited to 'tests/auto/quick/qquickgridview')
-rw-r--r--tests/auto/quick/qquickgridview/tst_qquickgridview.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
index 33008a9d1b..99702236ee 100644
--- a/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
+++ b/tests/auto/quick/qquickgridview/tst_qquickgridview.cpp
@@ -204,6 +204,8 @@ private slots:
void displayMargin();
void negativeDisplayMargin();
+ void jsArrayChange();
+
private:
QList<int> toIntList(const QVariantList &list);
void matchIndexLists(const QVariantList &indexLists, const QList<int> &expectedIndexes);
@@ -6431,6 +6433,33 @@ void tst_QQuickGridView::negativeDisplayMargin()
delete window;
}
+void tst_QQuickGridView::jsArrayChange()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.setData("import QtQuick 2.4; GridView {}", QUrl());
+
+ QScopedPointer<QQuickGridView> view(qobject_cast<QQuickGridView *>(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_QQuickGridView)
#include "tst_qquickgridview.moc"