aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmllanguage/testtypes.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmllanguage/testtypes.cpp')
-rw-r--r--tests/auto/qml/qqmllanguage/testtypes.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmllanguage/testtypes.cpp b/tests/auto/qml/qqmllanguage/testtypes.cpp
index c37845840b..6dd7fca77e 100644
--- a/tests/auto/qml/qqmllanguage/testtypes.cpp
+++ b/tests/auto/qml/qqmllanguage/testtypes.cpp
@@ -92,6 +92,7 @@ void registerTypes()
qmlRegisterType<MyCreateableDerivedClass,1>("Test", 1, 1, "MyCreateableDerivedClass");
qmlRegisterCustomType<CustomBinding>("Test", 1, 0, "CustomBinding", new CustomBindingParser);
+ qmlRegisterCustomType<SimpleObjectWithCustomParser>("Test", 1, 0, "SimpleObjectWithCustomParser", new SimpleObjectCustomParser);
qmlRegisterType<RootObjectInCreationTester>("Test", 1, 0, "RootObjectInCreationTester");
}
@@ -191,3 +192,18 @@ QByteArray EnumSupportingCustomParser::compile(const QV4::CompiledData::QmlUnit
return QByteArray();
}
+
+
+QByteArray SimpleObjectCustomParser::compile(const QV4::CompiledData::QmlUnit *, int, const QList<const QV4::CompiledData::Binding *> &bindings)
+{
+ return QByteArray::number(bindings.count());
+}
+
+void SimpleObjectCustomParser::setCustomData(QObject *object, const QByteArray &data)
+{
+ SimpleObjectWithCustomParser *o = qobject_cast<SimpleObjectWithCustomParser*>(object);
+ Q_ASSERT(o);
+ bool ok = false;
+ o->setCustomBindingsCount(data.toInt(&ok));
+ Q_ASSERT(ok);
+}