Merge lp:~bzoltan/ubuntu-ui-toolkit/landing_2307 into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh
Status: Merged
Approved by: Tim Peeters
Approved revision: 1166
Merged at revision: 1058
Proposed branch: lp:~bzoltan/ubuntu-ui-toolkit/landing_2307
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 3378 lines (+1633/-252)
78 files modified
CHANGES (+1/-0)
components.api (+18/-1)
debian/changelog (+53/-0)
debian/control (+3/-0)
examples/ubuntu-ui-toolkit-gallery/Colors.qml (+72/-0)
examples/ubuntu-ui-toolkit-gallery/ListItems.qml (+13/-2)
examples/ubuntu-ui-toolkit-gallery/ListItemsSection.qml (+7/-1)
examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml (+22/-1)
examples/ubuntu-ui-toolkit-gallery/Styles.qml (+1/-1)
examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml (+5/-1)
examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml (+1/-0)
modules/Ubuntu/Components/AppHeader.qml (+6/-0)
modules/Ubuntu/Components/Colors/FIXME (+4/-0)
modules/Ubuntu/Components/Colors/UbuntuColors.qml (+131/-0)
modules/Ubuntu/Components/Colors/UbuntuColors10.qml (+4/-48)
modules/Ubuntu/Components/ListItems/Empty.qml (+1/-0)
modules/Ubuntu/Components/MainView.qml (+2/-1)
modules/Ubuntu/Components/PageHeadConfiguration.qml (+41/-2)
modules/Ubuntu/Components/PageHeadSections.qml (+74/-0)
modules/Ubuntu/Components/Panel.qml (+6/-4)
modules/Ubuntu/Components/ProgressBar11.qdoc (+6/-0)
modules/Ubuntu/Components/ProgressBar11.qml (+21/-0)
modules/Ubuntu/Components/TextArea.qml (+1/-1)
modules/Ubuntu/Components/TextField.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml (+6/-1)
modules/Ubuntu/Components/Themes/Ambiance/CheckBoxStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml (+15/-15)
modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml (+48/-19)
modules/Ubuntu/Components/Themes/Ambiance/Palette.qml (+11/-9)
modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml (+3/-1)
modules/Ubuntu/Components/Themes/Ambiance/SwitchStyle.qml (+4/-4)
modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml (+2/-2)
modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml (+3/-2)
modules/Ubuntu/Components/Themes/Ambiance/qmldir (+1/-1)
modules/Ubuntu/Components/Themes/PaletteValues.qml (+4/-0)
modules/Ubuntu/Components/Themes/SuruDark/Palette.qml (+4/-2)
modules/Ubuntu/Components/deployment.pri (+1/-1)
modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp (+6/-9)
modules/Ubuntu/Components/plugin/plugin.cpp (+10/-2)
modules/Ubuntu/Components/plugin/ucfontutils.cpp (+6/-6)
modules/Ubuntu/Components/qmldir (+4/-2)
modules/Ubuntu/Test/UbuntuTestCase.qml (+10/-1)
push_to_phone.sh (+2/-0)
tests/autopilot/ubuntuuitoolkit/__init__.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+35/-8)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py (+1/-2)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py (+9/-6)
tests/autopilot/ubuntuuitoolkit/base.py (+12/-4)
tests/autopilot/ubuntuuitoolkit/fixture_setup.py (+97/-4)
tests/autopilot/ubuntuuitoolkit/tests/__init__.py (+23/-14)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py (+22/-6)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+1/-4)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.DeprecatedHeaderSectionsTestCase.qml (+50/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.SectionsTestCase.qml (+50/-0)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+71/-5)
tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py (+52/-5)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py (+21/-7)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py (+10/-1)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py (+3/-0)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py (+15/-4)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py (+10/-2)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py (+16/-6)
tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py (+104/-3)
tests/autopilot/ubuntuuitoolkit/tests/test_ubuntu_scenarios.py (+70/-0)
tests/autopilot/ubuntuuitoolkit/ubuntu_scenarios.py (+54/-0)
tests/qmlapicheck.py (+5/-7)
tests/qmlapicheck.sh (+1/-1)
tests/resources/header/header.qml (+18/-0)
tests/unit/runtest.sh (+1/-0)
tests/unit/tst_components/tst_fontutils.qml (+12/-12)
tests/unit/tst_components/tst_header_sections.qml (+79/-0)
tests/unit/tst_components/tst_progressbar.qml (+6/-1)
tests/unit/tst_components/tst_progressbar11.qml (+38/-0)
tests/unit_x11/tst_components/tst_animator.qml (+75/-0)
tests/unit_x11/tst_components/tst_panel.qml (+21/-1)
tests/unit_x11/tst_components/tst_textinput_touch.qml (+3/-5)
tests/unit_x11/tst_test/tst_ubuntutestcase.qml (+10/-1)
To merge this branch: bzr merge lp:~bzoltan/ubuntu-ui-toolkit/landing_2307
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Tim Peeters Pending
Review via email: mp+227897@code.launchpad.net

Commit message

Landing 24.07

Description of the change

Landing 24.07

To post a comment you must log in.
1163. By Zoltan Balogh

Don't use component type names in header CPOs for AP tests.

1164. By Zoltan Balogh

Don't use component type names in header CPOs for AP tests.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1165. By Zoltan Balogh

Remove the hiding of the toolbar on the option selector gallery autopilot tests.

1166. By Zoltan Balogh

Remove the hiding of the toolbar on the option selector gallery autopilot tests.

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CHANGES'
2--- CHANGES 2014-06-04 20:45:16 +0000
3+++ CHANGES 2014-07-24 02:10:07 +0000
4@@ -108,6 +108,7 @@
5 * CHANGED IN Page: Automatic detection of flickable inside a Page to control the header is now limited to Flickables that are anchored to the top of the Page or fill the Page. Header automatically shows when flickable.contentHeight becomes <= flickable.height.
6 * CHANGED IN Action, ActionItem, OptionSelectorDelegate: Setting iconName now always selects the requested icon from ubuntu-mobile theme, not the system icon theme.
7 * CHANGED IN TabBar: The model now needs to have a selectedIndex property.
8+* CHANGED IN Panel: The panel no longer closes automatically when the user presses outside of the opened panel. That was deprecated behavior that was useful in the first version of the Toolbar. Set __closeOnContentsClicks to restore the old behavior, but a better solution is to deal with the press in the app and call Panel.close() when needed.
9
10 SDK 0.1.46
11 ##########
12
13=== modified file 'components.api'
14--- components.api 2014-07-10 11:50:13 +0000
15+++ components.api 2014-07-24 02:10:07 +0000
16@@ -46,6 +46,12 @@
17 readonly property color coolGrey
18 property Gradient orangeGradient
19 property Gradient greyGradient
20+ readonly property color lightGrey
21+ readonly property color darkGrey
22+ readonly property color red
23+ readonly property color green
24+ readonly property color blue
25+ readonly property color purple
26 ComboButton 1.1
27 Button
28 property bool expanded
29@@ -247,10 +253,16 @@
30 Page10
31 readonly property PageHeadConfiguration head
32 PageHeadConfiguration 1.1
33-QtObject
34+Object
35 property list<Action> actions
36 property Action backAction
37 property Item contents
38+ readonly property PageHeadSections sections
39+PageHeadSections 1.1
40+QtObject
41+ property bool enabled
42+ property var model
43+ property int selectedIndex
44 PageHeadState 1.1
45 State
46 property PageHeadConfiguration head
47@@ -398,6 +410,9 @@
48 property real minimumValue
49 property real maximumValue
50 property real value
51+ProgressBar 1.1
52+ProgressBar
53+ property bool showProgressPercentage
54 PullToRefresh 1.1
55 StyledItem
56 readonly property bool releaseToRefresh
57@@ -620,6 +635,7 @@
58 property color overlayText
59 property color field
60 property color fieldText
61+ property color selection
62 ToolbarButton 0.1 1.0
63 ActionItem
64 ToolbarItems 0.1 1.0
65@@ -657,6 +673,7 @@
66 function flick(item, x, y, dx, dy, pressTimeout, steps, button, modifiers, delay)
67 function mouseLongPress(item, x, y, button, modifiers, delay)
68 function tryCompareFunction(func, expectedResult, timeout)
69+ function typeString(string)
70 plugins.qmltypes
71 name: "FilterBehavior"
72 prototype: "QObject"
73
74=== modified file 'debian/changelog'
75--- debian/changelog 2014-07-15 11:41:35 +0000
76+++ debian/changelog 2014-07-24 02:10:07 +0000
77@@ -1,3 +1,56 @@
78+ubuntu-ui-toolkit (0.1.50+14.10.20140715-0ubuntu2) UNRELEASED; urgency=medium
79+
80+ [ Christian Dywan ]
81+ * Wrap tempfile.NamedTemporaryFile to discard underscored
82+ filenames
83+ * Print errors and help to sys.stderr
84+ * Fixes false positives where buttons say for example Anrufen
85+ as opposed to Call depending on the local
86+ * Use memory alarm backend for API/ deployment and don't warn
87+ about it
88+ * Update selection and cursor to blue
89+ * Suppress error output from dpkg-architecture.
90+
91+ [ Tim Peeters ]
92+ * New sizes for icons and touch areas in header.
93+ * Workaround for large-timestamp autopilot bug
94+ * Push modules/Ubuntu/Components/qmldir in push_to_phone.sh
95+ * Various design tweaks:
96+ - Update CheckBox/Switch colors
97+ - Use new header by default in UITK gallery
98+ - Add margins for left and rightmost buttons in header
99+ * Updateed font sizes
100+ * Don't automatically close a Panel when the user presses next
101+ to it, and update Panel position when its height changes.
102+ * Support sections in header divider.
103+ * Add new colors to UbuntuColors.
104+ Fixes: https://bugs.launchpad.net/bugs/1335826.
105+
106+ [ Renato Filho ]
107+ * Reset item state if the cancelItemRemoval() function was
108+ called after the item be removed.
109+
110+ [ Zeller Benjamin ]
111+ * Work around LP: #1338602, RotationAnimator crashes application
112+
113+ [ Michael Zanetti ]
114+ * Add typeString to UbuntuTestCase
115+
116+ [ Ugo Riboni ]
117+ * Add a boolean property to allow hiding the ProgressBar label.
118+ Fixes: https://bugs.launchpad.net/bugs/1317377.
119+
120+ [ Nekhelesh Ramananthan ]
121+ * Adds examples to Actions, backAction and fixed the contents
122+ example in the PageHeadConfiguration.
123+
124+ [ Leo Arias ]
125+ * Simulate the supported devices on gallery autopilot tests.
126+ * Remove the hiding of the toolbar on the option selector
127+ gallery autopilot tests.
128+
129+ -- Zoltán Balogh <zoltan@bakter.hu> Wed, 23 Jul 2014 13:47:47 +0300
130+
131 ubuntu-ui-toolkit (0.1.49+14.10.20140715-0ubuntu1) utopic; urgency=low
132
133 [ Dimitri John Ledkov ]
134
135=== modified file 'debian/control'
136--- debian/control 2014-07-09 17:37:43 +0000
137+++ debian/control 2014-07-24 02:10:07 +0000
138@@ -39,6 +39,7 @@
139 xvfb,
140 libgl1-mesa-dri,
141 locales,
142+ suru-icon-theme,
143 Standards-Version: 3.9.4
144 Homepage: https://launchpad.net/ubuntu-ui-toolkit
145 # If you aren't a member of ~ubuntu-sdk-team but need to upload packaging
146@@ -135,10 +136,12 @@
147 libqt5widgets5,
148 python-autopilot (>= 1.4),
149 python-fixtures,
150+ python-gi,
151 python-mock,
152 python-testscenarios,
153 python-testtools,
154 python3-fixtures,
155+ python3-gi,
156 python3-testscenarios,
157 python3-testtools,
158 python3-autopilot (>= 1.4),
159
160=== added file 'examples/ubuntu-ui-toolkit-gallery/Colors.qml'
161--- examples/ubuntu-ui-toolkit-gallery/Colors.qml 1970-01-01 00:00:00 +0000
162+++ examples/ubuntu-ui-toolkit-gallery/Colors.qml 2014-07-24 02:10:07 +0000
163@@ -0,0 +1,72 @@
164+/*
165+ * Copyright 2014 Canonical Ltd.
166+ *
167+ * This program is free software; you can redistribute it and/or modify
168+ * it under the terms of the GNU Lesser General Public License as published by
169+ * the Free Software Foundation; version 3.
170+ *
171+ * This program is distributed in the hope that it will be useful,
172+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
173+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
174+ * GNU Lesser General Public License for more details.
175+ *
176+ * You should have received a copy of the GNU Lesser General Public License
177+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
178+ */
179+
180+import QtQuick 2.2
181+import Ubuntu.Components 1.1
182+
183+Template {
184+ objectName: "colorsTemplate"
185+
186+ TemplateSection {
187+ title: "UbuntuColors"
188+ className: "UbuntuColors"
189+
190+ // Except orange, none of the colors from UbuntuComponents 1.0
191+ // are included because they may be deprecated soon.
192+ TemplateRow {
193+ title: i18n.tr("Orange")
194+ UbuntuShape {
195+ color: UbuntuColors.orange
196+ }
197+ }
198+ TemplateRow {
199+ title: i18n.tr("Light grey")
200+ UbuntuShape {
201+ color: UbuntuColors.lightGrey
202+ }
203+ }
204+ TemplateRow {
205+ title: i18n.tr("Dark grey")
206+ UbuntuShape {
207+ color: UbuntuColors.darkGrey
208+ }
209+ }
210+ TemplateRow {
211+ title: i18n.tr("Red")
212+ UbuntuShape {
213+ color: UbuntuColors.red
214+ }
215+ }
216+ TemplateRow {
217+ title: i18n.tr("Green")
218+ UbuntuShape {
219+ color: UbuntuColors.green
220+ }
221+ }
222+ TemplateRow {
223+ title: i18n.tr("Blue")
224+ UbuntuShape {
225+ color: UbuntuColors.blue
226+ }
227+ }
228+ TemplateRow {
229+ title: i18n.tr("Purple")
230+ UbuntuShape {
231+ color: UbuntuColors.purple
232+ }
233+ }
234+ }
235+}
236
237=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItems.qml'
238--- examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2014-05-07 11:40:37 +0000
239+++ examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2014-07-24 02:10:07 +0000
240@@ -50,7 +50,7 @@
241
242 TemplateSection {
243 title: i18n.tr("ThinDivider")
244- className: "ThinDivider"
245+ className: "ListItems-ThinDivider"
246
247 Column {
248 anchors.left: parent.left
249@@ -198,6 +198,7 @@
250 }
251
252 ListItemsSection {
253+ id: removableSection
254 title: i18n.tr("Removable")
255 className: "Standard"
256 delegate: ListItem.Standard {
257@@ -209,11 +210,21 @@
258 color: Theme.palette.normal.base
259 }
260 }
261+
262+ Toolkit.Button {
263+ text: i18n.tr("Reset")
264+ anchors.right: parent.right
265+ onClicked: {
266+ for (var i=0, iMax=removableSection.count; i < iMax; i++) {
267+ removableSection.itemAt(i).cancelItemRemoval()
268+ }
269+ }
270+ }
271 }
272
273 TemplateSection {
274 title: i18n.tr("Grouped list")
275- className: "Header"
276+ className: "ListItems-Header"
277
278 Rectangle {
279 color: Qt.rgba(0.0, 0.0, 0.0, 0.01)
280
281=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItemsSection.qml'
282--- examples/ubuntu-ui-toolkit-gallery/ListItemsSection.qml 2014-04-23 09:39:11 +0000
283+++ examples/ubuntu-ui-toolkit-gallery/ListItemsSection.qml 2014-07-24 02:10:07 +0000
284@@ -20,7 +20,13 @@
285 TemplateSection {
286 id: section
287 property alias delegate: repeater.delegate
288- documentation: "qml-ubuntu-components-listitems0-%1.html".arg(className.toLowerCase())
289+ property alias count: repeater.count
290+ documentation: "qml-ubuntu-components-listitems-%1.html".arg(className.toLowerCase())
291+
292+ function itemAt(index)
293+ {
294+ return repeater.itemAt(index)
295+ }
296
297 Column {
298 id: column
299
300=== modified file 'examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml'
301--- examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml 2014-04-23 09:39:11 +0000
302+++ examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml 2014-07-24 02:10:07 +0000
303@@ -15,7 +15,7 @@
304 */
305
306 import QtQuick 2.0
307-import Ubuntu.Components 0.1
308+import Ubuntu.Components 1.1
309
310 Template {
311 objectName: "progressBarsTemplate"
312@@ -53,6 +53,27 @@
313 indeterminate: true
314 }
315 }
316+
317+ TemplateRow {
318+ title: i18n.tr("No label")
319+
320+ ProgressBar {
321+ id: progressNoLabel
322+ objectName: "progressbar_nolabel"
323+ width: parent.width
324+ showProgressPercentage: false
325+
326+ SequentialAnimation on value {
327+ loops: Animation.Infinite
328+ NumberAnimation {
329+ from: progress.minimumValue
330+ to: progress.maximumValue
331+ duration: 2000
332+ }
333+ PauseAnimation {duration: 1000}
334+ }
335+ }
336+ }
337 }
338
339 TemplateSection {
340
341=== modified file 'examples/ubuntu-ui-toolkit-gallery/Styles.qml'
342--- examples/ubuntu-ui-toolkit-gallery/Styles.qml 2014-06-19 13:11:09 +0000
343+++ examples/ubuntu-ui-toolkit-gallery/Styles.qml 2014-07-24 02:10:07 +0000
344@@ -28,7 +28,7 @@
345 }
346
347 OptionSelector {
348- model: [ i18n.tr('Header with Toolbar'), i18n.tr('New Style Header') ]
349+ model: [ i18n.tr('New Style Header'), i18n.tr('Header with Toolbar') ]
350 expanded: true
351 onSelectedIndexChanged: gallery.useDeprecatedToolbar = (selectedIndex == 0)
352 }
353
354=== modified file 'examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml'
355--- examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2014-07-02 13:39:29 +0000
356+++ examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2014-07-24 02:10:07 +0000
357@@ -28,7 +28,11 @@
358 label: "Styles"
359 source: "Styles.qml"
360 }
361-
362+ ListElement {
363+ objectName: "colorsElement"
364+ label: "Colors"
365+ source: "Colors.qml"
366+ }
367 ListElement {
368 objectName: "togglesElement"
369 label: "Toggles"
370
371=== modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml'
372--- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2014-05-23 13:03:09 +0000
373+++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml 2014-07-24 02:10:07 +0000
374@@ -26,6 +26,7 @@
375 // Note! applicationName needs to match the .desktop filename
376 applicationName: "ubuntu-ui-toolkit-gallery"
377
378+ useDeprecatedToolbar: false
379
380 width: units.gu(120)
381 height: units.gu(75)
382
383=== modified file 'modules/Ubuntu/Components/AppHeader.qml'
384--- modules/Ubuntu/Components/AppHeader.qml 2014-07-01 21:01:23 +0000
385+++ modules/Ubuntu/Components/AppHeader.qml 2014-07-24 02:10:07 +0000
386@@ -129,6 +129,12 @@
387 property int count: tabsModel ? tabsModel.count : 0
388 property int selectedIndex: tabsModel ? tabsModel.selectedIndex : -1
389 }
390+ Item {
391+ // FIXME: This is a workaround to be able to get the properties of
392+ // the sections in an autopilot test.
393+ objectName: "sectionsProperties"
394+ property int selectedIndex: header.config ? header.config.sections.selectedIndex : -1
395+ }
396
397 /*!
398 The flickable that controls the movement of the header.
399
400=== modified file 'modules/Ubuntu/Components/Colors/FIXME'
401--- modules/Ubuntu/Components/Colors/FIXME 2013-07-01 05:54:33 +0000
402+++ modules/Ubuntu/Components/Colors/FIXME 2014-07-24 02:10:07 +0000
403@@ -1,3 +1,7 @@
404 UbuntuColors.qml is located in the Colors subdirectory because
405 QuickUtils::createQmlObject() fails if the QML file is located in a
406 folder that has a qmldir file with JavaScript modules.
407+
408+UbuntuColors 1.1 is not in a file named UbuntuColors11.qml but in
409+UbuntuColors.qml so that qdoc can properly detect the component
410+name without a qmldir file.
411
412=== added file 'modules/Ubuntu/Components/Colors/UbuntuColors.qml'
413--- modules/Ubuntu/Components/Colors/UbuntuColors.qml 1970-01-01 00:00:00 +0000
414+++ modules/Ubuntu/Components/Colors/UbuntuColors.qml 2014-07-24 02:10:07 +0000
415@@ -0,0 +1,131 @@
416+/*
417+ Copyright 2014 Canonical Ltd.
418+ *
419+ This program is free software; you can redistribute it and/or modify
420+ it under the terms of the GNU Lesser General Public License as published by
421+ the Free Software Foundation; version 3.
422+ *
423+ This program is distributed in the hope that it will be useful,
424+ but WITHOUT ANY WARRANTY; without even the implied warranty of
425+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
426+ GNU Lesser General Public License for more details.
427+ *
428+ You should have received a copy of the GNU Lesser General Public License
429+ along with this program. If not, see <http://www.gnu.org/licenses/>.
430+ */
431+
432+import QtQuick 2.2
433+
434+/*!
435+ \qmltype UbuntuColors
436+ \inqmlmodule Ubuntu.Components 1.1
437+ \ingroup ubuntu
438+ \brief Singleton defining the Ubuntu color palette.
439+
440+ Each color of the Ubuntu color palette is accesible from it.
441+ For more information on how to appropriately use the colors according to
442+ the context, please refer to the
443+ \l{http://design.ubuntu.com/brand/colour-palette}{Ubuntu brand guidelines}.
444+
445+ Example of use:
446+
447+ \qml
448+ Rectangle {
449+ color: UbuntuColors.orange
450+ }
451+ \endqml
452+*/
453+QtObject {
454+ // old colors from UbuntuColors 1.0:
455+
456+ /*!
457+ Orange. Recommended for branded elements, display progress
458+ and intensity, textual links on light backgrounds.
459+ */
460+ readonly property color orange: "#DD4814"
461+ /*!
462+ \deprecated
463+ Ubuntu supporting color: light aubergine
464+ */
465+ readonly property color lightAubergine: "#77216F"
466+ /*!
467+ \deprecated
468+ Ubuntu supporting color: mid aubergine
469+ */
470+ readonly property color midAubergine: "#5E2750"
471+ /*!
472+ \deprecated
473+ Ubuntu supporting color: dark aubergine
474+ */
475+ readonly property color darkAubergine: "#2C001E"
476+ /*!
477+ \deprecated
478+ Ubuntu neutral color: warm grey
479+ */
480+ readonly property color warmGrey: "#AEA79F"
481+ /*!
482+ \deprecated
483+ Ubuntu neutral color: cool grey
484+ */
485+ readonly property color coolGrey: "#333333"
486+
487+ /*!
488+ Ubuntu orange gradient
489+
490+ \sa Button::gradient
491+ */
492+ property Gradient orangeGradient: Gradient {
493+ GradientStop { position: 0.0; color: "#DD4814" }
494+ GradientStop { position: 1.0; color: "#D9722D" }
495+ }
496+ /*!
497+ Ubuntu grey gradient
498+
499+ \sa Button::gradient
500+ */
501+ property Gradient greyGradient: Gradient {
502+ GradientStop { position: 0.0; color: "#888888" }
503+ GradientStop { position: 1.0; color: "#BBBBBB" }
504+ }
505+
506+ // New colors introduced in UbuntuColors 1.1:
507+
508+ /*!
509+ Light grey. Recommended for neutral action buttons and
510+ secondary text.
511+ \since Ubuntu.Components 1.1
512+ */
513+ readonly property color lightGrey: "#888888"
514+
515+ /*!
516+ Dark grey. Recommended for text and action icons.
517+ \since Ubuntu.Components 1.1
518+ */
519+ readonly property color darkGrey: "#5d5d5d"
520+
521+ /*!
522+ Red. Recommended for negative and irreversible action
523+ buttons, errors and alerts.
524+ \since Ubuntu.Components 1.1
525+ */
526+ readonly property color red: "#fc4949"
527+
528+ /*!
529+ Green. Recommended for positive action buttons.
530+ \since Ubuntu.Components 1.1
531+ */
532+ readonly property color green: "#3fb24f"
533+
534+ /*!
535+ Blue. Recommended for text selection and text cursor.
536+ \since Ubuntu.Components 1.1
537+ */
538+ readonly property color blue: "#1ab6ef"
539+
540+ /*!
541+ Purple. Recommended for proper nouns in
542+ list items.
543+ \since Ubuntu.Components 1.1
544+ */
545+ readonly property color purple: "#762572"
546+}
547
548=== renamed file 'modules/Ubuntu/Components/Colors/UbuntuColors.qml' => 'modules/Ubuntu/Components/Colors/UbuntuColors10.qml'
549--- modules/Ubuntu/Components/Colors/UbuntuColors.qml 2013-07-02 00:15:07 +0000
550+++ modules/Ubuntu/Components/Colors/UbuntuColors10.qml 2014-07-24 02:10:07 +0000
551@@ -1,5 +1,5 @@
552 /*
553- Copyright 2013 Canonical Ltd.
554+ Copyright 2013-2014 Canonical Ltd.
555 *
556 This program is free software; you can redistribute it and/or modify
557 it under the terms of the GNU Lesser General Public License as published by
558@@ -14,67 +14,23 @@
559 along with this program. If not, see <http://www.gnu.org/licenses/>.
560 */
561
562-import QtQuick 2.0
563+import QtQuick 2.2
564
565 /*!
566- \qmltype UbuntuColors
567- \inqmlmodule Ubuntu.Components 0.1
568- \ingroup theming
569- \brief Singleton defining the Ubuntu color palette.
570-
571- Each color of the Ubuntu color palette is accesible from it.
572- For more information on how to appropriately use the colors according to
573- the context, please refer to the
574- \l{http://design.ubuntu.com/brand/colour-palette}{Ubuntu brand guidelines}.
575-
576- Example of use:
577-
578- \qml
579- Rectangle {
580- color: UbuntuColors.orange
581- }
582- \endqml
583+ \internal
584+ Documentation is in UbuntuColors.qml
585 */
586 QtObject {
587- /*!
588- Ubuntu core color: Ubuntu orange
589- */
590 readonly property color orange: "#DD4814"
591- /*!
592- Ubuntu supporting color: light aubergine
593- */
594 readonly property color lightAubergine: "#77216F"
595- /*!
596- Ubuntu supporting color: mid aubergine
597- */
598 readonly property color midAubergine: "#5E2750"
599- /*!
600- Ubuntu supporting color: dark aubergine
601- */
602 readonly property color darkAubergine: "#2C001E"
603- /*!
604- Ubuntu neutral color: warm grey
605- */
606 readonly property color warmGrey: "#AEA79F"
607- /*!
608- Ubuntu neutral color: cool grey
609- */
610 readonly property color coolGrey: "#333333"
611-
612- /*!
613- Ubuntu orange gradient
614-
615- \sa Button::gradient
616- */
617 property Gradient orangeGradient: Gradient {
618 GradientStop { position: 0.0; color: "#DD4814" }
619 GradientStop { position: 1.0; color: "#D9722D" }
620 }
621- /*!
622- Ubuntu grey gradient
623-
624- \sa Button::gradient
625- */
626 property Gradient greyGradient: Gradient {
627 GradientStop { position: 0.0; color: "#888888" }
628 GradientStop { position: 1.0; color: "#BBBBBB" }
629
630=== modified file 'modules/Ubuntu/Components/ListItems/Empty.qml'
631--- modules/Ubuntu/Components/ListItems/Empty.qml 2014-06-05 11:42:07 +0000
632+++ modules/Ubuntu/Components/ListItems/Empty.qml 2014-07-24 02:10:07 +0000
633@@ -175,6 +175,7 @@
634 function cancelItemRemoval()
635 {
636 priv.resetDrag()
637+ priv.removed = false
638 }
639
640 width: parent ? parent.width : units.gu(31)
641
642=== modified file 'modules/Ubuntu/Components/MainView.qml'
643--- modules/Ubuntu/Components/MainView.qml 2014-07-10 11:50:13 +0000
644+++ modules/Ubuntu/Components/MainView.qml 2014-07-24 02:10:07 +0000
645@@ -387,7 +387,8 @@
646 config: internal.activePage && internal.activePage.hasOwnProperty("head") &&
647 (internal.activePage.head.actions.length > 0 ||
648 internal.activePage.head.backAction !== null ||
649- internal.activePage.head.contents !== null) ?
650+ internal.activePage.head.contents !== null ||
651+ internal.activePage.head.sections.model !== undefined) ?
652 internal.activePage.head : headerConfig
653
654 property Item tabBar: null
655
656=== modified file 'modules/Ubuntu/Components/PageHeadConfiguration.qml'
657--- modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-07-01 11:27:29 +0000
658+++ modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-07-24 02:10:07 +0000
659@@ -25,18 +25,48 @@
660
661 For examples how to use Page.head, see \l Page.
662 */
663-QtObject {
664+Object {
665 // To be used inside a Page only.
666 id: headerConfig
667
668 /*!
669 List of actions to show in the header.
670+
671+ Example:
672+ \qml
673+ Page {
674+ title: "Custom header actions"
675+ head.actions: [
676+ Action {
677+ iconName: "save"
678+ text: i18n.tr("Save")
679+ },
680+ Action {
681+ iconName: "add"
682+ text: i18n.tr("Add")
683+ }
684+ ]
685+ }
686+ \endqml
687 */
688 property list<Action> actions
689
690 /*!
691 Overrides the default \l PageStack back button and the
692 \l Tabs drawer button in the header.
693+
694+ Example:
695+ \qml
696+ Page {
697+ title: "Back Action Page"
698+ head.backAction: Action {
699+ iconName: "close"
700+ onTriggered: {
701+ console.log("Run custom back action")
702+ }
703+ }
704+ }
705+ \endqml
706 */
707 property Action backAction: null
708
709@@ -52,7 +82,7 @@
710 \qml
711 Page {
712 title: "Invisible title"
713- contents: Rectangle {
714+ head.contents: Rectangle {
715 color: UbuntuColors.orange
716 height: units.gu(5)
717 width: parent ? parent.width - units.gu(2) : undefined
718@@ -64,4 +94,13 @@
719 be implemented.
720 */
721 property Item contents: null
722+
723+ /*!
724+ \qmlproperty PageHeadSections sections
725+ Defines the sections in the page header divider.
726+ */
727+ readonly property alias sections: headSections
728+ PageHeadSections {
729+ id: headSections
730+ }
731 }
732
733=== added file 'modules/Ubuntu/Components/PageHeadSections.qml'
734--- modules/Ubuntu/Components/PageHeadSections.qml 1970-01-01 00:00:00 +0000
735+++ modules/Ubuntu/Components/PageHeadSections.qml 2014-07-24 02:10:07 +0000
736@@ -0,0 +1,74 @@
737+/*
738+ * Copyright 2014 Canonical Ltd.
739+ *
740+ * This program is free software; you can redistribute it and/or modify
741+ * it under the terms of the GNU Lesser General Public License as published by
742+ * the Free Software Foundation; version 3.
743+ *
744+ * This program is distributed in the hope that it will be useful,
745+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
746+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
747+ * GNU Lesser General Public License for more details.
748+ *
749+ * You should have received a copy of the GNU Lesser General Public License
750+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
751+ */
752+
753+import QtQuick 2.2
754+
755+/*!
756+ \qmltype PageHeadSections
757+ \inqmlmodule Ubuntu.Components 1.1
758+ \ingroup ubuntu
759+ \since Ubuntu.Components 1.1
760+ \brief PageHeadSections is used to configure the sections for a \l Page.
761+
762+ These sections will be shown in the bottom part of the header. This component does not
763+ need to be instantiated by the developer, it is automatically part of \l PageHeadConfiguration.
764+ */
765+QtObject {
766+ // To be used inside PageHeadConfiguration
767+ id: sections
768+
769+ /*!
770+ Set this property to false to disable user interaction to change the selected section.
771+ Default value: true
772+ */
773+ property bool enabled: true
774+
775+ /*!
776+ List of strings that represent section names. Example:
777+ \qml
778+ import Ubuntu.Components 1.1
779+ import QtQuick 2.2
780+
781+ MainView {
782+ width: units.gu(50)
783+ height: units.gu(80)
784+
785+ useDeprecatedToolbar: false
786+
787+ Page {
788+ id: page
789+ title: "Sections"
790+ head {
791+ sections {
792+ model: ["one", "two", "three"]
793+ }
794+ }
795+
796+ Label {
797+ anchors.centerIn: parent
798+ text: "Section " + page.head.sections.selectedIndex
799+ }
800+ }
801+ }
802+ \endqml
803+ */
804+ property var model
805+
806+ /*!
807+ The index of the currently selected section in \l model.
808+ */
809+ property int selectedIndex: model ? 0 : -1
810+}
811
812=== modified file 'modules/Ubuntu/Components/Panel.qml'
813--- modules/Ubuntu/Components/Panel.qml 2014-04-25 12:53:58 +0000
814+++ modules/Ubuntu/Components/Panel.qml 2014-07-24 02:10:07 +0000
815@@ -443,13 +443,13 @@
816 \internal
817 \deprecated
818 Enable the InverseMouseArea that closes the panel when the user clicks outside of the panel.
819- This functionality moved to the Toolbar/Page implementation because the mouse area needs to
820- access with the toolbar and header, but this InverseMouseArea is still in the Panel for backwards
821- compatibility in apps that use it directly. Default value is true, but it is set to false in Toolbar.
822+ This functionality moved to the MainView to deal with Toolbar hiding, but this InverseMouseArea
823+ is still in the Panel for backwards compatibility in apps that use it directly.
824+ Default value is false.
825
826 FIXME: Remove __closeOnContentsClicks and the IMA below when all apps use Toolbar instead of Panel.
827 */
828- property bool __closeOnContentsClicks: true
829+ property bool __closeOnContentsClicks: false
830 Toolkit.InverseMouseArea {
831 anchors.fill: draggingArea
832 onPressed: {
833@@ -625,6 +625,7 @@
834
835 Item {
836 id: bar
837+ objectName: "bar_item"
838 height: parent.height
839 width: parent.width
840 anchors {
841@@ -637,6 +638,7 @@
842 property real size: internal.orientation === Qt.Horizontal ? height : width
843 //position will always be in the range 0..size, where position==0 means spread, position==size means hidden.
844 property real position: panel.opened ? 0 : size
845+ onSizeChanged: position = panel.opened ? 0 : size
846
847 y: internal.align === Qt.AlignTop ? -position : internal.align === Qt.AlignBottom ? position : 0
848 x: internal.align === Qt.AlignLeft ? -position : internal.align === Qt.AlignRight ? position : 0
849
850=== renamed file 'modules/Ubuntu/Components/ProgressBar.qml' => 'modules/Ubuntu/Components/ProgressBar10.qml'
851=== added file 'modules/Ubuntu/Components/ProgressBar11.qdoc'
852--- modules/Ubuntu/Components/ProgressBar11.qdoc 1970-01-01 00:00:00 +0000
853+++ modules/Ubuntu/Components/ProgressBar11.qdoc 2014-07-24 02:10:07 +0000
854@@ -0,0 +1,6 @@
855+/*!
856+\qmlproperty bool ProgressBar::showProgressPercentage
857+\since Ubuntu.Components 1.1
858+
859+Specifies if the value of the progress is visible
860+*/
861
862=== added file 'modules/Ubuntu/Components/ProgressBar11.qml'
863--- modules/Ubuntu/Components/ProgressBar11.qml 1970-01-01 00:00:00 +0000
864+++ modules/Ubuntu/Components/ProgressBar11.qml 2014-07-24 02:10:07 +0000
865@@ -0,0 +1,21 @@
866+/*
867+ * Copyright 2014 Canonical Ltd.
868+ *
869+ * This program is free software; you can redistribute it and/or modify
870+ * it under the terms of the GNU Lesser General Public License as published by
871+ * the Free Software Foundation; version 3.
872+ *
873+ * This program is distributed in the hope that it will be useful,
874+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
875+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
876+ * GNU Lesser General Public License for more details.
877+ *
878+ * You should have received a copy of the GNU Lesser General Public License
879+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
880+ */
881+
882+import QtQuick 2.0
883+
884+ProgressBar {
885+ property bool showProgressPercentage: true
886+}
887
888=== modified file 'modules/Ubuntu/Components/TextArea.qml'
889--- modules/Ubuntu/Components/TextArea.qml 2014-06-28 17:26:49 +0000
890+++ modules/Ubuntu/Components/TextArea.qml 2014-07-24 02:10:07 +0000
891@@ -850,7 +850,7 @@
892 }
893 color: control.__styleInstance.color
894 selectedTextColor: Theme.palette.selected.foregroundText
895- selectionColor: Theme.palette.selected.foreground
896+ selectionColor: Theme.palette.selected.selection
897 font.pixelSize: FontUtils.sizeToPixels("medium")
898 // forward keys to the root element so it can be captured outside of it
899 // as well as to InputHandler to handle PageUp/PageDown keys
900
901=== modified file 'modules/Ubuntu/Components/TextField.qml'
902--- modules/Ubuntu/Components/TextField.qml 2014-06-29 21:46:30 +0000
903+++ modules/Ubuntu/Components/TextField.qml 2014-07-24 02:10:07 +0000
904@@ -979,7 +979,7 @@
905 }
906 color: control.__styleInstance.color
907 selectedTextColor: Theme.palette.selected.foregroundText
908- selectionColor: Theme.palette.selected.foreground
909+ selectionColor: Theme.palette.selected.selection
910 font.pixelSize: FontUtils.sizeToPixels("medium")
911 passwordCharacter: "\u2022"
912 // forward keys to the root element so it can be captured outside of it
913
914=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml'
915--- modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml 2014-05-22 13:04:58 +0000
916+++ modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml 2014-07-24 02:10:07 +0000
917@@ -28,7 +28,12 @@
918 verticalAlignment: Image.AlignVCenter
919 source: "artwork/spinner.png"
920
921- RotationAnimator on rotation {
922+ /*
923+ Changed from RotationAnimator to RotationAnimation to
924+ work around bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1338602
925+ "Activity Indicator crashes in QML/Widget mixed applications"
926+ */
927+ RotationAnimation on rotation {
928 running: styledItem.running
929 from: 0
930 to: 360
931
932=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/CheckBoxStyle.qml'
933--- modules/Ubuntu/Components/Themes/Ambiance/CheckBoxStyle.qml 2014-04-23 08:50:20 +0000
934+++ modules/Ubuntu/Components/Themes/Ambiance/CheckBoxStyle.qml 2014-07-24 02:10:07 +0000
935@@ -54,7 +54,7 @@
936 }
937 PropertyChanges {
938 target: background
939- color: Theme.palette.selected.foreground
940+ color: UbuntuColors.green
941 }
942 },
943 State {
944
945=== renamed file 'modules/Ubuntu/Components/Themes/Ambiance/HeaderButtonStyle.qml' => 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml'
946--- modules/Ubuntu/Components/Themes/Ambiance/HeaderButtonStyle.qml 2014-05-01 15:31:38 +0000
947+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadButton.qml 2014-07-24 02:10:07 +0000
948@@ -14,30 +14,30 @@
949 * along with this program. If not, see <http://www.gnu.org/licenses/>.
950 */
951
952-import QtQuick 2.0
953+import QtQuick 2.2
954 import Ubuntu.Components 1.1
955
956-Item {
957- id: visuals
958- // styling properties
959- property int iconWidth: units.gu(3)
960- property int iconHeight: units.gu(3)
961-
962- width: units.gu(5)
963- height: units.gu(5)
964+AbstractButton {
965+ id: button
966+
967+ property int iconWidth: units.gu(2)
968+ property int iconHeight: iconWidth
969+
970+ width: visible ? units.gu(4) : 0
971+ height: parent ? parent.height : undefined
972
973 Image {
974 id: icon
975 anchors {
976 centerIn: parent
977 }
978- width: visuals.iconWidth
979- height: visuals.iconWidth
980- source: styledItem.iconSource
981- opacity: styledItem.enabled ? 1.0 : 0.3
982+ width: button.iconWidth
983+ height: button.iconHeight
984+ source: button.iconSource
985+ opacity: button.enabled ? 1.0 : 0.3
986 sourceSize {
987- width: width
988- height: height
989+ width: icon.width
990+ height: icon.height
991 }
992 }
993 }
994
995=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml'
996--- modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-04 11:25:50 +0000
997+++ modules/Ubuntu/Components/Themes/Ambiance/PageHeadStyle.qml 2014-07-24 02:10:07 +0000
998@@ -13,7 +13,7 @@
999 * You should have received a copy of the GNU Lesser General Public License
1000 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1001 */
1002-import QtQuick 2.0
1003+import QtQuick 2.2
1004 import Ubuntu.Components 1.1
1005 import Ubuntu.Components.Popups 1.0
1006 import Ubuntu.Components.ListItems 1.0 as ListItem
1007@@ -32,6 +32,10 @@
1008
1009 implicitHeight: headerStyle.contentHeight + separator.height + separatorBottom.height
1010
1011+ // FIXME: Workaround to get sectionsRepeater.count in autopilot tests,
1012+ // see also FIXME in AppHeader where this property is used.
1013+ property alias __sections_repeater_for_autopilot: sectionsRepeater
1014+
1015 BorderImage {
1016 id: separator
1017 anchors {
1018@@ -40,6 +44,42 @@
1019 right: parent.right
1020 }
1021 source: headerStyle.separatorSource
1022+
1023+ property PageHeadSections sections: styledItem.config.sections
1024+
1025+ Row {
1026+ id: sectionsRow
1027+ property int itemWidth: sectionsRow.width / sectionsRepeater.count
1028+ anchors.fill: parent
1029+ enabled: separator.sections.enabled
1030+ visible: separator.sections.model !== undefined
1031+ opacity: enabled ? 1.0 : 0.5
1032+
1033+ Repeater {
1034+ id: sectionsRepeater
1035+ model: separator.sections.model
1036+ objectName: "page_head_sections_repeater"
1037+ AbstractButton {
1038+ id: sectionButton
1039+ objectName: "section_button_" + index
1040+ enabled: sectionsRow.enabled
1041+ width: sectionsRow.itemWidth
1042+ height: sectionsRow.height
1043+ property bool selected: index === separator.sections.selectedIndex
1044+ onClicked: separator.sections.selectedIndex = index;
1045+
1046+ Label {
1047+ text: modelData
1048+ fontSize: "small"
1049+ anchors.fill: parent
1050+ horizontalAlignment: Text.AlignHCenter
1051+ color: sectionButton.selected ?
1052+ Theme.palette.normal.backgroundText :
1053+ Theme.palette.selected.backgroundText
1054+ }
1055+ }
1056+ }
1057+ }
1058 }
1059 Image {
1060 id: separatorBottom
1061@@ -56,26 +96,22 @@
1062 anchors {
1063 left: parent.left
1064 top: parent.top
1065+ leftMargin: width > 0 ? units.gu(1) : 0
1066 }
1067 width: childrenRect.width
1068 height: headerStyle.contentHeight
1069
1070- AbstractButton {
1071+ PageHeadButton {
1072 id: customBackButton
1073 objectName: "customBackButton"
1074- height: parent ? parent.height : undefined
1075- width: visible ? units.gu(5) : 0
1076 action: styledItem.config.backAction
1077 visible: null !== styledItem.config.backAction &&
1078 styledItem.config.backAction.visible
1079- style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton)
1080 }
1081
1082- AbstractButton {
1083+ PageHeadButton {
1084 id: backButton
1085 objectName: "backButton"
1086- height: parent ? parent.height : undefined
1087- width: visible ? units.gu(5) : 0
1088
1089 iconName: "back"
1090 visible: styledItem.pageStack !== null &&
1091@@ -84,18 +120,15 @@
1092 !customBackButton.visible
1093
1094 text: "back"
1095- style: Theme.createStyleComponent("HeaderButtonStyle.qml", backButton)
1096
1097 onTriggered: {
1098 styledItem.pageStack.pop();
1099 }
1100 }
1101
1102- AbstractButton {
1103+ PageHeadButton {
1104 id: tabsButton
1105 objectName: "tabsButton"
1106- height: parent ? parent.height : undefined
1107- width: visible ? units.gu(5) : 0
1108
1109 iconName: "navigation-menu"
1110 visible: styledItem.tabsModel !== null &&
1111@@ -103,7 +136,6 @@
1112 !backButton.visible &&
1113 !customBackButton.visible
1114 text: visible ? styledItem.tabsModel.count + " tabs" : ""
1115- style: Theme.createStyleComponent("HeaderButtonStyle.qml", tabsButton)
1116
1117 onTriggered: {
1118 tabsPopover.show();
1119@@ -220,29 +252,26 @@
1120 anchors {
1121 top: parent.top
1122 right: parent.right
1123+ rightMargin: units.gu(1)
1124 }
1125 width: childrenRect.width
1126 height: headerStyle.contentHeight
1127
1128 Repeater {
1129 model: numberOfSlots.used
1130- AbstractButton {
1131+ PageHeadButton {
1132 id: actionButton
1133 objectName: action.objectName + "_header_button"
1134 action: actionsContainer.visibleActions[index]
1135- style: Theme.createStyleComponent("HeaderButtonStyle.qml", actionButton)
1136- width: units.gu(5)
1137- height: actionsContainer.height
1138 }
1139 }
1140
1141- AbstractButton {
1142+ PageHeadButton {
1143 id: actionsOverflowButton
1144 objectName: "actions_overflow_button"
1145 visible: numberOfSlots.requested > numberOfSlots.right
1146 iconName: "contextual-menu"
1147 width: visible ? units.gu(5) : 0
1148- style: Theme.createStyleComponent("HeaderButtonStyle.qml", actionsOverflowButton)
1149 height: actionsContainer.height
1150 onTriggered: actionsOverflowPopover.show()
1151
1152
1153=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/Palette.qml'
1154--- modules/Ubuntu/Components/Themes/Ambiance/Palette.qml 2013-07-05 12:21:32 +0000
1155+++ modules/Ubuntu/Components/Themes/Ambiance/Palette.qml 2014-07-24 02:10:07 +0000
1156@@ -15,20 +15,21 @@
1157 */
1158
1159 import QtQuick 2.0
1160+import Ubuntu.Components 1.1
1161 import Ubuntu.Components.Themes 0.1
1162
1163 Palette {
1164 normal: PaletteValues {
1165 background: "#EDEDED"
1166 backgroundText: "#81888888"
1167- base: "#1A000000"
1168- baseText: "#888888"
1169- foreground: "#888888"
1170+ base: Qt.rgba(0, 0, 0, 0.1)
1171+ baseText: UbuntuColors.lightGrey
1172+ foreground: UbuntuColors.lightGrey
1173 foregroundText: "#F3F3E7"
1174 overlay: "#FDFDFD"
1175- overlayText: "#888888"
1176+ overlayText: UbuntuColors.lightGrey
1177 field: "#1A000000"
1178- fieldText: "#888888"
1179+ fieldText: UbuntuColors.darkGrey
1180 }
1181 selected: PaletteValues {
1182 /* FIXME: 'background' does not come from design
1183@@ -36,10 +37,11 @@
1184 that will go away with the new design.
1185 */
1186 background: "#B2E6E6E6"
1187- backgroundText: "#888888"
1188- foreground: "#DD4814"
1189- foregroundText: "#F3F3E7"
1190+ backgroundText: UbuntuColors.darkGrey
1191+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
1192+ foreground: UbuntuColors.blue
1193+ foregroundText: UbuntuColors.darkGrey
1194 field: "#FFFFFF"
1195- fieldText: "#888888"
1196+ fieldText: UbuntuColors.darkGrey
1197 }
1198 }
1199
1200=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml'
1201--- modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml 2014-04-23 08:50:20 +0000
1202+++ modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml 2014-07-24 02:10:07 +0000
1203@@ -20,7 +20,7 @@
1204 Item {
1205 id: progressBarStyle
1206
1207- property ProgressBar progressBar: styledItem
1208+ property var progressBar: styledItem
1209
1210 implicitWidth: units.gu(38)
1211 implicitHeight: units.gu(4)
1212@@ -56,6 +56,7 @@
1213 color: Theme.palette.normal.baseText
1214 text: progressBar.indeterminate ? i18n.tr("In Progress")
1215 : "%1%".arg(Number(progressBarStyle.progress * 100.0).toFixed(0))
1216+ visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
1217
1218 SequentialAnimation on opacity {
1219 loops: Animation.Infinite
1220@@ -76,5 +77,6 @@
1221 rightColor: Theme.palette.normal.baseText
1222 progress: (progressBarStyle.progress * background.width - valueLabel.x) / valueLabel.width
1223 mirror: Qt.application.layoutDirection == Qt.RightToLeft
1224+ visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
1225 }
1226 }
1227
1228=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/SwitchStyle.qml'
1229--- modules/Ubuntu/Components/Themes/Ambiance/SwitchStyle.qml 2014-04-23 08:50:20 +0000
1230+++ modules/Ubuntu/Components/Themes/Ambiance/SwitchStyle.qml 2014-07-24 02:10:07 +0000
1231@@ -58,8 +58,8 @@
1232 bottomMargin: switchStyle.thumbPadding
1233 }
1234
1235- color: styledItem.checked ? Theme.palette.selected.foreground
1236- : Theme.palette.normal.foreground
1237+ color: styledItem.checked ? UbuntuColors.green
1238+ : Qt.rgba(0, 0, 0, 0.2)
1239
1240 Behavior on x {
1241 UbuntuNumberAnimation {
1242@@ -117,7 +117,7 @@
1243 }
1244 progress: MathUtils.clamp((thumb.x - parent.x - x) / width, 0.0, 1.0)
1245 leftColor: "transparent"
1246- rightColor: Theme.palette.selected.foregroundText
1247+ rightColor: Theme.palette.normal.foregroundText
1248 }
1249 }
1250
1251@@ -138,7 +138,7 @@
1252 source: "artwork/tick.png"
1253 }
1254 progress: MathUtils.clamp((thumb.x + thumb.width - parent.x - x) / width, 0.0, 1.0)
1255- leftColor: Theme.palette.selected.foregroundText
1256+ leftColor: Theme.palette.normal.foregroundText
1257 rightColor: "transparent"
1258 }
1259 }
1260
1261=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml'
1262--- modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-05-09 05:25:12 +0000
1263+++ modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-07-24 02:10:07 +0000
1264@@ -47,7 +47,7 @@
1265 Component {
1266 id: delegate
1267 Rectangle {
1268- width: units.dp(1)
1269+ width: units.dp(2)
1270 color: Theme.palette.selected.foreground
1271 visible: blinkTimer.timerShowCursor
1272 Timer {
1273@@ -70,7 +70,7 @@
1274 // caretItem
1275 Image {
1276 id: caretItem
1277- source: "artwork/teardrop-left.png"
1278+ source: "artwork/caret_noshadow.png"
1279 anchors {
1280 top: parent.bottom
1281 horizontalCenter: parent.horizontalCenter
1282
1283=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml'
1284--- modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml 2014-05-09 05:25:12 +0000
1285+++ modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml 2014-07-24 02:10:07 +0000
1286@@ -55,7 +55,7 @@
1287 // caretItem
1288 Image {
1289 id: caretItem
1290- source: "artwork/teardrop-left.png"
1291+ source: "artwork/caret_noshadow.png"
1292 anchors {
1293 top: parent.bottom
1294 horizontalCenter: parent.horizontalCenter
1295
1296=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml'
1297--- modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml 2014-05-13 08:00:18 +0000
1298+++ modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml 2014-07-24 02:10:07 +0000
1299@@ -55,12 +55,13 @@
1300 // caretItem
1301 Image {
1302 id: caretItem
1303- source: "artwork/teardrop-right.png"
1304+ source: "artwork/caret_noshadow.png"
1305 anchors {
1306- top: parent.bottom
1307+ bottom: parent.top
1308 horizontalCenter: parent.horizontalCenter
1309 topMargin: -units.gu(0.5)
1310 horizontalCenterOffset: LayoutMirroring.enabled ? -(units.gu(0.7) - caretItem.width) : -units.gu(0.7)
1311 }
1312+ rotation: 180
1313 }
1314 }
1315
1316=== added file 'modules/Ubuntu/Components/Themes/Ambiance/artwork/caret_noshadow@27.png'
1317Binary files modules/Ubuntu/Components/Themes/Ambiance/artwork/caret_noshadow@27.png 1970-01-01 00:00:00 +0000 and modules/Ubuntu/Components/Themes/Ambiance/artwork/caret_noshadow@27.png 2014-07-24 02:10:07 +0000 differ
1318=== removed file 'modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-left@20.png'
1319Binary files modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-left@20.png 2014-04-25 08:18:46 +0000 and modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-left@20.png 1970-01-01 00:00:00 +0000 differ
1320=== removed file 'modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-right@20.png'
1321Binary files modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-right@20.png 2014-04-25 08:18:46 +0000 and modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-right@20.png 1970-01-01 00:00:00 +0000 differ
1322=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/qmldir'
1323--- modules/Ubuntu/Components/Themes/Ambiance/qmldir 2014-06-30 10:49:51 +0000
1324+++ modules/Ubuntu/Components/Themes/Ambiance/qmldir 2014-07-24 02:10:07 +0000
1325@@ -4,7 +4,7 @@
1326 internal CheckBoxStyle CheckBoxStyle.qml
1327 internal DialogForegroundStyle DialogForegroundStyle.qml
1328 internal HeaderStyle HeaderStyle.qml
1329-internal HeaderButtonStyle HeaderButtonStyle.qml
1330+internal PageHeadButton PageHeadButton.qml
1331 MainViewStyle 0.1 MainViewStyle.qml
1332 ListItemOptionSelector 0.1 ListItemOptionSelector.qml
1333 OptionSelectorStyle 0.1 OptionSelectorStyle.qml
1334
1335=== modified file 'modules/Ubuntu/Components/Themes/PaletteValues.qml'
1336--- modules/Ubuntu/Components/Themes/PaletteValues.qml 2013-07-05 16:04:07 +0000
1337+++ modules/Ubuntu/Components/Themes/PaletteValues.qml 2014-07-24 02:10:07 +0000
1338@@ -69,4 +69,8 @@
1339 Typically used for labels and images.
1340 */
1341 property color fieldText
1342+ /*!
1343+ Color applied to selected text in editable components.
1344+ */
1345+ property color selection
1346 }
1347
1348=== modified file 'modules/Ubuntu/Components/Themes/SuruDark/Palette.qml'
1349--- modules/Ubuntu/Components/Themes/SuruDark/Palette.qml 2013-07-05 14:34:00 +0000
1350+++ modules/Ubuntu/Components/Themes/SuruDark/Palette.qml 2014-07-24 02:10:07 +0000
1351@@ -15,6 +15,7 @@
1352 */
1353
1354 import QtQuick 2.0
1355+import Ubuntu.Components 1.1
1356 import Ubuntu.Components.Themes 0.1
1357
1358 Palette {
1359@@ -33,8 +34,9 @@
1360 selected: PaletteValues {
1361 background: "#88D6D6D6" // FIXME: not from design
1362 backgroundText: "#F3F3E7"
1363- foreground: "#DD4814"
1364- foregroundText: "#F3F3E7"
1365+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
1366+ foreground: UbuntuColors.blue
1367+ foregroundText: UbuntuColors.darkGrey
1368 field: "#FFFFFF"
1369 fieldText: "#888888"
1370 }
1371
1372=== modified file 'modules/Ubuntu/Components/deployment.pri'
1373--- modules/Ubuntu/Components/deployment.pri 2014-04-29 05:39:04 +0000
1374+++ modules/Ubuntu/Components/deployment.pri 2014-07-24 02:10:07 +0000
1375@@ -52,6 +52,6 @@
1376 # Silence spam on stderr due to fonts
1377 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
1378 # https://bugreports.qt-project.org/browse/QTBUG-36243
1379-plugins_qmltypes.extra = $$[QT_INSTALL_BINS]/qmlplugindump -notrelocatable Ubuntu.Components 0.1 ../../ 2>/dev/null > $(INSTALL_ROOT)/$$installPath/plugins.qmltypes
1380+plugins_qmltypes.extra = ALARM_BACKEND=memory $$[QT_INSTALL_BINS]/qmlplugindump -notrelocatable Ubuntu.Components 0.1 ../../ 2>/dev/null > $(INSTALL_ROOT)/$$installPath/plugins.qmltypes
1381
1382 INSTALLS += qmldir_file qml_files js_files artwork_files listitems_files listitems_artwork_files popups_files picker_files styles_files plugins_qmltypes
1383
1384=== modified file 'modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp'
1385--- modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-04-17 14:05:49 +0000
1386+++ modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-07-24 02:10:07 +0000
1387@@ -57,17 +57,14 @@
1388 , fetchRequest(0)
1389 {
1390 QString envManager(qgetenv("ALARM_BACKEND"));
1391- if (!envManager.isEmpty() && QOrganizerManager::availableManagers().contains(envManager)) {
1392- manager = new QOrganizerManager(envManager);
1393- } else {
1394- manager = QOrganizerManager::availableManagers().contains(ALARM_MANAGER) ?
1395- new QOrganizerManager(ALARM_MANAGER) : new QOrganizerManager(ALARM_MANAGER_FALLBACK);
1396+ if (envManager.isEmpty())
1397+ envManager = ALARM_MANAGER;
1398+ if (!QOrganizerManager::availableManagers().contains(envManager)) {
1399+ qWarning() << "WARNING: alarm manager" << envManager << "not installed, using" << QString(ALARM_MANAGER_FALLBACK);
1400+ envManager = ALARM_MANAGER_FALLBACK;
1401 }
1402+ manager = new QOrganizerManager(envManager);
1403 manager->setParent(q_ptr);
1404- if (manager->managerName() != ALARM_MANAGER) {
1405- qWarning() << "WARNING: default alarm manager not installed, using" << manager->managerName() << "manager.";
1406- qWarning() << "This manager may not provide all the needed features.";
1407- }
1408
1409 QList<QOrganizerCollection> collections = manager->collections();
1410 if (collections.count() > 0) {
1411
1412=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
1413--- modules/Ubuntu/Components/plugin/plugin.cpp 2014-06-10 11:47:09 +0000
1414+++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-07-24 02:10:07 +0000
1415@@ -92,7 +92,14 @@
1416 return uriHandler;
1417 }
1418
1419-static QObject *registerUbuntuColors(QQmlEngine *engine, QJSEngine *scriptEngine)
1420+static QObject *registerUbuntuColors10(QQmlEngine *engine, QJSEngine *scriptEngine)
1421+{
1422+ Q_UNUSED(scriptEngine)
1423+ return UbuntuComponentsPlugin::registerQmlSingletonType(engine,
1424+ "Ubuntu.Components", "Colors/UbuntuColors10.qml");
1425+}
1426+
1427+static QObject *registerUbuntuColors11(QQmlEngine *engine, QJSEngine *scriptEngine)
1428 {
1429 Q_UNUSED(scriptEngine)
1430 return UbuntuComponentsPlugin::registerQmlSingletonType(engine,
1431@@ -154,7 +161,7 @@
1432
1433 void UbuntuComponentsPlugin::registerTypesToVersion(const char *uri, int major, int minor)
1434 {
1435- qmlRegisterSingletonType<QObject>(uri, major, minor, "UbuntuColors", registerUbuntuColors);
1436+ qmlRegisterSingletonType<QObject>(uri, major, minor, "UbuntuColors", registerUbuntuColors10);
1437 qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object");
1438 qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase");
1439 qmlRegisterUncreatableType<UCUnits>(uri, major, minor, "UCUnits", "Not instantiable");
1440@@ -184,6 +191,7 @@
1441 // register 0.1 for backward compatibility
1442 registerTypesToVersion(uri, 0, 1);
1443 registerTypesToVersion(uri, 1, 0);
1444+ qmlRegisterSingletonType<QObject>(uri, 1, 1, "UbuntuColors", registerUbuntuColors11);
1445
1446 // register custom event
1447 ForwardedEvent::registerForwardedEvent();
1448
1449=== modified file 'modules/Ubuntu/Components/plugin/ucfontutils.cpp'
1450--- modules/Ubuntu/Components/plugin/ucfontutils.cpp 2014-04-23 08:50:20 +0000
1451+++ modules/Ubuntu/Components/plugin/ucfontutils.cpp 2014-07-24 02:10:07 +0000
1452@@ -83,17 +83,17 @@
1453 qreal UCFontUtils::modularScale(const QString &size)
1454 {
1455 if (size == "xx-small") {
1456- return 0.606;
1457+ return 0.677;
1458 } else if (size == "x-small") {
1459- return 0.707;
1460+ return 0.804;
1461 } else if (size == "small") {
1462- return 0.857;
1463+ return 0.931;
1464 } else if (size == "medium") {
1465- return 1.0;
1466+ return 1.079;
1467 } else if (size == "large") {
1468- return 1.414;
1469+ return 1.291;
1470 } else if (size == "x-large") {
1471- return 1.905;
1472+ return 1.714;
1473 }
1474 return 0.0;
1475 }
1476
1477=== modified file 'modules/Ubuntu/Components/qmldir'
1478--- modules/Ubuntu/Components/qmldir 2014-07-03 13:59:52 +0000
1479+++ modules/Ubuntu/Components/qmldir 2014-07-24 02:10:07 +0000
1480@@ -15,7 +15,7 @@
1481 Label 0.1 Label.qml
1482 AbstractButton 0.1 AbstractButton.qml
1483 ActivityIndicator 0.1 ActivityIndicator.qml
1484-ProgressBar 0.1 ProgressBar.qml
1485+ProgressBar 0.1 ProgressBar10.qml
1486 TextField 0.1 TextField.qml
1487 TextArea 0.1 TextArea.qml
1488 Switch 0.1 Switch.qml
1489@@ -65,7 +65,7 @@
1490 Label 1.0 Label.qml
1491 AbstractButton 1.0 AbstractButton.qml
1492 ActivityIndicator 1.0 ActivityIndicator.qml
1493-ProgressBar 1.0 ProgressBar.qml
1494+ProgressBar 1.0 ProgressBar10.qml
1495 TextField 1.0 TextField.qml
1496 TextArea 1.0 TextArea.qml
1497 Switch 1.0 Switch.qml
1498@@ -93,10 +93,12 @@
1499
1500 #version 1.1
1501 ComboButton 1.1 ComboButton.qml
1502+ProgressBar 1.1 ProgressBar11.qml
1503 CrossFadeImage 1.1 CrossFadeImage11.qml
1504 PullToRefresh 1.1 PullToRefresh.qml
1505 UbuntuListView 1.1 UbuntuListView11.qml
1506 internal PageBase Page10.qml
1507 Page 1.1 Page11.qml
1508 PageHeadConfiguration 1.1 PageHeadConfiguration.qml
1509+PageHeadSections 1.1 PageHeadSections.qml
1510 PageHeadState 1.1 PageHeadState.qml
1511
1512=== modified file 'modules/Ubuntu/Test/UbuntuTestCase.qml'
1513--- modules/Ubuntu/Test/UbuntuTestCase.qml 2014-06-19 08:15:49 +0000
1514+++ modules/Ubuntu/Test/UbuntuTestCase.qml 2014-07-24 02:10:07 +0000
1515@@ -223,5 +223,14 @@
1516 throw new Error("QtQuickTest::fail")
1517 }
1518 }
1519-}
1520+
1521+ /*!
1522+ Convenience function to allow typing a full string instead of single characters
1523+ */
1524+ function typeString(string) {
1525+ for (var i = 0; i < string.length; i++) {
1526+ keyClick(string[i]);
1527+ }
1528+ }
1529+}
1530
1531
1532=== modified file 'push_to_phone.sh'
1533--- push_to_phone.sh 2014-05-30 09:59:17 +0000
1534+++ push_to_phone.sh 2014-07-24 02:10:07 +0000
1535@@ -30,6 +30,8 @@
1536 echo modules/$i '->' /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
1537 adb push $i /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
1538 done
1539+echo modules/Ubuntu/Components/qmldir '->' /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
1540+adb push Ubuntu/Components/qmldir /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
1541 cd ..
1542 for i in ListItems Pickers Popups Colors Styles Themes artwork; do
1543 adb push modules/Ubuntu/Components/$i/ /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/$i || exit 1
1544
1545=== modified file 'tests/autopilot/ubuntuuitoolkit/__init__.py'
1546--- tests/autopilot/ubuntuuitoolkit/__init__.py 2014-06-30 10:49:51 +0000
1547+++ tests/autopilot/ubuntuuitoolkit/__init__.py 2014-07-24 02:10:07 +0000
1548@@ -41,6 +41,7 @@
1549 'TextField',
1550 'Toolbar',
1551 'ToolkitException',
1552+ 'ubuntu_scenarios',
1553 'UbuntuListView11',
1554 'UbuntuUIToolkitCustomProxyObjectBase',
1555 ]
1556@@ -52,6 +53,7 @@
1557 environment,
1558 fixture_setup,
1559 tests,
1560+ ubuntu_scenarios
1561 )
1562 from ubuntuuitoolkit._custom_proxy_objects import (
1563 AppHeader,
1564
1565=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
1566--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-06-04 22:17:49 +0000
1567+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2014-07-24 02:10:07 +0000
1568@@ -52,14 +52,44 @@
1569 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
1570 self.y.wait_for(0)
1571
1572+ @autopilot_logging.log_action(logger.info)
1573+ def switch_to_section_by_index(self, index):
1574+ """Select a section in the header divider
1575+
1576+ :parameter index: The index of the section to select
1577+ :raise ToolkitEmulatorException: If the selection index is out of
1578+ range or useDeprecatedToolbar is set.
1579+
1580+ """
1581+ self._show_if_not_visible()
1582+
1583+ if self.useDeprecatedToolbar:
1584+ raise _common.ToolkitException('Old header has no sections')
1585+
1586+ try:
1587+ object_name = "section_button_" + str(index)
1588+ button = self.select_single(objectName=object_name)
1589+ except dbus.StateNotFoundError:
1590+ raise _common.ToolkitException(
1591+ 'Button for section with given index not found')
1592+
1593+ self.pointing_device.click_object(button)
1594+
1595+ def get_selected_section_index(self):
1596+ if self.useDeprecatedToolbar:
1597+ raise _common.ToolkitException('Old header has no sections')
1598+
1599+ sectionsProperties = self.select_single(
1600+ 'QQuickItem', objectName='sectionsProperties')
1601+ return sectionsProperties.selectedIndex
1602+
1603 def click_back_button(self):
1604 self._show_if_not_visible()
1605
1606 if self.useDeprecatedToolbar:
1607 raise _common.ToolkitException('Old header has no back button')
1608 try:
1609- back_button = self.select_single(
1610- 'AbstractButton', objectName='backButton')
1611+ back_button = self.select_single(objectName='backButton')
1612 except dbus.StateNotFoundError:
1613 raise _common.ToolkitException('Missing back button in header')
1614 if not back_button.visible:
1615@@ -74,7 +104,7 @@
1616 'Old header has no custom back button')
1617 try:
1618 custom_back_button = self.select_single(
1619- 'AbstractButton', objectName='customBackButton')
1620+ objectName='customBackButton')
1621 except dbus.StateNotFoundError:
1622 raise _common.ToolkitException(
1623 'Missing custom back button in header')
1624@@ -138,8 +168,7 @@
1625
1626 def _switch_to_tab_in_drawer_by_index(self, index):
1627 try:
1628- tabs_drawer_button = self.select_single(
1629- 'AbstractButton', objectName='tabsButton')
1630+ tabs_drawer_button = self.select_single(objectName='tabsButton')
1631 except dbus.StateNotFoundError:
1632 raise _common.ToolkitException(_NO_TABS_ERROR)
1633 self.pointing_device.click_object(tabs_drawer_button)
1634@@ -175,8 +204,7 @@
1635 def _get_action_button(self, action_object_name):
1636 try:
1637 object_name = action_object_name + "_header_button"
1638- button = self.select_single(
1639- 'AbstractButton', objectName=object_name)
1640+ button = self.select_single(objectName=object_name)
1641 except dbus.StateNotFoundError:
1642 # the button is not in the header, but it may be in the overflow
1643 try:
1644@@ -190,7 +218,6 @@
1645
1646 def _get_action_button_in_overflow(self, action_object_name):
1647 actions_overflow_button = self.select_single(
1648- 'AbstractButton',
1649 objectName='actions_overflow_button')
1650
1651 if not actions_overflow_button.visible:
1652
1653=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py'
1654--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py 2014-06-02 23:21:48 +0000
1655+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_mainview.py 2014-07-24 02:10:07 +0000
1656@@ -41,8 +41,7 @@
1657 def get_header(self):
1658 """Return the AppHeader emulator of the MainView."""
1659 try:
1660- return self.select_single(
1661- 'AppHeader', objectName='MainView_Header')
1662+ return self.select_single(objectName='MainView_Header')
1663 except dbus.StateNotFoundError:
1664 raise _common.ToolkitException('The main view has no header.')
1665
1666
1667=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py'
1668--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py 2014-05-09 05:39:20 +0000
1669+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/pickers.py 2014-07-24 02:10:07 +0000
1670@@ -127,15 +127,18 @@
1671 if not self._is_time_picker():
1672 raise _common.ToolkitException(
1673 "Can't pick time. The picker mode is: {!r}.".format(self.mode))
1674+ # Workaround https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1346669
1675+ # By setting seconds, then minutes, then hours, erratic behavoir
1676+ # can be dealt with
1677+ if 'Seconds' in self.mode:
1678+ self._pick_second(time.second)
1679+ self.seconds.wait_for(time.second)
1680+ if 'Minutes' in self.mode:
1681+ self._pick_minute(time.minute)
1682+ self.minutes.wait_for(time.minute)
1683 if 'Hours' in self.mode:
1684 self._pick_hour(time.hour)
1685 self.hours.wait_for(time.hour)
1686- if 'Minutes' in self.mode:
1687- self._pick_minute(time.minute)
1688- self.minutes.wait_for(time.minute)
1689- if 'Seconds' in self.mode:
1690- self._pick_second(time.second)
1691- self.seconds.wait_for(time.second)
1692
1693 def _is_time_picker(self):
1694 mode = self.mode
1695
1696=== modified file 'tests/autopilot/ubuntuuitoolkit/base.py'
1697--- tests/autopilot/ubuntuuitoolkit/base.py 2014-01-14 00:44:05 +0000
1698+++ tests/autopilot/ubuntuuitoolkit/base.py 2014-07-24 02:10:07 +0000
1699@@ -1,6 +1,6 @@
1700 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1701 #
1702-# Copyright (C) 2013 Canonical Ltd.
1703+# Copyright (C) 2013, 2014 Canonical Ltd.
1704 #
1705 # This program is free software; you can redistribute it and/or modify
1706 # it under the terms of the GNU Lesser General Public License as published by
1707@@ -16,6 +16,7 @@
1708
1709 """Base classes for Autopilot tests using the Ubuntu UI Toolkit."""
1710
1711+import os
1712 import subprocess
1713
1714 from autopilot import (
1715@@ -25,14 +26,21 @@
1716 )
1717
1718
1719+def get_host_multiarch():
1720+ if 'deb_host_multiarch' not in os.environ:
1721+ # Discard errors: the one known message is "GCC not installed"
1722+ os.environ['deb_host_multiarch'] = subprocess.check_output(
1723+ ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
1724+ universal_newlines=True, stderr=subprocess.PIPE).strip()
1725+ return os.environ['deb_host_multiarch']
1726+
1727+
1728 def get_qmlscene_launch_command():
1729 """Return the command to launch qmlscene for autopilot tests."""
1730 # We need to specify qt5 because qtchooser doesn't have a default
1731 # configuration on devices and it seems the environment variable
1732 # QT_SELECT=qt5 doesn't work for autopilot tests. --Mirv - 2013-10-03
1733- arch = subprocess.check_output(
1734- ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
1735- universal_newlines=True).strip()
1736+ arch = get_host_multiarch()
1737 return '/usr/lib/{}/qt5/bin/qmlscene'.format(arch)
1738
1739
1740
1741=== modified file 'tests/autopilot/ubuntuuitoolkit/fixture_setup.py'
1742--- tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-05-26 06:40:24 +0000
1743+++ tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-07-24 02:10:07 +0000
1744@@ -15,11 +15,14 @@
1745 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1746
1747 import copy
1748+import logging
1749 import os
1750 import shutil
1751 import tempfile
1752
1753 import fixtures
1754+from autopilot import display
1755+from gi.repository import Gio
1756
1757 from ubuntuuitoolkit import base, environment
1758
1759@@ -46,6 +49,9 @@
1760 }
1761
1762
1763+logger = logging.getLogger(__name__)
1764+
1765+
1766 class FakeApplication(fixtures.Fixture):
1767
1768 def __init__(
1769@@ -71,18 +77,26 @@
1770 return qml_file_path, desktop_file_path
1771
1772 def _write_test_qml_file(self):
1773- qml_file = tempfile.NamedTemporaryFile(
1774- mode='w+t', suffix='.qml', delete=False)
1775+ qml_file = self._named_temporary_file(suffix='.qml')
1776 qml_file.write(self._qml_file_contents)
1777 qml_file.close()
1778 return qml_file.name
1779
1780+ def _named_temporary_file(self, dir=None, mode='w+t',
1781+ delete=False, suffix=''):
1782+ # Discard files with underscores which look like an APP_ID to Unity
1783+ # See https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1329141
1784+ chars = tempfile._RandomNameSequence.characters.strip("_")
1785+ tempfile._RandomNameSequence.characters = chars
1786+ return tempfile.NamedTemporaryFile(dir=dir, mode=mode,
1787+ delete=delete, suffix=suffix)
1788+
1789 def _write_test_desktop_file(self, qml_file_path):
1790 desktop_file_dir = self._get_local_desktop_file_directory()
1791 if not os.path.exists(desktop_file_dir):
1792 os.makedirs(desktop_file_dir)
1793- desktop_file = tempfile.NamedTemporaryFile(
1794- mode='w+t', suffix='.desktop', dir=desktop_file_dir, delete=False)
1795+ desktop_file = self._named_temporary_file(suffix='.desktop',
1796+ dir=desktop_file_dir)
1797 self._desktop_file_dict['Exec'] = (
1798 self._desktop_file_dict['Exec'].format(
1799 qmlscene=base.get_qmlscene_launch_command(),
1800@@ -163,3 +177,82 @@
1801 shutil.copyfile(
1802 xauthority_file_path,
1803 os.path.join(directory, '.Xauthority'))
1804+
1805+
1806+class HideUnity7Launcher(fixtures.Fixture):
1807+
1808+ """Hide the Unity7 launcher if it is visible and restore it on clean up."""
1809+
1810+ _UNITYSHELL_GSETTINGS_SCHEMA = 'org.compiz.unityshell'
1811+ _UNITYSHELL_GSETTINGS_PATH = (
1812+ '/org/compiz/profiles/unity/plugins/unityshell/')
1813+ _UNITYSHELL_LAUNCHER_KEY = 'launcher-hide-mode'
1814+ _UNITYSHELL_LAUNCHER_HIDDEN_MODE = 1 # launcher hidden
1815+
1816+ def setUp(self):
1817+ super(HideUnity7Launcher, self).setUp()
1818+ self._hide_launcher()
1819+
1820+ def _hide_launcher(self):
1821+ if (self._UNITYSHELL_GSETTINGS_SCHEMA in
1822+ Gio.Settings.list_relocatable_schemas()):
1823+ unityshell_schema = Gio.Settings.new_with_path(
1824+ self._UNITYSHELL_GSETTINGS_SCHEMA,
1825+ self._UNITYSHELL_GSETTINGS_PATH)
1826+ self._hide_launcher_from_schema(unityshell_schema)
1827+ else:
1828+ logger.warning('Unity Shell gsettings schema not found.')
1829+
1830+ def _hide_launcher_from_schema(self, unityshell_schema):
1831+ original_mode = self._get_launcher_mode(unityshell_schema)
1832+ self.addCleanup(
1833+ self._set_launcher_mode, unityshell_schema, original_mode)
1834+ self._set_launcher_mode(
1835+ unityshell_schema, self._UNITYSHELL_LAUNCHER_HIDDEN_MODE)
1836+
1837+ def _get_launcher_mode(self, unityshell_schema):
1838+ return unityshell_schema.get_int(self._UNITYSHELL_LAUNCHER_KEY)
1839+
1840+ def _set_launcher_mode(self, unityshell_schema, mode):
1841+ unityshell_schema.set_int(self._UNITYSHELL_LAUNCHER_KEY, mode)
1842+
1843+
1844+class SimulateDevice(fixtures.Fixture):
1845+
1846+ def __init__(self, app_width, app_height, grid_unit_px):
1847+ super(SimulateDevice, self).__init__()
1848+ self.app_width = app_width
1849+ self.app_height = app_height
1850+ self.grid_unit_px = grid_unit_px
1851+ self._screen = None
1852+
1853+ def setUp(self):
1854+ super(SimulateDevice, self).setUp()
1855+ if self._is_geometry_larger_than_display(
1856+ self.app_width, self.app_height):
1857+ scale_divisor = self._get_scale_divisor()
1858+ self.grid_unit_px = self.grid_unit_px // scale_divisor
1859+ self.app_width = self.app_width // scale_divisor
1860+ self.app_height = self.app_height // scale_divisor
1861+ self.useFixture(
1862+ fixtures.EnvironmentVariable(
1863+ 'GRID_UNIT_PX', str(self.grid_unit_px)))
1864+
1865+ def _get_scale_divisor(self):
1866+ scale_divisor = 2
1867+ while self._is_geometry_larger_than_display(
1868+ self.app_width // scale_divisor,
1869+ self.app_height // scale_divisor):
1870+ scale_divisor = scale_divisor * 2
1871+ return scale_divisor
1872+
1873+ def _is_geometry_larger_than_display(self, width, height):
1874+ screen = self._get_screen()
1875+ screen_width = screen.get_screen_width()
1876+ screen_height = screen.get_screen_height()
1877+ return (width > screen_width) or (height > screen_height)
1878+
1879+ def _get_screen(self):
1880+ if self._screen is None:
1881+ self._screen = display.Display.create()
1882+ return self._screen
1883
1884=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py'
1885--- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-06-16 12:07:41 +0000
1886+++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-07-24 02:10:07 +0000
1887@@ -39,6 +39,10 @@
1888 desktop_file_dir = get_local_desktop_file_directory()
1889 if not os.path.exists(desktop_file_dir):
1890 os.makedirs(desktop_file_dir)
1891+ # Strip underscores which look like an APP_ID to Unity
1892+ # See https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1329141
1893+ chars = tempfile._RandomNameSequence.characters.strip("_")
1894+ tempfile._RandomNameSequence.characters = chars
1895 desktop_file = tempfile.NamedTemporaryFile(
1896 suffix='.desktop', dir=desktop_file_dir, delete=False)
1897 desktop_file.write(_DESKTOP_FILE_CONTENTS.encode('utf-8'))
1898@@ -60,8 +64,8 @@
1899 os.path.dirname(__file__), '..', '..', '..', '..'))
1900
1901
1902-class QMLStringAppTestCase(base.UbuntuUIToolkitAppTestCase):
1903- """Base test case for self tests that define the QML on an string."""
1904+class UbuntuUIToolkitWithFakeAppRunningTestCase(
1905+ base.UbuntuUIToolkitAppTestCase):
1906
1907 test_qml = ("""
1908 import QtQuick 2.0
1909@@ -69,13 +73,12 @@
1910
1911 MainView {
1912 width: units.gu(48)
1913- height: units.gu(60)
1914+ height: units.gu(80)
1915 }
1916 """)
1917
1918 def setUp(self):
1919- super(QMLStringAppTestCase, self).setUp()
1920- self.pointing_device = Pointer(self.input_device_class.create())
1921+ super(UbuntuUIToolkitWithFakeAppRunningTestCase, self).setUp()
1922 self.launch_application()
1923
1924 def launch_application(self):
1925@@ -83,18 +86,24 @@
1926 qml_file_contents=self.test_qml)
1927 self.useFixture(fake_application)
1928
1929- self.app = self.launch_test_application(
1930- base.get_qmlscene_launch_command(),
1931- '-I' + _get_module_include_path(),
1932- fake_application.qml_file_path,
1933- '--desktop_file_hint={0}'.format(
1934- fake_application.desktop_file_path),
1935- emulator_base=emulators.UbuntuUIToolkitEmulatorBase,
1936- app_type='qt')
1937-
1938+ desktop_file_name = os.path.basename(
1939+ fake_application.desktop_file_path)
1940+ application_name, _ = os.path.splitext(desktop_file_name)
1941+ self.app = self.launch_upstart_application(
1942+ application_name,
1943+ emulator_base=emulators.UbuntuUIToolkitEmulatorBase)
1944+
1945+
1946+class QMLStringAppTestCase(UbuntuUIToolkitWithFakeAppRunningTestCase):
1947+ """Base test case for self tests that define the QML on an string."""
1948+
1949+ def setUp(self):
1950+ super(QMLStringAppTestCase, self).setUp()
1951 self.assertThat(
1952 self.main_view.visible, Eventually(Equals(True)))
1953
1954+ self.pointing_device = Pointer(self.input_device_class.create())
1955+
1956 @property
1957 def main_view(self):
1958 return self.app.select_single(emulators.MainView)
1959
1960=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py'
1961--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2014-05-09 05:39:20 +0000
1962+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_date_picker.py 2014-07-24 02:10:07 +0000
1963@@ -36,11 +36,19 @@
1964 id: datePicker
1965 objectName: 'datePicker'
1966 mode: 'Years|Months|Days'
1967+ maximum: {
1968+ var d = new Date()
1969+ d.setFullYear('2030')
1970+ return d
1971+ }
1972+ minimum: {
1973+ var d = new Date()
1974+ d.setFullYear('1990')
1975+ return d
1976+ }
1977 date: {
1978 var d = new Date()
1979- // Make sure that the picker will have higher and lower values
1980- // to select.
1981- d.setFullYear(d.getFullYear() + 25)
1982+ d.setFullYear('2010')
1983 d.setMonth('5')
1984 d.setDate('15')
1985 return d
1986@@ -50,10 +58,18 @@
1987 id: timePicker
1988 objectName: 'timePicker'
1989 mode: 'Hours|Minutes|Seconds'
1990+ maximum: {
1991+ var d = new Date()
1992+ d.setFullYear('2030')
1993+ return d
1994+ }
1995+ minimum: {
1996+ var d = new Date()
1997+ d.setFullYear('1990')
1998+ return d
1999+ }
2000 date: {
2001 var d = new Date()
2002- // Make sure that the picker will have higher and lower values
2003- // to select.
2004 d.setHours(12)
2005 d.setMinutes('30')
2006 d.setSeconds('30')
2007@@ -133,7 +149,7 @@
2008
2009 class PickDateFromDatePickerTestCase(DatePickerBaseTestCase):
2010
2011- SELECTED_YEAR = datetime.date.today().year + 25
2012+ SELECTED_YEAR = 2010
2013 SELECTED_MONTH = 6 # June
2014 SELECTED_DAY = 15
2015
2016
2017=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
2018--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-06-17 07:12:49 +0000
2019+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-07-24 02:10:07 +0000
2020@@ -15,7 +15,6 @@
2021 # along with this program. If not, see <http://www.gnu.org/licenses/>.
2022
2023 import os
2024-import subprocess
2025
2026 import testtools
2027 import ubuntuuitoolkit
2028@@ -207,9 +206,7 @@
2029 if os.path.exists(path_to_local_launcher):
2030 return path_to_local_launcher
2031 else:
2032- arch = subprocess.check_output(
2033- ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
2034- universal_newlines=True).strip()
2035+ arch = ubuntuuitoolkit.base.get_host_multiarch()
2036 path_to_installed_launcher = os.path.join(
2037 '/', 'usr', 'lib', arch, 'ubuntu-ui-toolkit', 'launcher')
2038 return path_to_installed_launcher
2039
2040=== renamed file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderActionsTestCase.qml' => 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.ActionsTestCase.qml'
2041=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.DeprecatedHeaderSectionsTestCase.qml'
2042--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.DeprecatedHeaderSectionsTestCase.qml 1970-01-01 00:00:00 +0000
2043+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.DeprecatedHeaderSectionsTestCase.qml 2014-07-24 02:10:07 +0000
2044@@ -0,0 +1,50 @@
2045+/*
2046+ * Copyright 2014 Canonical Ltd.
2047+ *
2048+ * This program is free software; you can redistribute it and/or modify
2049+ * it under the terms of the GNU Lesser General Public License as published by
2050+ * the Free Software Foundation; version 3.
2051+ *
2052+ * This program is distributed in the hope that it will be useful,
2053+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2054+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2055+ * GNU Lesser General Public License for more details.
2056+ *
2057+ * You should have received a copy of the GNU Lesser General Public License
2058+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2059+ */
2060+
2061+import QtQuick 2.0
2062+import Ubuntu.Components 1.1
2063+
2064+MainView {
2065+ width: units.gu(48)
2066+ height: units.gu(60)
2067+
2068+ useDeprecatedToolbar: true
2069+
2070+ Page {
2071+ id: page
2072+ title: "Test title"
2073+
2074+ Column {
2075+ spacing: units.gu(1)
2076+ width: childrenRect.width
2077+ anchors.centerIn: parent
2078+
2079+ Label {
2080+ text: "Sections enabled"
2081+ }
2082+ Switch {
2083+ id: sectionsEnabledSWitch
2084+ objectName: "sections_enabled_switch"
2085+ checked: page.head.sections.enabled
2086+ onCheckedChanged: page.head.sections.enabled = checked
2087+ }
2088+ }
2089+
2090+ head {
2091+ sections.model: ["one", "two", "three"]
2092+ }
2093+ }
2094+}
2095
2096=== added file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.SectionsTestCase.qml'
2097--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.SectionsTestCase.qml 1970-01-01 00:00:00 +0000
2098+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.SectionsTestCase.qml 2014-07-24 02:10:07 +0000
2099@@ -0,0 +1,50 @@
2100+/*
2101+ * Copyright 2014 Canonical Ltd.
2102+ *
2103+ * This program is free software; you can redistribute it and/or modify
2104+ * it under the terms of the GNU Lesser General Public License as published by
2105+ * the Free Software Foundation; version 3.
2106+ *
2107+ * This program is distributed in the hope that it will be useful,
2108+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2109+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2110+ * GNU Lesser General Public License for more details.
2111+ *
2112+ * You should have received a copy of the GNU Lesser General Public License
2113+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2114+ */
2115+
2116+import QtQuick 2.0
2117+import Ubuntu.Components 1.1
2118+
2119+MainView {
2120+ width: units.gu(48)
2121+ height: units.gu(60)
2122+
2123+ useDeprecatedToolbar: false
2124+
2125+ Page {
2126+ id: page
2127+ title: "Test title"
2128+
2129+ Column {
2130+ spacing: units.gu(1)
2131+ width: childrenRect.width
2132+ anchors.centerIn: parent
2133+
2134+ Label {
2135+ text: "Sections enabled"
2136+ }
2137+ Switch {
2138+ id: sectionsEnabledSWitch
2139+ objectName: "sections_enabled_switch"
2140+ checked: page.head.sections.enabled
2141+ onCheckedChanged: page.head.sections.enabled = checked
2142+ }
2143+ }
2144+
2145+ head {
2146+ sections.model: ["one", "two", "three"]
2147+ }
2148+ }
2149+}
2150
2151=== renamed file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.HeaderToolsTestCase.qml' => 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.ToolsTestCase.qml'
2152=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
2153--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-29 21:44:06 +0000
2154+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-07-24 02:10:07 +0000
2155@@ -24,14 +24,14 @@
2156 from ubuntuuitoolkit import tests
2157
2158
2159-class HeaderTestCase(tests.QMLFileAppTestCase):
2160+class ActionsTestCase(tests.QMLFileAppTestCase):
2161
2162 path = os.path.abspath(__file__)
2163 dir_path = os.path.dirname(path)
2164 tools_test_qml_file_path = os.path.join(
2165- dir_path, 'test_header.HeaderToolsTestCase.qml')
2166+ dir_path, 'test_header.ToolsTestCase.qml')
2167 actions_test_qml_file_path = os.path.join(
2168- dir_path, 'test_header.HeaderActionsTestCase.qml')
2169+ dir_path, 'test_header.ActionsTestCase.qml')
2170
2171 scenarios = [
2172 ('deprecated tools',
2173@@ -41,7 +41,7 @@
2174 ]
2175
2176 def setUp(self):
2177- super(HeaderTestCase, self).setUp()
2178+ super(ActionsTestCase, self).setUp()
2179 self.header = self.main_view.get_header()
2180 self.label = self.app.select_single(
2181 'Label', objectName='clicked_label')
2182@@ -85,7 +85,6 @@
2183 def test_overflow_button(self):
2184 # there are 5 actions plus a custom back action
2185 overflow_button = self.header.select_single(
2186- 'AbstractButton',
2187 objectName='actions_overflow_button')
2188 self.assertEqual(overflow_button.visible, True)
2189
2190@@ -98,6 +97,73 @@
2191 self.assertEqual(overflow_button.visible, False)
2192
2193
2194+class SectionsTestCase(tests.QMLFileAppTestCase):
2195+
2196+ path = os.path.abspath(__file__)
2197+ dir_path = os.path.dirname(path)
2198+ test_qml_file_path = os.path.join(
2199+ dir_path, 'test_header.SectionsTestCase.qml')
2200+
2201+ def setUp(self):
2202+ super(SectionsTestCase, self).setUp()
2203+ self.header = self.main_view.get_header()
2204+ # initially, section 0 is selected
2205+ self.assertEqual(self.header.get_selected_section_index(), 0)
2206+
2207+ def test_select_sections(self):
2208+ for index in [1, 0, 2]:
2209+ self.header.switch_to_section_by_index(index)
2210+ self.assertEqual(self.header.get_selected_section_index(), index)
2211+
2212+ def test_select_sections_with_sections_disabled(self):
2213+ sectionsEnabledSwitch = self.app.select_single(
2214+ 'CheckBox', objectName='sections_enabled_switch')
2215+ sectionsEnabledSwitch.uncheck()
2216+ for index in [1, 0, 2]:
2217+ self.header.switch_to_section_by_index(index)
2218+ # cannot change section by tapping the section name in divider
2219+ self.assertEqual(self.header.get_selected_section_index(), 0)
2220+
2221+
2222+class DeprecatedHeaderSectionsTestCase(tests.QMLFileAppTestCase):
2223+
2224+ path = os.path.abspath(__file__)
2225+ dir_path = os.path.dirname(path)
2226+ test_qml_file_path = os.path.join(
2227+ dir_path, 'test_header.DeprecatedHeaderSectionsTestCase.qml')
2228+
2229+ def setUp(self):
2230+ super(DeprecatedHeaderSectionsTestCase, self).setUp()
2231+ self.header = self.main_view.get_header()
2232+
2233+ def test_get_selection_index(self):
2234+ error = self.assertRaises(
2235+ ubuntuuitoolkit.ToolkitException,
2236+ self.header.get_selected_section_index)
2237+ self.assertEqual(
2238+ str(error),
2239+ 'Old header has no sections')
2240+
2241+ def test_select_sections(self):
2242+ error = self.assertRaises(
2243+ ubuntuuitoolkit.ToolkitException,
2244+ self.header.switch_to_section_by_index, 1)
2245+ self.assertEqual(
2246+ str(error),
2247+ 'Old header has no sections')
2248+
2249+ def test_select_sections_with_sections_disabled(self):
2250+ sectionsEnabledSwitch = self.app.select_single(
2251+ 'CheckBox', objectName='sections_enabled_switch')
2252+ sectionsEnabledSwitch.uncheck()
2253+ error = self.assertRaises(
2254+ ubuntuuitoolkit.ToolkitException,
2255+ self.header.switch_to_section_by_index, 1)
2256+ self.assertEqual(
2257+ str(error),
2258+ 'Old header has no sections')
2259+
2260+
2261 class CustomMainView(ubuntuuitoolkit.MainView):
2262 """Autopilot helper for a custom main view."""
2263
2264
2265=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py'
2266--- tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2014-06-04 18:45:04 +0000
2267+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2014-07-24 02:10:07 +0000
2268@@ -19,24 +19,71 @@
2269 import os
2270 import shutil
2271
2272+from autopilot.matchers import Eventually
2273+from testtools.matchers import Equals
2274+
2275 import ubuntuuitoolkit
2276+from ubuntuuitoolkit import fixture_setup
2277
2278
2279 class GalleryTestCase(ubuntuuitoolkit.tests.QMLFileAppTestCase):
2280+
2281 """Base class for gallery test cases."""
2282
2283 local_desktop_file_path = None
2284
2285 def setUp(self):
2286- if self._application_source_exists():
2287- self.test_source_path = self._get_path_to_gallery_source()
2288- else:
2289- self.test_source_path = self._get_path_to_installed_gallery()
2290- assert os.path.exists(self.test_source_path)
2291+ self.test_source_path = self._get_test_source_path()
2292 self.test_qml_file_path = self._get_test_qml_file_path()
2293 self.desktop_file_path = self._get_desktop_file_path()
2294+
2295+ if self.should_simulate_device():
2296+ # Hide the Unity7 launcher because it takes space that might be
2297+ # needed by the app with the simulated size.
2298+ self.useFixture(fixture_setup.HideUnity7Launcher())
2299+ # This sets the grid units, so it should be called before launching
2300+ # the app.
2301+ self.simulate_device()
2302+
2303 super(GalleryTestCase, self).setUp()
2304
2305+ if self.should_simulate_device():
2306+ # XXX Currently we have no way to launch the application with a
2307+ # specific size, so we must resize it after it's launched.
2308+ # --elopio - 2014-06-25
2309+ self.resize_window()
2310+
2311+ def should_simulate_device(self):
2312+ return (hasattr(self, 'app_width') and hasattr(self, 'app_height') and
2313+ hasattr(self, 'grid_unit_px'))
2314+
2315+ def simulate_device(self):
2316+ simulate_device_fixture = self.useFixture(fixture_setup.SimulateDevice(
2317+ self.app_width, self.app_height, self.grid_unit_px))
2318+ self.app_width = simulate_device_fixture.app_width
2319+ self.app_height = simulate_device_fixture.app_height
2320+
2321+ def resize_window(self):
2322+ application = self.process_manager.get_running_applications()[0]
2323+ window = application.get_windows()[0]
2324+ window.resize(self.app_width, self.app_height)
2325+
2326+ def get_window_size():
2327+ _, _, window_width, window_height = window.geometry
2328+ return window_width, window_height
2329+
2330+ self.assertThat(
2331+ get_window_size,
2332+ Eventually(Equals((self.app_width, self.app_height))))
2333+
2334+ def _get_test_source_path(self):
2335+ if self._application_source_exists():
2336+ test_source_path = self._get_path_to_gallery_source()
2337+ else:
2338+ test_source_path = self._get_path_to_installed_gallery()
2339+ assert os.path.exists(test_source_path)
2340+ return test_source_path
2341+
2342 def _get_path_to_gallery_source(self):
2343 return os.path.join(
2344 ubuntuuitoolkit.tests.get_path_to_source_root(), 'examples',
2345
2346=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py'
2347--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-05-30 14:24:27 +0000
2348+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-07-24 02:10:07 +0000
2349@@ -1,6 +1,6 @@
2350 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2351 #
2352-# Copyright (C) 2012, 2013 Canonical Ltd.
2353+# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
2354 #
2355 # This program is free software; you can redistribute it and/or modify
2356 # it under the terms of the GNU Lesser General Public License as published by
2357@@ -16,14 +16,19 @@
2358
2359 """Tests for the Ubuntu UI Toolkit Gallery - Button component"""
2360
2361+import testscenarios
2362 from autopilot.matchers import Eventually
2363 from testtools.matchers import Equals
2364-from ubuntuuitoolkit.tests.gallery import GalleryTestCase
2365-
2366-
2367-class ButtonsTestCase(GalleryTestCase):
2368-
2369- scenarios = [
2370+
2371+from ubuntuuitoolkit import ubuntu_scenarios
2372+from ubuntuuitoolkit.tests import gallery
2373+
2374+import os
2375+
2376+
2377+class ButtonsTestCase(gallery.GalleryTestCase):
2378+
2379+ buttons_scenarios = [
2380 ('standard button', dict(
2381 button_name="button_text", is_enabled=True, color=None, icon=None,
2382 text="Call")),
2383@@ -44,6 +49,15 @@
2384 icon=None, text="Call"))
2385 ]
2386
2387+ scenarios = testscenarios.multiply_scenarios(
2388+ ubuntu_scenarios.get_device_simulation_scenarios(),
2389+ buttons_scenarios)
2390+
2391+ def setUp(self):
2392+ # Reset the locale to English
2393+ os.environ['LANGUAGE'] = 'en'
2394+ super(ButtonsTestCase, self).setUp()
2395+
2396 def test_buttons(self):
2397 self.open_page('buttonsElement')
2398
2399
2400=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py'
2401--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-06-18 05:35:24 +0000
2402+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-07-24 02:10:07 +0000
2403@@ -16,13 +16,18 @@
2404
2405 """Tests for the Ubuntu UI Toolkit Gallery"""
2406
2407+import testscenarios
2408+
2409 import ubuntuuitoolkit
2410+from ubuntuuitoolkit import ubuntu_scenarios
2411 from ubuntuuitoolkit.tests import gallery
2412
2413
2414 class GalleryAppTestCase(gallery.GalleryTestCase):
2415 """Generic tests for the Gallery"""
2416
2417+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
2418+
2419 def test_select_main_view_must_return_main_window_emulator(self):
2420 main_view = self.main_view
2421 self.assertIsInstance(main_view, ubuntuuitoolkit.MainView)
2422@@ -91,13 +96,17 @@
2423 'sheets', 'animations'
2424 ]
2425
2426- scenarios = [
2427+ pages_scenarios = [
2428 (name, dict(
2429 element_name=name+'Element',
2430 template_name=name+'Template'))
2431 for name in names
2432 ]
2433
2434+ scenarios = testscenarios.multiply_scenarios(
2435+ ubuntu_scenarios.get_device_simulation_scenarios(),
2436+ pages_scenarios)
2437+
2438 def test_open_page(self):
2439 self.open_page(self.element_name)
2440 element = self.main_view.select_single(
2441
2442=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py'
2443--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-05-30 14:24:27 +0000
2444+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-07-24 02:10:07 +0000
2445@@ -17,11 +17,14 @@
2446 """Tests for the Ubuntu UI Toolkit Gallery - OptionSelector component."""
2447
2448 import ubuntuuitoolkit
2449+from ubuntuuitoolkit import ubuntu_scenarios
2450 from ubuntuuitoolkit.tests.gallery import GalleryTestCase
2451
2452
2453 class OptionSelectorTestCase(GalleryTestCase):
2454
2455+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
2456+
2457 def setUp(self):
2458 super(OptionSelectorTestCase, self).setUp()
2459 self.open_page('optionSelectorsElement')
2460
2461=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py'
2462--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 2014-06-09 17:20:43 +0000
2463+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 2014-07-24 02:10:07 +0000
2464@@ -16,11 +16,14 @@
2465
2466 from autopilot import platform
2467
2468+from ubuntuuitoolkit import ubuntu_scenarios
2469 from ubuntuuitoolkit.tests import gallery
2470
2471
2472 class ScrollBarTestCase(gallery.GalleryTestCase):
2473
2474+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
2475+
2476 def setUp(self):
2477 super(ScrollBarTestCase, self).setUp()
2478 self.open_page('navigationElement')
2479@@ -30,9 +33,12 @@
2480 def move_mouse_to_thumb(self):
2481 # TODO we need a helper to move the interactive thumb.
2482 # --elopio 2014-05-06
2483- thumb = self.scrollbar.select_single(
2484+ thumb = self.get_mouse_thumb()
2485+ self.pointing_device.move_to_object(thumb)
2486+
2487+ def get_mouse_thumb(self):
2488+ return self.scrollbar.select_single(
2489 objectName='interactiveScrollbarThumb')
2490- self.pointing_device.move_to_object(thumb)
2491
2492 def test_scrollbar_must_start_without_interactive_thumb(self):
2493 self.assertEqual(self.scrollbar.interactive, False)
2494@@ -57,7 +63,12 @@
2495 self.assertEqual(flickable.is_child_visible(bottom_section), False)
2496
2497 self.move_mouse_to_thumb()
2498- x, y = self.pointing_device.position()
2499- self.pointing_device.drag(x, y, x, self.main_view.height)
2500+ mouse_thumb = self.get_mouse_thumb()
2501+ x, y, width, height = mouse_thumb.globalRect
2502+ start_x = stop_x = x + (width // 2)
2503+ start_y = y + (height // 0.8)
2504+
2505+ self.pointing_device.drag(
2506+ start_x, start_y, stop_x, self.main_view.height)
2507
2508 self.assertEqual(flickable.is_child_visible(bottom_section), True)
2509
2510=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py'
2511--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-05-30 14:24:27 +0000
2512+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-07-24 02:10:07 +0000
2513@@ -16,7 +16,9 @@
2514
2515 """Tests for the Ubuntu UI Toolkit Gallery - TextInput components"""
2516
2517-from ubuntuuitoolkit import emulators
2518+import testscenarios
2519+
2520+from ubuntuuitoolkit import emulators, ubuntu_scenarios
2521 from ubuntuuitoolkit.tests.gallery import GalleryTestCase
2522 import locale
2523
2524@@ -31,7 +33,7 @@
2525
2526 # text_to_write is a function to ensure
2527 # that locale is evaluated after setUp
2528- scenarios = [
2529+ text_input_scenarios = [
2530 ('standard textfield', dict(
2531 objectName='textfield_standard',
2532 text_to_write=text_to_write_string,
2533@@ -49,6 +51,10 @@
2534 expected_text='-100123'))
2535 ]
2536
2537+ scenarios = testscenarios.multiply_scenarios(
2538+ ubuntu_scenarios.get_device_simulation_scenarios(),
2539+ text_input_scenarios)
2540+
2541 def setUp(self):
2542 super(WriteAndClearTextInputTestCase, self).setUp()
2543 # Apply the user locale from the environment
2544@@ -74,6 +80,8 @@
2545
2546 class DisabledTextInputTestCase(GalleryTestCase):
2547
2548+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
2549+
2550 def setUp(self):
2551 super(DisabledTextInputTestCase, self).setUp()
2552 self.open_page('textinputsElement')
2553
2554=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py'
2555--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2014-05-30 14:24:27 +0000
2556+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2014-07-24 02:10:07 +0000
2557@@ -1,6 +1,6 @@
2558 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2559 #
2560-# Copyright (C) 2012, 2013 Canonical Ltd.
2561+# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
2562 #
2563 # This program is free software; you can redistribute it and/or modify
2564 # it under the terms of the GNU Lesser General Public License as published by
2565@@ -14,15 +14,17 @@
2566 # You should have received a copy of the GNU Lesser General Public License
2567 # along with this program. If not, see <http://www.gnu.org/licenses/>.
2568
2569-from ubuntuuitoolkit import emulators
2570+import testscenarios
2571+
2572+from testtools.matchers import Equals
2573+
2574+from ubuntuuitoolkit import emulators, ubuntu_scenarios
2575 from ubuntuuitoolkit.tests import gallery
2576
2577-from testtools.matchers import Equals
2578-
2579
2580 class EnabledTogglesTestCase(gallery.GalleryTestCase):
2581
2582- scenarios = [
2583+ toggles_scenarios = [
2584 ('checkbox unchecked', dict(
2585 object_name='checkbox_unchecked', initial_state=False)),
2586 ('checkbox checked', dict(
2587@@ -33,6 +35,10 @@
2588 object_name='switch_checked', initial_state=True))
2589 ]
2590
2591+ scenarios = testscenarios.multiply_scenarios(
2592+ ubuntu_scenarios.get_device_simulation_scenarios(),
2593+ toggles_scenarios)
2594+
2595 def setUp(self):
2596 super(EnabledTogglesTestCase, self).setUp()
2597 self.open_page('togglesElement')
2598@@ -49,7 +55,7 @@
2599
2600 class DisabledTogglesTestCase(gallery.GalleryTestCase):
2601
2602- scenarios = [
2603+ toggles_scenarios = [
2604 ('checkbox disabled unchecked', dict(
2605 object_name='checkbox_disabled_unchecked', initial_state=False)),
2606 ('checkbox disabled checked', dict(
2607@@ -60,6 +66,10 @@
2608 object_name='switch_disabled_checked', initial_state=True))
2609 ]
2610
2611+ scenarios = testscenarios.multiply_scenarios(
2612+ ubuntu_scenarios.get_device_simulation_scenarios(),
2613+ toggles_scenarios)
2614+
2615 def setUp(self):
2616 super(DisabledTogglesTestCase, self).setUp()
2617 self.open_page('togglesElement')
2618
2619=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
2620--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-06-03 20:10:53 +0000
2621+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-07-24 02:10:07 +0000
2622@@ -24,10 +24,15 @@
2623 # Python 2 add-on: python-mock.
2624 import mock
2625 import testtools
2626-from autopilot import testcase as autopilot_testcase
2627-from testtools.matchers import Contains, FileExists, Not
2628+from autopilot import (
2629+ display,
2630+ platform,
2631+ testcase as autopilot_testcase
2632+)
2633+from autopilot.matchers import Eventually
2634+from testtools.matchers import Contains, Equals, FileExists, Not
2635
2636-from ubuntuuitoolkit import base, environment, fixture_setup
2637+from ubuntuuitoolkit import base, environment, fixture_setup, tests
2638
2639
2640 class FakeApplicationTestCase(testtools.TestCase):
2641@@ -304,3 +309,99 @@
2642 self.assertTrue(
2643 os.path.exists(
2644 os.path.join(os.environ.get('HOME'), '.Xauthority')))
2645+
2646+
2647+class HideUnity7LauncherTestCase(
2648+ tests.UbuntuUIToolkitWithFakeAppRunningTestCase):
2649+
2650+ def setUp(self):
2651+ if platform.model() != 'Desktop':
2652+ self.skipTest('Unity 7 runs only on desktop.')
2653+ self.useFixture(fixture_setup.HideUnity7Launcher())
2654+ super(HideUnity7LauncherTestCase, self).setUp()
2655+
2656+ def test_maximized_application_must_use_all_screen_width(self):
2657+ application = self.process_manager.get_running_applications()[0]
2658+ window = application.get_windows()[0]
2659+
2660+ # Maximize window.
2661+ screen = display.Display.create()
2662+ screen_width = screen.get_screen_width()
2663+ screen_height = screen.get_screen_height()
2664+ window.resize(screen_width, screen_height)
2665+
2666+ def get_window_width():
2667+ _, _, window_width, _ = window.geometry
2668+ return window_width
2669+
2670+ self.assertThat(
2671+ get_window_width,
2672+ Eventually(Equals(screen_width)))
2673+
2674+
2675+class FakeDisplay(object):
2676+
2677+ """Fake display with fixed widht and height for use in tests."""
2678+
2679+ def __init__(self, width, height):
2680+ super(FakeDisplay, self).__init__()
2681+ self.width = width
2682+ self.height = height
2683+
2684+ def get_screen_width(self):
2685+ return self.width
2686+
2687+ def get_screen_height(self):
2688+ return self.height
2689+
2690+
2691+class SimulateDeviceTestCase(autopilot_testcase.AutopilotTestCase):
2692+
2693+ scenarios = [
2694+ ('Device equal to screen', {
2695+ 'device_width': 100, 'device_height': 100, 'device_grid_unit': 20,
2696+ 'screen_width': 100, 'screen_height': 100,
2697+ 'expected_width': 100, 'expected_height': 100,
2698+ 'expected_grid_unit': 20}),
2699+ ('Device smaller than screen', {
2700+ 'device_width': 100, 'device_height': 90, 'device_grid_unit': 20,
2701+ 'screen_width': 110, 'screen_height': 100,
2702+ 'expected_width': 100, 'expected_height': 90,
2703+ 'expected_grid_unit': 20}),
2704+ ('Device wider than screen', {
2705+ 'device_width': 200, 'device_height': 90, 'device_grid_unit': 20,
2706+ 'screen_width': 110, 'screen_height': 100,
2707+ 'expected_width': 100, 'expected_height': 45,
2708+ 'expected_grid_unit': 10}),
2709+ ('Device taller than screen', {
2710+ 'device_width': 100, 'device_height': 180, 'device_grid_unit': 20,
2711+ 'screen_width': 110, 'screen_height': 100,
2712+ 'expected_width': 50, 'expected_height': 90,
2713+ 'expected_grid_unit': 10}),
2714+ ('Device bigger than screen', {
2715+ 'device_width': 200, 'device_height': 180, 'device_grid_unit': 20,
2716+ 'screen_width': 110, 'screen_height': 100,
2717+ 'expected_width': 100, 'expected_height': 90,
2718+ 'expected_grid_unit': 10}),
2719+ ]
2720+
2721+ def test_simulate_device_fixture_with_size_smaller_than_screen(self):
2722+ """Test the simulation of a device that fits the screen.
2723+
2724+ All the attributes of the fixture must remain the same.
2725+
2726+ """
2727+
2728+ simulate_device_fixture = fixture_setup.SimulateDevice(
2729+ self.device_width, self.device_height, self.device_grid_unit)
2730+ fake_display = FakeDisplay(self.screen_width, self.screen_height)
2731+ simulate_device_fixture._screen = fake_display
2732+
2733+ self.useFixture(simulate_device_fixture)
2734+
2735+ self.assertEqual(
2736+ int(os.environ.get('GRID_UNIT_PX')), self.expected_grid_unit)
2737+ self.assertEqual(
2738+ simulate_device_fixture.app_width, self.expected_width)
2739+ self.assertEqual(
2740+ simulate_device_fixture.app_height, self.expected_height)
2741
2742=== added file 'tests/autopilot/ubuntuuitoolkit/tests/test_ubuntu_scenarios.py'
2743--- tests/autopilot/ubuntuuitoolkit/tests/test_ubuntu_scenarios.py 1970-01-01 00:00:00 +0000
2744+++ tests/autopilot/ubuntuuitoolkit/tests/test_ubuntu_scenarios.py 2014-07-24 02:10:07 +0000
2745@@ -0,0 +1,70 @@
2746+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2747+#
2748+# Copyright (C) 2014 Canonical Ltd.
2749+#
2750+# This program is free software; you can redistribute it and/or modify
2751+# it under the terms of the GNU Lesser General Public License as published by
2752+# the Free Software Foundation; version 3.
2753+#
2754+# This program is distributed in the hope that it will be useful,
2755+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2756+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2757+# GNU Lesser General Public License for more details.
2758+#
2759+# You should have received a copy of the GNU Lesser General Public License
2760+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2761+
2762+try:
2763+ from unittest import mock
2764+except ImportError:
2765+ import mock
2766+
2767+import testtools
2768+
2769+from ubuntuuitoolkit import ubuntu_scenarios
2770+
2771+
2772+class ScenariosTestCase(testtools.TestCase):
2773+
2774+ def test_get_nexus_4_scenario(self):
2775+ expected_scenarios = [
2776+ ('Simulating Nexus 4 in desktop',
2777+ dict(app_width=768, app_height=1280, grid_unit_px=18)),
2778+ ]
2779+ with mock.patch('autopilot.platform.model') as mock_model:
2780+ mock_model.return_value = 'Desktop'
2781+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios(
2782+ devices=ubuntu_scenarios.NEXUS4_DEVICE)
2783+ self.assertEqual(expected_scenarios, scenarios)
2784+
2785+ def test_get_nexus_10_scenario(self):
2786+ expected_scenarios = [
2787+ ('Simulating Nexus 10 in desktop',
2788+ dict(app_width=2560, app_height=1600, grid_unit_px=20))
2789+ ]
2790+
2791+ with mock.patch('autopilot.platform.model') as mock_model:
2792+ mock_model.return_value = 'Desktop'
2793+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios(
2794+ devices=ubuntu_scenarios.NEXUS10_DEVICE)
2795+ self.assertEqual(expected_scenarios, scenarios)
2796+
2797+ def test_get_default_scenarios_must_return_supported_devices(self):
2798+ expected_scenarios = [
2799+ ('Simulating Nexus 4 in desktop',
2800+ dict(app_width=768, app_height=1280, grid_unit_px=18)),
2801+ ('Simulating Nexus 10 in desktop',
2802+ dict(app_width=2560, app_height=1600, grid_unit_px=20))
2803+ ]
2804+
2805+ with mock.patch('autopilot.platform.model') as mock_model:
2806+ mock_model.return_value = 'Desktop'
2807+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
2808+ self.assertEqual(expected_scenarios, scenarios)
2809+
2810+ def test_get_scenarios_on_device_must_return_no_simulation_scenarios(self):
2811+ with mock.patch('autopilot.platform.model') as mock_model:
2812+ mock_model.return_value = 'Not Desktop'
2813+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
2814+
2815+ self.assertEqual([('Not Desktop', {})], scenarios)
2816
2817=== added file 'tests/autopilot/ubuntuuitoolkit/ubuntu_scenarios.py'
2818--- tests/autopilot/ubuntuuitoolkit/ubuntu_scenarios.py 1970-01-01 00:00:00 +0000
2819+++ tests/autopilot/ubuntuuitoolkit/ubuntu_scenarios.py 2014-07-24 02:10:07 +0000
2820@@ -0,0 +1,54 @@
2821+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2822+#
2823+# Copyright (C) 2014 Canonical Ltd.
2824+#
2825+# This program is free software; you can redistribute it and/or modify
2826+# it under the terms of the GNU Lesser General Public License as published by
2827+# the Free Software Foundation; version 3.
2828+#
2829+# This program is distributed in the hope that it will be useful,
2830+# but WITHOUT ANY WARRANTY; without even the implied warranty of
2831+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2832+# GNU Lesser General Public License for more details.
2833+#
2834+# You should have received a copy of the GNU Lesser General Public License
2835+# along with this program. If not, see <http://www.gnu.org/licenses/>.
2836+
2837+from autopilot import platform
2838+
2839+
2840+NEXUS4_DEVICE = 'Nexus4'
2841+NEXUS10_DEVICE = 'Nexus10'
2842+DEFAULT_DEVICES = (NEXUS4_DEVICE, NEXUS10_DEVICE)
2843+
2844+
2845+def get_device_simulation_scenarios(devices=DEFAULT_DEVICES):
2846+ """Return a list of devices to be simulated on tests.
2847+
2848+ :param devices: The device or devices to simulate. Default value is all the
2849+ officially supported devices.
2850+ :type devices: string or sequence of strings.
2851+ :return: A list of scenarios to be used with the testscenarios python
2852+ module, with the values of app_width, app_height and grid_unit
2853+ corresponding to the selected device.
2854+
2855+ """
2856+ if platform.model() == 'Desktop':
2857+ return _get_device_simulation_scenarios_for_desktop(devices)
2858+ else:
2859+ return [(platform.model(), {})]
2860+
2861+
2862+def _get_device_simulation_scenarios_for_desktop(devices):
2863+ scenarios = []
2864+ if NEXUS4_DEVICE in devices:
2865+ scenarios.append(
2866+ ('Simulating Nexus 4 in desktop',
2867+ dict(app_width=768, app_height=1280, grid_unit_px=18))
2868+ )
2869+ if NEXUS10_DEVICE in devices:
2870+ scenarios.append(
2871+ ('Simulating Nexus 10 in desktop',
2872+ dict(app_width=2560, app_height=1600, grid_unit_px=20))
2873+ )
2874+ return scenarios
2875
2876=== modified file 'tests/qmlapicheck.py'
2877--- tests/qmlapicheck.py 2014-07-03 13:30:32 +0000
2878+++ tests/qmlapicheck.py 2014-07-24 02:10:07 +0000
2879@@ -23,7 +23,7 @@
2880
2881 if len(sys.argv) < 2 or '-h' in sys.argv or '--help' in sys.argv:
2882 basename = os.path.basename(sys.argv[0])
2883- print (
2884+ sys.exit(
2885 'Usage:\n env BUILTINS=foo,bar %s FILENAME [FILENAME2..N]\n\n'
2886 ' Generate a QML API file\n'
2887 'Example:\n'
2888@@ -42,7 +42,6 @@
2889 '\n'
2890 'Use the following command to see changes in the API:\n'
2891 ' diff -Fqml -u components.api{,.new}\n' % (basename, basename))
2892- sys.exit(1)
2893
2894 builtins = os.getenv('BUILTINS', '').split(',')
2895 inputfiles = []
2896@@ -96,8 +95,7 @@
2897 'prototype',
2898 'exports']
2899 else:
2900- print('Unknown filetype %s' % fileinput.filename())
2901- sys.exit(1)
2902+ sys.exit('Unknown filetype %s' % fileinput.filename())
2903 if fileinput.filename() in classes:
2904 classname = ' '.join(classes[fileinput.filename()])
2905 else:
2906@@ -187,9 +185,9 @@
2907 annotated_properties[name] = 'internal'
2908 del annotated_properties['internal']
2909 if name not in annotated_properties:
2910- print(' %s' % (signature))
2911- print('Error: Missing \\qmlproperty for %s' % name)
2912- sys.exit(1)
2913+ sys.exit(
2914+ ' %s\nError: Missing \\qmlproperty for %s'
2915+ % (signature, name))
2916 real_type = annotated_properties[name]
2917 signature = signature.replace('alias', real_type)
2918 elif filetype == 'qmltypes':
2919
2920=== modified file 'tests/qmlapicheck.sh'
2921--- tests/qmlapicheck.sh 2014-06-19 07:21:53 +0000
2922+++ tests/qmlapicheck.sh 2014-07-24 02:10:07 +0000
2923@@ -25,7 +25,7 @@
2924 # Silence spam on stderr due to fonts
2925 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
2926 # https://bugreports.qt-project.org/browse/QTBUG-36243
2927- qmlplugindump $i 0.1 modules 1>> plugins.qmltypes
2928+ ALARM_BACKEND=memory qmlplugindump $i 0.1 modules 1>> plugins.qmltypes
2929 test $? != 0 && ERRORS=1
2930 done
2931 test $ERRORS = 1 && echo Error: qmlplugindump failed && exit 1
2932
2933=== renamed directory 'tests/resources/toolbar' => 'tests/resources/header'
2934=== modified file 'tests/resources/header/header.qml'
2935--- tests/resources/toolbar/header.qml 2014-07-04 11:25:50 +0000
2936+++ tests/resources/header/header.qml 2014-07-24 02:10:07 +0000
2937@@ -178,6 +178,24 @@
2938 ]
2939 }
2940 }
2941+ Tab {
2942+ title: "Sections"
2943+ page: Page {
2944+ id: sectionsPage
2945+ head {
2946+ sections {
2947+ model: ["navy", "lightblue", "brown", "cyan", "darkgrey"]
2948+ }
2949+ }
2950+ Rectangle {
2951+ anchors {
2952+ fill: parent
2953+ margins: units.gu(2)
2954+ }
2955+ color: sectionsPage.head.sections.model[sectionsPage.head.sections.selectedIndex]
2956+ }
2957+ }
2958+ }
2959 }
2960 }
2961
2962
2963=== modified file 'tests/unit/runtest.sh'
2964--- tests/unit/runtest.sh 2014-06-16 08:02:48 +0000
2965+++ tests/unit/runtest.sh 2014-07-24 02:10:07 +0000
2966@@ -45,6 +45,7 @@
2967 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
2968 # https://bugreports.qt-project.org/browse/QTBUG-36243
2969 QML2_IMPORT_PATH=../../../modules:$QML2_IMPORT_PATH UBUNTU_UI_TOOLKIT_THEMES_PATH=../../../modules \
2970+ ALARM_BACKEND=memory \
2971 $_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory'
2972 # Note: Get first command before the pipe, $? would be ambiguous
2973 RESULT=${PIPESTATUS[0]}
2974
2975=== modified file 'tests/unit/tst_components/tst_fontutils.qml'
2976--- tests/unit/tst_components/tst_fontutils.qml 2014-04-23 08:50:20 +0000
2977+++ tests/unit/tst_components/tst_fontutils.qml 2014-07-24 02:10:07 +0000
2978@@ -22,12 +22,12 @@
2979 name: "FontUtilsAPI"
2980
2981 function test_modularScale() {
2982- compare(FontUtils.modularScale("xx-small"), 0.606, "xx-small scale");
2983- compare(FontUtils.modularScale("x-small"), 0.707, "x-small scale");
2984- compare(FontUtils.modularScale("small"), 0.857, "small scale");
2985- compare(FontUtils.modularScale("medium"), 1.0, "medium scale");
2986- compare(FontUtils.modularScale("large"), 1.414, "large scale");
2987- compare(FontUtils.modularScale("x-large"), 1.905, "x-large scale");
2988+ compare(FontUtils.modularScale("xx-small"), 0.677, "xx-small scale");
2989+ compare(FontUtils.modularScale("x-small"), 0.804, "x-small scale");
2990+ compare(FontUtils.modularScale("small"), 0.931, "small scale");
2991+ compare(FontUtils.modularScale("medium"), 1.079, "medium scale");
2992+ compare(FontUtils.modularScale("large"), 1.291, "large scale");
2993+ compare(FontUtils.modularScale("x-large"), 1.714, "x-large scale");
2994 }
2995
2996 function test_modularScale_failures() {
2997@@ -36,12 +36,12 @@
2998 }
2999
3000 function test_sizeToPixels() {
3001- compare(FontUtils.sizeToPixels("xx-small"), 0.606 * units.dp(14), "xx-small scale");
3002- compare(FontUtils.sizeToPixels("x-small"), 0.707 * units.dp(14), "x-small scale");
3003- compare(FontUtils.sizeToPixels("small"), 0.857 * units.dp(14), "small scale");
3004- compare(FontUtils.sizeToPixels("medium"), 1.0 * units.dp(14), "medium scale");
3005- compare(FontUtils.sizeToPixels("large"), 1.414 * units.dp(14), "large scale");
3006- compare(FontUtils.sizeToPixels("x-large"), 1.905 * units.dp(14), "x-large scale");
3007+ compare(FontUtils.sizeToPixels("xx-small"), 0.677 * units.dp(14), "xx-small scale");
3008+ compare(FontUtils.sizeToPixels("x-small"), 0.804 * units.dp(14), "x-small scale");
3009+ compare(FontUtils.sizeToPixels("small"), 0.931 * units.dp(14), "small scale");
3010+ compare(FontUtils.sizeToPixels("medium"), 1.079 * units.dp(14), "medium scale");
3011+ compare(FontUtils.sizeToPixels("large"), 1.291 * units.dp(14), "large scale");
3012+ compare(FontUtils.sizeToPixels("x-large"), 1.714 * units.dp(14), "x-large scale");
3013 }
3014
3015 function test_sizeToPixels_failures() {
3016
3017=== added file 'tests/unit/tst_components/tst_header_sections.qml'
3018--- tests/unit/tst_components/tst_header_sections.qml 1970-01-01 00:00:00 +0000
3019+++ tests/unit/tst_components/tst_header_sections.qml 2014-07-24 02:10:07 +0000
3020@@ -0,0 +1,79 @@
3021+/*
3022+ * Copyright 2014 Canonical Ltd.
3023+ *
3024+ * This program is free software; you can redistribute it and/or modify
3025+ * it under the terms of the GNU Lesser General Public License as published by
3026+ * the Free Software Foundation; version 3.
3027+ *
3028+ * This program is distributed in the hope that it will be useful,
3029+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3030+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3031+ * GNU Lesser General Public License for more details.
3032+ *
3033+ * You should have received a copy of the GNU Lesser General Public License
3034+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3035+ */
3036+
3037+import QtQuick 2.2
3038+import QtTest 1.0
3039+import Ubuntu.Components 1.1
3040+import Ubuntu.Test 1.0
3041+
3042+UbuntuTestCase {
3043+ name: "PageHeadSectionsAPI"
3044+
3045+ MainView {
3046+ id: mainView
3047+ width: units.gu(50)
3048+ height: units.gu(80)
3049+
3050+ useDeprecatedToolbar: false
3051+
3052+ Page {
3053+ id: page
3054+ title: "Sections"
3055+ head {
3056+ sections {
3057+ model: ["one", "two", "three"]
3058+ }
3059+ }
3060+ }
3061+ }
3062+
3063+ function initTestCase() {
3064+ compare(mainView.active, true, "MainView always active.");
3065+ compare(page.active, true, "Single page is active in MainView.");
3066+ }
3067+
3068+ function test_number_of_sections() {
3069+ var sectionsRepeater = findChild(mainView, "page_head_sections_repeater");
3070+ compare(sectionsRepeater.count, 3, "Number of sections initialization failed.");
3071+ page.head.sections.model = ["one"]
3072+ compare(sectionsRepeater.count, 1, "Number of sections not updated.");
3073+ page.head.sections.model = ["one", "two", "three"];
3074+ compare(sectionsRepeater.count, 3, "Number of sections reverted.");
3075+ }
3076+
3077+ function check_selected_button(numberOfButtons, selectedButtonIndex) {
3078+ for (var i = 0; i < numberOfButtons; i++) {
3079+ var button = findChild(mainView, "section_button_"+i);
3080+ if (i === selectedButtonIndex) {
3081+ compare(button.selected, true, "Button "+i+" is not selected.");
3082+ } else {
3083+ compare(button.selected, false, "Button "+i+" is selected.");
3084+ }
3085+ }
3086+ }
3087+
3088+ function test_selected_section() {
3089+ var sectionsRepeater = findChild(mainView, "page_head_sections_repeater");
3090+ var count = sectionsRepeater.count;
3091+ check_selected_button(count, 0);
3092+ page.head.sections.selectedIndex = 2;
3093+ check_selected_button(count, 2);
3094+ page.head.sections.selectedIndex = 1;
3095+ check_selected_button(count, 1);
3096+ page.head.sections.selectedIndex = 0;
3097+ check_selected_button(count, 0);
3098+ }
3099+}
3100
3101=== modified file 'tests/unit/tst_components/tst_progressbar.qml'
3102--- tests/unit/tst_components/tst_progressbar.qml 2014-04-23 08:50:20 +0000
3103+++ tests/unit/tst_components/tst_progressbar.qml 2014-07-24 02:10:07 +0000
3104@@ -16,7 +16,8 @@
3105
3106 import QtQuick 2.0
3107 import QtTest 1.0
3108-import Ubuntu.Components 1.1
3109+// Note: See tst_progressbar11.qml for the newer API tests
3110+import Ubuntu.Components 1.0
3111
3112 TestCase {
3113 name: "ProgressBarAPI"
3114@@ -28,6 +29,10 @@
3115 compare(progressBar.indeterminate,newIndeterminated,"can set/get")
3116 }
3117
3118+ function test_showProgressPercentageExists() {
3119+ verify(!progressBar.hasOwnProperty("showProgressPercentage"), "Property absent")
3120+ }
3121+
3122 function test_maximumValue() {
3123 compare(progressBar.maximumValue,1.0,"is set to 1.0 by default")
3124 var newMaximumValue = 20.0
3125
3126=== added file 'tests/unit/tst_components/tst_progressbar11.qml'
3127--- tests/unit/tst_components/tst_progressbar11.qml 1970-01-01 00:00:00 +0000
3128+++ tests/unit/tst_components/tst_progressbar11.qml 2014-07-24 02:10:07 +0000
3129@@ -0,0 +1,38 @@
3130+/*
3131+ * Copyright 2014 Canonical Ltd.
3132+ *
3133+ * This program is free software; you can redistribute it and/or modify
3134+ * it under the terms of the GNU Lesser General Public License as published by
3135+ * the Free Software Foundation; version 3.
3136+ *
3137+ * This program is distributed in the hope that it will be useful,
3138+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3139+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3140+ * GNU Lesser General Public License for more details.
3141+ *
3142+ * You should have received a copy of the GNU Lesser General Public License
3143+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3144+ */
3145+
3146+import QtQuick 2.0
3147+import QtTest 1.0
3148+import Ubuntu.Components 1.1
3149+
3150+TestCase {
3151+ name: "ProgressBarAPI"
3152+
3153+ function test_showProgressPercentageExists() {
3154+ verify(progressBar.hasOwnProperty("showProgressPercentage"), "Property missing")
3155+ }
3156+
3157+ function test_noLabel() {
3158+ compare(progressBar.showProgressPercentage,true, "is set by default")
3159+ var newShowProgressPercentage = false
3160+ progressBar.showProgressPercentage = newShowProgressPercentage
3161+ compare(progressBar.showProgressPercentage, newShowProgressPercentage, "can set/get")
3162+ }
3163+
3164+ ProgressBar {
3165+ id: progressBar
3166+ }
3167+}
3168
3169=== added file 'tests/unit_x11/tst_components/tst_animator.qml'
3170--- tests/unit_x11/tst_components/tst_animator.qml 1970-01-01 00:00:00 +0000
3171+++ tests/unit_x11/tst_components/tst_animator.qml 2014-07-24 02:10:07 +0000
3172@@ -0,0 +1,75 @@
3173+/*
3174+ * Copyright 2014 Canonical Ltd.
3175+ *
3176+ * This program is free software; you can redistribute it and/or modify
3177+ * it under the terms of the GNU Lesser General Public License as published by
3178+ * the Free Software Foundation; version 3.
3179+ *
3180+ * This program is distributed in the hope that it will be useful,
3181+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
3182+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3183+ * GNU Lesser General Public License for more details.
3184+ *
3185+ * You should have received a copy of the GNU Lesser General Public License
3186+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
3187+ */
3188+
3189+
3190+/**
3191+ * Test to prevent regressions for bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1338602
3192+ * Activity Indicator crashes in QML/Widget mixed applications
3193+ */
3194+
3195+import QtQuick 2.2
3196+import QtQuick.Window 2.1
3197+import QtTest 1.0
3198+import Ubuntu.Components 1.1
3199+
3200+Item {
3201+ width: 360
3202+ height: 360
3203+ Window {
3204+ id: root
3205+ width: 360
3206+ height: 360
3207+
3208+ property int timeout: 500
3209+ property int runs: 20
3210+ property bool finished: false
3211+
3212+ TestCase {
3213+ name: "AnimatorRegressionTest"
3214+ when: windowShown
3215+
3216+ function test_show_hide () {
3217+ tryCompare(root,"finished",true,root.timeout * (root.runs+1));
3218+ }
3219+ }
3220+
3221+ Timer {
3222+ property int hits: 0
3223+ interval: root.timeout; running: !root.finished; repeat: !root.finished
3224+ onTriggered: {
3225+ hits++;
3226+ if (hits >= root.runs) {
3227+ root.visible = true;
3228+ root.finished = true;
3229+ return;
3230+ }
3231+
3232+ root.visible = !root.visible
3233+ }
3234+ }
3235+
3236+ Flow {
3237+ anchors.fill: parent
3238+ Repeater {
3239+ model: 3
3240+
3241+ ActivityIndicator {
3242+ running: true
3243+ }
3244+ }
3245+ }
3246+ }
3247+}
3248
3249=== modified file 'tests/unit_x11/tst_components/tst_panel.qml'
3250--- tests/unit_x11/tst_components/tst_panel.qml 2014-04-23 08:50:20 +0000
3251+++ tests/unit_x11/tst_components/tst_panel.qml 2014-07-24 02:10:07 +0000
3252@@ -17,6 +17,7 @@
3253 import QtQuick 2.0
3254 import QtTest 1.0
3255 import Ubuntu.Components 1.1
3256+import Ubuntu.Test 1.0
3257
3258 Item {
3259 width: 200
3260@@ -37,7 +38,7 @@
3261 }
3262 }
3263
3264- TestCase {
3265+ UbuntuTestCase {
3266 id: testCase
3267 name: "PanelAPI"
3268 when: windowShown
3269@@ -61,6 +62,21 @@
3270 compare(panel.align, Qt.AlignBottom, "Can set align to bottom");
3271 }
3272
3273+ function test_height() {
3274+ var bar = findChild(panel, "bar_item");
3275+ // panel is not opened
3276+ panel.height = 123;
3277+ compare(bar.y, 123, "Panel is properly closed after changing height");
3278+ panel.open(); wait(500);
3279+ compare(bar.y, 0, "Panel opens properly after changing height");
3280+ panel.height = 78;
3281+ compare(bar.y, 0, "Panel stays propery opened after changing height");
3282+ panel.close(); wait(500);
3283+ compare(bar.y, 78, "Panel closes properly after changing height");
3284+ panel.height = root.height / 2;
3285+ compare(bar.y, root.height/2, "Panel stays closed properly after changing height");
3286+ }
3287+
3288 function test_opened() {
3289 panel.open();
3290 compare(panel.opened, true, "Can set opened");
3291@@ -167,10 +183,14 @@
3292 }
3293
3294 function test_clickToDeactivate() {
3295+ // deprecated test. This functionality is only there for backwards compatibility
3296+ panel.__closeOnContentsClicks = true;
3297 panel.open();
3298 compare(panel.opened && panel.align === Qt.AlignBottom, true, "Panel is opened and bottom-aligned");
3299 mouseClick(root, root.width / 2, 5, Qt.LeftButton);
3300 compare(panel.opened, false, "Panel is deactivated by clicking in the view outside of the panel");
3301+ // reset property to default value
3302+ panel.__closeOnContentsClicks = false;
3303 }
3304
3305 function test_hideTimeout_bug1249031() {
3306
3307=== modified file 'tests/unit_x11/tst_components/tst_textinput_touch.qml'
3308--- tests/unit_x11/tst_components/tst_textinput_touch.qml 2014-06-24 08:42:47 +0000
3309+++ tests/unit_x11/tst_components/tst_textinput_touch.qml 2014-07-24 02:10:07 +0000
3310@@ -192,15 +192,15 @@
3311 verify(selectedText !== "", "No text selected!");
3312
3313 popupSpy.target = findChild(data.input, "input_handler");
3314- TestExtras.touchLongPress(0, data.input, guPoint(1, 1));
3315+ TestExtras.touchLongPress(0, data.input, guPoint(2, 2));
3316 waitForRendering(data.input, 500);
3317 popupSpy.wait();
3318 compare(data.input.selectedText, selectedText, "Text selection should be the same!");
3319
3320 // cleanup
3321- TestExtras.touchRelease(0, data.input, guPoint(1, 1));
3322+ TestExtras.touchRelease(0, data.input, guPoint(2, 2));
3323 // dismiss popover
3324- TestExtras.touchClick(0, testMain, 0, 0);
3325+ TestExtras.touchClick(0, testMain, guPoint(0, 0));
3326 }
3327
3328 function test_drag_cursor_handler_data() {
3329@@ -275,9 +275,7 @@
3330 flickerSpy.target = outerFlicker;
3331 autoSizeTextArea.focus = data.focused;
3332 var editor = findChild(autoSizeTextArea, "text_input");
3333- wait(5000)
3334 TestExtras.touchDrag(0, editor, guPoint(0, 0), guPoint(0, 40));
3335- wait(5000)
3336 flickerSpy.wait();
3337 }
3338 }
3339
3340=== modified file 'tests/unit_x11/tst_test/tst_ubuntutestcase.qml'
3341--- tests/unit_x11/tst_test/tst_ubuntutestcase.qml 2014-06-24 07:01:06 +0000
3342+++ tests/unit_x11/tst_test/tst_ubuntutestcase.qml 2014-07-24 02:10:07 +0000
3343@@ -17,11 +17,12 @@
3344 import QtQuick 2.0
3345 import QtTest 1.0
3346 import Ubuntu.Test 1.0
3347+import Ubuntu.Components 1.0
3348
3349 Rectangle {
3350 id: root
3351 width: 800
3352- height: 600
3353+ height: 1000
3354
3355 Column {
3356 anchors.fill: parent
3357@@ -73,6 +74,9 @@
3358 height: 1000
3359 }
3360 }
3361+ TextField {
3362+ id: textField
3363+ }
3364 }
3365
3366 UbuntuTestCase {
3367@@ -173,6 +177,11 @@
3368 flick(flicker, flicker.width, flicker.height, -flicker.width, -flicker.height, 400, 100);
3369 movementSpy.wait();
3370 }
3371+ function test_typeString() {
3372+ textField.forceActiveFocus();
3373+ typeString("Hello Ubuntu");
3374+ tryCompare(textField, "text", "Hello Ubuntu");
3375+ }
3376
3377 SignalSpy {
3378 id: touchPressSpy

Subscribers

People subscribed via source and target branches

to status/vote changes: