summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmllanguage
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-01-21 03:40:03 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-01-21 03:40:03 (GMT)
commit11db0632758db443c3fb336dae23da83a358e73d (patch)
tree40bb3b87c28a41d8dc5686aa00e59c27937064b5 /tests/auto/declarative/qmllanguage
parentdb0cfede616fbed94333615d1f6c1fabad46d088 (diff)
downloadQt-11db0632758db443c3fb336dae23da83a358e73d.zip
Qt-11db0632758db443c3fb336dae23da83a358e73d.tar.gz
Qt-11db0632758db443c3fb336dae23da83a358e73d.tar.bz2
Allow composite value sources
Diffstat (limited to 'tests/auto/declarative/qmllanguage')
-rw-r--r--tests/auto/declarative/qmllanguage/data/MyCompositeValueSource.qml6
-rw-r--r--tests/auto/declarative/qmllanguage/data/propertyValueSource.2.qml5
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp26
3 files changed, 35 insertions, 2 deletions
diff --git a/tests/auto/declarative/qmllanguage/data/MyCompositeValueSource.qml b/tests/auto/declarative/qmllanguage/data/MyCompositeValueSource.qml
new file mode 100644
index 0000000..e620e26
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/MyCompositeValueSource.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyPropertyValueSource {
+ property int x
+}
+
diff --git a/tests/auto/declarative/qmllanguage/data/propertyValueSource.2.qml b/tests/auto/declarative/qmllanguage/data/propertyValueSource.2.qml
new file mode 100644
index 0000000..57a6070
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/propertyValueSource.2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ intProperty : MyCompositeValueSource {}
+}
+
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
index 976dc76..0a636db 100644
--- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -650,6 +650,7 @@ void tst_qmllanguage::autoComponentCreation()
void tst_qmllanguage::propertyValueSource()
{
+ {
QmlComponent component(&engine, TEST_FILE("propertyValueSource.qml"));
VERIFY_ERRORS(0);
MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
@@ -658,8 +659,7 @@ void tst_qmllanguage::propertyValueSource()
QList<QObject *> valueSources;
QObjectList allChildren = object->findChildren<QObject*>();
foreach (QObject *child, allChildren) {
- QmlType *type = QmlMetaType::qmlType(child->metaObject());
- if (type && type->propertyValueSourceCast() != -1)
+ if (qobject_cast<QmlPropertyValueSource *>(child))
valueSources.append(child);
}
@@ -669,6 +669,28 @@ void tst_qmllanguage::propertyValueSource()
QVERIFY(valueSource != 0);
QCOMPARE(valueSource->prop.object(), object);
QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty")));
+ }
+
+ {
+ QmlComponent component(&engine, TEST_FILE("propertyValueSource.2.qml"));
+ VERIFY_ERRORS(0);
+ MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QList<QObject *> valueSources;
+ QObjectList allChildren = object->findChildren<QObject*>();
+ foreach (QObject *child, allChildren) {
+ if (qobject_cast<QmlPropertyValueSource *>(child))
+ valueSources.append(child);
+ }
+
+ QCOMPARE(valueSources.count(), 1);
+ MyPropertyValueSource *valueSource =
+ qobject_cast<MyPropertyValueSource *>(valueSources.at(0));
+ QVERIFY(valueSource != 0);
+ QCOMPARE(valueSource->prop.object(), object);
+ QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty")));
+ }
}
void tst_qmllanguage::attachedProperties()