summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativecontext
diff options
context:
space:
mode:
authorBea Lam <bea.lam@nokia.com>2010-03-05 03:56:47 (GMT)
committerBea Lam <bea.lam@nokia.com>2010-03-05 03:56:47 (GMT)
commit0c558e05f880cb51078b2d5e5281227352c1de3f (patch)
tree809e95ab06fc5d757c1d66493de5c9376866aee1 /tests/auto/declarative/qdeclarativecontext
parentaf81ea8a5abbd9a94eb6ab5c3fe0425779905d5a (diff)
parent48fd47f64f3f73e82016161d82cdf67908a9c653 (diff)
downloadQt-0c558e05f880cb51078b2d5e5281227352c1de3f.zip
Qt-0c558e05f880cb51078b2d5e5281227352c1de3f.tar.gz
Qt-0c558e05f880cb51078b2d5e5281227352c1de3f.tar.bz2
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto/declarative/qdeclarativecontext')
-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"