diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 2809124028..770d6b8197 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -320,6 +320,8 @@ private slots: void singletonWithEnum(); void lazyBindingEvaluation(); void varPropertyAccessOnObjectWithInvalidContext(); + void importedScriptsAccessOnObjectWithInvalidContext(); + void contextObjectOnLazyBindings(); private: // static void propertyVarWeakRefCallback(v8::Persistent<v8::Value> object, void* parameter); @@ -2316,7 +2318,7 @@ static inline bool evaluate_value(QV8Engine *engine, const QV4::ValueRef o, ctx->catchException(); return false; } - return Runtime::strictEqual(value, result); + return QV4::Runtime::strictEqual(value, result); } static inline QV4::ReturnedValue evaluate(QV8Engine *engine, const QV4::ValueRef o, @@ -7579,6 +7581,28 @@ void tst_qqmlecmascript::varPropertyAccessOnObjectWithInvalidContext() QVERIFY(obj->property("success") == true); } +void tst_qqmlecmascript::importedScriptsAccessOnObjectWithInvalidContext() +{ + QQmlComponent component(&engine, testFileUrl("importedScriptsAccessOnObjectWithInvalidContext.qml")); + QScopedPointer<QObject> obj(component.create()); + if (obj.isNull()) + qDebug() << component.errors().first().toString(); + QVERIFY(!obj.isNull()); + QTRY_VERIFY(obj->property("success") == true); +} + +void tst_qqmlecmascript::contextObjectOnLazyBindings() +{ + QQmlComponent component(&engine, testFileUrl("contextObjectOnLazyBindings.qml")); + QScopedPointer<QObject> obj(component.create()); + if (obj.isNull()) + qDebug() << component.errors().first().toString(); + QVERIFY(!obj.isNull()); + QObject *subObject = qvariant_cast<QObject*>(obj->property("subObject")); + QVERIFY(subObject); + QCOMPARE(subObject->property("testValue").toInt(), int(42)); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |