summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-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()