From e9398ba4e7512ae53e617dcb3a3577c14b43fe7d Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Thu, 8 Jan 2015 15:48:28 +0100 Subject: Fix empty arrays in QML 1 Commit 9cbb6fa added a regression, where empty arrays would produce errors in QML 1. Change-Id: Ie5c784d5ec921d1ca69084750ed37fc2e273bbef Task-number: QTBUG-43656 Reviewed-by: Simon Hausmann --- src/declarative/qml/qdeclarativeengine.cpp | 2 ++ .../qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index 682c8267..14f3c95c 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -2125,6 +2125,8 @@ QVariant QDeclarativeEnginePrivate::scriptValueToVariant(const QScriptValue &val if (val.isArray()) { int length = val.property(QLatin1String("length")).toInt32(); + if (!length) + containsQObjects = true; for (int ii = 0; ii < length; ++ii) { if (val.property(ii).isQObject()) { containsQObjects = true; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 9eef4c74..779c1d2e 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -438,6 +438,12 @@ void tst_qdeclarativeecmascript::arrayExpressions() QCOMPARE(list2.at(1), QVariant(2)); QCOMPARE(list2.at(2), QVariant(QString("foo"))); QCOMPARE(list2.at(3), QVariant(QString("bar"))); + + MyExpression expr3(&context, "[]"); + result = expr3.evaluate(); + QCOMPARE(result.userType(), qMetaTypeId >()); + QList list3 = qvariant_cast >(result); + QCOMPARE(list3.count(), 0); } // Tests that modifying a context property will reevaluate expressions -- cgit v1.2.3 From bc0cbee60cc309bef5e5359254f798942f676928 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Tue, 3 Feb 2015 09:39:15 +0100 Subject: This test seems to be unstable on some platforms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We've had some failures with this test in the CI system. Ignore it as we plan on deprecating qt quick1 anyway. Change-Id: If882598dfd0cdb13b588ca9ad4074d61b8574d19 Reviewed-by: Jani Heikkinen Reviewed-by: Tony Sarajärvi --- tests/auto/declarative/qdeclarativegridview/BLACKLIST | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativegridview/BLACKLIST diff --git a/tests/auto/declarative/qdeclarativegridview/BLACKLIST b/tests/auto/declarative/qdeclarativegridview/BLACKLIST new file mode 100644 index 00000000..2fe0dd96 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/BLACKLIST @@ -0,0 +1,2 @@ +[currentIndex] +* -- cgit v1.2.3