diff options
author | Chris Adams <christopher.adams@nokia.com> | 2012-08-08 14:53:45 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-08-09 05:57:33 +0200 |
commit | f09517bd9c907698a05ee92ccf158a06db3340b8 (patch) | |
tree | c8bae3c214f06c1293d3f0706960f7139dc999db /tests/auto/qml/qqmlecmascript/data | |
parent | 9c2ab7af355d0132af771f8784e42c13d1f49183 (diff) |
Ensure that copy sequences can be passed as arguments
Previously, automatic conversion from JS array to sequence copy
resource was not performed in the case where the array was passed as
a parameter to a QObject function invocation. This commit adds code
to check if the parameter type is a sequence type - and if so, and if
the value is a variantlist, we convert it to a sequence of the
appropriate type.
Change-Id: I3cc3e2f95604bc71d1d8d237e1acffa1e03b78ba
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/data')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml index f6614dad0c..088e240ad4 100644 --- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml +++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.copy.qml @@ -157,4 +157,27 @@ Item { if (jsIntList == jsIntList2) success = false; if (jsIntList != jsIntList) success = false; } + + // this test ensures that copy resource sequences can be passed as parameters + function testCopyParameters() { + success = false; + + var jsIntList = msco.generateIntSequence(); + success = msco.parameterEqualsGeneratedIntSequence(jsIntList); + if (success == false) return; + + // here we construct something which should be converted to a copy sequence automatically. + success = msco.parameterEqualsGeneratedIntSequence([1,2,3]); + } + + // this test ensures that reference resource sequences are converted + // to copy resource sequences when passed as parameters. + function testReferenceParameters() { + success = false; + + msco.intListProperty = msco.generateIntSequence(); + var jsIntList = msco.intListProperty + success = msco.parameterEqualsGeneratedIntSequence(jsIntList); + if (success == false) return; + } } |