diff options
author | Martin Jones <martin.jones@jollamobile.com> | 2014-07-16 13:20:53 +1000 |
---|---|---|
committer | Robin Burchell <robin+qt@viroteck.net> | 2014-07-22 12:24:53 +0200 |
commit | ac032fc1524f8e00a26580a68ed1c4dc23077c14 (patch) | |
tree | 3ac2cadda38926ebf815086ed148ca3a3a84f47c /tests | |
parent | 1bc6afe8e0eb21e83f0acda8fdb263670e3172e8 (diff) |
shift and unshift fail for QQmlSequence types
QQmlSequence is a Custom array type, so must use the generic
shift/unshift implementation.
Task-number: QTBUG-40244
Change-Id: I491d9dc87a3a204daad4cf7460ffac81165056a5
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/sequenceConversion.array.qml | 37 |
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 ]; |