diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-09-23 15:52:10 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-26 09:05:16 +0200 |
commit | 12fd2ccd3fa2dc0133b5a3fb89f9fdf5cf721232 (patch) | |
tree | 880acb9c7c0d8289185b6aebe4339f439c707a0e /tests | |
parent | 2e4f66caa8a5f9e887dbdb4e3f2ae5c9be9a7005 (diff) |
Fix Persistent/WeakValue API
Don't use unprotected Values in the API anymore.
Change-Id: I8851628227fca374de24701bc8ee0908b5ae3923
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.h | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 18 |
2 files changed, 12 insertions, 10 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h index a77c300d49..cba0267b26 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.h +++ b/tests/auto/qml/qqmlecmascript/testtypes.h @@ -1233,13 +1233,13 @@ public: { QQmlData *ddata = QQmlData::get(this); assert(ddata); - QV4::QObjectWrapper *thisObject = ddata->jsWrapper.value().as<QV4::QObjectWrapper>(); + QV4::QObjectWrapper *thisObject = QV4::Value::fromReturnedValue(ddata->jsWrapper.value()).as<QV4::QObjectWrapper>(); assert(thisObject); QQmlData *otherDData = QQmlData::get(other); assert(otherDData); - thisObject->defineDefaultProperty(QStringLiteral("autoTestStrongRef"), otherDData->jsWrapper.value()); + thisObject->defineDefaultProperty(QStringLiteral("autoTestStrongRef"), QV4::Value::fromReturnedValue(otherDData->jsWrapper.value())); } void setEngine(QQmlEngine* declarativeEngine) diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index d85b974175..a5f30a01c2 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -3905,8 +3905,11 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) { if (qmlglobal.isUndefined()) continue; + QV4::Scope scope(QV8Engine::getV4((engine))); + QV4::ScopedValue qml(scope, qmlglobal.value()); - scriptContext = QV4::QmlContextWrapper::getContext(qmlglobal); + scriptContext = QV4::QmlContextWrapper::getContext(qml); + qml = QV4::Encode::undefined(); { QV4::Scope scope(QV8Engine::getV4((engine))); @@ -3915,7 +3918,8 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) { } engine->gc(); - newContext = QV4::QmlContextWrapper::getContext(qmlglobal); + qml = qmlglobal.value(); + newContext = QV4::QmlContextWrapper::getContext(qml); QVERIFY(scriptContext == newContext); } } @@ -4992,11 +4996,11 @@ void tst_qqmlecmascript::propertyVarInheritance() { // XXX NOTE: this is very implementation dependent. QDVMEMO->vmeProperty() is the only // public function which can return us a handle to something in the varProperties array. - QV4::Value tmp = QV4::Value::fromReturnedValue(icovmemo->vmeProperty(ico5->metaObject()->indexOfProperty("circ"))); + QV4::ReturnedValue tmp = icovmemo->vmeProperty(ico5->metaObject()->indexOfProperty("circ")); icoCanaryHandle = tmp; - tmp = QV4::Value::fromReturnedValue(ccovmemo->vmeProperty(cco5->metaObject()->indexOfProperty("circ"))); + tmp = ccovmemo->vmeProperty(cco5->metaObject()->indexOfProperty("circ")); ccoCanaryHandle = tmp; - tmp = QV4::Value::nullValue(); + tmp = QV4::Encode::null(); QVERIFY(!icoCanaryHandle.isUndefined()); QVERIFY(!ccoCanaryHandle.isUndefined()); gc(engine); @@ -5038,9 +5042,7 @@ void tst_qqmlecmascript::propertyVarInheritance2() QCOMPARE(childObject->property("textCanary").toInt(), 10); QV4::WeakValue childObjectVarArrayValueHandle; { - QV4::Value tmp = QV4::Value::fromReturnedValue(QQmlVMEMetaObject::get(childObject)->vmeProperty(childObject->metaObject()->indexOfProperty("vp"))); - childObjectVarArrayValueHandle = tmp; - tmp = QV4::Value::nullValue(); + childObjectVarArrayValueHandle = QQmlVMEMetaObject::get(childObject)->vmeProperty(childObject->metaObject()->indexOfProperty("vp")); QVERIFY(!childObjectVarArrayValueHandle.isUndefined()); gc(engine); QVERIFY(!childObjectVarArrayValueHandle.isUndefined()); // should not have been collected yet. |