From 21705ae91e727812ebaef80583136c29505e977d Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 17 Jun 2013 09:18:19 +0200 Subject: [PATCH] Fix most qjsonbinding auto tests Change-Id: I67476bc7e931e2f4790e859d4a3c00c050752271 Reviewed-by: Simon Hausmann --- src/qml/qml/v4/qv4jsonobject.cpp | 7 ++++--- tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp | 6 +++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/qml/qml/v4/qv4jsonobject.cpp b/src/qml/qml/v4/qv4jsonobject.cpp index 45fe90d..1d83a0d 100644 --- a/src/qml/qml/v4/qv4jsonobject.cpp +++ b/src/qml/qml/v4/qv4jsonobject.cpp @@ -345,7 +345,7 @@ bool JsonParser::parseValue(Value *val) switch ((json++)->unicode()) { case 'n': - if (end - json < 4) { + if (end - json < 3) { lastError = QJsonParseError::IllegalValue; return false; } @@ -360,7 +360,7 @@ bool JsonParser::parseValue(Value *val) lastError = QJsonParseError::IllegalValue; return false; case 't': - if (end - json < 4) { + if (end - json < 3) { lastError = QJsonParseError::IllegalValue; return false; } @@ -375,7 +375,7 @@ bool JsonParser::parseValue(Value *val) lastError = QJsonParseError::IllegalValue; return false; case 'f': - if (end - json < 5) { + if (end - json < 4) { lastError = QJsonParseError::IllegalValue; return false; } @@ -1007,6 +1007,7 @@ QV4::Value JsonObject::fromJsonArray(ExecutionEngine *engine, const QJsonArray & a->arrayReserve(size); for (int i = 0; i < size; i++) a->arrayData[i].value = fromJsonValue(engine, array.at(i)); + a->arrayDataLen = size; a->setArrayLengthUnchecked(size); return Value::fromObject(a); } diff --git a/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp b/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp index b891921..e6b056f 100644 --- a/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp +++ b/tests/auto/qml/qjsonbinding/tst_qjsonbinding.cpp @@ -457,13 +457,13 @@ void tst_qjsonbinding::writeProperty_javascriptExpression_data() << "array" << "(function() { var a = [10, 20]; a.__proto__ = { proto_foo: 123 }; return a; })()" << "[10,20]"; - // Non-enumerable properties should be included. + // Non-enumerable properties should not be included. QTest::newRow("value = object with non-enumerable property") << "value" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })" - << "{\"foo\":123}"; + << "{}"; QTest::newRow("object = object with non-enumerable property") << "object" << "Object.defineProperty({}, 'foo', { value: 123, enumerable: false })" - << "{\"foo\":123}"; + << "{}"; // Cyclic data structures are permitted, but the cyclic links become // empty objects. -- 2.7.4