summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-03-04 08:22:49 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-03-04 08:23:30 (GMT)
commit83cbbd6c4c9ff2f00651c31af0d52845b2e98390 (patch)
treeee347a5dcdd4b0b13aa4010ca2b9fc7386609263 /tests
parent0a6401da552805d2e3f3ca228153d66590d3a142 (diff)
downloadQt-83cbbd6c4c9ff2f00651c31af0d52845b2e98390.zip
Qt-83cbbd6c4c9ff2f00651c31af0d52845b2e98390.tar.gz
Qt-83cbbd6c4c9ff2f00651c31af0d52845b2e98390.tar.bz2
Add testcase for QTBUG-7730
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml12
-rw-r--r--tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp17
2 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml
new file mode 100644
index 0000000..d65b6e7
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.4.qml
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: a
+ property int b: 9
+
+ property int test
+ property string test2
+
+ // Should resolve to signal arguments, not to other elements in the file
+ onArgumentSignal: { test = a; test2 = b; }
+}
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
index 2e00e10..b5649cb 100644
--- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
+++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp
@@ -740,6 +740,23 @@ void tst_qdeclarativeecmascript::scope()
QCOMPARE(object->property("test2").toBool(), true);
QCOMPARE(object->property("test3").toBool(), true);
}
+
+ // Signal argument scope
+ {
+ QDeclarativeComponent component(&engine, TEST_FILE("scope.4.qml"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+
+ QCOMPARE(object->property("test").toInt(), 0);
+ QCOMPARE(object->property("test2").toString(), QString());
+
+ emit object->argumentSignal(13, "Argument Scope", 9);
+
+ QCOMPARE(object->property("test").toInt(), 13);
+ QCOMPARE(object->property("test2").toString(), QString("Argument Scope"));
+
+ delete object;
+ }
}
/*