diff options
author | Nikita Krupenko <krnekit@gmail.com> | 2015-10-06 22:35:44 +0300 |
---|---|---|
committer | Nikita Krupenko <krnekit@gmail.com> | 2015-10-08 12:40:14 +0000 |
commit | 5e7d7dfc07ea00b53873a6ad5399f2400781f8b9 (patch) | |
tree | 3f3caaaa31ae3170b25927c845f7b789d1655a4c /tests/auto/controls/data/tst_tabbar.qml | |
parent | 7de4e4c98aa0297057f92afafef697696c3b17f3 (diff) |
Fixed TabBar reset currentIndex to -1 on completion
TabBar resets currentIndex to -1 on completion, even if it has been
explicitly set to a proper value. This is due to a calling
updateCurrent() on completion.
As updateCurrent() handle cases, where tab clicked by user, and proper
index handled by QQuickContainer, there is no need to call this function
on TabBar completion.
Task-number: QTBUG-48624
Change-Id: Ied316af2bfb8983ea1d5947544cc8399aaf7eb84
Reviewed-by: Liang Qi <liang.qi@theqtcompany.com>
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'tests/auto/controls/data/tst_tabbar.qml')
-rw-r--r-- | tests/auto/controls/data/tst_tabbar.qml | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_tabbar.qml b/tests/auto/controls/data/tst_tabbar.qml index 2b272ae7..8d2dbc17 100644 --- a/tests/auto/controls/data/tst_tabbar.qml +++ b/tests/auto/controls/data/tst_tabbar.qml @@ -60,6 +60,31 @@ TestCase { TabBar { } } + Component { + id: tabBarStaticTabs + TabBar { + TabButton { + text: "0" + } + TabButton { + text: "1" + } + } + } + + Component { + id: tabBarStaticTabsCurrent + TabBar { + currentIndex: 1 + TabButton { + text: "0" + } + TabButton { + text: "1" + } + } + } + SignalSpy { id: contentChildrenSpy signalName: "contentChildrenChanged" @@ -117,6 +142,24 @@ TestCase { control.destroy() } + function test_current_static() { + var control = tabBarStaticTabs.createObject(testCase) + + compare(control.count, 2) + compare(control.currentIndex, 0) + compare(control.currentItem.text, "0") + + control.destroy() + + control = tabBarStaticTabsCurrent.createObject(testCase) + + compare(control.count, 2) + compare(control.currentIndex, 1) + compare(control.currentItem.text, "1") + + control.destroy() + } + function test_addRemove() { var control = tabBar.createObject(testCase) |