From 833336fa963b3cd9f1996d7d255098f523dfa580 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Fri, 9 Mar 2012 11:40:44 +0100 Subject: Loosen shared binding tests Previously we blocked all function calls, but only because we were trying to prevent "eval" calls from appearing in shared bindings. Instead this test allows function calls as long as the identifier "eval" doesn't appear. This also exposed a crash with v8 bindings that is also fixed. Change-Id: I22eefd290c7b82d9c01b2cd2907a46e560ae4db9 Reviewed-by: Chris Adams Reviewed-by: Michael Brasser --- .../data/singleV8BindingDestroyedDuringEvaluation.qml | 12 ++++++++++++ tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 12 +++++++++++- tests/auto/qml/qqmlproperty/data/invalidBinding.qml | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml (limited to 'tests') diff --git a/tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml b/tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml new file mode 100644 index 0000000000..ae84f028a5 --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/singleV8BindingDestroyedDuringEvaluation.qml @@ -0,0 +1,12 @@ +import QtQuick 2.0 +import Qt.test 1.0 + +Item { + MyQmlObject { + value: if (1) 3 + } + + MyQmlObject { + value: { deleteMe(), 2 } + } +} diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index eaa6d39ea4..6b10672c4e 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -183,7 +183,7 @@ private slots: void assignSequenceTypes(); void qtbug_22464(); void qtbug_21580(); - + void singleV8BindingDestroyedDuringEvaluation(); void bug1(); void bug2(); void dynamicCreationCrash(); @@ -1901,6 +1901,16 @@ void tst_qqmlecmascript::qtbug_21580() delete object; } +// Causes a v8 binding, but not all v8 bindings to be destroyed during evaluation +void tst_qqmlecmascript::singleV8BindingDestroyedDuringEvaluation() +{ + QQmlComponent component(&engine, testFileUrl("singleV8BindingDestroyedDuringEvaluation.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + // QTBUG-6781 void tst_qqmlecmascript::bug1() { diff --git a/tests/auto/qml/qqmlproperty/data/invalidBinding.qml b/tests/auto/qml/qqmlproperty/data/invalidBinding.qml index 58e83070ee..35dacf1619 100644 --- a/tests/auto/qml/qqmlproperty/data/invalidBinding.qml +++ b/tests/auto/qml/qqmlproperty/data/invalidBinding.qml @@ -4,7 +4,7 @@ Item { property Text text: myText property Rectangle rectangle1: myText - property Rectangle rectangle2: getMyText() + property Rectangle rectangle2: eval('getMyText()') // eval to force non-shared (v8) binding function getMyText() { return myText; } -- cgit v1.2.3