summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qmllanguage
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-10-09 10:17:04 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-10-09 10:17:04 (GMT)
commita700d7c263748d3635eb06a7091164fd75ec608c (patch)
tree17fc6e408bc49003ddb5800ca6a60f5725849626 /tests/auto/declarative/qmllanguage
parent65aa9ff2704fed181eee2b189fc0db81a59ff75f (diff)
downloadQt-a700d7c263748d3635eb06a7091164fd75ec608c.zip
Qt-a700d7c263748d3635eb06a7091164fd75ec608c.tar.gz
Qt-a700d7c263748d3635eb06a7091164fd75ec608c.tar.bz2
Add id aliases
Diffstat (limited to 'tests/auto/declarative/qmllanguage')
-rw-r--r--tests/auto/declarative/qmllanguage/data/alias.5.qml13
-rw-r--r--tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp24
2 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmllanguage/data/alias.5.qml b/tests/auto/declarative/qmllanguage/data/alias.5.qml
new file mode 100644
index 0000000..39bfd9b
--- /dev/null
+++ b/tests/auto/declarative/qmllanguage/data/alias.5.qml
@@ -0,0 +1,13 @@
+import Qt 4.6
+import Test 1.0
+
+Object {
+ property alias otherAlias: otherObject
+
+ property var other
+ other: MyQmlObject {
+ id: otherObject
+ value: 10
+ }
+}
+
diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
index 135a207..ff78e6d 100644
--- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
+++ b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp
@@ -620,6 +620,30 @@ void tst_qmllanguage::aliasProperties()
QVERIFY(object != 0);
QCOMPARE(object->property("enumAlias").toInt(), 1);
+
+ delete object;
+ }
+
+ // Id aliases
+ {
+ QmlComponent component(&engine, TEST_FILE("alias.5.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+
+ QVariant v = object->property("otherAlias");
+ QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>());
+ MyQmlObject *o = qvariant_cast<MyQmlObject*>(v);
+ QCOMPARE(o->value(), 10);
+
+ delete o;
+
+ v = object->property("otherAlias");
+ QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>());
+ o = qvariant_cast<MyQmlObject*>(v);
+ QVERIFY(o == 0);
+
+ delete object;
}
}