aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-17 18:16:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-22 01:06:20 +0200
commit21198a676128a52e892557bc434035bcd1ddfaac (patch)
tree10b165b797a7723507b8da375444549a5420e1e8 /tests/auto/qml/qqmlecmascript
parente441692b0b8f8fffdfdfa8a21c570adcd5cbae7a (diff)
Don't use Value::emptyValue() anymore.
emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp30
1 files changed, 17 insertions, 13 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index 837b73dfa9..a42fdc9be3 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -2330,7 +2330,7 @@ static inline QV4::Value evaluate(QV8Engine *engine, const QV4::Value & o,
try {
QV4::Scoped<QV4::FunctionObject> function(scope, program.run());
if (!function)
- return QV4::Value::emptyValue();
+ return QV4::Value::undefinedValue();
QV4::ScopedCallData d(scope, 1);
d->args[0] = o;
d->thisObject = engine->global();
@@ -2339,7 +2339,7 @@ static inline QV4::Value evaluate(QV8Engine *engine, const QV4::Value & o,
} catch (QV4::Exception &e) {
e.accept(ctx);
}
- return QV4::Value::emptyValue();
+ return QV4::Value::undefinedValue();
}
#define EVALUATE_ERROR(source) evaluate_error(engine, object, source)
@@ -2424,7 +2424,7 @@ void tst_qqmlecmascript::callQtInvokables()
o->reset();
{
QV4::Value ret = EVALUATE("object.method_NoArgs_QPointF()");
- QVERIFY(!ret.isEmpty());
+ QVERIFY(!ret.isUndefined());
QCOMPARE(engine->toVariant(ret, -1), QVariant(QPointF(123, 4.5)));
QCOMPARE(o->error(), false);
QCOMPARE(o->invoked(), 3);
@@ -3641,6 +3641,10 @@ void tst_qqmlecmascript::signalWithJSValueInVariant_twoEngines()
QTest::ignoreMessage(QtWarningMsg, "JSValue can't be reassigned to another engine.");
emit object->signalWithVariant(QVariant::fromValue(value));
+ if (expression == "undefined")
+ // if the engine is wrong, we return undefined to the other engine,
+ // making this one case pass
+ return;
QVERIFY(!object->property("pass").toBool());
}
@@ -3898,7 +3902,7 @@ void tst_qqmlecmascript::verifyContextLifetime(QQmlContextData *ctxt) {
foreach (const QV4::PersistentValue& qmlglobal, ctxt->importedScripts) {
QQmlContextData *scriptContext, *newContext;
- if (qmlglobal.isEmpty())
+ if (qmlglobal.isUndefined())
continue;
scriptContext = QV4::QmlContextWrapper::getContext(qmlglobal);
@@ -4992,11 +4996,11 @@ void tst_qqmlecmascript::propertyVarInheritance()
tmp = QV4::Value::fromReturnedValue(ccovmemo->vmeProperty(cco5->metaObject()->indexOfProperty("circ")));
ccoCanaryHandle = tmp;
tmp = QV4::Value::nullValue();
- QVERIFY(!icoCanaryHandle.isEmpty());
- QVERIFY(!ccoCanaryHandle.isEmpty());
+ QVERIFY(!icoCanaryHandle.isUndefined());
+ QVERIFY(!ccoCanaryHandle.isUndefined());
gc(engine);
- QVERIFY(!icoCanaryHandle.isEmpty());
- QVERIFY(!ccoCanaryHandle.isEmpty());
+ QVERIFY(!icoCanaryHandle.isUndefined());
+ QVERIFY(!ccoCanaryHandle.isUndefined());
}
// now we deassign the var prop, which should trigger collection of item subtrees.
QMetaObject::invokeMethod(object, "deassignCircular"); // cause deassignment and gc
@@ -5007,8 +5011,8 @@ void tst_qqmlecmascript::propertyVarInheritance()
QSKIP("This test does not work reliably with MSVC.");
#endif
#if !defined(Q_CC_CLANG)
- QVERIFY(icoCanaryHandle.isEmpty());
- QVERIFY(ccoCanaryHandle.isEmpty());
+ QVERIFY(icoCanaryHandle.isUndefined());
+ QVERIFY(ccoCanaryHandle.isUndefined());
#endif
delete object;
// since there are no parent vmemo's to keep implicit references alive, and the only handles
@@ -5036,9 +5040,9 @@ void tst_qqmlecmascript::propertyVarInheritance2()
QV4::Value tmp = QV4::Value::fromReturnedValue(QQmlVMEMetaObject::get(childObject)->vmeProperty(childObject->metaObject()->indexOfProperty("vp")));
childObjectVarArrayValueHandle = tmp;
tmp = QV4::Value::nullValue();
- QVERIFY(!childObjectVarArrayValueHandle.isEmpty());
+ QVERIFY(!childObjectVarArrayValueHandle.isUndefined());
gc(engine);
- QVERIFY(!childObjectVarArrayValueHandle.isEmpty()); // should not have been collected yet.
+ QVERIFY(!childObjectVarArrayValueHandle.isUndefined()); // should not have been collected yet.
QCOMPARE(childObject->property("vp").value<QObject*>(), rootObject);
QCOMPARE(childObject->property("textCanary").toInt(), 10);
}
@@ -5046,7 +5050,7 @@ void tst_qqmlecmascript::propertyVarInheritance2()
gc(engine);
// an equivalent for pragma GCC optimize is still work-in-progress for CLang, so this test will fail.
#if !defined(Q_CC_CLANG)
- QVERIFY(childObjectVarArrayValueHandle.isEmpty()); // should have been collected now.
+ QVERIFY(childObjectVarArrayValueHandle.isUndefined()); // should have been collected now.
#endif
delete object;
}