Merge lp:~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer into lp:ubuntu-ui-toolkit
- optIn-tabsDrawer
- Merge into trunk
Status: | Rejected | ||||||||
---|---|---|---|---|---|---|---|---|---|
Rejected by: | Tim Peeters | ||||||||
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer | ||||||||
Merge into: | lp:ubuntu-ui-toolkit | ||||||||
Prerequisite: | lp:~tpeeters/ubuntu-ui-toolkit/tabBarInStyle | ||||||||
Diff against target: |
1779 lines (+613/-512) (has conflicts) 37 files modified
debian/changelog (+0/-21) modules/Ubuntu/Components/Header.qml (+24/-1) modules/Ubuntu/Components/MainView.qml (+8/-0) modules/Ubuntu/Components/Panel.qml (+31/-0) modules/Ubuntu/Components/TabBar.qml (+24/-5) modules/Ubuntu/Components/Tabs.qml (+6/-1) modules/Ubuntu/Components/TextField.qml (+11/-10) modules/Ubuntu/Components/TextInputPopover.qml (+1/-3) modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+146/-0) modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml (+5/-3) modules/Ubuntu/Components/Themes/Ambiance/qmldir (+1/-0) modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.cpp (+75/-0) modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.h (+59/-0) modules/Ubuntu/Components/plugin/inversemouseareatype.h (+4/-11) modules/Ubuntu/Components/plugin/plugin.cpp (+3/-0) modules/Ubuntu/Components/plugin/plugin.pro (+2/-0) modules/Ubuntu/Components/plugin/quickutils.cpp (+1/-1) modules/Ubuntu/Components/plugin/quickutils.h (+1/-1) modules/Ubuntu/Test/Test.pro (+0/-1) modules/Ubuntu/Test/plugin/plugin.pro (+0/-25) modules/Ubuntu/Test/plugin/uctestcase.cpp (+0/-50) modules/Ubuntu/Test/plugin/uctestcase.h (+0/-47) tests/autopilot/ubuntuuitoolkit/emulators.py (+87/-20) tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+42/-32) tests/resources/navigation/SimpleTabs.qml (+2/-0) tests/resources/navigation/StackWithTabs.qml (+22/-32) tests/resources/navigation/Tabs.qml (+8/-2) tests/unit/plugin_dependency.pri (+0/-3) tests/unit_x11/tst_components/tst_tabbar.qml (+7/-0) tests/unit_x11/tst_inversemousearea/InverseMouseAreaClip.qml (+0/-73) tests/unit_x11/tst_inversemousearea/InverseMouseAreaInFlickable.qml (+0/-52) tests/unit_x11/tst_inversemousearea/InverseMouseAreaInPage.qml (+0/-46) tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTop.qml (+6/-0) tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTopNoAccept.qml (+6/-1) tests/unit_x11/tst_inversemousearea/InverseMouseAreaParentClipped.qml (+0/-56) tests/unit_x11/tst_inversemousearea/InverseMouseAreaTopmostItem.qml (+9/-10) tests/unit_x11/tst_layouts/tst_layouts.cpp (+22/-5) Text conflict in tests/resources/navigation/Tabs.qml |
||||||||
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/optIn-tabsDrawer | ||||||||
Related bugs: |
|
||||||||
Related blueprints: |
New header and bottom edge
(Essential)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Peeters | Disapprove | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Leo Arias | code review of the autopilot tests and helpers | Pending | |
Review via email: mp+212496@code.launchpad.net |
This proposal supersedes a proposal from 2014-03-10.
Commit message
Description of the change
Add new tab patterns (and autopilot tests for those patterns) which are used when useDeprecatedTo
Leo Arias (elopio) wrote : Posted in a previous version of this proposal | # |
Leo Arias (elopio) : Posted in a previous version of this proposal | # |
- 964. By Tim Peeters
-
merge trunk
- 965. By Tim Peeters
-
revert
- 966. By Tim Peeters
-
merge optIn-newHeader
- 967. By Tim Peeters
-
link bug
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:963
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:967
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 968. By Tim Peeters
-
remove unused variable
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:968
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 969. By Tim Peeters
-
bug no longer present in this branch
- 970. By Tim Peeters
-
merge 20-tabbarInStyle
- 971. By Tim Peeters
-
merge 25-pageTitle
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:971
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
- 972. By Tim Peeters
-
fix TypeError when closing StackWithTabs example
- 973. By Tim Peeters
-
update StackWithTabs example
- 974. By Tim Peeters
-
update Tabs example
- 975. By Tim Peeters
-
merge tabbarInStyle
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:974
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:975
http://
Executed test runs:
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
- 975. By Tim Peeters
-
merge tabbarInStyle
- 974. By Tim Peeters
-
update Tabs example
- 973. By Tim Peeters
-
update StackWithTabs example
- 972. By Tim Peeters
-
fix TypeError when closing StackWithTabs example
- 971. By Tim Peeters
-
merge 25-pageTitle
- 970. By Tim Peeters
-
merge 20-tabbarInStyle
- 969. By Tim Peeters
-
bug no longer present in this branch
- 968. By Tim Peeters
-
remove unused variable
- 967. By Tim Peeters
-
link bug
- 966. By Tim Peeters
-
merge optIn-newHeader
Preview Diff
1 | === modified file 'debian/changelog' |
2 | --- debian/changelog 2014-04-08 14:47:06 +0000 |
3 | +++ debian/changelog 2014-04-09 21:55:48 +0000 |
4 | @@ -78,27 +78,6 @@ |
5 | |
6 | -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Mon, 31 Mar 2014 18:26:59 +0000 |
7 | |
8 | -ubuntu-ui-toolkit (0.1.46+14.04.20140321.1-0ubuntu1) trusty; urgency=low |
9 | - |
10 | - [ Bartosz Kosiorek ] |
11 | - * Fix selection and coping text from TextFields (LP: 1130369) (LP: |
12 | - #1130369) |
13 | - * "Cut" operation do not shows for "ReadOnly's" TextField and TextArea |
14 | - (LP: 1293149) (LP: #1293149, #1267821) |
15 | - |
16 | - [ Zsombor Egri ] |
17 | - * InverseMouseArea not getting mouse events converted from touch when |
18 | - set as topmost item. (LP: #1288876) |
19 | - |
20 | - [ Michael Zanetti ] |
21 | - * drop BottomBarVisiblityCommunicator as it has gone from unity8 - no |
22 | - more HUD from the lower edge |
23 | - |
24 | - [ Christian Dywan ] |
25 | - * Introduce UbuntuTestCase API for C++ (LP: #1261396) |
26 | - |
27 | - -- Ubuntu daily release <ps-jenkins@lists.canonical.com> Fri, 21 Mar 2014 11:29:53 +0000 |
28 | - |
29 | ubuntu-ui-toolkit (0.1.46+14.04.20140317-0ubuntu1) trusty; urgency=low |
30 | |
31 | [ Didier Roche ] |
32 | |
33 | === modified file 'modules/Ubuntu/Components/Header.qml' |
34 | --- modules/Ubuntu/Components/Header.qml 2014-04-09 21:55:47 +0000 |
35 | +++ modules/Ubuntu/Components/Header.qml 2014-04-09 21:55:48 +0000 |
36 | @@ -97,6 +97,23 @@ |
37 | property var tabsModel: null |
38 | |
39 | /*! |
40 | + A model of tabs to represent in the header. |
41 | + This is automatically set by \l Tabs. |
42 | + */ |
43 | + property var tabsModel: null |
44 | + |
45 | + // FIXME: Currently autopilot can only get visual items, but once bug #1273956 |
46 | + // is fixed to support non-visual items, a QtObject may be used. |
47 | + // --timp - 2014-03-20 |
48 | + Item { |
49 | + // FIXME: This is a workaround to be able to get the properties of |
50 | + // tabsModel in an autopilot test. |
51 | + objectName: "tabsModelProperties" |
52 | + property int count: tabsModel ? tabsModel.count : 0 |
53 | + property int selectedIndex: tabsModel ? tabsModel.selectedIndex : -1 |
54 | + } |
55 | + |
56 | + /*! |
57 | The flickable that controls the movement of the header. |
58 | Will be set automatically by Pages inside a MainView, but can |
59 | be overridden. |
60 | @@ -108,6 +125,11 @@ |
61 | header.show(); |
62 | } |
63 | |
64 | + /*! |
65 | + Set by \l MainView |
66 | + */ |
67 | + property bool useDeprecatedToolbar: true |
68 | + |
69 | QtObject { |
70 | id: internal |
71 | |
72 | @@ -195,5 +217,6 @@ |
73 | } |
74 | } |
75 | |
76 | - style: Theme.createStyleComponent("HeaderStyle.qml", header) |
77 | + style: header.useDeprecatedToolbar ? Theme.createStyleComponent("HeaderStyle.qml", header) : |
78 | + Theme.createStyleComponent("NewHeaderStyle.qml", header) |
79 | } |
80 | |
81 | === modified file 'modules/Ubuntu/Components/MainView.qml' |
82 | --- modules/Ubuntu/Components/MainView.qml 2014-04-04 11:03:45 +0000 |
83 | +++ modules/Ubuntu/Components/MainView.qml 2014-04-09 21:55:48 +0000 |
84 | @@ -369,6 +369,8 @@ |
85 | } |
86 | } |
87 | |
88 | + useDeprecatedToolbar: mainView.useDeprecatedToolbar |
89 | + |
90 | // 'window' is defined by QML between startup and showing on the screen. |
91 | // There is no signal for when it becomes available and re-declaring it is not safe. |
92 | property bool windowActive: typeof window != 'undefined' |
93 | @@ -451,6 +453,12 @@ |
94 | |
95 | /*! |
96 | \internal |
97 | + Tabs needs to know whether to use a TabBar or the new header. |
98 | + */ |
99 | + property alias useDeprecatedToolbar: mainView.useDeprecatedToolbar |
100 | + |
101 | + /*! |
102 | + \internal |
103 | The action manager that has the global context for the MainView's actions, |
104 | and to which a local context can be added for each Page that has actions.actions. |
105 | */ |
106 | |
107 | === modified file 'modules/Ubuntu/Components/Panel.qml' |
108 | --- modules/Ubuntu/Components/Panel.qml 2014-04-02 09:47:42 +0000 |
109 | +++ modules/Ubuntu/Components/Panel.qml 2014-04-09 21:55:48 +0000 |
110 | @@ -407,6 +407,11 @@ |
111 | property string previousState: "" |
112 | property int movingDelta |
113 | |
114 | + // Used for recovering the state from before |
115 | + // bottomBarVisibilityCommunicator forced the toolbar to hide. |
116 | + property bool savedLocked: panel.locked |
117 | + property bool savedOpened: panel.opened |
118 | + |
119 | // Convert from Qt.AlignLeading to Qt.AlignTrailing to Qt.AlignLeft and Qt.AlignRight |
120 | property int align: { |
121 | if (panel.align === Qt.AlignLeading) { |
122 | @@ -430,6 +435,30 @@ |
123 | ? Qt.Horizontal : Qt.Vertical |
124 | } |
125 | |
126 | + Connections { |
127 | + // FIXME: bottomBarVisibilityCommunicator is not the most-suitable name anymore. |
128 | + target: bottomBarVisibilityCommunicator |
129 | + onForceHiddenChanged: { |
130 | + if (bottomBarVisibilityCommunicator.forceHidden) { |
131 | + internal.savedLocked = panel.locked; |
132 | + internal.savedOpened = panel.opened; |
133 | + panel.close(); |
134 | + panel.locked = true; |
135 | + } else { // don't force hidden |
136 | + panel.locked = internal.savedLocked; |
137 | + if (panel.locked) { |
138 | + if (internal.savedOpened) { |
139 | + panel.open(); |
140 | + } else { |
141 | + panel.close(); |
142 | + } |
143 | + } |
144 | + // if the panel was locked, do not slide it back in |
145 | + // until the user performs an edge swipe. |
146 | + } |
147 | + } |
148 | + } |
149 | + |
150 | /*! \internal */ |
151 | onStateChanged: { |
152 | if (state == "hint") { |
153 | @@ -637,6 +666,8 @@ |
154 | //position will always be in the range 0..size, where position==0 means spread, position==size means hidden. |
155 | property real position: panel.opened ? 0 : size |
156 | |
157 | + onPositionChanged: bottomBarVisibilityCommunicator.position = size - position |
158 | + |
159 | y: internal.align === Qt.AlignTop ? -position : internal.align === Qt.AlignBottom ? position : 0 |
160 | x: internal.align === Qt.AlignLeft ? -position : internal.align === Qt.AlignRight ? position : 0 |
161 | } |
162 | |
163 | === modified file 'modules/Ubuntu/Components/TabBar.qml' |
164 | --- modules/Ubuntu/Components/TabBar.qml 2014-04-08 12:38:35 +0000 |
165 | +++ modules/Ubuntu/Components/TabBar.qml 2014-04-09 21:55:48 +0000 |
166 | @@ -63,8 +63,18 @@ |
167 | |
168 | /*! |
169 | The property holds the index of the selected Tab item. |
170 | + Note: Setting this property is DEPRECATED. Set the selectedIndex of the model instead. |
171 | */ |
172 | - property int selectedIndex: (model && internal.modelChecked && model.count > 0) ? 0 : -1 |
173 | + property int selectedIndex: (model && internal.modelChecked) ? model.selectedIndex : -1 |
174 | + |
175 | + /*! \internal */ |
176 | + onSelectedIndexChanged: { |
177 | + if (!model) return; |
178 | + if (tabBar.selectedIndex !== model.selectedIndex) { |
179 | + console.warn("Setting TabBar.selectedIndex is DEPRECATED. Set selectedIndex of the model instead"); |
180 | + tabBar.selectedIndex = Qt.binding(function() { return (model && internal.modelChecked) ? model.selectedIndex : -1 }); |
181 | + } |
182 | + } |
183 | |
184 | /*! |
185 | Do not deactivate the tab bar after a specified idle time or when the user selects a new tab. |
186 | @@ -95,18 +105,21 @@ |
187 | |
188 | function checkRoles() { |
189 | if (tabBar.model.count <= 0) |
190 | - return; |
191 | + return false; |
192 | |
193 | modelChecked = true; |
194 | var f = tabBar.model.get(0); |
195 | if (f.tab === undefined && f.title === undefined) { |
196 | console.error("TabBar model must provide either tab or title role."); |
197 | tabBar.model = null; |
198 | + return false; |
199 | } |
200 | if (f.tab !== undefined && f.tab.title === undefined) { |
201 | console.error("TabBar model's tab role must have title property."); |
202 | tabBar.model = null; |
203 | + return false; |
204 | } |
205 | + return true; |
206 | } |
207 | } |
208 | |
209 | @@ -117,6 +130,12 @@ |
210 | if (!model) |
211 | return; |
212 | |
213 | + if (!model.hasOwnProperty("selectedIndex")) { |
214 | + console.error("TabBar model must have selectedIndex property defined."); |
215 | + tabBar.model = null; |
216 | + return; |
217 | + } |
218 | + |
219 | if (!model.hasOwnProperty("count")) { |
220 | console.error("TabBar model must have count property defined."); |
221 | tabBar.model = null; |
222 | @@ -130,11 +149,11 @@ |
223 | } |
224 | |
225 | if (model.count > 0) { |
226 | - internal.checkRoles(); |
227 | - tabBar.selectedIndex = Math.max(Math.min(tabBar.selectedIndex, model.count - 1), 0); |
228 | + if (internal.checkRoles()) { |
229 | + model.selectedIndex = Math.max(Math.min(tabBar.selectedIndex, model.count - 1), 0); |
230 | + } |
231 | } else { |
232 | internal.modelChecked = false; |
233 | - tabBar.selectedIndex = Qt.binding(function() { return (model && internal.modelChecked && model.count > 0) ? 0 : -1 }) |
234 | } |
235 | } |
236 | |
237 | |
238 | === modified file 'modules/Ubuntu/Components/Tabs.qml' |
239 | --- modules/Ubuntu/Components/Tabs.qml 2014-04-09 21:55:47 +0000 |
240 | +++ modules/Ubuntu/Components/Tabs.qml 2014-04-09 21:55:48 +0000 |
241 | @@ -161,7 +161,7 @@ |
242 | The first tab is 0, and -1 means that no tab is selected. |
243 | The initial value is 0 if Tabs has contents, or -1 otherwise. |
244 | */ |
245 | - property alias selectedTabIndex: bar.selectedIndex |
246 | + property alias selectedTabIndex: tabsModel.selectedIndex |
247 | |
248 | /*! |
249 | \preliminary |
250 | @@ -209,6 +209,11 @@ |
251 | ListModel { |
252 | id: tabsModel |
253 | |
254 | + /*! |
255 | + The index of the selected tab. |
256 | + */ |
257 | + property int selectedIndex: tabsModel.count > 0 ? 0 : -1 |
258 | + |
259 | function listModel(tab) { |
260 | return {"title": tab.title, "tab": tab}; |
261 | } |
262 | |
263 | === modified file 'modules/Ubuntu/Components/TextField.qml' |
264 | --- modules/Ubuntu/Components/TextField.qml 2014-03-17 17:58:47 +0000 |
265 | +++ modules/Ubuntu/Components/TextField.qml 2014-04-09 21:55:48 +0000 |
266 | @@ -834,6 +834,8 @@ |
267 | property real lineSize: editor.font.pixelSize + lineSpacing |
268 | //selection properties |
269 | property bool selectionMode: false |
270 | + property int selectionStart: 0 |
271 | + property int selectionEnd: 0 |
272 | |
273 | signal popupTriggered() |
274 | |
275 | @@ -880,20 +882,16 @@ |
276 | // reset selection |
277 | function resetEditorSelection(mouseX) |
278 | { |
279 | - editor.cursorPosition = editor.positionAt(mouseX); |
280 | + editor.cursorPosition = selectionStart = selectionEnd = editor.positionAt(mouseX); |
281 | } |
282 | |
283 | // positions the cursor depending on whether there is a selection active or not |
284 | function positionCursor(x) { |
285 | - |
286 | var cursorPos = control.positionAt(x); |
287 | - if (control.selectedText === "") { |
288 | - control.cursorPosition = cursorPos; |
289 | - } |
290 | - // If target cursor position is outside selection then cancel selection and move cursor |
291 | - else if (control.selectionStart > cursorPos || control.selectionEnd < cursorPos) { |
292 | - control.cursorPosition = cursorPos; |
293 | - } |
294 | + if (internal.selectionEnd == internal.selectionStart) |
295 | + control.cursorPosition = control.positionAt(x); |
296 | + else |
297 | + control.select(internal.selectionStart, internal.selectionEnd); |
298 | } |
299 | } |
300 | |
301 | @@ -1057,6 +1055,9 @@ |
302 | if (!control.activeFocus) |
303 | return; |
304 | editor.selectWord(); |
305 | + // update selection boundaries, except cursorPosition |
306 | + internal.selectionEnd = editor.selectionEnd; |
307 | + internal.selectionStart = editor.selectionStart; |
308 | internal.selectionMode = false; |
309 | } |
310 | onPressed: { |
311 | @@ -1064,7 +1065,7 @@ |
312 | if (!control.activeFocus || (pressedButtons != Qt.LeftButton)) |
313 | return; |
314 | internal.activateEditor(); |
315 | - if (control.selectedText === "") { |
316 | + if (internal.selectionEnd == internal.selectionStart) { |
317 | internal.resetEditorSelection(mouse.x); |
318 | internal.selectionMode = true; |
319 | } |
320 | |
321 | === modified file 'modules/Ubuntu/Components/TextInputPopover.qml' |
322 | --- modules/Ubuntu/Components/TextInputPopover.qml 2014-03-17 18:17:23 +0000 |
323 | +++ modules/Ubuntu/Components/TextInputPopover.qml 2014-04-09 21:55:48 +0000 |
324 | @@ -33,9 +33,7 @@ |
325 | } |
326 | Action { |
327 | text: i18n.tr("Cut") |
328 | - // If paste/editing is not possible, then disable also "Cut" operation |
329 | - // It is applicable for ReadOnly's TextFields and TextAreas |
330 | - enabled: target && target.selectedText !== "" && target.canPaste |
331 | + enabled: target && target.selectedText !== "" |
332 | onTriggered: target.cut() |
333 | } |
334 | Action { |
335 | |
336 | === added file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml' |
337 | --- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 1970-01-01 00:00:00 +0000 |
338 | +++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-04-09 21:55:48 +0000 |
339 | @@ -0,0 +1,146 @@ |
340 | +/* |
341 | + * Copyright 2012 Canonical Ltd. |
342 | + * |
343 | + * This program is free software; you can redistribute it and/or modify |
344 | + * it under the terms of the GNU Lesser General Public License as published by |
345 | + * the Free Software Foundation; version 3. |
346 | + * |
347 | + * This program is distributed in the hope that it will be useful, |
348 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
349 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
350 | + * GNU Lesser General Public License for more details. |
351 | + * |
352 | + * You should have received a copy of the GNU Lesser General Public License |
353 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
354 | + */ |
355 | +import QtQuick 2.0 |
356 | +import Ubuntu.Components 0.1 |
357 | +import Ubuntu.Components.Popups 0.1 |
358 | +import Ubuntu.Components.ListItems 0.1 as ListItem |
359 | + |
360 | +Item { |
361 | + id: headerStyle |
362 | + /*! |
363 | + The height of the headercontents, which is the full height of |
364 | + the header minus the separators shown at the bottom of it. |
365 | + */ |
366 | + property real contentHeight: units.gu(7.5) |
367 | + |
368 | + /*! |
369 | + The source of the image that separates the header from the contents of a \l MainView. |
370 | + The separator will be drawn over the contents. |
371 | + */ |
372 | + property url separatorSource: "artwork/PageHeaderBaseDividerLight.sci" |
373 | + |
374 | + /*! |
375 | + The source of an additional image attached to the bottom of the separator. The contents |
376 | + of the \l MainView will be drawn on top of the separator bottom image. |
377 | + */ |
378 | + property url separatorBottomSource: "artwork/PageHeaderBaseDividerBottom.png" |
379 | + |
380 | + property int fontWeight: Font.Light |
381 | + property string fontSize: "x-large" |
382 | + property color textColor: Theme.palette.selected.backgroundText |
383 | + property real textLeftMargin: units.gu(2) |
384 | + |
385 | + implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height |
386 | + |
387 | + BorderImage { |
388 | + id: separator |
389 | + anchors { |
390 | + bottom: parent.bottom |
391 | + left: parent.left |
392 | + right: parent.right |
393 | + } |
394 | + source: headerStyle.separatorSource |
395 | + } |
396 | + Image { |
397 | + id: separatorBottom |
398 | + anchors { |
399 | + top: separator.bottom |
400 | + left: parent.left |
401 | + right: parent.right |
402 | + } |
403 | + source: headerStyle.separatorBottomSource |
404 | + } |
405 | + |
406 | + Item { |
407 | + id: leftButtonContainer |
408 | + anchors { |
409 | + left: parent.left |
410 | + top: parent.top |
411 | + bottom: parent.bottom |
412 | + } |
413 | + width: childrenRect.width |
414 | + |
415 | + AbstractButton { |
416 | + id: tabsButton |
417 | + objectName: "tabsButton" |
418 | + height: parent ? parent.height : undefined |
419 | + width: visible ? units.gu(5) : 0 |
420 | + |
421 | + iconName: "navigation-menu" |
422 | + visible: styledItem.tabsModel !== null |
423 | + text: visible ? styledItem.tabsModel.count + " tabs" : "" |
424 | + |
425 | + // XXX: We currently use an AbstractButton with ToolbarButtonStyle because |
426 | + // a ToolbarButton does not has its own MouseArea to handle interaction, |
427 | + // that was done in the Toolbar. |
428 | + style: Theme.createStyleComponent("ToolbarButtonStyle.qml", tabsButton) |
429 | + |
430 | + onTriggered: { |
431 | + tabsPopover.show(); |
432 | + } |
433 | + |
434 | + Popover { |
435 | + id: tabsPopover |
436 | + objectName: "tabsPopover" |
437 | + parent: QuickUtils.rootItem(tabsPopover) |
438 | + caller: tabsButton |
439 | + Column { |
440 | + anchors { |
441 | + left: parent.left |
442 | + top: parent.top |
443 | + right: parent.right |
444 | + } |
445 | + Repeater { |
446 | + model: styledItem.tabsModel |
447 | + ListItem.Standard { |
448 | + visible: index !== styledItem.tabsModel.selectedIndex |
449 | + text: tab.title // XXX: only "title" doesn't work with i18n.tr(). Why not? |
450 | + objectName: "tabButton" + index |
451 | + onClicked: { |
452 | + styledItem.tabsModel.selectedIndex = index; |
453 | + tabsPopover.hide(); |
454 | + } |
455 | + } |
456 | + } |
457 | + } |
458 | + } |
459 | + } |
460 | + } |
461 | + |
462 | + Item { |
463 | + id: foreground |
464 | + anchors { |
465 | + left: leftButtonContainer.right |
466 | + right: parent.right |
467 | + top: parent.top |
468 | + } |
469 | + height: headerStyle.contentHeight |
470 | + |
471 | + Label { |
472 | + LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft |
473 | + |
474 | + anchors { |
475 | + left: parent.left |
476 | + verticalCenter: parent.verticalCenter |
477 | + leftMargin: headerStyle.textLeftMargin |
478 | + } |
479 | + text: styledItem.title |
480 | + font.weight: headerStyle.fontWeight |
481 | + fontSize: headerStyle.fontSize |
482 | + color: headerStyle.textColor |
483 | + } |
484 | + } |
485 | +} |
486 | |
487 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml' |
488 | --- modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-04-08 12:38:35 +0000 |
489 | +++ modules/Ubuntu/Components/Themes/Ambiance/TabBarStyle.qml 2014-04-09 21:55:48 +0000 |
490 | @@ -116,8 +116,10 @@ |
491 | AbstractButton { |
492 | id: button |
493 | anchors { |
494 | - top: parent.top |
495 | - bottom: parent.bottom |
496 | + // parent may not exist when closing an app which |
497 | + // causes TypeErrors |
498 | + top: parent ? parent.top : undefined |
499 | + bottom: parent ? parent.bottom : undefined |
500 | } |
501 | width: text.paintedWidth + text.anchors.leftMargin + text.anchors.rightMargin |
502 | |
503 | @@ -212,7 +214,7 @@ |
504 | if (mouseArea.enteringSelectionMode) { |
505 | mouseArea.enteringSelectionMode = false; |
506 | } else if (opacity > 0.0) { |
507 | - styledItem.selectedIndex = index; |
508 | + styledItem.model.selectedIndex = index; |
509 | if (!styledItem.alwaysSelectionMode) { |
510 | styledItem.selectionMode = false; |
511 | } |
512 | |
513 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/qmldir' |
514 | --- modules/Ubuntu/Components/Themes/Ambiance/qmldir 2013-12-04 10:47:19 +0000 |
515 | +++ modules/Ubuntu/Components/Themes/Ambiance/qmldir 2014-04-09 21:55:48 +0000 |
516 | @@ -4,6 +4,7 @@ |
517 | internal CheckBoxStyle CheckBoxStyle.qml |
518 | internal DialogForegroundStyle DialogForegroundStyle.qml |
519 | internal HeaderStyle HeaderStyle.qml |
520 | +internal NewHeaderStyle NewHeaderStyle.qml |
521 | MainViewStyle 0.1 MainViewStyle.qml |
522 | ListItemOptionSelector 0.1 ListItemOptionSelector.qml |
523 | OptionSelectorStyle 0.1 OptionSelectorStyle.qml |
524 | |
525 | === added file 'modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.cpp' |
526 | --- modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.cpp 1970-01-01 00:00:00 +0000 |
527 | +++ modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.cpp 2014-04-09 21:55:48 +0000 |
528 | @@ -0,0 +1,75 @@ |
529 | +/* |
530 | + * Copyright 2013 Canonical Ltd. |
531 | + * |
532 | + * This program is free software; you can redistribute it and/or modify |
533 | + * it under the terms of the GNU Lesser General Public License as published by |
534 | + * the Free Software Foundation; version 3. |
535 | + * |
536 | + * This program is distributed in the hope that it will be useful, |
537 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
538 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
539 | + * GNU Lesser General Public License for more details. |
540 | + * |
541 | + * You should have received a copy of the GNU Lesser General Public License |
542 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
543 | + * |
544 | + */ |
545 | + |
546 | +#include "bottombarvisibilitycommunicator.h" |
547 | + |
548 | +#include <QDBusInterface> |
549 | + |
550 | +static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH = "/BottomBarVisibilityCommunicator"; |
551 | +static const char* BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_INTERFACE = "com.canonical.Shell.BottomBarVisibilityCommunicator"; |
552 | +static const char* DBUS_SERVICE = "com.canonical.Shell.BottomBarVisibilityCommunicator"; |
553 | + |
554 | +/*! |
555 | + \internal |
556 | + |
557 | + BottomBarVisibilityCommunicator controller is used to communicate with the Shell BottomBarVisibilityCommunicator. |
558 | + This class allows for the bottom edge interaction to happen |
559 | + |
560 | + The shell can control the bottom bar behaviour: |
561 | + * forceHidden: If set to true, the bottom bar has to be forced to be hidden |
562 | +*/ |
563 | + |
564 | +BottomBarVisibilityCommunicator::BottomBarVisibilityCommunicator() |
565 | + : m_shellDbusIface(NULL), |
566 | + m_position(0), |
567 | + m_forceHidden(false) |
568 | +{ |
569 | + m_shellDbusIface = new QDBusInterface(DBUS_SERVICE, BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_PATH, BOTTOM_BAR_VISIBILITY_COMMUNICATOR_DBUS_INTERFACE, QDBusConnection::sessionBus(), this); |
570 | + if (m_shellDbusIface->isValid()) { |
571 | + connect(m_shellDbusIface, SIGNAL(forceHiddenChanged(bool)), SLOT(onShellForceHiddenChanged(bool))); |
572 | + |
573 | + const bool forceHidden = m_shellDbusIface->property("forceHidden").toDouble(); |
574 | + onShellForceHiddenChanged(forceHidden); |
575 | + } |
576 | +} |
577 | + |
578 | +bool BottomBarVisibilityCommunicator::forceHidden() const |
579 | +{ |
580 | + return m_forceHidden; |
581 | +} |
582 | + |
583 | +double BottomBarVisibilityCommunicator::position() const |
584 | +{ |
585 | + return m_position; |
586 | +} |
587 | + |
588 | +void BottomBarVisibilityCommunicator::setPosition(double position) |
589 | +{ |
590 | + if (position != m_position) { |
591 | + m_position = position; |
592 | + m_shellDbusIface->setProperty("position", position); |
593 | + Q_EMIT positionChanged(position); |
594 | + } |
595 | +} |
596 | + |
597 | +void BottomBarVisibilityCommunicator::onShellForceHiddenChanged(bool forceHidden) |
598 | +{ |
599 | + if (forceHidden != m_forceHidden) { |
600 | + m_forceHidden = forceHidden; |
601 | + Q_EMIT forceHiddenChanged(forceHidden); |
602 | + } |
603 | +} |
604 | |
605 | === added file 'modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.h' |
606 | --- modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.h 1970-01-01 00:00:00 +0000 |
607 | +++ modules/Ubuntu/Components/plugin/bottombarvisibilitycommunicator.h 2014-04-09 21:55:48 +0000 |
608 | @@ -0,0 +1,59 @@ |
609 | +/* |
610 | + * Copyright 2013 Canonical Ltd. |
611 | + * |
612 | + * This program is free software; you can redistribute it and/or modify |
613 | + * it under the terms of the GNU Lesser General Public License as published by |
614 | + * the Free Software Foundation; version 3. |
615 | + * |
616 | + * This program is distributed in the hope that it will be useful, |
617 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
618 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
619 | + * GNU Lesser General Public License for more details. |
620 | + * |
621 | + * You should have received a copy of the GNU Lesser General Public License |
622 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
623 | + * |
624 | + */ |
625 | + |
626 | +#ifndef BOTTOMBARVISIBILITYCOMMUNICATOR_H |
627 | +#define BOTTOMBARVISIBILITYCOMMUNICATOR_H |
628 | + |
629 | +#include <QObject> |
630 | + |
631 | +class QDBusInterface; |
632 | + |
633 | +class BottomBarVisibilityCommunicator : public QObject |
634 | +{ |
635 | + Q_OBJECT |
636 | + Q_PROPERTY(bool forceHidden READ forceHidden NOTIFY forceHiddenChanged) |
637 | + Q_PROPERTY(double position READ position WRITE setPosition NOTIFY positionChanged) |
638 | + |
639 | +public: |
640 | + static BottomBarVisibilityCommunicator& instance() { |
641 | + static BottomBarVisibilityCommunicator instance; |
642 | + return instance; |
643 | + } |
644 | + |
645 | + bool forceHidden() const; |
646 | + double position() const; |
647 | + void setPosition(double position); |
648 | + |
649 | +Q_SIGNALS: |
650 | + void forceHiddenChanged(bool forceHidden); |
651 | + void positionChanged(double position); |
652 | + |
653 | +private Q_SLOTS: |
654 | + void onShellForceHiddenChanged(bool forceHidden); |
655 | + |
656 | +private: |
657 | + BottomBarVisibilityCommunicator(); |
658 | + |
659 | + QDBusInterface* m_shellDbusIface; |
660 | + |
661 | + double m_position; |
662 | + |
663 | + // This is cached from dbus |
664 | + bool m_forceHidden; |
665 | +}; |
666 | + |
667 | +#endif |
668 | |
669 | === modified file 'modules/Ubuntu/Components/plugin/inversemouseareatype.h' |
670 | --- modules/Ubuntu/Components/plugin/inversemouseareatype.h 2014-03-20 10:01:21 +0000 |
671 | +++ modules/Ubuntu/Components/plugin/inversemouseareatype.h 2014-04-09 21:55:48 +0000 |
672 | @@ -17,7 +17,6 @@ |
673 | #define INVERSEMOUSEAREATYPE_H |
674 | |
675 | #include <private/qquickmousearea_p.h> |
676 | -#include <QtCore/QPointer> |
677 | |
678 | class QQuickItem; |
679 | class InverseMouseAreaType : public QQuickMouseArea |
680 | @@ -45,7 +44,7 @@ |
681 | void setSensingArea(QQuickItem *sensing); |
682 | bool topmostItem() const; |
683 | void setTopmostItem(bool value); |
684 | - QEvent * mapEventToArea(QObject *target, QEvent *event, QPoint &point); |
685 | + QEvent * mapEventToArea(QObject *target, QEvent *event); |
686 | |
687 | Q_SIGNALS: |
688 | void sensingAreaChanged(); |
689 | @@ -53,17 +52,11 @@ |
690 | |
691 | private Q_SLOTS: |
692 | void update(); |
693 | - void resetFilterOnWindowUpdate(QQuickWindow *win); |
694 | |
695 | private: |
696 | - bool m_ready:1; |
697 | - bool m_topmostItem:1; |
698 | - bool m_filteredEvent:1; |
699 | - QPointer<QObject> m_filterHost; |
700 | - QPointer<QQuickItem> m_sensingArea; |
701 | - int m_touchId; |
702 | - |
703 | - void updateEventFilter(bool enable); |
704 | + bool m_ready; |
705 | + bool m_topmostItem; |
706 | + QQuickItem *m_sensingArea; |
707 | }; |
708 | |
709 | #endif // INVERSEMOUSEAREATYPE_H |
710 | |
711 | === modified file 'modules/Ubuntu/Components/plugin/plugin.cpp' |
712 | --- modules/Ubuntu/Components/plugin/plugin.cpp 2014-03-05 12:29:58 +0000 |
713 | +++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-04-09 21:55:48 +0000 |
714 | @@ -35,6 +35,7 @@ |
715 | #include "inversemouseareatype.h" |
716 | #include "qquickclipboard.h" |
717 | #include "qquickmimedata.h" |
718 | +#include "bottombarvisibilitycommunicator.h" |
719 | #include "thumbnailgenerator.h" |
720 | #include "ucubuntuanimation.h" |
721 | #include "ucfontutils.h" |
722 | @@ -224,6 +225,8 @@ |
723 | QObject::connect(&UCUnits::instance(), SIGNAL(gridUnitChanged()), |
724 | fontUtilsListener, SLOT(updateContextProperty())); |
725 | |
726 | + context->setContextProperty("bottomBarVisibilityCommunicator", &BottomBarVisibilityCommunicator::instance()); |
727 | + |
728 | engine->addImageProvider(QLatin1String("scaling"), new UCScalingImageProvider); |
729 | |
730 | // register icon provider |
731 | |
732 | === modified file 'modules/Ubuntu/Components/plugin/plugin.pro' |
733 | --- modules/Ubuntu/Components/plugin/plugin.pro 2014-03-25 06:46:36 +0000 |
734 | +++ modules/Ubuntu/Components/plugin/plugin.pro 2014-04-09 21:55:48 +0000 |
735 | @@ -36,6 +36,7 @@ |
736 | shapeitemtexture.h \ |
737 | shapeitem.h \ |
738 | inversemouseareatype.h \ |
739 | + bottombarvisibilitycommunicator.h \ |
740 | qquickclipboard.h \ |
741 | qquickmimedata.h \ |
742 | qquickclipboard_p.h \ |
743 | @@ -73,6 +74,7 @@ |
744 | quickutils.cpp \ |
745 | shapeitem.cpp \ |
746 | inversemouseareatype.cpp \ |
747 | + bottombarvisibilitycommunicator.cpp \ |
748 | qquickclipboard.cpp \ |
749 | qquickmimedata.cpp \ |
750 | ucubuntuanimation.cpp \ |
751 | |
752 | === modified file 'modules/Ubuntu/Components/plugin/quickutils.cpp' |
753 | --- modules/Ubuntu/Components/plugin/quickutils.cpp 2014-03-20 15:46:28 +0000 |
754 | +++ modules/Ubuntu/Components/plugin/quickutils.cpp 2014-04-09 21:55:48 +0000 |
755 | @@ -113,7 +113,7 @@ |
756 | QString QuickUtils::className(QObject *item) |
757 | { |
758 | if (!item) { |
759 | - return QString("(null)"); |
760 | + return QString(); |
761 | } |
762 | QString result = item->metaObject()->className(); |
763 | return result.left(result.indexOf("_QML")); |
764 | |
765 | === modified file 'modules/Ubuntu/Components/plugin/quickutils.h' |
766 | --- modules/Ubuntu/Components/plugin/quickutils.h 2014-03-20 15:46:28 +0000 |
767 | +++ modules/Ubuntu/Components/plugin/quickutils.h 2014-04-09 21:55:48 +0000 |
768 | @@ -41,7 +41,7 @@ |
769 | Q_INVOKABLE QQuickItem *rootItem(QObject *object); |
770 | QString inputMethodProvider() const; |
771 | |
772 | - Q_INVOKABLE static QString className(QObject *item); |
773 | + Q_INVOKABLE QString className(QObject *item); |
774 | QObject* createQmlObject(const QUrl &url, QQmlEngine *engine); |
775 | |
776 | Q_SIGNALS: |
777 | |
778 | === modified file 'modules/Ubuntu/Test/Test.pro' |
779 | --- modules/Ubuntu/Test/Test.pro 2013-12-16 17:37:48 +0000 |
780 | +++ modules/Ubuntu/Test/Test.pro 2014-04-09 21:55:48 +0000 |
781 | @@ -1,5 +1,4 @@ |
782 | TEMPLATE = subdirs |
783 | -SUBDIRS += plugin |
784 | OTHER_FILES += $$system(ls *.qml) |
785 | include(deployment.pri) |
786 | |
787 | |
788 | === removed directory 'modules/Ubuntu/Test/plugin' |
789 | === removed file 'modules/Ubuntu/Test/plugin/plugin.pro' |
790 | --- modules/Ubuntu/Test/plugin/plugin.pro 2013-12-16 17:37:48 +0000 |
791 | +++ modules/Ubuntu/Test/plugin/plugin.pro 1970-01-01 00:00:00 +0000 |
792 | @@ -1,25 +0,0 @@ |
793 | -TEMPLATE = lib |
794 | -TARGET = ../UbuntuTest |
795 | -QT += core-private qml qml-private quick quick-private |
796 | - |
797 | -equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) { |
798 | - QT += v8-private |
799 | -} |
800 | - |
801 | -CONFIG += qt plugin no_keywords |
802 | - |
803 | -QMAKE_CXXFLAGS += -Werror |
804 | - |
805 | -TARGET = $$qtLibraryTarget($$TARGET) |
806 | -uri = Ubuntu.Test |
807 | - |
808 | -HEADERS += \ |
809 | - uctestcase.h \ |
810 | - |
811 | -SOURCES += \ |
812 | - uctestcase.cpp \ |
813 | - |
814 | -# deployment rules for the plugin |
815 | -installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) |
816 | -target.path = $$installPath |
817 | -INSTALLS += target |
818 | |
819 | === removed file 'modules/Ubuntu/Test/plugin/uctestcase.cpp' |
820 | --- modules/Ubuntu/Test/plugin/uctestcase.cpp 2014-03-19 12:48:33 +0000 |
821 | +++ modules/Ubuntu/Test/plugin/uctestcase.cpp 1970-01-01 00:00:00 +0000 |
822 | @@ -1,50 +0,0 @@ |
823 | -/* |
824 | - * Copyright 2013-2014 Canonical Ltd. |
825 | - * |
826 | - * This program is free software; you can redistribute it and/or modify |
827 | - * it under the terms of the GNU Lesser General Public License as published by |
828 | - * the Free Software Foundation; version 3. |
829 | - * |
830 | - * This program is distributed in the hope that it will be useful, |
831 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
832 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
833 | - * GNU Lesser General Public License for more details. |
834 | - * |
835 | - * You should have received a copy of the GNU Lesser General Public License |
836 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
837 | - * |
838 | - * Author: Christian Dywan <christian.dywan@canonical.com> |
839 | - */ |
840 | - |
841 | -#include "uctestcase.h" |
842 | - |
843 | -#include <stdlib.h> |
844 | - |
845 | -#include <QtQml/QQmlEngine> |
846 | -#include <QtCore/QDir> |
847 | -#include <QtCore/QDebug> |
848 | -#include <QtTest/QtTest> |
849 | -#include <QtQuick/QQuickItem> |
850 | - |
851 | -/*! |
852 | - * \ingroup ubuntu |
853 | - * \brief UbuntuTestCase is the C++ pendant to the QML UbuntuTestCase. |
854 | - */ |
855 | -UbuntuTestCase::UbuntuTestCase(const QString& file, QWindow* parent) : QQuickView(parent) |
856 | -{ |
857 | - QString modules("../../../modules"); |
858 | - Q_ASSERT(QDir(modules).exists()); |
859 | - QString modulePath(QDir(modules).absolutePath()); |
860 | - engine()->addImportPath(modulePath); |
861 | - |
862 | - m_spy = new QSignalSpy(engine(), SIGNAL(warnings(QList<QQmlError>))); |
863 | - m_spy->setParent(this); |
864 | - |
865 | - Q_ASSERT(!file.isEmpty()); |
866 | - setSource(QUrl::fromLocalFile(file)); |
867 | - Q_ASSERT(status() == QQuickView::Ready); |
868 | - Q_ASSERT(rootObject()); |
869 | - show(); |
870 | - QTest::qWaitForWindowExposed(this); |
871 | -} |
872 | - |
873 | |
874 | === removed file 'modules/Ubuntu/Test/plugin/uctestcase.h' |
875 | --- modules/Ubuntu/Test/plugin/uctestcase.h 2014-03-19 12:48:33 +0000 |
876 | +++ modules/Ubuntu/Test/plugin/uctestcase.h 1970-01-01 00:00:00 +0000 |
877 | @@ -1,47 +0,0 @@ |
878 | -/* |
879 | - * Copyright 2013-2014 Canonical Ltd. |
880 | - * |
881 | - * This program is free software; you can redistribute it and/or modify |
882 | - * it under the terms of the GNU Lesser General Public License as published by |
883 | - * the Free Software Foundation; version 3. |
884 | - * |
885 | - * This program is distributed in the hope that it will be useful, |
886 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
887 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
888 | - * GNU Lesser General Public License for more details. |
889 | - * |
890 | - * You should have received a copy of the GNU Lesser General Public License |
891 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
892 | - * |
893 | - * Author: Christian Dywan <christian.dywan@canonical.com> |
894 | - */ |
895 | - |
896 | -#ifndef UBUNTU_TEST_UBUNTUTESTCASE_H |
897 | -#define UBUNTU_TEST_UBUNTUTESTCASE_H |
898 | - |
899 | -#include <QtQuick/QQuickItem> |
900 | -#include <QtQuick/QQuickView> |
901 | -#include <QtTest/QSignalSpy> |
902 | - |
903 | -class UbuntuTestCase : public QQuickView |
904 | -{ |
905 | - Q_OBJECT |
906 | - |
907 | -public: |
908 | - UbuntuTestCase(const QString& file, QWindow* parent = 0); |
909 | - // getter |
910 | - template<class T> |
911 | - inline T findItem(const QString& objectName) const { |
912 | - T item = rootObject()->findChild<T>(objectName); |
913 | - if (item) |
914 | - return item; |
915 | - if (rootObject()->findChild<QObject*>(objectName)) |
916 | - qFatal("Item '%s' found with unexpected type", qPrintable(objectName)); |
917 | - qFatal("No item '%s' found", qPrintable(objectName)); |
918 | - } |
919 | - |
920 | -private: |
921 | - QSignalSpy* m_spy; |
922 | -}; |
923 | - |
924 | -#endif // UBUNTU_TEST_UBUNTUTESTCASE_H |
925 | |
926 | === modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py' |
927 | --- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-04-08 14:46:25 +0000 |
928 | +++ tests/autopilot/ubuntuuitoolkit/emulators.py 2014-04-09 21:55:48 +0000 |
929 | @@ -143,20 +143,12 @@ |
930 | current_tab.visible.wait_for(True) |
931 | return current_tab |
932 | |
933 | - @autopilot_logging.log_action(logger.info) |
934 | - def switch_to_tab_by_index(self, index): |
935 | - """Open a tab. |
936 | - |
937 | - :parameter index: The index of the tab to open. |
938 | - :return: The newly opened tab. |
939 | - :raise ToolkitEmulatorException: If the tab index is out of range. |
940 | - |
941 | - """ |
942 | - logger.debug('Switch to tab with index {0}.'.format(index)) |
943 | + def _switch_to_tab_in_deprecated_tabbar_by_index(self, index): |
944 | tabs = self.get_tabs() |
945 | number_of_tabs = tabs.get_number_of_tabs() |
946 | if index >= number_of_tabs: |
947 | raise ToolkitEmulatorException('Tab index out of range.') |
948 | + |
949 | current_tab = tabs.get_current_tab() |
950 | number_of_switches = 0 |
951 | while not tabs.selectedTabIndex == index: |
952 | @@ -171,6 +163,33 @@ |
953 | number_of_switches += 1 |
954 | return current_tab |
955 | |
956 | + def _switch_to_tab_in_drawer_by_index(self, index): |
957 | + tabs = self.get_tabs() |
958 | + number_of_tabs = tabs.get_number_of_tabs() |
959 | + if index >= number_of_tabs: |
960 | + raise ToolkitEmulatorException('Tab index out of range.') |
961 | + |
962 | + if (index != tabs.selectedTabIndex): |
963 | + self.get_header().switch_to_tab_by_index(index) |
964 | + current_tab = tabs.get_current_tab() |
965 | + return current_tab |
966 | + |
967 | + @autopilot_logging.log_action(logger.info) |
968 | + def switch_to_tab_by_index(self, index): |
969 | + """Open a tab. |
970 | + |
971 | + :parameter index: The index of the tab to open. |
972 | + :return: The newly opened tab. |
973 | + :raise ToolkitEmulatorException: If the tab index is out of range. |
974 | + |
975 | + """ |
976 | + logger.debug('Switch to tab with index {0}.'.format(index)) |
977 | + |
978 | + if (self.useDeprecatedToolbar): |
979 | + return self._switch_to_tab_in_deprecated_tabbar_by_index(index) |
980 | + else: |
981 | + return self._switch_to_tab_in_drawer_by_index(index) |
982 | + |
983 | @autopilot_logging.log_action(logger.info) |
984 | def switch_to_previous_tab(self): |
985 | """Open the previous tab. |
986 | @@ -226,16 +245,13 @@ |
987 | self.pointing_device = get_pointing_device() |
988 | |
989 | def _get_animating(self): |
990 | - tab_bar_style = self.select_single('TabBarStyle') |
991 | - return tab_bar_style.animating |
992 | - |
993 | - @autopilot_logging.log_action(logger.info) |
994 | - def switch_to_next_tab(self): |
995 | - """Open the next tab. |
996 | - |
997 | - :raise ToolkitEmulatorException: If the main view has no tabs. |
998 | - |
999 | - """ |
1000 | + if (self.useDeprecatedToolbar): |
1001 | + tab_bar_style = self.select_single('TabBarStyle') |
1002 | + return tab_bar_style.animating |
1003 | + else: |
1004 | + return False |
1005 | + |
1006 | + def _switch_to_next_tab_in_deprecated_tabbar(self): |
1007 | try: |
1008 | tab_bar = self.select_single(TabBar) |
1009 | except dbus.StateNotFoundError: |
1010 | @@ -243,6 +259,57 @@ |
1011 | tab_bar.switch_to_next_tab() |
1012 | self._get_animating().wait_for(False) |
1013 | |
1014 | + def _switch_to_next_tab_in_drawer(self): |
1015 | + tabs_model_properties = self.select_single( |
1016 | + 'QQuickItem', objectName='tabsModelProperties') |
1017 | + next_tab_index = (tabs_model_properties.selectedIndex |
1018 | + + 1) % tabs_model_properties.count |
1019 | + self._switch_to_tab_in_drawer_by_index(next_tab_index) |
1020 | + |
1021 | + @autopilot_logging.log_action(logger.info) |
1022 | + def switch_to_next_tab(self): |
1023 | + """Open the next tab. |
1024 | + |
1025 | + :raise ToolkitEmulatorException: If the main view has no tabs. |
1026 | + |
1027 | + """ |
1028 | + if (self.useDeprecatedToolbar): |
1029 | + self._switch_to_next_tab_in_deprecated_tabbar() |
1030 | + else: |
1031 | + self._switch_to_next_tab_in_drawer() |
1032 | + |
1033 | + def _switch_to_tab_in_drawer_by_index(self, index): |
1034 | + try: |
1035 | + tabs_drawer_button = self.select_single( |
1036 | + 'AbstractButton', objectName='tabsButton') |
1037 | + except dbus.StateNotFoundError: |
1038 | + raise ToolkitEmulatorException(_NO_TABS_ERROR) |
1039 | + self.pointing_device.click_object(tabs_drawer_button) |
1040 | + |
1041 | + try: |
1042 | + tab_button = self.get_root_instance().select_single( |
1043 | + 'Standard', objectName='tabButton' + str(index)) |
1044 | + except dbus.StateNotFoundError: |
1045 | + raise ToolkitEmulatorException( |
1046 | + "Tab button {0} not found.".format(index)) |
1047 | + |
1048 | + self.pointing_device.click_object(tab_button) |
1049 | + |
1050 | + @autopilot_logging.log_action(logger.info) |
1051 | + def switch_to_tab_by_index(self, index): |
1052 | + """Open a tab. This only supports the new tabs in the header |
1053 | + |
1054 | + :parameter index: The index of the tab to open. |
1055 | + :raise ToolkitEmulatorException: If the tab index is out of range or |
1056 | + useDeprecatedToolbar is set. |
1057 | + |
1058 | + """ |
1059 | + if (self.useDeprecatedToolbar): |
1060 | + raise ToolkitEmulatorException( |
1061 | + "Header.swtich_to_tab_by_index only works with new header") |
1062 | + else: |
1063 | + self._switch_to_tab_in_drawer_by_index(index) |
1064 | + |
1065 | |
1066 | class Toolbar(UbuntuUIToolkitEmulatorBase): |
1067 | """Toolbar Autopilot emulator.""" |
1068 | |
1069 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py' |
1070 | --- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-03-22 06:53:24 +0000 |
1071 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-04-09 21:55:48 +0000 |
1072 | @@ -242,56 +242,66 @@ |
1073 | 'Toolbar must be opened before calling click_button().') |
1074 | |
1075 | |
1076 | -class TabsTestCase(tests.QMLStringAppTestCase): |
1077 | - |
1078 | - test_qml = (""" |
1079 | +TEST_TABS_QML_FORMAT = (""" |
1080 | import QtQuick 2.0 |
1081 | import Ubuntu.Components 0.1 |
1082 | -import Ubuntu.Components.ListItems 0.1 as ListItem |
1083 | |
1084 | -MainView { |
1085 | +MainView {{ |
1086 | width: units.gu(70) |
1087 | height: units.gu(60) |
1088 | + useDeprecatedToolbar: {use_deprecated_toolbar} |
1089 | |
1090 | - Tabs { |
1091 | + Tabs {{ |
1092 | id: tabs |
1093 | - Tab { |
1094 | + Tab {{ |
1095 | objectName: "tab1" |
1096 | title: "Tab1" |
1097 | - Page { |
1098 | - tools: ToolbarItems { |
1099 | - ToolbarButton { |
1100 | + Page {{ |
1101 | + tools: ToolbarItems {{ |
1102 | + ToolbarButton {{ |
1103 | text: "Test1" |
1104 | - } |
1105 | - } |
1106 | - } |
1107 | - } |
1108 | - Tab { |
1109 | + }} |
1110 | + }} |
1111 | + }} |
1112 | + }} |
1113 | + Tab {{ |
1114 | objectName: "tab2" |
1115 | title: "Tab2" |
1116 | - Page { |
1117 | - tools: ToolbarItems { |
1118 | - ToolbarButton { |
1119 | + Page {{ |
1120 | + tools: ToolbarItems {{ |
1121 | + ToolbarButton {{ |
1122 | text: "Test2" |
1123 | - } |
1124 | - } |
1125 | - } |
1126 | - } |
1127 | - Tab { |
1128 | + }} |
1129 | + }} |
1130 | + }} |
1131 | + }} |
1132 | + Tab {{ |
1133 | objectName: "tab3" |
1134 | title: "Tab3" |
1135 | - Page { |
1136 | - tools: ToolbarItems { |
1137 | - ToolbarButton { |
1138 | + Page {{ |
1139 | + tools: ToolbarItems {{ |
1140 | + ToolbarButton {{ |
1141 | text: "Test3" |
1142 | - } |
1143 | - } |
1144 | - } |
1145 | - } |
1146 | - } |
1147 | -} |
1148 | + }} |
1149 | + }} |
1150 | + }} |
1151 | + }} |
1152 | + }} |
1153 | +}} |
1154 | """) |
1155 | |
1156 | + |
1157 | +class TabsTestCase(tests.QMLStringAppTestCase): |
1158 | + |
1159 | + scenarios = [ |
1160 | + ('deprecated tabs', dict( |
1161 | + test_qml=TEST_TABS_QML_FORMAT.format( |
1162 | + use_deprecated_toolbar='true'))), |
1163 | + ('drawer tabs', dict( |
1164 | + test_qml=TEST_TABS_QML_FORMAT.format( |
1165 | + use_deprecated_toolbar='false'))) |
1166 | + ] |
1167 | + |
1168 | def test_tabs_custom_emulator(self): |
1169 | self.assertIsInstance(self.main_view.get_tabs(), emulators.Tabs) |
1170 | |
1171 | |
1172 | === modified file 'tests/resources/navigation/SimpleTabs.qml' |
1173 | --- tests/resources/navigation/SimpleTabs.qml 2013-11-20 18:00:41 +0000 |
1174 | +++ tests/resources/navigation/SimpleTabs.qml 2014-04-09 21:55:48 +0000 |
1175 | @@ -20,6 +20,8 @@ |
1176 | MainView { |
1177 | width: 800 |
1178 | height: 600 |
1179 | + useDeprecatedToolbar: false |
1180 | + |
1181 | Tabs { |
1182 | id: tabs |
1183 | selectedTabIndex: 1 |
1184 | |
1185 | === modified file 'tests/resources/navigation/StackWithTabs.qml' |
1186 | --- tests/resources/navigation/StackWithTabs.qml 2013-08-01 13:08:32 +0000 |
1187 | +++ tests/resources/navigation/StackWithTabs.qml 2014-04-09 21:55:48 +0000 |
1188 | @@ -21,6 +21,7 @@ |
1189 | id: mainView |
1190 | width: units.gu(38) |
1191 | height: units.gu(50) |
1192 | + useDeprecatedToolbar: true |
1193 | |
1194 | PageStack { |
1195 | id: pageStack |
1196 | @@ -34,56 +35,45 @@ |
1197 | Button { |
1198 | anchors.centerIn: parent |
1199 | onClicked: pageStack.push(page3) |
1200 | - text: "Press" |
1201 | + text: "Push to stack" |
1202 | } |
1203 | } |
1204 | } |
1205 | Tab { |
1206 | title: "Tab 2" |
1207 | page: Page { |
1208 | - Column { |
1209 | - anchors { |
1210 | - centerIn: parent |
1211 | - } |
1212 | - width: childrenRect.width |
1213 | - height: childrenRect.height |
1214 | - spacing: units.gu(1) |
1215 | - |
1216 | - Label { |
1217 | - text: "Tab bar always in selection mode?" |
1218 | - } |
1219 | - Switch { |
1220 | - id: alwaysSelectionModeSwitch |
1221 | - Binding { |
1222 | - target: tabs.tabBar |
1223 | - property: "alwaysSelectionMode" |
1224 | - value: alwaysSelectionModeSwitch.checked |
1225 | - } |
1226 | - } |
1227 | - Label { |
1228 | - text: "Animate tab bar." |
1229 | - } |
1230 | - Switch { |
1231 | - id: animateSwitch |
1232 | - checked: true |
1233 | - Binding { |
1234 | - target: tabs.tabBar |
1235 | - property: "animate" |
1236 | - value: animateSwitch.checked |
1237 | - } |
1238 | - } |
1239 | + Button { |
1240 | + anchors.centerIn: parent |
1241 | + text: "Switch to tab 1" |
1242 | + onClicked: tabs.selectedTabIndex = 0 |
1243 | } |
1244 | } |
1245 | } |
1246 | } |
1247 | Page { |
1248 | id: page3 |
1249 | + active: parent.active |
1250 | visible: false |
1251 | title: "Page on stack" |
1252 | Label { |
1253 | anchors.centerIn: parent |
1254 | text: "Press back to return to the tabs" |
1255 | } |
1256 | + |
1257 | + Loader { |
1258 | + // FIXME: This Loader is a temporary solution, when the back |
1259 | + // button in in the header it is no longer needed. |
1260 | + active: !mainView.useDeprecatedToolbar |
1261 | + sourceComponent: Button { |
1262 | + onClicked: pageStack.pop() |
1263 | + text: "Back" |
1264 | + } |
1265 | + anchors { |
1266 | + horizontalCenter: parent.horizontalCenter |
1267 | + bottom: parent.bottom |
1268 | + bottomMargin: units.gu(1) |
1269 | + } |
1270 | + } |
1271 | } |
1272 | } |
1273 | } |
1274 | |
1275 | === modified file 'tests/resources/navigation/Tabs.qml' |
1276 | --- tests/resources/navigation/Tabs.qml 2014-04-07 10:03:39 +0000 |
1277 | +++ tests/resources/navigation/Tabs.qml 2014-04-09 21:55:48 +0000 |
1278 | @@ -19,8 +19,10 @@ |
1279 | import Ubuntu.Components.ListItems 0.1 as ListItem |
1280 | |
1281 | MainView { |
1282 | + id: mainView |
1283 | width: 800 |
1284 | height: 600 |
1285 | + useDeprecatedToolbar: false |
1286 | |
1287 | Tabs { |
1288 | id: tabs |
1289 | @@ -33,6 +35,10 @@ |
1290 | id: simpleTab |
1291 | title: i18n.tr("Simple page #" + index) |
1292 | page: Page { |
1293 | +<<<<<<< TREE |
1294 | +======= |
1295 | + title: "Selected page title" |
1296 | +>>>>>>> MERGE-SOURCE |
1297 | Row { |
1298 | anchors.centerIn: parent |
1299 | spacing: units.gu(1) |
1300 | @@ -40,12 +46,12 @@ |
1301 | height: childrenRect.height |
1302 | Button { |
1303 | text: "tab bar on" |
1304 | - enabled: !tabs.tabBar.selectionMode |
1305 | + enabled: mainView.useDeprecatedToolbar && !tabs.tabBar.selectionMode |
1306 | onClicked: tabs.tabBar.selectionMode = true; |
1307 | } |
1308 | Button { |
1309 | text: "tab bar off" |
1310 | - enabled: tabs.tabBar.selectionMode |
1311 | + enabled: mainView.useDeprecatedToolbar && tabs.tabBar.selectionMode |
1312 | onClicked: tabs.tabBar.selectionMode = false; |
1313 | } |
1314 | } |
1315 | |
1316 | === modified file 'tests/unit/plugin_dependency.pri' |
1317 | --- tests/unit/plugin_dependency.pri 2013-12-16 17:37:48 +0000 |
1318 | +++ tests/unit/plugin_dependency.pri 2014-04-09 21:55:48 +0000 |
1319 | @@ -1,10 +1,7 @@ |
1320 | COMPONENTS_PATH = ../../../modules/Ubuntu/Components |
1321 | INCLUDEPATH += $$COMPONENTS_PATH/plugin |
1322 | -INCLUDEPATH += ../../../modules/Ubuntu/Test/plugin |
1323 | PRE_TARGETDEPS = $$COMPONENTS_PATH/libUbuntuComponents.so |
1324 | -PRE_TARGETDEPS += ../../../modules/Ubuntu/Test/libUbuntuTest.so |
1325 | LIBS += $$COMPONENTS_PATH/libUbuntuComponents.so |
1326 | -LIBS += ../../../modules/Ubuntu/Test/libUbuntuTest.so |
1327 | DEFINES += QUICK_TEST_SOURCE_DIR=\"\\\"$$_PRO_FILE_PWD_\\\"\" |
1328 | QMAKE_CXXFLAGS += -Werror |
1329 | |
1330 | |
1331 | === modified file 'tests/unit_x11/tst_components/tst_tabbar.qml' |
1332 | --- tests/unit_x11/tst_components/tst_tabbar.qml 2014-04-08 12:38:35 +0000 |
1333 | +++ tests/unit_x11/tst_components/tst_tabbar.qml 2014-04-09 21:55:48 +0000 |
1334 | @@ -60,6 +60,7 @@ |
1335 | |
1336 | ListModel { |
1337 | id: pages |
1338 | + property int selectedIndex: 0 |
1339 | ListElement { |
1340 | title: "Tab 1" |
1341 | } |
1342 | @@ -79,6 +80,7 @@ |
1343 | |
1344 | ListModel { |
1345 | id: invalidModel |
1346 | + property int selectedIndex: 0 |
1347 | ListElement { |
1348 | fruit: "Pear" |
1349 | } |
1350 | @@ -86,6 +88,7 @@ |
1351 | |
1352 | ListModel { |
1353 | id: invalidModelTab |
1354 | + property int selectedIndex: 0 |
1355 | ListElement { |
1356 | tab: "Pear" |
1357 | } |
1358 | @@ -98,18 +101,22 @@ |
1359 | |
1360 | ListModel { |
1361 | id: validModelTab |
1362 | + property int selectedIndex: count > 0 ? 0 : -1 |
1363 | } |
1364 | |
1365 | ListModel { |
1366 | id: emptyModelWillBeInvalid |
1367 | + property int selectedIndex: count > 0 ? 0 : -1 |
1368 | } |
1369 | |
1370 | ListModel { |
1371 | id: emptyModel |
1372 | + property int selectedIndex: count > 0 ? 0 : -1 |
1373 | } |
1374 | |
1375 | TabsModel { |
1376 | id: pagesCpp |
1377 | + property int selectedIndex: count > 0 ? 0 : -1 |
1378 | } |
1379 | |
1380 | Label { |
1381 | |
1382 | === removed file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaClip.qml' |
1383 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaClip.qml 2014-03-20 15:30:06 +0000 |
1384 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaClip.qml 1970-01-01 00:00:00 +0000 |
1385 | @@ -1,73 +0,0 @@ |
1386 | -/* |
1387 | - * Copyright 2014 Canonical Ltd. |
1388 | - * |
1389 | - * This program is free software; you can redistribute it and/or modify |
1390 | - * it under the terms of the GNU Lesser General Public License as published by |
1391 | - * the Free Software Foundation; version 3. |
1392 | - * |
1393 | - * This program is distributed in the hope that it will be useful, |
1394 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1395 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1396 | - * GNU Lesser General Public License for more details. |
1397 | - * |
1398 | - * You should have received a copy of the GNU Lesser General Public License |
1399 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1400 | - */ |
1401 | - |
1402 | -import QtQuick 2.0 |
1403 | -import Ubuntu.Components 0.1 |
1404 | - |
1405 | -Rectangle { |
1406 | - color: "yellow" |
1407 | - width: units.gu(70) |
1408 | - height: units.gu(70) |
1409 | - |
1410 | - property InverseMouseArea ima: imaItem |
1411 | - |
1412 | - Label { |
1413 | - anchors { |
1414 | - horizontalCenter: parent.horizontalCenter |
1415 | - top: parent.top |
1416 | - } |
1417 | - text: "Root" |
1418 | - } |
1419 | - |
1420 | - Rectangle { |
1421 | - color: "green" |
1422 | - width: units.gu(50) |
1423 | - height: units.gu(50) |
1424 | - anchors.centerIn: parent |
1425 | - clip: true |
1426 | - |
1427 | - Label { |
1428 | - anchors { |
1429 | - horizontalCenter: parent.horizontalCenter |
1430 | - top: parent.top |
1431 | - } |
1432 | - text: "Clipper" |
1433 | - } |
1434 | - |
1435 | - Rectangle { |
1436 | - width: units.gu(30) |
1437 | - height: units.gu(30) |
1438 | - color: "lightgrey" |
1439 | - anchors.centerIn: parent |
1440 | - |
1441 | - Label { |
1442 | - anchors { |
1443 | - horizontalCenter: parent.horizontalCenter |
1444 | - top: parent.top |
1445 | - } |
1446 | - text: "Inverse mouse area" |
1447 | - } |
1448 | - |
1449 | - InverseMouseArea { |
1450 | - id: imaItem |
1451 | - objectName: "Test_IMA" |
1452 | - anchors.fill: parent |
1453 | - topmostItem: true |
1454 | - clip: false |
1455 | - } |
1456 | - } |
1457 | - } |
1458 | -} |
1459 | |
1460 | === removed file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaInFlickable.qml' |
1461 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaInFlickable.qml 2014-03-20 15:30:06 +0000 |
1462 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaInFlickable.qml 1970-01-01 00:00:00 +0000 |
1463 | @@ -1,52 +0,0 @@ |
1464 | -/* |
1465 | - * Copyright 2014 Canonical Ltd. |
1466 | - * |
1467 | - * This program is free software; you can redistribute it and/or modify |
1468 | - * it under the terms of the GNU Lesser General Public License as published by |
1469 | - * the Free Software Foundation; version 3. |
1470 | - * |
1471 | - * This program is distributed in the hope that it will be useful, |
1472 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1473 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1474 | - * GNU Lesser General Public License for more details. |
1475 | - * |
1476 | - * You should have received a copy of the GNU Lesser General Public License |
1477 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1478 | - */ |
1479 | - |
1480 | -import QtQuick 2.0 |
1481 | -import Ubuntu.Components 0.1 |
1482 | -import Ubuntu.Components.ListItems 0.1 |
1483 | - |
1484 | -MainView { |
1485 | - id: root |
1486 | - width: units.gu(40) |
1487 | - height: units.gu(71) |
1488 | - |
1489 | - property InverseMouseArea ima: null |
1490 | - |
1491 | - Page { |
1492 | - title: "Test" |
1493 | - |
1494 | - Flickable { |
1495 | - id: list |
1496 | - objectName: "ListView" |
1497 | - anchors.fill: parent |
1498 | - contentHeight: units.gu(100) |
1499 | - |
1500 | - Rectangle { |
1501 | - width: 100 |
1502 | - height: 100 |
1503 | - anchors.centerIn: parent |
1504 | - |
1505 | - InverseMouseArea { |
1506 | - id: ima |
1507 | - objectName: "Test_IMA" |
1508 | - anchors.fill: parent |
1509 | - topmostItem: true |
1510 | - Component.onCompleted: root.ima = ima |
1511 | - } |
1512 | - } |
1513 | - } |
1514 | - } |
1515 | -} |
1516 | |
1517 | === removed file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaInPage.qml' |
1518 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaInPage.qml 2014-03-20 15:30:06 +0000 |
1519 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaInPage.qml 1970-01-01 00:00:00 +0000 |
1520 | @@ -1,46 +0,0 @@ |
1521 | -/* |
1522 | - * Copyright 2014 Canonical Ltd. |
1523 | - * |
1524 | - * This program is free software; you can redistribute it and/or modify |
1525 | - * it under the terms of the GNU Lesser General Public License as published by |
1526 | - * the Free Software Foundation; version 3. |
1527 | - * |
1528 | - * This program is distributed in the hope that it will be useful, |
1529 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1530 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1531 | - * GNU Lesser General Public License for more details. |
1532 | - * |
1533 | - * You should have received a copy of the GNU Lesser General Public License |
1534 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1535 | - */ |
1536 | - |
1537 | -import QtQuick 2.0 |
1538 | -import Ubuntu.Components 0.1 |
1539 | - |
1540 | -MainView { |
1541 | - id: root |
1542 | - width: units.gu(40) |
1543 | - height: units.gu(71) |
1544 | - |
1545 | - property InverseMouseArea ima: imaItem |
1546 | - |
1547 | - Page { |
1548 | - title: "Test" |
1549 | - |
1550 | - Rectangle { |
1551 | - objectName: "Card" |
1552 | - width: parent.width - units.gu(5) |
1553 | - height: units.gu(50) |
1554 | - anchors.centerIn: parent |
1555 | - color: "blue" |
1556 | - |
1557 | - InverseMouseArea { |
1558 | - id: imaItem |
1559 | - objectName: "Test_IMA" |
1560 | - anchors.fill: parent |
1561 | - topmostItem: true |
1562 | - Component.onCompleted: root.ima = ima |
1563 | - } |
1564 | - } |
1565 | - } |
1566 | -} |
1567 | |
1568 | === modified file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTop.qml' |
1569 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTop.qml 2014-03-20 15:30:06 +0000 |
1570 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTop.qml 2014-04-09 21:55:48 +0000 |
1571 | @@ -38,6 +38,8 @@ |
1572 | objectName: "MA1" |
1573 | anchors.fill: parent |
1574 | z: 1 |
1575 | + onPressed: print("MA1") |
1576 | + onDoubleClicked: print("DMA1") |
1577 | } |
1578 | } |
1579 | |
1580 | @@ -61,11 +63,15 @@ |
1581 | MouseArea { |
1582 | objectName: "MA2" |
1583 | anchors.fill: parent |
1584 | + onPressed: print("MA2") |
1585 | + onDoubleClicked: print("DMA2") |
1586 | } |
1587 | |
1588 | InverseMouseArea { |
1589 | objectName: "IMA" |
1590 | anchors.fill: button |
1591 | + onPressed: print("IMA") |
1592 | + onDoubleClicked: print("DIMA") |
1593 | } |
1594 | } |
1595 | } |
1596 | |
1597 | === modified file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTopNoAccept.qml' |
1598 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTopNoAccept.qml 2014-03-20 15:30:06 +0000 |
1599 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaOnTopNoAccept.qml 2014-04-09 21:55:48 +0000 |
1600 | @@ -38,6 +38,8 @@ |
1601 | objectName: "MA1" |
1602 | anchors.fill: parent |
1603 | z: 1 |
1604 | + onPressed: print("MA1") |
1605 | + onDoubleClicked: print("DMA1") |
1606 | } |
1607 | } |
1608 | |
1609 | @@ -61,12 +63,15 @@ |
1610 | MouseArea { |
1611 | objectName: "MA2" |
1612 | anchors.fill: parent |
1613 | + onPressed: print("MA2") |
1614 | + onDoubleClicked: print("DMA2") |
1615 | } |
1616 | |
1617 | InverseMouseArea { |
1618 | objectName: "IMA" |
1619 | anchors.fill: button |
1620 | - onPressed: mouse.accepted = false |
1621 | + onPressed: {mouse.accepted = false; print("IMA")} |
1622 | + onDoubleClicked: print("DIMA") |
1623 | } |
1624 | } |
1625 | } |
1626 | |
1627 | === removed file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaParentClipped.qml' |
1628 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaParentClipped.qml 2014-03-20 15:30:06 +0000 |
1629 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaParentClipped.qml 1970-01-01 00:00:00 +0000 |
1630 | @@ -1,56 +0,0 @@ |
1631 | -/* |
1632 | - * Copyright 2014 Canonical Ltd. |
1633 | - * |
1634 | - * This program is free software; you can redistribute it and/or modify |
1635 | - * it under the terms of the GNU Lesser General Public License as published by |
1636 | - * the Free Software Foundation; version 3. |
1637 | - * |
1638 | - * This program is distributed in the hope that it will be useful, |
1639 | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1640 | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1641 | - * GNU Lesser General Public License for more details. |
1642 | - * |
1643 | - * You should have received a copy of the GNU Lesser General Public License |
1644 | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1645 | - */ |
1646 | - |
1647 | -import QtQuick 2.0 |
1648 | -import Ubuntu.Components 0.1 |
1649 | - |
1650 | -MainView { |
1651 | - id: root |
1652 | - width: units.gu(40) |
1653 | - height: units.gu(71) |
1654 | - |
1655 | - property InverseMouseArea ima: null |
1656 | - Component { |
1657 | - id: imaComponent |
1658 | - InverseMouseArea { |
1659 | - id: ima |
1660 | - objectName: "Test_IMA" |
1661 | - anchors.fill: parent |
1662 | - topmostItem: true |
1663 | - Component.onCompleted: root.ima = ima |
1664 | - } |
1665 | - } |
1666 | - |
1667 | - Component.onCompleted: loader.sourceComponent = imaComponent |
1668 | - |
1669 | - Page { |
1670 | - title: "Test" |
1671 | - |
1672 | - Rectangle { |
1673 | - objectName: "Card" |
1674 | - width: parent.width - units.gu(5) |
1675 | - height: units.gu(50) |
1676 | - anchors.centerIn: parent |
1677 | - color: "teal" |
1678 | - clip: true |
1679 | - |
1680 | - Loader { |
1681 | - id: loader |
1682 | - anchors.fill: parent |
1683 | - } |
1684 | - } |
1685 | - } |
1686 | -} |
1687 | |
1688 | === modified file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaTopmostItem.qml' |
1689 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaTopmostItem.qml 2014-03-19 14:24:20 +0000 |
1690 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaTopmostItem.qml 2014-04-09 21:55:48 +0000 |
1691 | @@ -23,16 +23,6 @@ |
1692 | objectName: "ROOT" |
1693 | |
1694 | Rectangle { |
1695 | - x: 110; y: 10 |
1696 | - width: 100; height: 100 |
1697 | - color: "red" |
1698 | - MouseArea { |
1699 | - anchors.fill: parent |
1700 | - objectName: "MA" |
1701 | - } |
1702 | - } |
1703 | - |
1704 | - Rectangle { |
1705 | x: 10; y: 10 |
1706 | width: 100; height: 100 |
1707 | color: "blue" |
1708 | @@ -43,4 +33,13 @@ |
1709 | } |
1710 | } |
1711 | |
1712 | + Rectangle { |
1713 | + x: 110; y: 10 |
1714 | + width: 100; height: 100 |
1715 | + color: "red" |
1716 | + MouseArea { |
1717 | + anchors.fill: parent |
1718 | + objectName: "MA" |
1719 | + } |
1720 | + } |
1721 | } |
1722 | |
1723 | === modified file 'tests/unit_x11/tst_layouts/tst_layouts.cpp' |
1724 | --- tests/unit_x11/tst_layouts/tst_layouts.cpp 2014-03-19 12:48:33 +0000 |
1725 | +++ tests/unit_x11/tst_layouts/tst_layouts.cpp 2014-04-09 21:55:48 +0000 |
1726 | @@ -28,7 +28,6 @@ |
1727 | |
1728 | #include "ullayouts.h" |
1729 | #include "ucunits.h" |
1730 | -#include "uctestcase.h" |
1731 | #include <QtQuick/private/qquickanchors_p.h> |
1732 | #include <QtQuick/private/qquickanchors_p_p.h> |
1733 | |
1734 | @@ -59,8 +58,18 @@ |
1735 | |
1736 | QQuickView * loadTest(const QString &file) |
1737 | { |
1738 | - UbuntuTestCase* testCase = new UbuntuTestCase(file); |
1739 | - return qobject_cast<QQuickView*>(testCase); |
1740 | + QQuickView *view = new QQuickView; |
1741 | + view->engine()->addImportPath(m_modulePath); |
1742 | + |
1743 | + view->setSource(QUrl::fromLocalFile(file)); |
1744 | + if (!view->rootObject()) { |
1745 | + delete view; |
1746 | + view = 0; |
1747 | + } else { |
1748 | + view->show(); |
1749 | + QTest::qWaitForWindowExposed(view); |
1750 | + } |
1751 | + return view; |
1752 | } |
1753 | |
1754 | QQuickItem *testItem(QQuickItem *that, const QString &identifier) |
1755 | @@ -76,6 +85,10 @@ |
1756 | private Q_SLOTS: |
1757 | void initTestCase() |
1758 | { |
1759 | + QString modules("../../../modules"); |
1760 | + QVERIFY(QDir(modules).exists()); |
1761 | + |
1762 | + m_modulePath = QDir(modules).absolutePath(); |
1763 | } |
1764 | |
1765 | void cleanupTestCase() |
1766 | @@ -84,8 +97,12 @@ |
1767 | |
1768 | void testCase_NoLayouts() |
1769 | { |
1770 | - QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("NoLayouts.qml")); |
1771 | - ULLayouts *layouts = testCase->findItem<ULLayouts*>("layouts"); |
1772 | + QScopedPointer<QQuickView> view(loadTest("NoLayouts.qml")); |
1773 | + QVERIFY(view); |
1774 | + |
1775 | + ULLayouts *layouts = qobject_cast<ULLayouts*>(testItem(view->rootObject(), "layouts")); |
1776 | + QVERIFY(layouts); |
1777 | + |
1778 | QVERIFY(layouts->layoutList().isEmpty()); |
1779 | } |
1780 |
42 + // FIXME: Currently autopilot can only get visual items, but once it is
43 + // updated to support non-visual items, a QtObject may be used.
Please add a link to http:// pad.lv/ 1273956 so we know what you are referring to. Also, I find it useful to sign the FIXME comments, with something like --timp - 2014-03-19
637 + current_tab = tabs.get_ current_ tab() bIndex == index: tabs.selectedTa bIndex) ) Exception( '.format( index)) to_next_ tab()
638 + number_of_switches = 0
639 + while not tabs.selectedTa
640 + logger.debug(
641 + 'Current tab index: {0}.'.format(
642 + if number_of_switches >= number_of_tabs - 1:
643 + # This prevents a loop. But if this error is ever raised, it's
644 + # likely there's a bug on the emulator or on the QML Tab.
645 + raise ToolkitEmulator
646 + 'The tab with index {0} was not selected.
647 + current_tab = self.switch_
648 + number_of_switches += 1
649 + return current_tab
You should move this into a method. You can call it something like _switch_ to_deprecated_ tab_by_ index
651 + if (index != tabs.selectedTa bIndex) : header( ).switch_ to_tab_ by_index( index) current_ tab()
652 + self.get_
653 + current_tab = tabs.get_
654 + return current_tab
This is not a big deal, but it would also make it clearer putting those statements on _switch_ to_tab_ in_drawer_ by_index
668 + return false
Typo. It's False.
677 + try: single( TabBar) undError: Exception( _NO_TABS_ ERROR) switch_ to_next_ tab() animating( ).wait_ for(False)
678 + tab_bar = self.select_
679 + except dbus.StateNotFo
680 + raise ToolkitEmulator
681 + tab_bar.
682 + self._get_
Same thing here ^
684 + try: single( 'AbstractButton ', objectName= 'tabsButton' ) undError: Exception( _NO_TABS_ ERROR) device. click_object( tabs_drawer_ button) properties = self.select_ single( 'QQuickItem' , objectName= 'tabsModelPrope rties') properties. selectedIndex + 1) % tabs_model_ properties. count root_instance( ).select_ single( 'Standard' , 'tabButton' +str(next_ tab_index) ) undError: Exception( "Tab button {0} not found." .format( next_tab_ index)) device. click_object( tab_button)
685 + tabs_drawer_button = self.select_
686 + except dbus.StateNotFo
687 + raise ToolkitEmulator
688 + self.pointing_
689 +
690 + tabs_model_
691 + next_tab_index = (tabs_model_
692 +
693 + try:
694 + tab_button = self.get_
695 + objectName=
696 + except dbus.StateNotFo
697 + raise ToolkitEmulator
698 +
699 + self.pointing_
and here ^. Please wrap them in something like _switch_ to_next_ deprecated_ tab, and _switch_ to_next_ tab_in_ drawer
4 + try: single( 'AbstractButton ', objectName= 'tabsButton' ) undError: Exception( _NO_TABS_ ERROR)
685 + tabs_drawer_button = self.select_
686 + except dbus.StateNotFo
687 + raise ToolkitEmulator
You can also move this ^
724 + try: root_instance( ).select_ single( 'Standard' , 'tabButton' +str(index) ) undError: Exception( "Tab button {0} not found." .format( index))
725 + tab_button = self.get_
726 + objectName=
727 + except dbus.StateNotFo
728 + raise ToolkitEmulator
and this ^ into a private methods, as you have the same statements twice.
755 +class DeprecatedTabsT estCase( TabsTestCase) :
I would prefer to do it with scenarios. Take a look at http:// paste.ubuntu. com/7121301/
I haven't tried it, but something like that should work.
70...