Merge lp:~tpeeters/ubuntu-ui-toolkit/first-page-no-back-action into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 1923
Merged at revision: 1926
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/first-page-no-back-action
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 90 lines (+41/-8)
2 files modified
src/Ubuntu/Components/1.3/PageStack.qml (+1/-2)
tests/unit_x11/tst_components/tst_pagestack.qml (+40/-6)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/first-page-no-back-action
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+291268@code.launchpad.net

Commit message

Hide the PageStack back button when depth == 1.

Description of the change

Also fixes the unit test.

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

unit test does not need wait(100) when checking for button == null only

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Looks sensible. Nice!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/1.3/PageStack.qml'
2--- src/Ubuntu/Components/1.3/PageStack.qml 2016-02-08 13:55:17 +0000
3+++ src/Ubuntu/Components/1.3/PageStack.qml 2016-04-07 14:52:43 +0000
4@@ -218,14 +218,13 @@
5 Action {
6 // used when the Page has a Page.header property set.
7 id: backAction
8- visible: pageStack.depth > 0
9+ visible: pageStack.depth > 1
10 iconName: "back"
11 text: "Back"
12 onTriggered: pageStack.pop()
13 objectName: "pagestack_back_action"
14 }
15
16-
17 Component {
18 id: pageWrapperComponent
19 PageWrapper{
20
21=== modified file 'tests/unit_x11/tst_components/tst_pagestack.qml'
22--- tests/unit_x11/tst_components/tst_pagestack.qml 2016-01-07 14:55:33 +0000
23+++ tests/unit_x11/tst_components/tst_pagestack.qml 2016-04-07 14:52:43 +0000
24@@ -34,6 +34,41 @@
25 id: pageInStack
26 }
27 }
28+
29+ Column {
30+ // for manual testing
31+ visible: pageStack.depth === 0
32+ anchors {
33+ left: parent.left
34+ right: parent.right
35+ top: parent.top
36+ margins: units.gu(1)
37+ }
38+ Button {
39+ text: "page1"
40+ onClicked: pageStack.push(page1)
41+ }
42+ Button {
43+ text: "page2"
44+ onClicked: pageStack.push(page2)
45+ }
46+ Button {
47+ text: "pageWithPage"
48+ onClicked: pageStack.push(pageWithPage)
49+ }
50+ Button {
51+ text: "tabs"
52+ onClicked: pageStack.push(tabs)
53+ }
54+ Button {
55+ text: "pageWithHeader"
56+ onClicked: pageStack.push(pageWithHeader)
57+ }
58+ Button {
59+ text: "pageComponent"
60+ onClicked: pageStack.push(pageComponent)
61+ }
62+ }
63 }
64 Page {
65 id: page1
66@@ -238,19 +273,18 @@
67 "PageStack.push() returns Page created from QML file");
68 }
69
70- function test_page_header_back_button() {
71+ function test_page_header_back_button_bug1565811() {
72 pageStack.push(pageWithHeader);
73- var backButton = findChild(pageWithHeader.header, "pagestack_back_action_button");
74- // FIXME TIM: when visibleActions is fixed, only check for backButton, null.
75- compare(backButton == null || !backButton.visible, true,
76+ var backButton = findChild(pageWithHeader.header.leadingActionBar,
77+ "pagestack_back_action_button");
78+ compare(backButton, null,
79 "Page header shows back button with only one page on the stack.");
80-
81 pageStack.pop();
82 pageStack.push(page1);
83 pageStack.push(pageWithHeader);
84 waitForHeaderAnimation(mainView);
85 backButton = findChild(pageWithHeader.header, "pagestack_back_action_button");
86- compare(backButton.visible, true,
87+ compare(backButton && backButton.visible, true,
88 "Page header has no back button with two pages on the stack.");
89 }
90 }

Subscribers

People subscribed via source and target branches