summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-04 05:19:09 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-03-04 05:19:09 (GMT)
commite86dc3cbc40824353688db52d9933af26a30aaa0 (patch)
tree9574572b7dd33b990e74f2835d40973ef2cbaea8 /tests
parent26d28b39504d1c55690985deb52646114b6cf710 (diff)
downloadQt-e86dc3cbc40824353688db52d9933af26a30aaa0.zip
Qt-e86dc3cbc40824353688db52d9933af26a30aaa0.tar.gz
Qt-e86dc3cbc40824353688db52d9933af26a30aaa0.tar.bz2
QDeclarativeContext::contextProperty() should also access ids
QT-2800
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
index 5f03989..f0117f5 100644
--- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
+++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp
@@ -60,6 +60,7 @@ private slots:
void setContextProperty();
void addDefaultObject();
void destruction();
+ void idAsContextProperty();
private:
QDeclarativeEngine engine;
@@ -429,6 +430,25 @@ void tst_qdeclarativecontext::destruction()
QCOMPARE(ctxt, expr.context());
}
+void tst_qdeclarativecontext::idAsContextProperty()
+{
+ QDeclarativeComponent component(&engine);
+ component.setData("import Qt 4.6; QtObject { property var a; a: QtObject { id: myObject } }", QUrl());
+
+ QObject *obj = component.create();
+ QVERIFY(obj);
+
+ QVariant a = obj->property("a");
+ QVERIFY(a.userType() == QMetaType::QObjectStar);
+
+ QVariant ctxt = qmlContext(obj)->contextProperty("myObject");
+ QVERIFY(ctxt.userType() == QMetaType::QObjectStar);
+
+ QVERIFY(a == ctxt);
+
+ delete obj;
+}
+
QTEST_MAIN(tst_qdeclarativecontext)
#include "tst_qdeclarativecontext.moc"