aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@digia.com>2014-07-26 09:14:44 +0200
committerSimon Hausmann <simon.hausmann@digia.com>2014-07-26 13:21:16 +0200
commit75d8ebb3e6925f500ddeefe2ab491be2ae83264c (patch)
tree6874c91386434f4a1934a9555a3f1d5daf69434c /tests/auto/qml/qqmlecmascript
parentfcb40ff6d71f4561401e6b2bd4d7fc706fff8eee (diff)
parentba8416b80f42c81387170620472194e7a76429b8 (diff)
Merge remote-tracking branch 'origin/5.3' into dev
Conflicts: src/qml/compiler/qv4ssa.cpp src/qml/jsruntime/qv4arrayobject.cpp src/qml/jsruntime/qv4engine.cpp Change-Id: Ie3ef6202b6a3a8521971e1be10c40c6a2db6989c
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r--tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
index 8847055a70..5103168fd3 100644
--- a/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
+++ b/tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml
@@ -165,6 +165,43 @@ Item {
}
}
}
+
+ // unshift
+ msco.stringListProperty = [ "one", "two" ]
+ var unshiftedVal = msco.stringListProperty.unshift("zero")
+ expected = [ "zero", "one", "two" ]
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+ expected = 3
+ if (msco.stringListProperty.length != expected) success = false
+ msco.stringListProperty = [ ]
+ msco.stringListProperty.unshift("zero", "one")
+ expected = [ "zero", "one" ]
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+ expected = 2
+ if (msco.stringListProperty.length != expected) success = false
+
+ // shift
+ msco.stringListProperty = [ "one", "two", "three" ]
+ var shiftVal = msco.stringListProperty.shift()
+ expected = [ "two", "three" ]
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+ expected = "one"
+ if (shiftVal != expected) success = false
+ shiftVal = msco.stringListProperty.shift()
+ expected = [ "three" ]
+ if (msco.stringListProperty.toString() != expected.toString()) success = false;
+ expected = "two"
+ if (shiftVal != expected) success = false
+ shiftVal = msco.stringListProperty.shift()
+ expected = 0
+ if (msco.stringListProperty.length != expected) success = false;
+ expected = "three"
+ if (shiftVal != expected) success = false
+ shiftVal = msco.stringListProperty.shift()
+ expected = 0
+ if (msco.stringListProperty.length != expected) success = false;
+ expected = undefined
+ if (shiftVal != expected) success = false
}
property variant variantList: [ 1, 2, 3, 4, 5 ];