Merge lp:~tpeeters/ubuntu-ui-toolkit/noBackButton into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Superseded
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/noBackButton
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 121 lines (+105/-1)
2 files modified
modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+1/-1)
tests/unit_x11/tst_components/tst_headActions.qml (+104/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/noBackButton
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+228556@code.launchpad.net

Description of the change

Allow app developers to disable the back button by setting an invisible back action for the page.

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

clean

1165. By Tim Peeters

clean

1166. By Tim Peeters

clean

1167. By Tim Peeters

merge iconFix branch

1168. By Tim Peeters

update type of iconWidth, iconHeight

1169. By Tim Peeters

testing icon fix

1170. By Tim Peeters

merge iconFix

1171. By Tim Peeters

merge iconFix

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
2--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-22 15:15:28 +0000
3+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-28 18:35:34 +0000
4@@ -117,7 +117,7 @@
5 visible: styledItem.pageStack !== null &&
6 styledItem.pageStack !== undefined &&
7 styledItem.pageStack.depth > 1 &&
8- !customBackButton.visible
9+ !styledItem.config.backAction
10
11 text: "back"
12
13
14=== added file 'tests/unit_x11/tst_components/tst_headActions.qml'
15--- tests/unit_x11/tst_components/tst_headActions.qml 1970-01-01 00:00:00 +0000
16+++ tests/unit_x11/tst_components/tst_headActions.qml 2014-07-28 18:35:34 +0000
17@@ -0,0 +1,104 @@
18+/*
19+ * Copyright 2014 Canonical Ltd.
20+ *
21+ * This program is free software; you can redistribute it and/or modify
22+ * it under the terms of the GNU Lesser General Public License as published by
23+ * the Free Software Foundation; version 3.
24+ *
25+ * This program is distributed in the hope that it will be useful,
26+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
27+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28+ * GNU Lesser General Public License for more details.
29+ *
30+ * You should have received a copy of the GNU Lesser General Public License
31+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
32+ */
33+
34+import QtQuick 2.2
35+import Ubuntu.Test 1.0
36+import Ubuntu.Components 1.1
37+
38+
39+// NOTE: Other parts of the page head API are being tested with autopilot in
40+// ubuntuuitoolkit.tests.components.test_header
41+
42+Item {
43+ width: units.gu(50)
44+ height: units.gu(80)
45+
46+ MainView {
47+ id: mainView
48+ anchors.fill: parent
49+ useDeprecatedToolbar: false
50+
51+ PageStack {
52+ id: pageStack
53+ Page {
54+ id: page1
55+ title: "First page"
56+ }
57+ Page {
58+ id: page2
59+ title: "Second page"
60+
61+ Action {
62+ id: customBackAction
63+ iconName: "search"
64+ text: "Search"
65+ }
66+ Action {
67+ id: invisibleAction
68+ visible: false
69+ }
70+ }
71+ }
72+ Component.onCompleted: {
73+ pageStack.push(page1);
74+ }
75+ }
76+
77+ UbuntuTestCase {
78+ name: "HeaderBackButton"
79+ when: windowShown
80+ id: testCase
81+
82+ property var app_header
83+ property var back_button
84+ property var custom_back_button
85+
86+ function initTestCase() {
87+ testCase.app_header = findChild(mainView, "MainView_Header");
88+ testCase.back_button = findChild(testCase.app_header, "backButton");
89+ testCase.custom_back_button = findChild(testCase.app_header, "customBackButton");
90+
91+ compare(page2.head.backAction, null, "Back action set by default.");
92+ compare(back_button.visible, false, "Back button visible with only 1 page on the stack.");
93+ compare(custom_back_button.visible, false, "Custom back button visible without custom back action.")
94+ }
95+
96+ function test_default_back_button() {
97+ pageStack.push(page2);
98+ compare(back_button.visible, true, "Back button not visible with 2 pages on stack.");
99+ compare(custom_back_button.visible, false, "Showing custom back button without custom back action.");
100+ pageStack.pop();
101+ }
102+
103+ function test_custom_back_button() {
104+ page2.head.backAction = customBackAction;
105+ pageStack.push(page2);
106+ compare(back_button.visible, false, "Default back button visible with custom back action set.");
107+ compare(custom_back_button.visible, true, "Custom back button invisible with back action set.");
108+ pageStack.pop();
109+ page2.head.backAction = null;
110+ }
111+
112+ function test_no_back_button() {
113+ page2.head.backAction = invisibleAction;
114+ pageStack.push(page2);
115+ compare(back_button.visible, false, "Default back button visible with invisible custom back action set.");
116+ compare(custom_back_button.visible, false, "Custom back button visible with invisible custom back action.");
117+ pageStack.pop();
118+ page2.head.backAction = null;
119+ }
120+ }
121+}

Subscribers

People subscribed via source and target branches

to status/vote changes: