Merge lp:~tpeeters/ubuntu-ui-toolkit/toolbar-tabs-deactivate into lp:ubuntu-ui-toolkit
- toolbar-tabs-deactivate
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Cris Dywan |
Approved revision: | 773 |
Merged at revision: | 819 |
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/toolbar-tabs-deactivate |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
465 lines (+228/-73) 7 files modified
components.api (+2/-0) modules/Ubuntu/Components/Page.qml (+41/-2) modules/Ubuntu/Components/Panel.qml (+11/-1) modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml (+1/-1) modules/Ubuntu/Components/Toolbar.qml (+11/-2) tests/resources/navigation/SimpleTabs.qml (+58/-0) tests/unit_x11/tst_components/tst_tabs.qml (+104/-67) |
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/toolbar-tabs-deactivate |
Related bugs: | |
Related blueprints: |
Tabs 2.0
(High)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Cris Dywan | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Tim Peeters | Approve | ||
Review via email: mp+186065@code.launchpad.net |
Commit message
Close tabbar and toolbar when user interacts with app contents.
Description of the change
Close tabbar and toolbar when user interacts with app contents.
This is (currently) the last of a series of incremental MRs that change behaviors of tabs and toolbars. More changes will be made in following MRs.
Depends on https:/
After installing the packages above you should get the following new behaviors:
- Toolbar visible initially when starting app or changing views
- Toolbar automatically hides after a timeout, or when user interacts with app contents
- Tabs initially visible
- Tab bar automatically leaves selection mode (only current tab title visible) after timeout or when interacting with app contents
The following new behaviors will be implemented in following MRs:
- Hide toolbar when interacting with tabs
- Hide tabs when interacting with toolbar
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:756
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : | # |
I downloaded and unzipped http://
Tested with gallery-app, clock-app, notes-app and seems to work well. Tabs and toolbar are visible initially and will hide after a timeout, or when the user interacts with the app contents.
For proposed updates to the behavior, please leave a comment on this MR.
Tim Peeters (tpeeters) wrote : | # |
After installing the packages above you should get the following new behaviors:
- Toolbar visible initially when starting app or changing views
- Toolbar automatically hides after a timeout, or when user interacts with app contents
- Tabs initially visible
- Tab bar automatically leaves selection mode (only current tab title visible) after timeout or when interacting with app contents
The following new behaviors will be implemented later:
- Hide toolbar when interacting with tabs
- Hide tabs when interacting with toolbar
Vesa Rautiainen (vesar) wrote : | # |
We reviewed this MR in design team and here are our comments and issues we found:
Different timeouts in tabs and in toolbar
- Should have the same timeout value. Use the same as what launcher uses.
Showing toolbar when page changes doesn't work with Page Stack
- Happens in e.g. system settings app.
- Seems to work though when going back in stack. Then toolbar visibility is retained.
Re-launching an application: tabs should be expanded and toolbar open
- When opening an application that is in recent application category (stopped/suspended) toolbar is not shown and tabs are not expanded.
- This causes inconsistency between different app launches.
- So every time the app is launched/opened toolbar should be in open state and tabs in expanded state. In place. No animation. No animation because it would be too intrusive when going through app stack with right edge swipe.
Initial tabs scrolling animation in startup
- Sometimes when opening an app tabs are scrolling while expanding like a focused item would have been changed.
- It's not too bad animation and it even might be that we in design team proposed it. We just didn't take right edge back swipe in to account when proposing this. So let's take the animation away and have tabs in open state when application is launched.
Timeout timer doesn't restart when switching page from tabs
- this fails for example in Gallery, Weather and Calendar. In shorts (rss reader) app seems to work fine.
- To reproduce keep tapping on tabs. At some point toolbar hides quite quickly after page switch. It's a sign that timer is never restarted if running on page switch.
- Or is this something that hasn't been implemented because this will not be valid anymore when "tabs interaction closes toolbar" feature lands.
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:756
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:756
http://
Executed test runs:
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : | # |
This MR is still valid, but should not be accepted yet. I will ask for a review when ready.
- 757. By Tim Peeters
-
merge trunk
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:757
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 758. By Tim Peeters
-
update tabbar timeout to match the timeout of toolbar and unity's launcher
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:758
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 759. By Tim Peeters
-
empty commit for CI
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:759
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 760. By Tim Peeters
-
fix bug that doesn't show toolbar the first time a page with no tools is pushed
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:760
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 761. By Tim Peeters
-
add SimpleTabs test program
- 762. By Tim Peeters
-
add SimpleTabs test program
- 763. By Tim Peeters
-
previous change: debugging
- 764. By Tim Peeters
-
reset toolbar hide timer when tools change
Tim Peeters (tpeeters) wrote : | # |
> We reviewed this MR in design team and here are our comments and issues we
> found:
>
> Different timeouts in tabs and in toolbar
> - Should have the same timeout value. Use the same as what launcher uses.
Ok, all timeouts are 5s now.
> Showing toolbar when page changes doesn't work with Page Stack
> - Happens in e.g. system settings app.
> - Seems to work though when going back in stack. Then toolbar visibility is
> retained.
It should work, but I noticed a bug where it does not work the first time a page is pushed to the stack. The bug was fixed in this MR.
> Re-launching an application: tabs should be expanded and toolbar open
> - When opening an application that is in recent application category
> (stopped/suspended) toolbar is not shown and tabs are not expanded.
> - This causes inconsistency between different app launches.
> - So every time the app is launched/opened toolbar should be in open state and
> tabs in expanded state. In place. No animation. No animation because it would
> be too intrusive when going through app stack with right edge swipe.
Agreed. I will work on that in a separate MR. I reported a bug to track the progress: https:/
>
> Initial tabs scrolling animation in startup
> - Sometimes when opening an app tabs are scrolling while expanding like a
> focused item would have been changed.
> - It's not too bad animation and it even might be that we in design team
> proposed it. We just didn't take right edge back swipe in to account when
> proposing this. So let's take the animation away and have tabs in open state
> when application is launched.
I agreed. I reported this bug https:/
> Timeout timer doesn't restart when switching page from tabs
> - this fails for example in Gallery, Weather and Calendar. In shorts (rss
> reader) app seems to work fine.
> - To reproduce keep tapping on tabs. At some point toolbar hides quite quickly
> after page switch. It's a sign that timer is never restarted if running on
> page switch.
> - Or is this something that hasn't been implemented because this will not be
> valid anymore when "tabs interaction closes toolbar" feature lands.
Fixed.
Indeed, the fix may not be valid anymore when the "tabs interaction closes toolbar" feature lands, but I will think about that when implementing that feature.
Tim Peeters (tpeeters) wrote : | # |
I think everything is ready now.
- 765. By Tim Peeters
-
merge trunk
- 766. By Tim Peeters
-
clean text
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:764
http://
Executed test runs:
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Cris Dywan (kalikiana) wrote : | # |
I'm worried by the fact that you didn't change any tests but they still pass. Even though your code looks sane it means it's completely untested.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:766
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Tim Peeters (tpeeters) wrote : | # |
> I'm worried by the fact that you didn't change any tests but they still pass.
> Even though your code looks sane it means it's completely untested.
There were some related MRs before this one that changed the tests for the Tabs, including checking whether the tab bar is active before switching tabs (by clicking a tab button), and only clicking the tab bar to activate it if it is not active yet.
So the description at the top describes changes of this MR including changes in previous MRs (they were ready a while ago but I couldn't merge them because of the jenkins issues we had back then. And I wanted to give this MR that included all the changes to design so they could have a look).
The main change that was left for this MR is to deactivate/close the tab bar and toolbar when the user interacts with the app contents (the page). I will add a test for that and let you know when it is ready.
- 767. By Tim Peeters
-
trying to make the tests for automatic timeout of activated tabbar
- 768. By Tim Peeters
-
fix bug in MainView
- 769. By Tim Peeters
-
remove debugging code
- 770. By Tim Peeters
-
fix test_deactivate
ByTimeout( ) - 771. By Tim Peeters
-
add test
Tim Peeters (tpeeters) wrote : | # |
I moved the tabs test to unit_x11, and added the test_deactivate
- 772. By Tim Peeters
-
fixed in r768 of this branch
Tim Peeters (tpeeters) wrote : | # |
linked this bug that I fixed here: https:/
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:770
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Cris Dywan (kalikiana) wrote : | # |
Your fix for bug 1244660 isn't covered by the tests. The following patch however does catch it:
=== modified file 'tests/
--- tests/unit/
+++ tests/unit/
@@ -128,6 +128,9 @@ class tst_MainView : public QObject
}
void testLocalStorage() {
+ QSignalSpy spy(view->engine(), SIGNAL(
+ spy.setParent(
+
QQuickItem *root = loadTest(
QQuickItem *mainView = root;
@@ -141,6 +144,9 @@ class tst_MainView : public QObject
QString hash(QCryptogra
QString database(
+
+ // No warnings from QML
+ QCOMPARE(
}
};
Cris Dywan (kalikiana) wrote : | # |
Aside from the above the revamped tests look very nice!
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:772
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 773. By Tim Peeters
-
unfix bug. doing that in separate MR
Tim Peeters (tpeeters) wrote : | # |
Removed bugfix and unlinked bug. It is not related to the other changes of this MR, so I'll do it in a separate MR.
Preview Diff
1 | === modified file 'components.api' |
2 | --- components.api 2013-10-28 16:33:39 +0000 |
3 | +++ components.api 2013-11-04 19:49:51 +0000 |
4 | @@ -131,6 +131,7 @@ |
5 | property string title |
6 | property Flickable flickable |
7 | property list<Action> actions |
8 | + default property internal pageContents |
9 | modules/Ubuntu/Components/PageStack.qml |
10 | PageTreeNode |
11 | property bool __showHeader |
12 | @@ -168,6 +169,7 @@ |
13 | property real hintSize |
14 | property real triggerSize |
15 | readonly property bool animating |
16 | + property bool __closeOnContentsClicks |
17 | modules/Ubuntu/Components/ProgressBar.qml |
18 | AnimatedItem |
19 | property bool indeterminate |
20 | |
21 | === modified file 'modules/Ubuntu/Components/Page.qml' |
22 | --- modules/Ubuntu/Components/Page.qml 2013-09-16 00:24:21 +0000 |
23 | +++ modules/Ubuntu/Components/Page.qml 2013-11-04 19:49:51 +0000 |
24 | @@ -120,7 +120,7 @@ |
25 | of the header by scrolling in the Flickable. In cases where a flickable should control the header, |
26 | but it is not automatically detected, the flickable property can be set. |
27 | */ |
28 | - property Flickable flickable: internal.getFlickableChild(page) |
29 | + property Flickable flickable: internal.getFlickableChild(contentsItem) |
30 | |
31 | /*! \internal */ |
32 | onActiveChanged: { |
33 | @@ -216,7 +216,7 @@ |
34 | for (var i=0; i < item.children.length; i++) { |
35 | var child = item.children[i]; |
36 | if (internal.isVerticalFlickable(child)) { |
37 | - if (child.anchors.top === page.top || child.anchors.fill === page) { |
38 | + if (child.anchors.top === contentsItem.top || child.anchors.fill === contentsItem) { |
39 | return item.children[i]; |
40 | } |
41 | } |
42 | @@ -240,4 +240,43 @@ |
43 | } |
44 | } |
45 | } |
46 | + |
47 | + /*! |
48 | + \internal |
49 | + The contents of the page. |
50 | + */ |
51 | + default property alias pageContents: contentsItem.data |
52 | + Item { |
53 | + id: contentsItem |
54 | + anchors.fill: parent |
55 | + } |
56 | + |
57 | + MouseArea { |
58 | + id: contentsArea |
59 | + anchors.fill: contentsItem |
60 | + // This mouse area will be on top of the page contents, but |
61 | + // under the toolbar and header. |
62 | + // It is used for detecting interaction with the page contents |
63 | + // which can close the toolbar and take a tab bar out of selection mode. |
64 | + |
65 | + property Toolbar toolbar: page.__propagated && page.__propagated.toolbar ? |
66 | + page.__propagated.toolbar : null |
67 | + |
68 | + property TabBar tabBar: page.__propagated && page.__propagated.header && |
69 | + page.__propagated.header.contents && |
70 | + page.__propagated.header.contents.hasOwnProperty("selectionMode") && |
71 | + page.__propagated.header.contents.hasOwnProperty("alwaysSelectionMode") ? |
72 | + page.__propagated.header.contents : null |
73 | + |
74 | + onPressed: { |
75 | + mouse.accepted = false; |
76 | + if (contentsArea.toolbar && !toolbar.locked) { |
77 | + contentsArea.toolbar.close(); |
78 | + } |
79 | + if (contentsArea.tabBar && !contentsArea.tabBar.alwaysSelectionMode) { |
80 | + contentsArea.tabBar.selectionMode = false; |
81 | + } |
82 | + } |
83 | + propagateComposedEvents: true |
84 | + } |
85 | } |
86 | |
87 | === modified file 'modules/Ubuntu/Components/Panel.qml' |
88 | --- modules/Ubuntu/Components/Panel.qml 2013-10-21 17:28:37 +0000 |
89 | +++ modules/Ubuntu/Components/Panel.qml 2013-11-04 19:49:51 +0000 |
90 | @@ -398,6 +398,16 @@ |
91 | } |
92 | } |
93 | |
94 | + /*! |
95 | + \internal |
96 | + Enable the InverseMouseArea that closes the panel when the user clicks outside of the panel. |
97 | + This functionality moved to the Toolbar/Page implementation because the mouse area needs to |
98 | + access with the toolbar and header, but this InverseMouseArea is still in the Panel for backwards |
99 | + compatibility in apps that use it directly. Default value is true, but it is set to false in Toolbar. |
100 | + |
101 | + FIXME: Remove __detectContentsClicks and the IMA below when all apps use Toolbar instead of Panel. |
102 | + */ |
103 | + property bool __closeOnContentsClicks: true |
104 | Toolkit.InverseMouseArea { |
105 | anchors.fill: draggingArea |
106 | onClicked: { |
107 | @@ -407,7 +417,7 @@ |
108 | if (!panel.locked) panel.close(); |
109 | } |
110 | propagateComposedEvents: true |
111 | - visible: panel.locked == false && panel.state == "spread" |
112 | + visible: panel.__closeOnContentsClicks && panel.locked == false && panel.state == "spread" |
113 | } |
114 | |
115 | DraggingArea { |
116 | |
117 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml' |
118 | --- modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2013-09-20 10:55:21 +0000 |
119 | +++ modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2013-11-04 19:49:51 +0000 |
120 | @@ -35,7 +35,7 @@ |
121 | property real buttonPositioningVelocity: styledItem.animate ? 1.0 : -1 |
122 | |
123 | // The time of inactivity before leaving selection mode automatically |
124 | - property int deactivateTime: 3000 |
125 | + property int deactivateTime: 5000 |
126 | |
127 | /*! |
128 | The set of tabs this tab bar belongs to |
129 | |
130 | === modified file 'modules/Ubuntu/Components/Toolbar.qml' |
131 | --- modules/Ubuntu/Components/Toolbar.qml 2013-10-21 17:30:11 +0000 |
132 | +++ modules/Ubuntu/Components/Toolbar.qml 2013-11-04 19:49:51 +0000 |
133 | @@ -33,6 +33,9 @@ |
134 | } |
135 | height: background.height |
136 | |
137 | + // Closing of the toolbar on app contents ineraction is handled by the Page. |
138 | + __closeOnContentsClicks: false |
139 | + |
140 | /*! |
141 | \preliminary |
142 | The list of \l Actions to be shown on the toolbar |
143 | @@ -63,6 +66,7 @@ |
144 | if (tools && tools.hasOwnProperty("opened")) { |
145 | tools.opened = toolbar.opened; |
146 | } |
147 | + hideTimer.restart(); |
148 | } else { // no tools |
149 | locked = true; |
150 | toolbar.close(); |
151 | @@ -83,7 +87,7 @@ |
152 | if (tools && tools.hasOwnProperty("opened")) { |
153 | tools.opened = toolbar.opened; |
154 | } |
155 | - if (!toolbar.locked) hideTimer.restart() |
156 | + if (!toolbar.locked) hideTimer.restart(); |
157 | } |
158 | |
159 | Connections { |
160 | @@ -96,7 +100,12 @@ |
161 | toolbar.close(); |
162 | } |
163 | } |
164 | - onLockedChanged: toolbar.locked = tools.locked; |
165 | + onLockedChanged: { |
166 | + toolbar.locked = tools.locked; |
167 | + // open the toolbar when it becomes unlocked |
168 | + // (may be because a new page was pushed to the page stack) |
169 | + if (!toolbar.locked) toolbar.open(); |
170 | + } |
171 | } |
172 | |
173 | QtObject { |
174 | |
175 | === added file 'tests/resources/navigation/SimpleTabs.qml' |
176 | --- tests/resources/navigation/SimpleTabs.qml 1970-01-01 00:00:00 +0000 |
177 | +++ tests/resources/navigation/SimpleTabs.qml 2013-11-04 19:49:51 +0000 |
178 | @@ -0,0 +1,58 @@ |
179 | +/* |
180 | + * Copyright 2013 Canonical Ltd. |
181 | + * |
182 | + * This program is free software; you can redistribute it and/or modify |
183 | + * it under the terms of the GNU Lesser General Public License as published by |
184 | + * the Free Software Foundation; version 3. |
185 | + * |
186 | + * This program is distributed in the hope that it will be useful, |
187 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
188 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
189 | + * GNU Lesser General Public License for more details. |
190 | + * |
191 | + * You should have received a copy of the GNU Lesser General Public License |
192 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
193 | + */ |
194 | + |
195 | +import QtQuick 2.0 |
196 | +import Ubuntu.Components 0.1 |
197 | + |
198 | +MainView { |
199 | + width: 800 |
200 | + height: 600 |
201 | + Tabs { |
202 | + id: tabs |
203 | + selectedTabIndex: 0 |
204 | + |
205 | + Tab { |
206 | + title: i18n.tr("One") |
207 | + page: Page { |
208 | + Label { |
209 | + anchors.centerIn: parent |
210 | + text: i18n.tr("First page") |
211 | + } |
212 | + tools: ToolbarItems { |
213 | + ToolbarButton { |
214 | + text: "1111" |
215 | + iconSource: "call_icon.png" |
216 | + } |
217 | + } |
218 | + } |
219 | + } |
220 | + Tab { |
221 | + title: i18n.tr("Two") |
222 | + page: Page { |
223 | + Label { |
224 | + anchors.centerIn: parent |
225 | + text: i18n.tr("Second page") |
226 | + } |
227 | + tools: ToolbarItems { |
228 | + ToolbarButton { |
229 | + text: "2222" |
230 | + iconSource: "call_icon.png" |
231 | + } |
232 | + } |
233 | + } |
234 | + } |
235 | + } |
236 | +} |
237 | |
238 | === renamed file 'tests/unit/tst_components/tst_tabs.qml' => 'tests/unit_x11/tst_components/tst_tabs.qml' |
239 | --- tests/unit/tst_components/tst_tabs.qml 2013-10-02 06:23:44 +0000 |
240 | +++ tests/unit_x11/tst_components/tst_tabs.qml 2013-11-04 19:49:51 +0000 |
241 | @@ -18,72 +18,9 @@ |
242 | import QtTest 1.0 |
243 | import Ubuntu.Components 0.1 |
244 | |
245 | -TestCase { |
246 | - name: "TabsAPI" |
247 | - |
248 | - function test_emptyTabs() { |
249 | - compare(emptyTabs.selectedTabIndex, -1, "The default value for selectedTabIndex is -1 when there are no tabs"); |
250 | - compare(emptyTabs.selectedTab, null, "The default selected tab is null when there are no tabs"); |
251 | - compare(emptyTabs.currentPage, null, "The default currentPage is null when there are no tabs"); |
252 | - } |
253 | - |
254 | - function test_tabsDefaults() { |
255 | - compare(tabs.selectedTabIndex, 0, "The default selectedTabIndex is 0 when Tabs has contents"); |
256 | - compare(tabs.selectedTab, tab1, "The default selectedTab is the first tab"); |
257 | - compare(tabs.currentPage, page1, "The default currentPage is the page of the first tab"); |
258 | - compare(mainView.__propagated.toolbar.tools, page1.tools, "The default tools are the tools of the first tab"); |
259 | - compare(mainView.__propagated.header.contents, tabs.tabBar, "Tabs updates the Header contents"); |
260 | - } |
261 | - |
262 | - function test_tabsSetSelectedTab() { |
263 | - var tabArray = [tab1, tab2, tab3]; |
264 | - var pageArray = [page1, page2, page3]; |
265 | - for (var i=0; i < 3; i++) { |
266 | - tabs.selectedTabIndex = i; |
267 | - compare(tabs.selectedTabIndex, i, "Can set selectedTabIndex"); |
268 | - compare(tabs.selectedTab, tabArray[i], "Can update selectedTab by setting selectedTabIndex"); |
269 | - compare(tabs.currentPage, pageArray[i], "Can update currentPage by setting selectedTabIndex"); |
270 | - compare(mainView.__propagated.toolbar.tools, pageArray[i].tools, "Activating a Tab updates the tools of the Toolbar"); |
271 | - for (var j=0; j < 3; j++) { |
272 | - compare(pageArray[j].active, j===i, "Only the page of the selected tab is active"); |
273 | - } |
274 | - } |
275 | - } |
276 | - |
277 | - function test_flickable() { |
278 | - // ensure that the flickable of the header is set to the flickable of the selected tab. |
279 | - tabs.selectedTabIndex = 3; |
280 | - compare(mainView.__propagated.header.flickable, flickable1, "Header flickable correctly initialized"); |
281 | - tabs.selectedTabIndex = 4; |
282 | - compare(mainView.__propagated.header.flickable, flickable2, "Header flickable correctly updated"); |
283 | - tabs.selectedTabIndex = 0; |
284 | - } |
285 | - |
286 | - function test_pageLoader() { |
287 | - tabs.selectedTabIndex = 0; |
288 | - compare(loader.item, null, "Page not loaded when tab is not selected"); |
289 | - tabs.selectedTabIndex = 5; |
290 | - compare(tabs.currentPage, loader, "Selected loader for current page"); |
291 | - compare(loader.item.title, "Loaded page", "Loaded item is a page"); |
292 | - tabs.selectedTabIndex = 0; |
293 | - compare(loader.item, null, "Loaded page was properly unloaded"); |
294 | - } |
295 | - |
296 | - function test_bug1088740() { |
297 | - tabs.selectedTabIndex = 5; |
298 | - compare(mainView.__propagated.header.flickable, loader.item.flick, "Header flickable correctly updated with Loader"); |
299 | - compare(loader.item.flick.contentHeight, 1000, "Header flickable is correct flickable"); |
300 | - tabs.selectedTabIndex = 0; |
301 | - } |
302 | - |
303 | - function test_index() { |
304 | - compare(tab1.index, 0, "tab1 is at 0"); |
305 | - compare(tab2.index, 1, "tab2 is at 1"); |
306 | - compare(tab3.index, 2, "tab3 is at 2"); |
307 | - compare(tabFlick1.index, 3, "tabFlick1 is at 3"); |
308 | - compare(tabFlick2.index, 4, "tabFlick2 is at 4"); |
309 | - compare(tabFlickLoader.index, 5, "tabFlickLoader is at 5"); |
310 | - } |
311 | +Item { |
312 | + width: units.gu(50) |
313 | + height: units.gu(80) |
314 | |
315 | Tabs { |
316 | id: emptyTabs |
317 | @@ -91,28 +28,40 @@ |
318 | |
319 | MainView { |
320 | id: mainView |
321 | + anchors.fill: parent |
322 | Tabs { |
323 | id: tabs |
324 | Tab { |
325 | id: tab1 |
326 | + title: "tab 1" |
327 | page: Page { |
328 | id: page1 |
329 | + Rectangle { |
330 | + id: centerRect |
331 | + width: units.gu(10) |
332 | + height: units.gu(5) |
333 | + color: "navy" |
334 | + anchors.centerIn: parent |
335 | + } |
336 | } |
337 | } |
338 | Tab { |
339 | id: tab2 |
340 | + title: "tab 2" |
341 | page: Page { |
342 | id: page2 |
343 | } |
344 | } |
345 | Tab { |
346 | id: tab3 |
347 | + title: "tab 3" |
348 | page: Page { |
349 | id: page3 |
350 | } |
351 | - } |
352 | + } |
353 | Tab { |
354 | id: tabFlick1 |
355 | + title: "flick" |
356 | page: Page { |
357 | Flickable { |
358 | id: flickable1 |
359 | @@ -122,6 +71,7 @@ |
360 | } |
361 | Tab { |
362 | id: tabFlick2 |
363 | + title: "flick 2" |
364 | page: Page { |
365 | Flickable { |
366 | id: flickable2 |
367 | @@ -131,6 +81,7 @@ |
368 | } |
369 | Tab { |
370 | id: tabFlickLoader |
371 | + title: "load" |
372 | page: Loader { |
373 | id: loader |
374 | sourceComponent: tabs.selectedTabIndex != 5 ? null : pageComponent |
375 | @@ -150,4 +101,90 @@ |
376 | } |
377 | } |
378 | } |
379 | + |
380 | + |
381 | + |
382 | + TestCase { |
383 | + name: "TabsAPI" |
384 | + when: windowShown |
385 | + |
386 | + function test_emptyTabs() { |
387 | + compare(emptyTabs.selectedTabIndex, -1, "The default value for selectedTabIndex is -1 when there are no tabs"); |
388 | + compare(emptyTabs.selectedTab, null, "The default selected tab is null when there are no tabs"); |
389 | + compare(emptyTabs.currentPage, null, "The default currentPage is null when there are no tabs"); |
390 | + } |
391 | + |
392 | + function test_tabsDefaults() { |
393 | + compare(tabs.selectedTabIndex, 0, "The default selectedTabIndex is 0 when Tabs has contents"); |
394 | + compare(tabs.selectedTab, tab1, "The default selectedTab is the first tab"); |
395 | + compare(tabs.currentPage, page1, "The default currentPage is the page of the first tab"); |
396 | + compare(mainView.__propagated.toolbar.tools, page1.tools, "The default tools are the tools of the first tab"); |
397 | + compare(mainView.__propagated.header.contents, tabs.tabBar, "Tabs updates the Header contents"); |
398 | + } |
399 | + |
400 | + function test_tabsSetSelectedTab() { |
401 | + var tabArray = [tab1, tab2, tab3]; |
402 | + var pageArray = [page1, page2, page3]; |
403 | + for (var i=0; i < 3; i++) { |
404 | + tabs.selectedTabIndex = i; |
405 | + compare(tabs.selectedTabIndex, i, "Can set selectedTabIndex"); |
406 | + compare(tabs.selectedTab, tabArray[i], "Can update selectedTab by setting selectedTabIndex"); |
407 | + compare(tabs.currentPage, pageArray[i], "Can update currentPage by setting selectedTabIndex"); |
408 | + compare(mainView.__propagated.toolbar.tools, pageArray[i].tools, "Activating a Tab updates the tools of the Toolbar"); |
409 | + for (var j=0; j < 3; j++) { |
410 | + compare(pageArray[j].active, j===i, "Only the page of the selected tab is active"); |
411 | + } |
412 | + } |
413 | + } |
414 | + |
415 | + function test_flickable() { |
416 | + // ensure that the flickable of the header is set to the flickable of the selected tab. |
417 | + tabs.selectedTabIndex = 3; |
418 | + compare(mainView.__propagated.header.flickable, flickable1, "Header flickable correctly initialized"); |
419 | + tabs.selectedTabIndex = 4; |
420 | + compare(mainView.__propagated.header.flickable, flickable2, "Header flickable correctly updated"); |
421 | + tabs.selectedTabIndex = 0; |
422 | + } |
423 | + |
424 | + function test_pageLoader() { |
425 | + tabs.selectedTabIndex = 0; |
426 | + compare(loader.item, null, "Page not loaded when tab is not selected"); |
427 | + tabs.selectedTabIndex = 5; |
428 | + compare(tabs.currentPage, loader, "Selected loader for current page"); |
429 | + compare(loader.item.title, "Loaded page", "Loaded item is a page"); |
430 | + tabs.selectedTabIndex = 0; |
431 | + compare(loader.item, null, "Loaded page was properly unloaded"); |
432 | + } |
433 | + |
434 | + function test_bug1088740() { |
435 | + tabs.selectedTabIndex = 5; |
436 | + compare(mainView.__propagated.header.flickable, loader.item.flick, "Header flickable correctly updated with Loader"); |
437 | + compare(loader.item.flick.contentHeight, 1000, "Header flickable is correct flickable"); |
438 | + tabs.selectedTabIndex = 0; |
439 | + } |
440 | + |
441 | + function test_index() { |
442 | + compare(tab1.index, 0, "tab1 is at 0"); |
443 | + compare(tab2.index, 1, "tab2 is at 1"); |
444 | + compare(tab3.index, 2, "tab3 is at 2"); |
445 | + compare(tabFlick1.index, 3, "tabFlick1 is at 3"); |
446 | + compare(tabFlick2.index, 4, "tabFlick2 is at 4"); |
447 | + compare(tabFlickLoader.index, 5, "tabFlickLoader is at 5"); |
448 | + } |
449 | + |
450 | + function test_deactivateByTimeout() { |
451 | + tabs.tabBar.selectionMode = true; |
452 | + compare(tabs.tabBar.selectionMode, true, "Tab bar can be put into selection mode"); |
453 | + compare(tabs.tabBar.__styleInstance.deactivateTime > 0, true, "There is a positive deactivate time"); |
454 | + wait(tabs.tabBar.__styleInstance.deactivateTime + 500); // add 500 ms margin |
455 | + compare(tabs.tabBar.selectionMode, false, "Tab bar automatically leaves selection mode after a timeout."); |
456 | + } |
457 | + |
458 | + function test_deactivateByAppInteraction() { |
459 | + tabs.tabBar.selectionMode = true; |
460 | + compare(tabs.tabBar.selectionMode, true, "Tab bar can be put into selection mode"); |
461 | + mouseClick(centerRect, units.gu(1), units.gu(1), Qt.LeftButton); |
462 | + compare(tabs.tabBar.selectionMode, false, "Tab bar deactivated by interactiong with the page contents"); |
463 | + } |
464 | + } |
465 | } |
FAILED: Continuous integration, rev:755 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- ci/667/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/3534/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- touch/1062/ console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-amd64- ci/524/ console jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-armhf- ci/524/ console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-i386/ 3546/console jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy-armhf/ 1064/console
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ ubuntu- ui-toolkit- ci/667/ rebuild
http://