summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeecmascript
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-10-19 04:55:47 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-10-19 04:55:47 (GMT)
commit0e8862bbcfe3d77a02cd32889e6d2fa928acd361 (patch)
tree15e0762d496802db7f86c6de1300bd8df26169f3 /tests/auto/declarative/qdeclarativeecmascript
parent341831b75166cee713c2d792b81b61f3ae15b8e7 (diff)
downloadQt-0e8862bbcfe3d77a02cd32889e6d2fa928acd361.zip
Qt-0e8862bbcfe3d77a02cd32889e6d2fa928acd361.tar.gz
Qt-0e8862bbcfe3d77a02cd32889e6d2fa928acd361.tar.bz2
Properties take precedence over methods
Properties have always had precedence over methods in C++ classes, but erroneously, not in types declared in QML. This was because the property cache for the two went through a different code path. With changes 0c06e59577df1ec715e67d6d5842800bcec24945 and c407d79f79c67f2f2bb84efc93061fd57fe4cf54 the code paths were unified and this bug was exposed.
Diffstat (limited to 'tests/auto/declarative/qdeclarativeecmascript')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml8
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp4
2 files changed, 6 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml
index 95f34d8..9555b7f 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml
@@ -2,7 +2,7 @@ import QtQuick 1.0
Item {
property int a: 0
- property int b: 0
+ property int b: 14
function b() { return 11; }
function c() { return 33; }
@@ -21,7 +21,7 @@ Item {
id: nested
property int a: 1
property int test: a.value
- property int test2: b()
+ property int test2: b
property int test3: c.value
}
@@ -30,8 +30,8 @@ Item {
property int test1: a.value
property alias test2: nested.test
- // methods takes precedence over local, and root properties
- property int test3: b()
+ // properties takes precedence over local, and root methods
+ property int test3: b
property alias test4: nested.test2
// id takes precedence over methods
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index e4e5a54..72e2e10 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -803,8 +803,8 @@ void tst_qdeclarativeecmascript::scope()
QCOMPARE(object->property("test1").toInt(), 19);
QCOMPARE(object->property("test2").toInt(), 19);
- QCOMPARE(object->property("test3").toInt(), 11);
- QCOMPARE(object->property("test4").toInt(), 11);
+ QCOMPARE(object->property("test3").toInt(), 14);
+ QCOMPARE(object->property("test4").toInt(), 14);
QCOMPARE(object->property("test5").toInt(), 24);
QCOMPARE(object->property("test6").toInt(), 24);
}