summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2010-03-22 02:26:55 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2010-03-22 02:29:17 (GMT)
commit3d9ea4d3b1cf81710ba5ef843399c8625e1ccd9f (patch)
tree1ae4fce93041bb4d4cfa56ee9bf56bea4ddce787
parent44660e6d34ce969069a82fe26f5e4b13d4d5ec78 (diff)
downloadQt-3d9ea4d3b1cf81710ba5ef843399c8625e1ccd9f.zip
Qt-3d9ea4d3b1cf81710ba5ef843399c8625e1ccd9f.tar.gz
Qt-3d9ea4d3b1cf81710ba5ef843399c8625e1ccd9f.tar.bz2
Fix test.
Use a custom type to test this language feature, rather than PropertyChanges.
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml2
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.cpp3
-rw-r--r--tests/auto/declarative/qdeclarativelanguage/testtypes.h16
3 files changed, 20 insertions, 1 deletions
diff --git a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml
index 85d1052..930bf2c 100644
--- a/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml
+++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml
@@ -1,6 +1,6 @@
import Test 1.0
import Qt 4.6
-PropertyChanges {
+MyCustomParserType {
propa: a + 10
propb: Math.min(a, 10)
propc: MyPropertyValueSource {}
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
index 6efe755..623775a 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp
@@ -51,6 +51,9 @@ void registerTypes()
qmlRegisterType<MyNamespace::MyNamespacedType>("Test",1,0,"MyNamespacedType");
qmlRegisterType<MyNamespace::MySecondNamespacedType>("Test",1,0,"MySecondNamespacedType");
qmlRegisterType<MyGroupedObject>();
+
+ qmlRegisterCustomType<MyCustomParserType>("Test", 1, 0, "MyCustomParserType", "MyCustomParserType",
+ new MyCustomParserTypeParser);
}
QVariant myCustomVariantTypeConverter(const QString &data)
diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
index 4963e2e..8c163a5 100644
--- a/tests/auto/declarative/qdeclarativelanguage/testtypes.h
+++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h
@@ -54,6 +54,8 @@
#include <QtDeclarative/qdeclarativescriptstring.h>
#include <QtDeclarative/qdeclarativeproperty.h>
+#include <private/qdeclarativecustomparser_p.h>
+
QVariant myCustomVariantTypeConverter(const QString &data);
class MyInterface
@@ -560,6 +562,20 @@ namespace MyNamespace {
QML_DECLARE_TYPE(MyNamespace::MyNamespacedType);
QML_DECLARE_TYPE(MyNamespace::MySecondNamespacedType);
+class MyCustomParserType : public QObject
+{
+ Q_OBJECT
+};
+
+class MyCustomParserTypeParser : public QDeclarativeCustomParser
+{
+public:
+ QByteArray compile(const QList<QDeclarativeCustomParserProperty> &) { return QByteArray(); }
+ void setCustomData(QObject *, const QByteArray &) {}
+};
+
+QML_DECLARE_TYPE(MyCustomParserType);
+
void registerTypes();
#endif // TESTTYPES_H