aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-05-30 18:56:47 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2013-05-30 20:55:19 +0200
commit07c7c419cc2231112ddb39b11c709bf3843ace6d (patch)
tree09582b2023e84d8b4c8ff958dd5bc01fb09ea651
parentacde568e10e3d60e02443762540461f35879fb77 (diff)
Fix all autotests related to value types
Fix 3 bugs in the new implementation, and adjust two expected error messages in the auto test. Change-Id: Ic3c08e54f9babc7e4779d67829e36f3ff805e127 Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
-rw-r--r--src/qml/qml/qqmlvaluetypewrapper.cpp6
-rw-r--r--src/qml/qml/v8/qv8engine.cpp2
-rw-r--r--tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp4
3 files changed, 7 insertions, 5 deletions
diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp
index 36b9994660..31c95e6a53 100644
--- a/src/qml/qml/qqmlvaluetypewrapper.cpp
+++ b/src/qml/qml/qqmlvaluetypewrapper.cpp
@@ -136,7 +136,7 @@ void QmlValueTypeWrapper::initProto(ExecutionEngine *v4)
return;
Object *o = v4->newObject();
- o->defineDefaultProperty(v4, QStringLiteral("toString"), method_toString);
+ o->defineDefaultProperty(v4, QStringLiteral("toString"), method_toString, 1);
proto = Value::fromObject(o);
}
@@ -146,6 +146,7 @@ Value QmlValueTypeWrapper::create(QV8Engine *v8, QObject *object, int property,
initProto(v4);
QmlValueTypeReference *r = new (v4->memoryManager) QmlValueTypeReference(v8);
+ r->externalComparison = true;
r->prototype = proto.value().objectValue();
r->type = type; r->object = object; r->property = property;
return Value::fromObject(r);
@@ -157,6 +158,7 @@ Value QmlValueTypeWrapper::create(QV8Engine *v8, const QVariant &value, QQmlValu
initProto(v4);
QmlValueTypeCopy *r = new (v4->memoryManager) QmlValueTypeCopy(v8);
+ r->externalComparison = true;
r->prototype = proto.value().objectValue();
r->type = type; r->value = value;
return Value::fromObject(r);
@@ -274,7 +276,7 @@ Value QmlValueTypeWrapper::get(Managed *m, ExecutionContext *ctx, String *name,
}
if (!result)
- return Value::undefinedValue();
+ return Object::get(m, ctx, name, hasProperty);
if (result->isFunction()) {
// calling a Q_INVOKABLE function of a value type
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index 2111e87fc9..b665863a9f 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -101,7 +101,7 @@ static bool ObjectComparisonCallback(v8::Handle<v8::Object> lhs, v8::Handle<v8::
return false;
}
- if (QV4::QmlValueTypeWrapper *lv = rhs->v4Value().asQmlValueType()) {
+ if (QV4::QmlValueTypeWrapper *lv = lhs->v4Value().asQmlValueType()) {
if (QV4::VariantObject *rv = rhs->v4Value().asVariantObject())
return lv->isEqual(rv->data);
diff --git a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
index a8e598b11c..7c0507dce3 100644
--- a/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
+++ b/tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp
@@ -946,7 +946,7 @@ void tst_qqmlvaluetypes::bindingAssignment()
// function assignment should fail without crashing
{
QString warning1 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":6:13: Invalid use of Qt.binding() in a binding declaration.");
- QString warning2 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":10: Error: Cannot assign JavaScript function to value-type property");
+ QString warning2 = testFileUrl("bindingAssignment.2.qml").toString() + QLatin1String(":10: Cannot assign JavaScript function to value-type property");
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1));
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2));
QQmlComponent component(&engine, testFileUrl("bindingAssignment.2.qml"));
@@ -1050,7 +1050,7 @@ void tst_qqmlvaluetypes::autoBindingRemoval()
{
QQmlComponent component(&engine, testFileUrl("autoBindingRemoval.3.qml"));
- QString warning = component.url().toString() + ":6: Unable to assign [undefined] to QRect";
+ QString warning = component.url().toString() + ":6:11: Unable to assign [undefined] to QRect";
QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
QVERIFY(object != 0);