diff options
author | Mitch Curtis <mitch.curtis@theqtcompany.com> | 2015-09-03 13:16:02 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-09-05 17:42:05 +0000 |
commit | ddfa5e774febee165059079a5e9f9e54a122a190 (patch) | |
tree | 6d487f2025a469f08d5593ad81c684d9774d4141 /tests/auto | |
parent | 0addfd5d586c7850c1e470f24c6364e6305dfa08 (diff) |
SwipeView: don't override initial currentIndex.
When insertItem() was called for the first time as a result of
"statically" declared SwipeView children, the currentIndex would be
changed to 0. We should only do this if the currentIndex is invalid
(-1), otherwise we disrespect the user's settings.
Change-Id: I692b60581e706edcfa4939bbe59a815ff3e019e5
Task-number: QTBUG-48086
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/extras/data/tst_swipeview.qml | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/extras/data/tst_swipeview.qml b/tests/auto/extras/data/tst_swipeview.qml index 6ec71acc..dbd1c10b 100644 --- a/tests/auto/extras/data/tst_swipeview.qml +++ b/tests/auto/extras/data/tst_swipeview.qml @@ -93,6 +93,33 @@ TestCase { control.destroy() } + Component { + id: initialCurrentSwipeView + SwipeView { + currentIndex: 1 + + property alias item0: item0 + property alias item1: item1 + + Item { + id: item0 + } + Item { + id: item1 + } + } + } + + function test_initialCurrent() { + var control = initialCurrentSwipeView.createObject(testCase) + + compare(control.count, 2) + compare(control.currentIndex, 1) + compare(control.currentItem, control.item1) + + control.destroy() + } + function test_addRemove() { var control = swipeView.createObject(testCase) |