diff options
author | Lars Knoll <lars.knoll@digia.com> | 2013-05-14 02:01:04 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-05-17 23:59:03 +0200 |
commit | bd7fb994da9dbb9340f6485376f0f187488a05a4 (patch) | |
tree | c9f92ae7aaf346a8def41e1ff581f20e317eac08 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | 093c9c94189018381a0e155b0fa421cc73dbb704 (diff) |
convert QV8VariantWrapper to v4
Implement variant support through a QV4::VariantObject
class. Port scarce resource support for the
pixmap and image variants.
Change-Id: Ib6aac8debc7f57224ccddb912ab4342c5f1dec15
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 5c0e277859..58072e87a0 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -4056,6 +4056,7 @@ void tst_qqmlecmascript::scarceResources_other() origPixmap.fill(Qt::blue); QString srp_name, expectedWarning; QQmlEnginePrivate *ep = QQmlEnginePrivate::get(&engine); + QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); ScarceResourceObject *eo = 0; QObject *srsc = 0; QObject *object = 0; @@ -4081,7 +4082,7 @@ void tst_qqmlecmascript::scarceResources_other() QCOMPARE(srsc->property("scarceResourceCopy").value<QPixmap>(), origPixmap); eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(!(eo->scarceResourceIsDetached())); // should be another copy of the resource now. - QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point. + QVERIFY(v4->scarceResources.isEmpty()); // should have been released by this point. delete object; // test that scarce resources are handled properly from js functions in qml files @@ -4100,7 +4101,7 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // just released, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point. + QVERIFY(v4->scarceResources.isEmpty()); // should have been released by this point. delete object; // test that if an exception occurs while invoking js function from cpp, that the resources are released. @@ -4116,7 +4117,7 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred. eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point. + QVERIFY(v4->scarceResources.isEmpty()); // should have been released by this point. delete object; // test that if an Item which has JS ownership but has a scarce resource property is garbage collected, @@ -4126,9 +4127,9 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(object != 0); QVERIFY(!object->property("varProperty").isValid()); // not assigned yet QMetaObject::invokeMethod(object, "assignVarProperty"); - QVERIFY(ep->scarceResources.isEmpty()); // the scarce resource is a VME property. + QVERIFY(v4->scarceResources.isEmpty()); // the scarce resource is a VME property. QMetaObject::invokeMethod(object, "deassignVarProperty"); - QVERIFY(ep->scarceResources.isEmpty()); // should still be empty; the resource should have been released on gc. + QVERIFY(v4->scarceResources.isEmpty()); // should still be empty; the resource should have been released on gc. delete object; /* property variant semantics */ @@ -4153,7 +4154,7 @@ void tst_qqmlecmascript::scarceResources_other() QCOMPARE(srsc->property("scarceResourceCopy").value<QPixmap>(), origPixmap); eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(!(eo->scarceResourceIsDetached())); // should be another copy of the resource now. - QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point. + QVERIFY(v4->scarceResources.isEmpty()); // should have been released by this point. delete object; // test that scarce resources are handled properly from js functions in qml files @@ -4172,7 +4173,7 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // just released, so should not be valid eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point. + QVERIFY(v4->scarceResources.isEmpty()); // should have been released by this point. delete object; // test that if an exception occurs while invoking js function from cpp, that the resources are released. @@ -4188,7 +4189,7 @@ void tst_qqmlecmascript::scarceResources_other() QVERIFY(!object->property("scarceResourceCopy").isValid()); // due to exception, assignment will NOT have occurred. eo = qobject_cast<ScarceResourceObject*>(QQmlProperty::read(object, "a").value<QObject*>()); QVERIFY(eo->scarceResourceIsDetached()); // should be no other copies of it at this stage. - QVERIFY(ep->scarceResources.isEmpty()); // should have been released by this point. + QVERIFY(v4->scarceResources.isEmpty()); // should have been released by this point. delete object; } @@ -4424,6 +4425,7 @@ void tst_qqmlecmascript::scarceResources() QFETCH(QStringList, expectedErrors); QQmlEnginePrivate *ep = QQmlEnginePrivate::get(&engine); + QV4::ExecutionEngine *v4 = QV8Engine::getV4(ep->v8engine()); ScarceResourceObject *eo = 0; QObject *object = 0; @@ -4448,7 +4450,7 @@ void tst_qqmlecmascript::scarceResources() QCOMPARE(eo->scarceResourceIsDetached(), expectedDetachStatus); } - QVERIFY(ep->scarceResources.isEmpty()); + QVERIFY(v4->scarceResources.isEmpty()); delete object; } |