aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2013-12-11 15:45:43 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-12-11 19:09:05 +0100
commitd9b934a1c115f6eac00b9b2564c908f7eecd196a (patch)
tree97b9aea689e8b87be78db44f3104dadc5a5989cb /tests
parent3ca143e2d46685e9e099f0448e77250d3a34d83c (diff)
Fix regression in QML string list concatenations
String lists and other QList property types (wrapped as QQmlSequence) should behave like arrays and have the Array prototype. Therefore it should be possible to pass them also as parameter to concat and they get composed correctly, i.e. the individual items get appended instead of the list being appened as one item. In the spec for concat this "special" casing should be applied if the "class internal property" is "Array", and concat appears to be the only place where this check is done. Therefore this patch adds another exception to match the expected behavior in QML and extends the "internal class is Array" meaning to QML list types. This is a regression from Qt <= 5.1.x Task-number: QTBUG-33149 Change-Id: Iab9522ac3c4ae6b746e790a99d87501b1cc1b655 Reviewed-by: Michael Brasser <michael.brasser@live.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
index 52abda1e55..8d08cc5559 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
@@ -140,6 +140,22 @@ Item {
if (msco.intListProperty.toString() != expected.toString()) success = false;
expected = 7;
if (poppedVal != expected) success = false;
+
+ // concat
+ msco.stringListProperty = [ "one", "two" ]
+ stringList = [ "hello", "world" ]
+ stringList = stringList.concat(msco.stringListProperty)
+ expected = [ "hello", "world", "one", "two" ]
+ if (stringList.length != expected.length) {
+ success = false;
+ } else {
+ for (var i = 0; i < stringList.length; ++i) {
+ if (stringList[i] != expected[i]) {
+ success = false;
+ break;
+ }
+ }
+ }
}
property variant variantList: [ 1, 2, 3, 4, 5 ];