Merge lp:~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar2 into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 869
Merged at revision: 866
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar2
Merge into: lp:ubuntu-ui-toolkit
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/hide-bars-mainview
Diff against target: 111 lines (+96/-0)
2 files modified
modules/Ubuntu/Components/MainView.qml (+10/-0)
tests/unit_x11/tst_components/tst_hide_chrome.qml (+86/-0)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/tabbar-closes-toolbar2
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+196864@code.launchpad.net

Commit message

Close the toolbar when user activates tabbar.

Description of the change

Close the toolbar when user activates tabbar.

"HideChrome" was used as a name for the tests, because in following MRs I will add more tests there that hide the chrome (when user interacts with toolbar, tabs in tabbar will hide).

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

merge trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Tim Peeters (tpeeters) wrote :

Tested apps and autopilot on maguro, all fine.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Nice!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) :
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/MainView.qml'
2--- modules/Ubuntu/Components/MainView.qml 2013-11-26 14:58:13 +0000
3+++ modules/Ubuntu/Components/MainView.qml 2013-11-27 12:25:45 +0000
4@@ -318,6 +318,16 @@
5 headerItem.contents.hasOwnProperty("alwaysSelectionMode") &&
6 headerItem.contents.hasOwnProperty("selectedIndex")
7 }
8+
9+ Connections {
10+ // no connections are made when target is null
11+ target: headerItem.tabBar
12+ onSelectionModeChanged: {
13+ if (headerItem.tabBar.selectionMode) {
14+ if (!toolbarItem.locked) toolbarItem.close();
15+ }
16+ }
17+ }
18 }
19 }
20
21
22=== added file 'tests/unit_x11/tst_components/tst_hide_chrome.qml'
23--- tests/unit_x11/tst_components/tst_hide_chrome.qml 1970-01-01 00:00:00 +0000
24+++ tests/unit_x11/tst_components/tst_hide_chrome.qml 2013-11-27 12:25:45 +0000
25@@ -0,0 +1,86 @@
26+/*
27+ * Copyright 2013 Canonical Ltd.
28+ *
29+ * This program is free software; you can redistribute it and/or modify
30+ * it under the terms of the GNU Lesser General Public License as published by
31+ * the Free Software Foundation; version 3.
32+ *
33+ * This program is distributed in the hope that it will be useful,
34+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
35+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
36+ * GNU Lesser General Public License for more details.
37+ *
38+ * You should have received a copy of the GNU Lesser General Public License
39+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
40+ */
41+
42+import QtQuick 2.0
43+import QtTest 1.0
44+import Ubuntu.Components 0.1
45+
46+Item {
47+ width: units.gu(50)
48+ height: units.gu(80)
49+
50+ MainView {
51+ id: mainView
52+ anchors.fill: parent
53+ Tabs {
54+ id: tabs
55+ Tab {
56+ id: tab1
57+ title: "tab 1"
58+ page: Page {
59+ id: page1
60+ Button {
61+ id: button
62+ anchors.centerIn: parent
63+ text: "click"
64+ }
65+
66+ tools: ToolbarItems {
67+ ToolbarButton {
68+ text: "something"
69+ }
70+ }
71+ }
72+ }
73+ Tab {
74+ id: tab2
75+ title: "tab 2"
76+ page: Page {
77+ id: page2
78+ }
79+ }
80+ }
81+ }
82+
83+ TestCase {
84+ name: "HideChrome"
85+ when: windowShown
86+ id: testCase
87+
88+ function openToolbar() {
89+ var toolbar = mainView.__propagated.toolbar;
90+ toolbar.open();
91+ compare(toolbar.opened, true, "Cannot open toolbar using open()");
92+ return toolbar;
93+ }
94+
95+ function setTabBarSelectionMode(newSelectionMode) {
96+ var tabBar = tabs.tabBar;
97+ var header = mainView.__propagated.header;
98+ compare(tabBar, header.contents, "TabBar is not the active header contents");
99+ header.show();
100+ tabBar.selectionMode = newSelectionMode;
101+ return tabBar;
102+ }
103+
104+ function test_tabBar_selectionMode_closes_toolbar_bug1223600() {
105+ testCase.setTabBarSelectionMode(false);
106+ var toolbar = testCase.openToolbar();
107+ testCase.setTabBarSelectionMode(true);
108+ compare(toolbar.opened, false, "Activating TabBar did not close toolbar");
109+ }
110+ }
111+}

Subscribers

People subscribed via source and target branches

to status/vote changes: