diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-03 07:14:07 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-03-03 07:15:01 (GMT) |
commit | 4690084e9f3fbf3635aa3fb6a8025ae046672aea (patch) | |
tree | e691c0745411ae0075cd507bc14799cc30c68124 /tests/auto/declarative/qdeclarativeecmascript | |
parent | aebadf248a93458615a53b3480987f829aba0ee6 (diff) | |
download | Qt-4690084e9f3fbf3635aa3fb6a8025ae046672aea.zip Qt-4690084e9f3fbf3635aa3fb6a8025ae046672aea.tar.gz Qt-4690084e9f3fbf3635aa3fb6a8025ae046672aea.tar.bz2 |
Move JS global scope to top of the QML scope chain
QT-2787
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml | 13 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 10 |
2 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml new file mode 100644 index 0000000..4ad7f34 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.3.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +Item { + id: root + + property int foo: 12 + property int console: 11 + + property bool test1: foo == 12 + property bool test2: console != 11 + property bool test3: root.console == 11 +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 85a3ef3..e45f0fa 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -729,6 +729,16 @@ void tst_qdeclarativeecmascript::scope() QCOMPARE(object->property("test5").toInt(), 24); QCOMPARE(object->property("test6").toInt(), 24); } + + { + QDeclarativeComponent component(&engine, TEST_FILE("scope.3.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + QCOMPARE(object->property("test3").toBool(), true); + } } /* |