From 51e9a75d2d26f2f7ad4cf11a730c8d6e12dc3886 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Tue, 6 Oct 2009 15:01:28 +1000 Subject: Improve scope autotest --- tests/auto/declarative/qmlecmascript/data/ScopeObject.qml | 14 ++++++++++++++ tests/auto/declarative/qmlecmascript/data/scope.qml | 6 ++++++ tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 2 ++ 3 files changed, 22 insertions(+) create mode 100644 tests/auto/declarative/qmlecmascript/data/ScopeObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/ScopeObject.qml b/tests/auto/declarative/qmlecmascript/data/ScopeObject.qml new file mode 100644 index 0000000..b7bec63 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/ScopeObject.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Item { + property int a: 3 + property int binding: myFunction(); + property int binding2: myCompFunction(); + + Script { + function myCompFunction() { + return a; + } + } +} + diff --git a/tests/auto/declarative/qmlecmascript/data/scope.qml b/tests/auto/declarative/qmlecmascript/data/scope.qml index 87155d1..80222c8 100644 --- a/tests/auto/declarative/qmlecmascript/data/scope.qml +++ b/tests/auto/declarative/qmlecmascript/data/scope.qml @@ -31,6 +31,10 @@ Item { property int binding4: myNestedFunction() } + ScopeObject { + id: CompObject + } + property alias test1: Root.binding property alias test2: NestedObject.binding property alias test3: Root.binding2 @@ -39,4 +43,6 @@ Item { property alias test6: NestedObject.binding3 property alias test7: Root.binding4 property alias test8: NestedObject.binding4 + property alias test9: CompObject.binding + property alias test10: CompObject.binding2 } diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 15bfe24..c69528a 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -542,6 +542,8 @@ void tst_qmlecmascript::scope() QCOMPARE(object->property("test6").toInt(), 1); QCOMPARE(object->property("test7").toInt(), 2); QCOMPARE(object->property("test8").toInt(), 2); + QCOMPARE(object->property("test9").toInt(), 1); + QCOMPARE(object->property("test10").toInt(), 3); } /* -- cgit v0.12