Merge lp:~tpeeters/ubuntu-ui-toolkit/popToTabs into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Florian Boucault
Approved revision: 1047
Merged at revision: 1042
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/popToTabs
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 136 lines (+35/-18)
4 files modified
modules/Ubuntu/Components/TabBar.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml (+7/-7)
tests/resources/navigation/StackWithTabs.qml (+10/-10)
tests/unit/tst_components/tst_pagestack.qml (+17/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/popToTabs
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Florian Boucault (community) Approve
Nekhelesh Ramananthan (community) testing Approve
Review via email: mp+218971@code.launchpad.net

Description of the change

Use selectedIndex of the tabs model instead of the TabBar everywhere in TabBarStyle to fix a bug that uses Tabs on a PageStack.

To post a comment you must log in.
1047. By Tim Peeters

revert test program to use new header

Revision history for this message
Nekhelesh Ramananthan (nik90) wrote :

I noticed this regression while testing on the clock app trunk. I can confirm that this MP fixes the issue during my testing. Poping a page from the pagestack now returns to the tab it was initially pushed from.

review: Approve (testing)
Revision history for this message
Florian Boucault (fboucault) wrote :

Well done.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:1047
http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/196/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-utopic-touch/112
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-utopic/100
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-amd64-ci/28
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/28
        deb: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-armhf-ci/28/artifact/work/output/*zip*/output.zip
    SUCCESS: http://jenkins.qa.ubuntu.com/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-utopic-i386-ci/28
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-deb-autopilot-runner-mako/624
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/278
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-armhf/278/artifact/work/output/*zip*/output.zip
    SUCCESS: http://s-jenkins.ubuntu-ci:8080/job/touch-flash-device/7000
    SUCCESS: http://jenkins.qa.ubuntu.com/job/autopilot-testrunner-otto-utopic/93
    SUCCESS: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/143
        deb: http://jenkins.qa.ubuntu.com/job/generic-mediumtests-builder-utopic-amd64/143/artifact/work/output/*zip*/output.zip

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/ubuntu-sdk-team-ubuntu-ui-toolkit-staging-ci/196/rebuild

review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/TabBar.qml'
2--- modules/Ubuntu/Components/TabBar.qml 2014-04-24 17:44:56 +0000
3+++ modules/Ubuntu/Components/TabBar.qml 2014-05-09 11:25:49 +0000
4@@ -151,7 +151,7 @@
5
6 if (model.count > 0) {
7 if (internal.checkRoles()) {
8- model.selectedIndex = Math.max(Math.min(tabBar.selectedIndex, model.count - 1), 0);
9+ model.selectedIndex = Math.max(Math.min(model.selectedIndex, model.count - 1), 0);
10 }
11 } else {
12 internal.modelChecked = false;
13
14=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml'
15--- modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-04-24 17:44:56 +0000
16+++ modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-05-09 11:25:49 +0000
17@@ -59,7 +59,7 @@
18 automaytically through ListModel changes.
19 */
20 function sync() {
21- buttonView.selectButton(styledItem.selectedIndex);
22+ buttonView.selectButton(styledItem.model.selectedIndex);
23 }
24
25 property var tabsModel : styledItem ? styledItem.model : null
26@@ -69,14 +69,14 @@
27
28 onSelectionModeChanged: {
29 if (!styledItem.selectionMode) {
30- buttonView.selectButton(styledItem.selectedIndex);
31+ buttonView.selectButton(styledItem.model.selectedIndex);
32 }
33 }
34 }
35
36 Connections {
37- target: styledItem
38- onSelectedIndexChanged: buttonView.selectButton(styledItem.selectedIndex)
39+ target: styledItem.model
40+ onSelectedIndexChanged: buttonView.selectButton(styledItem.model.selectedIndex)
41 }
42
43 /*
44@@ -126,7 +126,7 @@
45 // to avoid seeing fading animations of the unselected button when switching
46 // tabs from outside the tab bar.
47 property bool selected: (styledItem.selectionMode && buttonView.needsScrolling) ?
48- styledItem.selectedIndex === index :
49+ styledItem.model.selectedIndex === index :
50 buttonView.selectedButtonIndex === button.buttonIndex
51 property real offset: theRow.rowNumber + 1 - button.x / theRow.width;
52 property int buttonIndex: index + theRow.rowNumber*repeater.count
53@@ -171,9 +171,9 @@
54 // The indicator image must be visible after the selected tab button, when the
55 // tab bar is not in selection mode, or after the "last" button (starting with
56 // the selected one), when the tab bar is in selection mode.
57- property bool isLastAfterSelected: index === (styledItem.selectedIndex === 0 ?
58+ property bool isLastAfterSelected: index === (styledItem.model.selectedIndex === 0 ?
59 repeater.count-1 :
60- styledItem.selectedIndex - 1)
61+ styledItem.model.selectedIndex - 1)
62 opacity: (styledItem.selectionMode ? isLastAfterSelected : selected) ? 1 : 0
63 Behavior on opacity {
64 NumberAnimation {
65
66=== modified file 'tests/resources/navigation/StackWithTabs.qml'
67--- tests/resources/navigation/StackWithTabs.qml 2014-04-28 15:39:24 +0000
68+++ tests/resources/navigation/StackWithTabs.qml 2014-05-09 11:25:49 +0000
69@@ -32,16 +32,6 @@
70 Tab {
71 title: "Tab 1"
72 page: Page {
73- Button {
74- anchors.centerIn: parent
75- onClicked: pageStack.push(page3)
76- text: "Press"
77- }
78- }
79- }
80- Tab {
81- title: "Tab 2"
82- page: Page {
83 Column {
84 anchors {
85 centerIn: parent
86@@ -76,6 +66,16 @@
87 }
88 }
89 }
90+ Tab {
91+ title: "Tab 2"
92+ page: Page {
93+ Button {
94+ anchors.centerIn: parent
95+ onClicked: pageStack.push(page3)
96+ text: "Press"
97+ }
98+ }
99+ }
100 }
101 Page {
102 id: page3
103
104=== modified file 'tests/unit/tst_components/tst_pagestack.qml'
105--- tests/unit/tst_components/tst_pagestack.qml 2014-04-25 05:28:37 +0000
106+++ tests/unit/tst_components/tst_pagestack.qml 2014-05-09 11:25:49 +0000
107@@ -96,6 +96,17 @@
108 pageStack.clear();
109 }
110
111+ function test_pop_to_tabs_bug1316736() {
112+ pageStack.push(tabs);
113+ tabs.selectedTabIndex = 1;
114+ pageStack.push(page1);
115+ compare(tabs.active, false, "Tabs on a PageStack, but not on top, are inactive");
116+ pageStack.pop();
117+ compare(tabs.active, true, "Tabs on top of PageStack is active");
118+ compare(tabs.selectedTabIndex, 1, "Pushing and popping another page on top of Tabs does not change selectedTabsIndex");
119+ pageStack.clear();
120+ }
121+
122 MainView {
123 id: mainView
124 PageStack {
125@@ -119,5 +130,11 @@
126
127 Tabs {
128 id: tabs
129+ Tab {
130+ id: tab1
131+ }
132+ Tab {
133+ id: tab2
134+ }
135 }
136 }

Subscribers

People subscribed via source and target branches