aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexey Edelev <alexey.edelev@qt.io>2021-01-14 14:19:26 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-01-14 16:50:41 +0000
commit44f37f37f6a21db4d9d8e10735203d485924a5da (patch)
treeba81f5e407eb5d40056ac6a1294801eab3a9c920 /tests
parentfed2f43784e3407b833674997e50f52b0a26161f (diff)
Fix initial currentIndex in Tumbler when wrap is set to false
syncCurrentIndex () function assumes that PathView is used as view for, Tumbler component, and states that actualViewIndex should be 0 while initialization. This statement is not correct when Tumbler is in non-wrap mode and uses ListView as view, where currentIndex is set to -1 by default. Fix actualViewIndex condition according to ListView logic. Fixes: QTBUG-84426 Change-Id: I4ef1e7b45399bf748968490f44b8909f3218d9bc Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> (cherry picked from commit 1fe83c1fd3eb9abfd13a7b8c7adb2c2355d8ad4d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/controls/data/tst_tumbler.qml21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_tumbler.qml b/tests/auto/controls/data/tst_tumbler.qml
index c103aefc..3a09bd9f 100644
--- a/tests/auto/controls/data/tst_tumbler.qml
+++ b/tests/auto/controls/data/tst_tumbler.qml
@@ -1257,4 +1257,25 @@ TestCase {
tumbler.height *= 1.4
tryCompare(delegate, "displacement", 0)
}
+
+ //QTBUG-84426
+ Component {
+ id: initialCurrentIndexTumbler
+
+ Tumbler {
+ anchors.centerIn: parent
+ width: 60
+ height: 200
+ delegate: Text {text: modelData}
+ model: 10
+ currentIndex: 4
+ }
+ }
+
+ function test_initialCurrentIndex() {
+ var tumbler = createTemporaryObject(initialCurrentIndexTumbler, testCase, {wrap: true});
+ compare(tumbler.currentIndex, 4);
+ tumbler = createTemporaryObject(initialCurrentIndexTumbler, testCase, {wrap: false});
+ compare(tumbler.currentIndex, 4);
+ }
}