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

Subscribers

People subscribed via source and target branches

to status/vote changes: