diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-11 11:08:11 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-02-11 12:00:31 +0100 |
commit | 7c9497a6d47a02d961baef3993ba4cf4267ec607 (patch) | |
tree | 335fae3e9e3a84d33310efca23f1d6993265805b /tests/auto/qml/qqmlecmascript | |
parent | 67ba88947f57ab2d1859bbeb96c6dcba020561b1 (diff) | |
parent | 6c840c70d61c3ae277b60a024a086215c743e5b3 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/qml/compiler/qv4ssa.cpp
src/qml/jsruntime/qv4arrayobject.cpp
src/qml/jsruntime/qv4context.cpp
Change-Id: Ied5b23bec4dc14abe51127c507aed668f855c1e1
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
4 files changed, 42 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/LazyBindingComponent.qml b/tests/auto/qml/qqmlecmascript/data/LazyBindingComponent.qml new file mode 100644 index 0000000000..81cb56f0e5 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/LazyBindingComponent.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +Item +{ + property int someInt: 4 + property var variantArray: [1, 2] + property int arrayLength: 0 + + onSomeIntChanged: + { + arrayLength = variantArray.length + } +} diff --git a/tests/auto/qml/qqmlecmascript/data/lazyBindingEvaluation.qml b/tests/auto/qml/qqmlecmascript/data/lazyBindingEvaluation.qml new file mode 100644 index 0000000000..2f55ff0709 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/lazyBindingEvaluation.qml @@ -0,0 +1,6 @@ +import QtQuick 2.1 + +LazyBindingComponent +{ + someInt: 5 +} diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml index 8d08cc5559..8847055a70 100644 --- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml +++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml @@ -141,6 +141,15 @@ Item { expected = 7; if (poppedVal != expected) success = false; + // push + msco.stringListProperty = [ "one", "two" ] + msco.stringListProperty.push("three") + expected = [ "one", "two", "three" ] + if (msco.stringListProperty.toString() != expected.toString()) success = false; + msco.stringListProperty.push("four", "five") + expected = [ "one", "two", "three", "four", "five" ] + if (msco.stringListProperty.toString() != expected.toString()) success = false; + // concat msco.stringListProperty = [ "one", "two" ] stringList = [ "hello", "world" ] diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 6163628ab5..a39564bd19 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -317,6 +317,7 @@ private slots: void qtbug_34792(); void noCaptureWhenWritingProperty(); void singletonWithEnum(); + void lazyBindingEvaluation(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -663,7 +664,7 @@ void tst_qqmlecmascript::methods() void tst_qqmlecmascript::bindingLoop() { QQmlComponent component(&engine, testFileUrl("bindingLoop.qml")); - QString warning = component.url().toString() + ":5:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\""; + QString warning = component.url().toString() + ":9:9: QML MyQmlObject: Binding loop detected for property \"stringProperty\""; QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); QObject *object = component.create(); QVERIFY(object != 0); @@ -7533,6 +7534,18 @@ void tst_qqmlecmascript::singletonWithEnum() QCOMPARE(prop.toInt(), int(SingletonWithEnum::TestValue)); } +void tst_qqmlecmascript::lazyBindingEvaluation() +{ + QQmlComponent component(&engine, testFileUrl("lazyBindingEvaluation.qml")); + QScopedPointer<QObject> obj(component.create()); + if (obj.isNull()) + qDebug() << component.errors().first().toString(); + QVERIFY(!obj.isNull()); + QVariant prop = obj->property("arrayLength"); + QVERIFY(prop.type() == QVariant::Int); + QCOMPARE(prop.toInt(), 2); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |