summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@trolltech.com>2009-08-13 08:39:28 (GMT)
committerOlivier Goffart <ogoffart@trolltech.com>2009-08-13 13:24:12 (GMT)
commit04ac768f2ac5e3800893370c13c261a075a723ff (patch)
treea14a6c9580cde04bb962c350b9667d4510e66972 /tests/auto
parent88c6dc6ec7f73de279703b30874b30511901854b (diff)
downloadQt-04ac768f2ac5e3800893370c13c261a075a723ff.zip
Qt-04ac768f2ac5e3800893370c13c261a075a723ff.tar.gz
Qt-04ac768f2ac5e3800893370c13c261a075a723ff.tar.bz2
Lazily construct the QScriptActivationObject
We can store flags on the ReturnValueRegister entry in the stackframe header (as native function don't use that) Then when requesting an activation object we can lookup the flags to know if we should create it. This reduce a lot the cost of a native call. Reviewed-by: Kent Hansen
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qscriptengine/tst_qscriptengine.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp
index f15ebdf..821bc0c 100644
--- a/tests/auto/qscriptengine/tst_qscriptengine.cpp
+++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp
@@ -806,10 +806,26 @@ void tst_QScriptEngine::newQMetaObject()
QVERIFY(instance3.instanceOf(qclass));
args.clear();
+ QPointer<QObject> qpointer1 = instance.toQObject();
+ QPointer<QObject> qpointer2 = instance2.toQObject();
+ QPointer<QObject> qpointer3 = instance3.toQObject();
+
+ QVERIFY(qpointer1);
+ QVERIFY(qpointer2);
+ QVERIFY(qpointer3);
+
// verify that AutoOwnership is in effect
instance = QScriptValue();
eng.collectGarbage();
+
+ QEXPECT_FAIL("","collectGarbage not working", Continue);
+ QVERIFY(!qpointer1);
+ QVERIFY(qpointer2);
+ QEXPECT_FAIL("","collectGarbage not working", Continue);
+ QVERIFY(!qpointer3); // was child of instance
+
QVERIFY(instance.toQObject() == 0);
+ QEXPECT_FAIL("","collectGarbage not working", Continue);
QVERIFY(instance3.toQObject() == 0); // was child of instance
QVERIFY(instance2.toQObject() != 0);
instance2 = QScriptValue();
@@ -2060,7 +2076,6 @@ void tst_QScriptEngine::collectGarbage()
QScriptValue v = eng.newQObject(ptr, QScriptEngine::ScriptOwnership);
}
eng.collectGarbage();
- QEXPECT_FAIL("", "", Continue);
QVERIFY(ptr == 0);
}