Merge lp:~nskaggs/ubuntu-ui-toolkit/fix-1328600 into lp:ubuntu-ui-toolkit

Proposed by Nicholas Skaggs
Status: Superseded
Proposed branch: lp:~nskaggs/ubuntu-ui-toolkit/fix-1328600
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 2085 lines (+1008/-147)
52 files modified
components.api (+11/-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/WidgetsModel.qml (+5/-1)
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/PageHeadConfiguration.qml (+31/-1)
modules/Ubuntu/Components/Pickers/DatePicker.qml (+1/-1)
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/Palette.qml (+10/-8)
modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml (+3/-1)
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/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/qmldir (+3/-2)
modules/Ubuntu/Test/UbuntuTestCase.qml (+10/-1)
tests/autopilot/ubuntuuitoolkit/__init__.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/base.py (+12/-4)
tests/autopilot/ubuntuuitoolkit/fixture_setup.py (+85/-0)
tests/autopilot/ubuntuuitoolkit/tests/__init__.py (+19/-14)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+1/-4)
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 (+6/-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.sh (+1/-1)
tests/unit/runtest.sh (+1/-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_textinput_touch.qml (+3/-5)
tests/unit_x11/tst_test/tst_ubuntutestcase.qml (+10/-1)
To merge this branch: bzr merge lp:~nskaggs/ubuntu-ui-toolkit/fix-1328600
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+227380@code.launchpad.net

Commit message

Change the default maxyear property to 15 to avoid 32-bit limitation issues

Description of the change

Change the default maxyear property to 15 to avoid 32-bit limitation issues

To post a comment you must log in.
1154. By Nicholas Skaggs

set min and max values for picker to avoid bug 1328600

1155. By Nicholas Skaggs

revert default datepicker change

1156. By Nicholas Skaggs

workaround for bug 1346669

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'components.api'
2--- components.api 2014-07-10 11:50:13 +0000
3+++ components.api 2014-07-18 18:17:44 +0000
4@@ -46,6 +46,12 @@
5 readonly property color coolGrey
6 property Gradient orangeGradient
7 property Gradient greyGradient
8+ readonly property color lightGrey
9+ readonly property color darkGrey
10+ readonly property color red
11+ readonly property color green
12+ readonly property color blue
13+ readonly property color purple
14 ComboButton 1.1
15 Button
16 property bool expanded
17@@ -398,6 +404,9 @@
18 property real minimumValue
19 property real maximumValue
20 property real value
21+ProgressBar 1.1
22+ProgressBar
23+ property bool showProgressPercentage
24 PullToRefresh 1.1
25 StyledItem
26 readonly property bool releaseToRefresh
27@@ -620,6 +629,7 @@
28 property color overlayText
29 property color field
30 property color fieldText
31+ property color selection
32 ToolbarButton 0.1 1.0
33 ActionItem
34 ToolbarItems 0.1 1.0
35@@ -657,6 +667,7 @@
36 function flick(item, x, y, dx, dy, pressTimeout, steps, button, modifiers, delay)
37 function mouseLongPress(item, x, y, button, modifiers, delay)
38 function tryCompareFunction(func, expectedResult, timeout)
39+ function typeString(string)
40 plugins.qmltypes
41 name: "FilterBehavior"
42 prototype: "QObject"
43
44=== modified file 'debian/control'
45--- debian/control 2014-07-09 17:37:43 +0000
46+++ debian/control 2014-07-18 18:17:44 +0000
47@@ -39,6 +39,7 @@
48 xvfb,
49 libgl1-mesa-dri,
50 locales,
51+ suru-icon-theme,
52 Standards-Version: 3.9.4
53 Homepage: https://launchpad.net/ubuntu-ui-toolkit
54 # If you aren't a member of ~ubuntu-sdk-team but need to upload packaging
55@@ -135,10 +136,12 @@
56 libqt5widgets5,
57 python-autopilot (>= 1.4),
58 python-fixtures,
59+ python-gi,
60 python-mock,
61 python-testscenarios,
62 python-testtools,
63 python3-fixtures,
64+ python3-gi,
65 python3-testscenarios,
66 python3-testtools,
67 python3-autopilot (>= 1.4),
68
69=== added file 'examples/ubuntu-ui-toolkit-gallery/Colors.qml'
70--- examples/ubuntu-ui-toolkit-gallery/Colors.qml 1970-01-01 00:00:00 +0000
71+++ examples/ubuntu-ui-toolkit-gallery/Colors.qml 2014-07-18 18:17:44 +0000
72@@ -0,0 +1,72 @@
73+/*
74+ * Copyright 2014 Canonical Ltd.
75+ *
76+ * This program is free software; you can redistribute it and/or modify
77+ * it under the terms of the GNU Lesser General Public License as published by
78+ * the Free Software Foundation; version 3.
79+ *
80+ * This program is distributed in the hope that it will be useful,
81+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
82+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
83+ * GNU Lesser General Public License for more details.
84+ *
85+ * You should have received a copy of the GNU Lesser General Public License
86+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
87+ */
88+
89+import QtQuick 2.2
90+import Ubuntu.Components 1.1
91+
92+Template {
93+ objectName: "colorsTemplate"
94+
95+ TemplateSection {
96+ title: "UbuntuColors"
97+ className: "UbuntuColors"
98+
99+ // Except orange, none of the colors from UbuntuComponents 1.0
100+ // are included because they may be deprecated soon.
101+ TemplateRow {
102+ title: i18n.tr("Orange")
103+ UbuntuShape {
104+ color: UbuntuColors.orange
105+ }
106+ }
107+ TemplateRow {
108+ title: i18n.tr("Light grey")
109+ UbuntuShape {
110+ color: UbuntuColors.lightGrey
111+ }
112+ }
113+ TemplateRow {
114+ title: i18n.tr("Dark grey")
115+ UbuntuShape {
116+ color: UbuntuColors.darkGrey
117+ }
118+ }
119+ TemplateRow {
120+ title: i18n.tr("Red")
121+ UbuntuShape {
122+ color: UbuntuColors.red
123+ }
124+ }
125+ TemplateRow {
126+ title: i18n.tr("Green")
127+ UbuntuShape {
128+ color: UbuntuColors.green
129+ }
130+ }
131+ TemplateRow {
132+ title: i18n.tr("Blue")
133+ UbuntuShape {
134+ color: UbuntuColors.blue
135+ }
136+ }
137+ TemplateRow {
138+ title: i18n.tr("Purple")
139+ UbuntuShape {
140+ color: UbuntuColors.purple
141+ }
142+ }
143+ }
144+}
145
146=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItems.qml'
147--- examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2014-05-07 11:40:37 +0000
148+++ examples/ubuntu-ui-toolkit-gallery/ListItems.qml 2014-07-18 18:17:44 +0000
149@@ -50,7 +50,7 @@
150
151 TemplateSection {
152 title: i18n.tr("ThinDivider")
153- className: "ThinDivider"
154+ className: "ListItems-ThinDivider"
155
156 Column {
157 anchors.left: parent.left
158@@ -198,6 +198,7 @@
159 }
160
161 ListItemsSection {
162+ id: removableSection
163 title: i18n.tr("Removable")
164 className: "Standard"
165 delegate: ListItem.Standard {
166@@ -209,11 +210,21 @@
167 color: Theme.palette.normal.base
168 }
169 }
170+
171+ Toolkit.Button {
172+ text: i18n.tr("Reset")
173+ anchors.right: parent.right
174+ onClicked: {
175+ for (var i=0, iMax=removableSection.count; i < iMax; i++) {
176+ removableSection.itemAt(i).cancelItemRemoval()
177+ }
178+ }
179+ }
180 }
181
182 TemplateSection {
183 title: i18n.tr("Grouped list")
184- className: "Header"
185+ className: "ListItems-Header"
186
187 Rectangle {
188 color: Qt.rgba(0.0, 0.0, 0.0, 0.01)
189
190=== modified file 'examples/ubuntu-ui-toolkit-gallery/ListItemsSection.qml'
191--- examples/ubuntu-ui-toolkit-gallery/ListItemsSection.qml 2014-04-23 09:39:11 +0000
192+++ examples/ubuntu-ui-toolkit-gallery/ListItemsSection.qml 2014-07-18 18:17:44 +0000
193@@ -20,7 +20,13 @@
194 TemplateSection {
195 id: section
196 property alias delegate: repeater.delegate
197- documentation: "qml-ubuntu-components-listitems0-%1.html".arg(className.toLowerCase())
198+ property alias count: repeater.count
199+ documentation: "qml-ubuntu-components-listitems-%1.html".arg(className.toLowerCase())
200+
201+ function itemAt(index)
202+ {
203+ return repeater.itemAt(index)
204+ }
205
206 Column {
207 id: column
208
209=== modified file 'examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml'
210--- examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml 2014-04-23 09:39:11 +0000
211+++ examples/ubuntu-ui-toolkit-gallery/ProgressBars.qml 2014-07-18 18:17:44 +0000
212@@ -15,7 +15,7 @@
213 */
214
215 import QtQuick 2.0
216-import Ubuntu.Components 0.1
217+import Ubuntu.Components 1.1
218
219 Template {
220 objectName: "progressBarsTemplate"
221@@ -53,6 +53,27 @@
222 indeterminate: true
223 }
224 }
225+
226+ TemplateRow {
227+ title: i18n.tr("No label")
228+
229+ ProgressBar {
230+ id: progressNoLabel
231+ objectName: "progressbar_nolabel"
232+ width: parent.width
233+ showProgressPercentage: false
234+
235+ SequentialAnimation on value {
236+ loops: Animation.Infinite
237+ NumberAnimation {
238+ from: progress.minimumValue
239+ to: progress.maximumValue
240+ duration: 2000
241+ }
242+ PauseAnimation {duration: 1000}
243+ }
244+ }
245+ }
246 }
247
248 TemplateSection {
249
250=== modified file 'examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml'
251--- examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2014-07-02 13:39:29 +0000
252+++ examples/ubuntu-ui-toolkit-gallery/WidgetsModel.qml 2014-07-18 18:17:44 +0000
253@@ -28,7 +28,11 @@
254 label: "Styles"
255 source: "Styles.qml"
256 }
257-
258+ ListElement {
259+ objectName: "colorsElement"
260+ label: "Colors"
261+ source: "Colors.qml"
262+ }
263 ListElement {
264 objectName: "togglesElement"
265 label: "Toggles"
266
267=== modified file 'modules/Ubuntu/Components/Colors/FIXME'
268--- modules/Ubuntu/Components/Colors/FIXME 2013-07-01 05:54:33 +0000
269+++ modules/Ubuntu/Components/Colors/FIXME 2014-07-18 18:17:44 +0000
270@@ -1,3 +1,7 @@
271 UbuntuColors.qml is located in the Colors subdirectory because
272 QuickUtils::createQmlObject() fails if the QML file is located in a
273 folder that has a qmldir file with JavaScript modules.
274+
275+UbuntuColors 1.1 is not in a file named UbuntuColors11.qml but in
276+UbuntuColors.qml so that qdoc can properly detect the component
277+name without a qmldir file.
278
279=== added file 'modules/Ubuntu/Components/Colors/UbuntuColors.qml'
280--- modules/Ubuntu/Components/Colors/UbuntuColors.qml 1970-01-01 00:00:00 +0000
281+++ modules/Ubuntu/Components/Colors/UbuntuColors.qml 2014-07-18 18:17:44 +0000
282@@ -0,0 +1,131 @@
283+/*
284+ Copyright 2014 Canonical Ltd.
285+ *
286+ This program is free software; you can redistribute it and/or modify
287+ it under the terms of the GNU Lesser General Public License as published by
288+ the Free Software Foundation; version 3.
289+ *
290+ This program is distributed in the hope that it will be useful,
291+ but WITHOUT ANY WARRANTY; without even the implied warranty of
292+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
293+ GNU Lesser General Public License for more details.
294+ *
295+ You should have received a copy of the GNU Lesser General Public License
296+ along with this program. If not, see <http://www.gnu.org/licenses/>.
297+ */
298+
299+import QtQuick 2.2
300+
301+/*!
302+ \qmltype UbuntuColors
303+ \inqmlmodule Ubuntu.Components 1.1
304+ \ingroup ubuntu
305+ \brief Singleton defining the Ubuntu color palette.
306+
307+ Each color of the Ubuntu color palette is accesible from it.
308+ For more information on how to appropriately use the colors according to
309+ the context, please refer to the
310+ \l{http://design.ubuntu.com/brand/colour-palette}{Ubuntu brand guidelines}.
311+
312+ Example of use:
313+
314+ \qml
315+ Rectangle {
316+ color: UbuntuColors.orange
317+ }
318+ \endqml
319+*/
320+QtObject {
321+ // old colors from UbuntuColors 1.0:
322+
323+ /*!
324+ Orange. Recommended for branded elements, display progress
325+ and intensity, textual links on light backgrounds.
326+ */
327+ readonly property color orange: "#DD4814"
328+ /*!
329+ \deprecated
330+ Ubuntu supporting color: light aubergine
331+ */
332+ readonly property color lightAubergine: "#77216F"
333+ /*!
334+ \deprecated
335+ Ubuntu supporting color: mid aubergine
336+ */
337+ readonly property color midAubergine: "#5E2750"
338+ /*!
339+ \deprecated
340+ Ubuntu supporting color: dark aubergine
341+ */
342+ readonly property color darkAubergine: "#2C001E"
343+ /*!
344+ \deprecated
345+ Ubuntu neutral color: warm grey
346+ */
347+ readonly property color warmGrey: "#AEA79F"
348+ /*!
349+ \deprecated
350+ Ubuntu neutral color: cool grey
351+ */
352+ readonly property color coolGrey: "#333333"
353+
354+ /*!
355+ Ubuntu orange gradient
356+
357+ \sa Button::gradient
358+ */
359+ property Gradient orangeGradient: Gradient {
360+ GradientStop { position: 0.0; color: "#DD4814" }
361+ GradientStop { position: 1.0; color: "#D9722D" }
362+ }
363+ /*!
364+ Ubuntu grey gradient
365+
366+ \sa Button::gradient
367+ */
368+ property Gradient greyGradient: Gradient {
369+ GradientStop { position: 0.0; color: "#888888" }
370+ GradientStop { position: 1.0; color: "#BBBBBB" }
371+ }
372+
373+ // New colors introduced in UbuntuColors 1.1:
374+
375+ /*!
376+ Light grey. Recommended for neutral action buttons and
377+ secondary text.
378+ \since Ubuntu.Components 1.1
379+ */
380+ readonly property color lightGrey: "#888888"
381+
382+ /*!
383+ Dark grey. Recommended for text and action icons.
384+ \since Ubuntu.Components 1.1
385+ */
386+ readonly property color darkGrey: "#5d5d5d"
387+
388+ /*!
389+ Red. Recommended for negative and irreversible action
390+ buttons, errors and alerts.
391+ \since Ubuntu.Components 1.1
392+ */
393+ readonly property color red: "#fc4949"
394+
395+ /*!
396+ Green. Recommended for positive action buttons.
397+ \since Ubuntu.Components 1.1
398+ */
399+ readonly property color green: "#3fb24f"
400+
401+ /*!
402+ Blue. Recommended for text selection and text cursor.
403+ \since Ubuntu.Components 1.1
404+ */
405+ readonly property color blue: "#1ab6ef"
406+
407+ /*!
408+ Purple. Recommended for proper nouns in
409+ list items.
410+ \since Ubuntu.Components 1.1
411+ */
412+ readonly property color purple: "#762572"
413+}
414
415=== renamed file 'modules/Ubuntu/Components/Colors/UbuntuColors.qml' => 'modules/Ubuntu/Components/Colors/UbuntuColors10.qml'
416--- modules/Ubuntu/Components/Colors/UbuntuColors.qml 2013-07-02 00:15:07 +0000
417+++ modules/Ubuntu/Components/Colors/UbuntuColors10.qml 2014-07-18 18:17:44 +0000
418@@ -1,5 +1,5 @@
419 /*
420- Copyright 2013 Canonical Ltd.
421+ Copyright 2013-2014 Canonical Ltd.
422 *
423 This program is free software; you can redistribute it and/or modify
424 it under the terms of the GNU Lesser General Public License as published by
425@@ -14,67 +14,23 @@
426 along with this program. If not, see <http://www.gnu.org/licenses/>.
427 */
428
429-import QtQuick 2.0
430+import QtQuick 2.2
431
432 /*!
433- \qmltype UbuntuColors
434- \inqmlmodule Ubuntu.Components 0.1
435- \ingroup theming
436- \brief Singleton defining the Ubuntu color palette.
437-
438- Each color of the Ubuntu color palette is accesible from it.
439- For more information on how to appropriately use the colors according to
440- the context, please refer to the
441- \l{http://design.ubuntu.com/brand/colour-palette}{Ubuntu brand guidelines}.
442-
443- Example of use:
444-
445- \qml
446- Rectangle {
447- color: UbuntuColors.orange
448- }
449- \endqml
450+ \internal
451+ Documentation is in UbuntuColors.qml
452 */
453 QtObject {
454- /*!
455- Ubuntu core color: Ubuntu orange
456- */
457 readonly property color orange: "#DD4814"
458- /*!
459- Ubuntu supporting color: light aubergine
460- */
461 readonly property color lightAubergine: "#77216F"
462- /*!
463- Ubuntu supporting color: mid aubergine
464- */
465 readonly property color midAubergine: "#5E2750"
466- /*!
467- Ubuntu supporting color: dark aubergine
468- */
469 readonly property color darkAubergine: "#2C001E"
470- /*!
471- Ubuntu neutral color: warm grey
472- */
473 readonly property color warmGrey: "#AEA79F"
474- /*!
475- Ubuntu neutral color: cool grey
476- */
477 readonly property color coolGrey: "#333333"
478-
479- /*!
480- Ubuntu orange gradient
481-
482- \sa Button::gradient
483- */
484 property Gradient orangeGradient: Gradient {
485 GradientStop { position: 0.0; color: "#DD4814" }
486 GradientStop { position: 1.0; color: "#D9722D" }
487 }
488- /*!
489- Ubuntu grey gradient
490-
491- \sa Button::gradient
492- */
493 property Gradient greyGradient: Gradient {
494 GradientStop { position: 0.0; color: "#888888" }
495 GradientStop { position: 1.0; color: "#BBBBBB" }
496
497=== modified file 'modules/Ubuntu/Components/ListItems/Empty.qml'
498--- modules/Ubuntu/Components/ListItems/Empty.qml 2014-06-05 11:42:07 +0000
499+++ modules/Ubuntu/Components/ListItems/Empty.qml 2014-07-18 18:17:44 +0000
500@@ -175,6 +175,7 @@
501 function cancelItemRemoval()
502 {
503 priv.resetDrag()
504+ priv.removed = false
505 }
506
507 width: parent ? parent.width : units.gu(31)
508
509=== modified file 'modules/Ubuntu/Components/PageHeadConfiguration.qml'
510--- modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-07-01 11:27:29 +0000
511+++ modules/Ubuntu/Components/PageHeadConfiguration.qml 2014-07-18 18:17:44 +0000
512@@ -31,12 +31,42 @@
513
514 /*!
515 List of actions to show in the header.
516+
517+ Example:
518+ \qml
519+ Page {
520+ title: "Custom header actions"
521+ head.actions: [
522+ Action {
523+ iconName: "save"
524+ text: i18n.tr("Save")
525+ },
526+ Action {
527+ iconName: "add"
528+ text: i18n.tr("Add")
529+ }
530+ ]
531+ }
532+ \endqml
533 */
534 property list<Action> actions
535
536 /*!
537 Overrides the default \l PageStack back button and the
538 \l Tabs drawer button in the header.
539+
540+ Example:
541+ \qml
542+ Page {
543+ title: "Back Action Page"
544+ head.backAction: Action {
545+ iconName: "close"
546+ onTriggered: {
547+ console.log("Run custom back action")
548+ }
549+ }
550+ }
551+ \endqml
552 */
553 property Action backAction: null
554
555@@ -52,7 +82,7 @@
556 \qml
557 Page {
558 title: "Invisible title"
559- contents: Rectangle {
560+ head.contents: Rectangle {
561 color: UbuntuColors.orange
562 height: units.gu(5)
563 width: parent ? parent.width - units.gu(2) : undefined
564
565=== modified file 'modules/Ubuntu/Components/Pickers/DatePicker.qml'
566--- modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-05-27 07:17:16 +0000
567+++ modules/Ubuntu/Components/Pickers/DatePicker.qml 2014-07-18 18:17:44 +0000
568@@ -248,7 +248,7 @@
569 */
570 property date maximum: {
571 var d = Date.prototype.midnight.call(new Date());
572- d.setFullYear(d.getFullYear() + 50);
573+ d.setFullYear(d.getFullYear() + 15);
574 return d;
575 }
576
577
578=== renamed file 'modules/Ubuntu/Components/ProgressBar.qml' => 'modules/Ubuntu/Components/ProgressBar10.qml'
579=== added file 'modules/Ubuntu/Components/ProgressBar11.qdoc'
580--- modules/Ubuntu/Components/ProgressBar11.qdoc 1970-01-01 00:00:00 +0000
581+++ modules/Ubuntu/Components/ProgressBar11.qdoc 2014-07-18 18:17:44 +0000
582@@ -0,0 +1,6 @@
583+/*!
584+\qmlproperty bool ProgressBar::showProgressPercentage
585+\since Ubuntu.Components 1.1
586+
587+Specifies if the value of the progress is visible
588+*/
589
590=== added file 'modules/Ubuntu/Components/ProgressBar11.qml'
591--- modules/Ubuntu/Components/ProgressBar11.qml 1970-01-01 00:00:00 +0000
592+++ modules/Ubuntu/Components/ProgressBar11.qml 2014-07-18 18:17:44 +0000
593@@ -0,0 +1,21 @@
594+/*
595+ * Copyright 2014 Canonical Ltd.
596+ *
597+ * This program is free software; you can redistribute it and/or modify
598+ * it under the terms of the GNU Lesser General Public License as published by
599+ * the Free Software Foundation; version 3.
600+ *
601+ * This program is distributed in the hope that it will be useful,
602+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
603+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
604+ * GNU Lesser General Public License for more details.
605+ *
606+ * You should have received a copy of the GNU Lesser General Public License
607+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
608+ */
609+
610+import QtQuick 2.0
611+
612+ProgressBar {
613+ property bool showProgressPercentage: true
614+}
615
616=== modified file 'modules/Ubuntu/Components/TextArea.qml'
617--- modules/Ubuntu/Components/TextArea.qml 2014-06-28 17:26:49 +0000
618+++ modules/Ubuntu/Components/TextArea.qml 2014-07-18 18:17:44 +0000
619@@ -850,7 +850,7 @@
620 }
621 color: control.__styleInstance.color
622 selectedTextColor: Theme.palette.selected.foregroundText
623- selectionColor: Theme.palette.selected.foreground
624+ selectionColor: Theme.palette.selected.selection
625 font.pixelSize: FontUtils.sizeToPixels("medium")
626 // forward keys to the root element so it can be captured outside of it
627 // as well as to InputHandler to handle PageUp/PageDown keys
628
629=== modified file 'modules/Ubuntu/Components/TextField.qml'
630--- modules/Ubuntu/Components/TextField.qml 2014-06-29 21:46:30 +0000
631+++ modules/Ubuntu/Components/TextField.qml 2014-07-18 18:17:44 +0000
632@@ -979,7 +979,7 @@
633 }
634 color: control.__styleInstance.color
635 selectedTextColor: Theme.palette.selected.foregroundText
636- selectionColor: Theme.palette.selected.foreground
637+ selectionColor: Theme.palette.selected.selection
638 font.pixelSize: FontUtils.sizeToPixels("medium")
639 passwordCharacter: "\u2022"
640 // forward keys to the root element so it can be captured outside of it
641
642=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml'
643--- modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml 2014-05-22 13:04:58 +0000
644+++ modules/Ubuntu/Components/Themes/Ambiance/ActivityIndicatorStyle.qml 2014-07-18 18:17:44 +0000
645@@ -28,7 +28,12 @@
646 verticalAlignment: Image.AlignVCenter
647 source: "artwork/spinner.png"
648
649- RotationAnimator on rotation {
650+ /*
651+ Changed from RotationAnimator to RotationAnimation to
652+ work around bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1338602
653+ "Activity Indicator crashes in QML/Widget mixed applications"
654+ */
655+ RotationAnimation on rotation {
656 running: styledItem.running
657 from: 0
658 to: 360
659
660=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/Palette.qml'
661--- modules/Ubuntu/Components/Themes/Ambiance/Palette.qml 2013-07-05 12:21:32 +0000
662+++ modules/Ubuntu/Components/Themes/Ambiance/Palette.qml 2014-07-18 18:17:44 +0000
663@@ -15,6 +15,7 @@
664 */
665
666 import QtQuick 2.0
667+import Ubuntu.Components 1.1
668 import Ubuntu.Components.Themes 0.1
669
670 Palette {
671@@ -22,13 +23,13 @@
672 background: "#EDEDED"
673 backgroundText: "#81888888"
674 base: "#1A000000"
675- baseText: "#888888"
676- foreground: "#888888"
677+ baseText: UbuntuColors.lightGrey
678+ foreground: UbuntuColors.lightGrey
679 foregroundText: "#F3F3E7"
680 overlay: "#FDFDFD"
681- overlayText: "#888888"
682+ overlayText: UbuntuColors.lightGrey
683 field: "#1A000000"
684- fieldText: "#888888"
685+ fieldText: UbuntuColors.darkGrey
686 }
687 selected: PaletteValues {
688 /* FIXME: 'background' does not come from design
689@@ -36,10 +37,11 @@
690 that will go away with the new design.
691 */
692 background: "#B2E6E6E6"
693- backgroundText: "#888888"
694- foreground: "#DD4814"
695- foregroundText: "#F3F3E7"
696+ backgroundText: UbuntuColors.darkGrey
697+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
698+ foreground: UbuntuColors.blue
699+ foregroundText: UbuntuColors.darkGrey
700 field: "#FFFFFF"
701- fieldText: "#888888"
702+ fieldText: UbuntuColors.darkGrey
703 }
704 }
705
706=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml'
707--- modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml 2014-04-23 08:50:20 +0000
708+++ modules/Ubuntu/Components/Themes/Ambiance/ProgressBarStyle.qml 2014-07-18 18:17:44 +0000
709@@ -20,7 +20,7 @@
710 Item {
711 id: progressBarStyle
712
713- property ProgressBar progressBar: styledItem
714+ property var progressBar: styledItem
715
716 implicitWidth: units.gu(38)
717 implicitHeight: units.gu(4)
718@@ -56,6 +56,7 @@
719 color: Theme.palette.normal.baseText
720 text: progressBar.indeterminate ? i18n.tr("In Progress")
721 : "%1%".arg(Number(progressBarStyle.progress * 100.0).toFixed(0))
722+ visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
723
724 SequentialAnimation on opacity {
725 loops: Animation.Infinite
726@@ -76,5 +77,6 @@
727 rightColor: Theme.palette.normal.baseText
728 progress: (progressBarStyle.progress * background.width - valueLabel.x) / valueLabel.width
729 mirror: Qt.application.layoutDirection == Qt.RightToLeft
730+ visible: !progressBar.hasOwnProperty("showProgressPercentage") || progressBar.showProgressPercentage
731 }
732 }
733
734=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml'
735--- modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-05-09 05:25:12 +0000
736+++ modules/Ubuntu/Components/Themes/Ambiance/TextCursorStyle.qml 2014-07-18 18:17:44 +0000
737@@ -47,7 +47,7 @@
738 Component {
739 id: delegate
740 Rectangle {
741- width: units.dp(1)
742+ width: units.dp(2)
743 color: Theme.palette.selected.foreground
744 visible: blinkTimer.timerShowCursor
745 Timer {
746@@ -70,7 +70,7 @@
747 // caretItem
748 Image {
749 id: caretItem
750- source: "artwork/teardrop-left.png"
751+ source: "artwork/caret_noshadow.png"
752 anchors {
753 top: parent.bottom
754 horizontalCenter: parent.horizontalCenter
755
756=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml'
757--- modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml 2014-05-09 05:25:12 +0000
758+++ modules/Ubuntu/Components/Themes/Ambiance/TextSelectionEndCursorStyle.qml 2014-07-18 18:17:44 +0000
759@@ -55,7 +55,7 @@
760 // caretItem
761 Image {
762 id: caretItem
763- source: "artwork/teardrop-left.png"
764+ source: "artwork/caret_noshadow.png"
765 anchors {
766 top: parent.bottom
767 horizontalCenter: parent.horizontalCenter
768
769=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml'
770--- modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml 2014-05-13 08:00:18 +0000
771+++ modules/Ubuntu/Components/Themes/Ambiance/TextSelectionStartCursorStyle.qml 2014-07-18 18:17:44 +0000
772@@ -55,12 +55,13 @@
773 // caretItem
774 Image {
775 id: caretItem
776- source: "artwork/teardrop-right.png"
777+ source: "artwork/caret_noshadow.png"
778 anchors {
779- top: parent.bottom
780+ bottom: parent.top
781 horizontalCenter: parent.horizontalCenter
782 topMargin: -units.gu(0.5)
783 horizontalCenterOffset: LayoutMirroring.enabled ? -(units.gu(0.7) - caretItem.width) : -units.gu(0.7)
784 }
785+ rotation: 180
786 }
787 }
788
789=== added file 'modules/Ubuntu/Components/Themes/Ambiance/artwork/caret_noshadow@27.png'
790Binary 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-18 18:17:44 +0000 differ
791=== removed file 'modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-left@20.png'
792Binary 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
793=== removed file 'modules/Ubuntu/Components/Themes/Ambiance/artwork/teardrop-right@20.png'
794Binary 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
795=== modified file 'modules/Ubuntu/Components/Themes/PaletteValues.qml'
796--- modules/Ubuntu/Components/Themes/PaletteValues.qml 2013-07-05 16:04:07 +0000
797+++ modules/Ubuntu/Components/Themes/PaletteValues.qml 2014-07-18 18:17:44 +0000
798@@ -69,4 +69,8 @@
799 Typically used for labels and images.
800 */
801 property color fieldText
802+ /*!
803+ Color applied to selected text in editable components.
804+ */
805+ property color selection
806 }
807
808=== modified file 'modules/Ubuntu/Components/Themes/SuruDark/Palette.qml'
809--- modules/Ubuntu/Components/Themes/SuruDark/Palette.qml 2013-07-05 14:34:00 +0000
810+++ modules/Ubuntu/Components/Themes/SuruDark/Palette.qml 2014-07-18 18:17:44 +0000
811@@ -15,6 +15,7 @@
812 */
813
814 import QtQuick 2.0
815+import Ubuntu.Components 1.1
816 import Ubuntu.Components.Themes 0.1
817
818 Palette {
819@@ -33,8 +34,9 @@
820 selected: PaletteValues {
821 background: "#88D6D6D6" // FIXME: not from design
822 backgroundText: "#F3F3E7"
823- foreground: "#DD4814"
824- foregroundText: "#F3F3E7"
825+ selection: Qt.rgba(UbuntuColors.blue.r, UbuntuColors.blue.g, UbuntuColors.blue.b, 0.2)
826+ foreground: UbuntuColors.blue
827+ foregroundText: UbuntuColors.darkGrey
828 field: "#FFFFFF"
829 fieldText: "#888888"
830 }
831
832=== modified file 'modules/Ubuntu/Components/deployment.pri'
833--- modules/Ubuntu/Components/deployment.pri 2014-04-29 05:39:04 +0000
834+++ modules/Ubuntu/Components/deployment.pri 2014-07-18 18:17:44 +0000
835@@ -52,6 +52,6 @@
836 # Silence spam on stderr due to fonts
837 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
838 # https://bugreports.qt-project.org/browse/QTBUG-36243
839-plugins_qmltypes.extra = $$[QT_INSTALL_BINS]/qmlplugindump -notrelocatable Ubuntu.Components 0.1 ../../ 2>/dev/null > $(INSTALL_ROOT)/$$installPath/plugins.qmltypes
840+plugins_qmltypes.extra = ALARM_BACKEND=memory $$[QT_INSTALL_BINS]/qmlplugindump -notrelocatable Ubuntu.Components 0.1 ../../ 2>/dev/null > $(INSTALL_ROOT)/$$installPath/plugins.qmltypes
841
842 INSTALLS += qmldir_file qml_files js_files artwork_files listitems_files listitems_artwork_files popups_files picker_files styles_files plugins_qmltypes
843
844=== modified file 'modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp'
845--- modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-04-17 14:05:49 +0000
846+++ modules/Ubuntu/Components/plugin/adapters/alarmsadapter_organizer.cpp 2014-07-18 18:17:44 +0000
847@@ -57,17 +57,14 @@
848 , fetchRequest(0)
849 {
850 QString envManager(qgetenv("ALARM_BACKEND"));
851- if (!envManager.isEmpty() && QOrganizerManager::availableManagers().contains(envManager)) {
852- manager = new QOrganizerManager(envManager);
853- } else {
854- manager = QOrganizerManager::availableManagers().contains(ALARM_MANAGER) ?
855- new QOrganizerManager(ALARM_MANAGER) : new QOrganizerManager(ALARM_MANAGER_FALLBACK);
856+ if (envManager.isEmpty())
857+ envManager = ALARM_MANAGER;
858+ if (!QOrganizerManager::availableManagers().contains(envManager)) {
859+ qWarning() << "WARNING: alarm manager" << envManager << "not installed, using" << QString(ALARM_MANAGER_FALLBACK);
860+ envManager = ALARM_MANAGER_FALLBACK;
861 }
862+ manager = new QOrganizerManager(envManager);
863 manager->setParent(q_ptr);
864- if (manager->managerName() != ALARM_MANAGER) {
865- qWarning() << "WARNING: default alarm manager not installed, using" << manager->managerName() << "manager.";
866- qWarning() << "This manager may not provide all the needed features.";
867- }
868
869 QList<QOrganizerCollection> collections = manager->collections();
870 if (collections.count() > 0) {
871
872=== modified file 'modules/Ubuntu/Components/plugin/plugin.cpp'
873--- modules/Ubuntu/Components/plugin/plugin.cpp 2014-06-10 11:47:09 +0000
874+++ modules/Ubuntu/Components/plugin/plugin.cpp 2014-07-18 18:17:44 +0000
875@@ -92,7 +92,14 @@
876 return uriHandler;
877 }
878
879-static QObject *registerUbuntuColors(QQmlEngine *engine, QJSEngine *scriptEngine)
880+static QObject *registerUbuntuColors10(QQmlEngine *engine, QJSEngine *scriptEngine)
881+{
882+ Q_UNUSED(scriptEngine)
883+ return UbuntuComponentsPlugin::registerQmlSingletonType(engine,
884+ "Ubuntu.Components", "Colors/UbuntuColors10.qml");
885+}
886+
887+static QObject *registerUbuntuColors11(QQmlEngine *engine, QJSEngine *scriptEngine)
888 {
889 Q_UNUSED(scriptEngine)
890 return UbuntuComponentsPlugin::registerQmlSingletonType(engine,
891@@ -154,7 +161,7 @@
892
893 void UbuntuComponentsPlugin::registerTypesToVersion(const char *uri, int major, int minor)
894 {
895- qmlRegisterSingletonType<QObject>(uri, major, minor, "UbuntuColors", registerUbuntuColors);
896+ qmlRegisterSingletonType<QObject>(uri, major, minor, "UbuntuColors", registerUbuntuColors10);
897 qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object");
898 qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase");
899 qmlRegisterUncreatableType<UCUnits>(uri, major, minor, "UCUnits", "Not instantiable");
900@@ -184,6 +191,7 @@
901 // register 0.1 for backward compatibility
902 registerTypesToVersion(uri, 0, 1);
903 registerTypesToVersion(uri, 1, 0);
904+ qmlRegisterSingletonType<QObject>(uri, 1, 1, "UbuntuColors", registerUbuntuColors11);
905
906 // register custom event
907 ForwardedEvent::registerForwardedEvent();
908
909=== modified file 'modules/Ubuntu/Components/qmldir'
910--- modules/Ubuntu/Components/qmldir 2014-07-03 13:59:52 +0000
911+++ modules/Ubuntu/Components/qmldir 2014-07-18 18:17:44 +0000
912@@ -15,7 +15,7 @@
913 Label 0.1 Label.qml
914 AbstractButton 0.1 AbstractButton.qml
915 ActivityIndicator 0.1 ActivityIndicator.qml
916-ProgressBar 0.1 ProgressBar.qml
917+ProgressBar 0.1 ProgressBar10.qml
918 TextField 0.1 TextField.qml
919 TextArea 0.1 TextArea.qml
920 Switch 0.1 Switch.qml
921@@ -65,7 +65,7 @@
922 Label 1.0 Label.qml
923 AbstractButton 1.0 AbstractButton.qml
924 ActivityIndicator 1.0 ActivityIndicator.qml
925-ProgressBar 1.0 ProgressBar.qml
926+ProgressBar 1.0 ProgressBar10.qml
927 TextField 1.0 TextField.qml
928 TextArea 1.0 TextArea.qml
929 Switch 1.0 Switch.qml
930@@ -93,6 +93,7 @@
931
932 #version 1.1
933 ComboButton 1.1 ComboButton.qml
934+ProgressBar 1.1 ProgressBar11.qml
935 CrossFadeImage 1.1 CrossFadeImage11.qml
936 PullToRefresh 1.1 PullToRefresh.qml
937 UbuntuListView 1.1 UbuntuListView11.qml
938
939=== modified file 'modules/Ubuntu/Test/UbuntuTestCase.qml'
940--- modules/Ubuntu/Test/UbuntuTestCase.qml 2014-06-19 08:15:49 +0000
941+++ modules/Ubuntu/Test/UbuntuTestCase.qml 2014-07-18 18:17:44 +0000
942@@ -223,5 +223,14 @@
943 throw new Error("QtQuickTest::fail")
944 }
945 }
946-}
947+
948+ /*!
949+ Convenience function to allow typing a full string instead of single characters
950+ */
951+ function typeString(string) {
952+ for (var i = 0; i < string.length; i++) {
953+ keyClick(string[i]);
954+ }
955+ }
956+}
957
958
959=== modified file 'tests/autopilot/ubuntuuitoolkit/__init__.py'
960--- tests/autopilot/ubuntuuitoolkit/__init__.py 2014-06-30 10:49:51 +0000
961+++ tests/autopilot/ubuntuuitoolkit/__init__.py 2014-07-18 18:17:44 +0000
962@@ -41,6 +41,7 @@
963 'TextField',
964 'Toolbar',
965 'ToolkitException',
966+ 'ubuntu_scenarios',
967 'UbuntuListView11',
968 'UbuntuUIToolkitCustomProxyObjectBase',
969 ]
970@@ -52,6 +53,7 @@
971 environment,
972 fixture_setup,
973 tests,
974+ ubuntu_scenarios
975 )
976 from ubuntuuitoolkit._custom_proxy_objects import (
977 AppHeader,
978
979=== modified file 'tests/autopilot/ubuntuuitoolkit/base.py'
980--- tests/autopilot/ubuntuuitoolkit/base.py 2014-01-14 00:44:05 +0000
981+++ tests/autopilot/ubuntuuitoolkit/base.py 2014-07-18 18:17:44 +0000
982@@ -1,6 +1,6 @@
983 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
984 #
985-# Copyright (C) 2013 Canonical Ltd.
986+# Copyright (C) 2013, 2014 Canonical Ltd.
987 #
988 # This program is free software; you can redistribute it and/or modify
989 # it under the terms of the GNU Lesser General Public License as published by
990@@ -16,6 +16,7 @@
991
992 """Base classes for Autopilot tests using the Ubuntu UI Toolkit."""
993
994+import os
995 import subprocess
996
997 from autopilot import (
998@@ -25,14 +26,21 @@
999 )
1000
1001
1002+def get_host_multiarch():
1003+ if 'deb_host_multiarch' not in os.environ:
1004+ # Discard errors: the one known message is "GCC not installed"
1005+ os.environ['deb_host_multiarch'] = subprocess.check_output(
1006+ ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
1007+ universal_newlines=True, stderr=subprocess.PIPE).strip()
1008+ return os.environ['deb_host_multiarch']
1009+
1010+
1011 def get_qmlscene_launch_command():
1012 """Return the command to launch qmlscene for autopilot tests."""
1013 # We need to specify qt5 because qtchooser doesn't have a default
1014 # configuration on devices and it seems the environment variable
1015 # QT_SELECT=qt5 doesn't work for autopilot tests. --Mirv - 2013-10-03
1016- arch = subprocess.check_output(
1017- ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
1018- universal_newlines=True).strip()
1019+ arch = get_host_multiarch()
1020 return '/usr/lib/{}/qt5/bin/qmlscene'.format(arch)
1021
1022
1023
1024=== modified file 'tests/autopilot/ubuntuuitoolkit/fixture_setup.py'
1025--- tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-05-26 06:40:24 +0000
1026+++ tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-07-18 18:17:44 +0000
1027@@ -15,11 +15,14 @@
1028 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1029
1030 import copy
1031+import logging
1032 import os
1033 import shutil
1034 import tempfile
1035
1036 import fixtures
1037+from autopilot import display
1038+from gi.repository import Gio
1039
1040 from ubuntuuitoolkit import base, environment
1041
1042@@ -46,6 +49,9 @@
1043 }
1044
1045
1046+logger = logging.getLogger(__name__)
1047+
1048+
1049 class FakeApplication(fixtures.Fixture):
1050
1051 def __init__(
1052@@ -163,3 +169,82 @@
1053 shutil.copyfile(
1054 xauthority_file_path,
1055 os.path.join(directory, '.Xauthority'))
1056+
1057+
1058+class HideUnity7Launcher(fixtures.Fixture):
1059+
1060+ """Hide the Unity7 launcher if it is visible and restore it on clean up."""
1061+
1062+ _UNITYSHELL_GSETTINGS_SCHEMA = 'org.compiz.unityshell'
1063+ _UNITYSHELL_GSETTINGS_PATH = (
1064+ '/org/compiz/profiles/unity/plugins/unityshell/')
1065+ _UNITYSHELL_LAUNCHER_KEY = 'launcher-hide-mode'
1066+ _UNITYSHELL_LAUNCHER_HIDDEN_MODE = 1 # launcher hidden
1067+
1068+ def setUp(self):
1069+ super(HideUnity7Launcher, self).setUp()
1070+ self._hide_launcher()
1071+
1072+ def _hide_launcher(self):
1073+ if (self._UNITYSHELL_GSETTINGS_SCHEMA in
1074+ Gio.Settings.list_relocatable_schemas()):
1075+ unityshell_schema = Gio.Settings.new_with_path(
1076+ self._UNITYSHELL_GSETTINGS_SCHEMA,
1077+ self._UNITYSHELL_GSETTINGS_PATH)
1078+ self._hide_launcher_from_schema(unityshell_schema)
1079+ else:
1080+ logger.warning('Unity Shell gsettings schema not found.')
1081+
1082+ def _hide_launcher_from_schema(self, unityshell_schema):
1083+ original_mode = self._get_launcher_mode(unityshell_schema)
1084+ self.addCleanup(
1085+ self._set_launcher_mode, unityshell_schema, original_mode)
1086+ self._set_launcher_mode(
1087+ unityshell_schema, self._UNITYSHELL_LAUNCHER_HIDDEN_MODE)
1088+
1089+ def _get_launcher_mode(self, unityshell_schema):
1090+ return unityshell_schema.get_int(self._UNITYSHELL_LAUNCHER_KEY)
1091+
1092+ def _set_launcher_mode(self, unityshell_schema, mode):
1093+ unityshell_schema.set_int(self._UNITYSHELL_LAUNCHER_KEY, mode)
1094+
1095+
1096+class SimulateDevice(fixtures.Fixture):
1097+
1098+ def __init__(self, app_width, app_height, grid_unit_px):
1099+ super(SimulateDevice, self).__init__()
1100+ self.app_width = app_width
1101+ self.app_height = app_height
1102+ self.grid_unit_px = grid_unit_px
1103+ self._screen = None
1104+
1105+ def setUp(self):
1106+ super(SimulateDevice, self).setUp()
1107+ if self._is_geometry_larger_than_display(
1108+ self.app_width, self.app_height):
1109+ scale_divisor = self._get_scale_divisor()
1110+ self.grid_unit_px = self.grid_unit_px // scale_divisor
1111+ self.app_width = self.app_width // scale_divisor
1112+ self.app_height = self.app_height // scale_divisor
1113+ self.useFixture(
1114+ fixtures.EnvironmentVariable(
1115+ 'GRID_UNIT_PX', str(self.grid_unit_px)))
1116+
1117+ def _get_scale_divisor(self):
1118+ scale_divisor = 2
1119+ while self._is_geometry_larger_than_display(
1120+ self.app_width // scale_divisor,
1121+ self.app_height // scale_divisor):
1122+ scale_divisor = scale_divisor * 2
1123+ return scale_divisor
1124+
1125+ def _is_geometry_larger_than_display(self, width, height):
1126+ screen = self._get_screen()
1127+ screen_width = screen.get_screen_width()
1128+ screen_height = screen.get_screen_height()
1129+ return (width > screen_width) or (height > screen_height)
1130+
1131+ def _get_screen(self):
1132+ if self._screen is None:
1133+ self._screen = display.Display.create()
1134+ return self._screen
1135
1136=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py'
1137--- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-06-16 12:07:41 +0000
1138+++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-07-18 18:17:44 +0000
1139@@ -60,8 +60,8 @@
1140 os.path.dirname(__file__), '..', '..', '..', '..'))
1141
1142
1143-class QMLStringAppTestCase(base.UbuntuUIToolkitAppTestCase):
1144- """Base test case for self tests that define the QML on an string."""
1145+class UbuntuUIToolkitWithFakeAppRunningTestCase(
1146+ base.UbuntuUIToolkitAppTestCase):
1147
1148 test_qml = ("""
1149 import QtQuick 2.0
1150@@ -69,13 +69,12 @@
1151
1152 MainView {
1153 width: units.gu(48)
1154- height: units.gu(60)
1155+ height: units.gu(80)
1156 }
1157 """)
1158
1159 def setUp(self):
1160- super(QMLStringAppTestCase, self).setUp()
1161- self.pointing_device = Pointer(self.input_device_class.create())
1162+ super(UbuntuUIToolkitWithFakeAppRunningTestCase, self).setUp()
1163 self.launch_application()
1164
1165 def launch_application(self):
1166@@ -83,18 +82,24 @@
1167 qml_file_contents=self.test_qml)
1168 self.useFixture(fake_application)
1169
1170- self.app = self.launch_test_application(
1171- base.get_qmlscene_launch_command(),
1172- '-I' + _get_module_include_path(),
1173- fake_application.qml_file_path,
1174- '--desktop_file_hint={0}'.format(
1175- fake_application.desktop_file_path),
1176- emulator_base=emulators.UbuntuUIToolkitEmulatorBase,
1177- app_type='qt')
1178-
1179+ desktop_file_name = os.path.basename(
1180+ fake_application.desktop_file_path)
1181+ application_name, _ = os.path.splitext(desktop_file_name)
1182+ self.app = self.launch_upstart_application(
1183+ application_name,
1184+ emulator_base=emulators.UbuntuUIToolkitEmulatorBase)
1185+
1186+
1187+class QMLStringAppTestCase(UbuntuUIToolkitWithFakeAppRunningTestCase):
1188+ """Base test case for self tests that define the QML on an string."""
1189+
1190+ def setUp(self):
1191+ super(QMLStringAppTestCase, self).setUp()
1192 self.assertThat(
1193 self.main_view.visible, Eventually(Equals(True)))
1194
1195+ self.pointing_device = Pointer(self.input_device_class.create())
1196+
1197 @property
1198 def main_view(self):
1199 return self.app.select_single(emulators.MainView)
1200
1201=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
1202--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-06-17 07:12:49 +0000
1203+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-07-18 18:17:44 +0000
1204@@ -15,7 +15,6 @@
1205 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1206
1207 import os
1208-import subprocess
1209
1210 import testtools
1211 import ubuntuuitoolkit
1212@@ -207,9 +206,7 @@
1213 if os.path.exists(path_to_local_launcher):
1214 return path_to_local_launcher
1215 else:
1216- arch = subprocess.check_output(
1217- ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"],
1218- universal_newlines=True).strip()
1219+ arch = ubuntuuitoolkit.base.get_host_multiarch()
1220 path_to_installed_launcher = os.path.join(
1221 '/', 'usr', 'lib', arch, 'ubuntu-ui-toolkit', 'launcher')
1222 return path_to_installed_launcher
1223
1224=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py'
1225--- tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2014-06-04 18:45:04 +0000
1226+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2014-07-18 18:17:44 +0000
1227@@ -19,24 +19,71 @@
1228 import os
1229 import shutil
1230
1231+from autopilot.matchers import Eventually
1232+from testtools.matchers import Equals
1233+
1234 import ubuntuuitoolkit
1235+from ubuntuuitoolkit import fixture_setup
1236
1237
1238 class GalleryTestCase(ubuntuuitoolkit.tests.QMLFileAppTestCase):
1239+
1240 """Base class for gallery test cases."""
1241
1242 local_desktop_file_path = None
1243
1244 def setUp(self):
1245- if self._application_source_exists():
1246- self.test_source_path = self._get_path_to_gallery_source()
1247- else:
1248- self.test_source_path = self._get_path_to_installed_gallery()
1249- assert os.path.exists(self.test_source_path)
1250+ self.test_source_path = self._get_test_source_path()
1251 self.test_qml_file_path = self._get_test_qml_file_path()
1252 self.desktop_file_path = self._get_desktop_file_path()
1253+
1254+ if self.should_simulate_device():
1255+ # Hide the Unity7 launcher because it takes space that might be
1256+ # needed by the app with the simulated size.
1257+ self.useFixture(fixture_setup.HideUnity7Launcher())
1258+ # This sets the grid units, so it should be called before launching
1259+ # the app.
1260+ self.simulate_device()
1261+
1262 super(GalleryTestCase, self).setUp()
1263
1264+ if self.should_simulate_device():
1265+ # XXX Currently we have no way to launch the application with a
1266+ # specific size, so we must resize it after it's launched.
1267+ # --elopio - 2014-06-25
1268+ self.resize_window()
1269+
1270+ def should_simulate_device(self):
1271+ return (hasattr(self, 'app_width') and hasattr(self, 'app_height') and
1272+ hasattr(self, 'grid_unit_px'))
1273+
1274+ def simulate_device(self):
1275+ simulate_device_fixture = self.useFixture(fixture_setup.SimulateDevice(
1276+ self.app_width, self.app_height, self.grid_unit_px))
1277+ self.app_width = simulate_device_fixture.app_width
1278+ self.app_height = simulate_device_fixture.app_height
1279+
1280+ def resize_window(self):
1281+ application = self.process_manager.get_running_applications()[0]
1282+ window = application.get_windows()[0]
1283+ window.resize(self.app_width, self.app_height)
1284+
1285+ def get_window_size():
1286+ _, _, window_width, window_height = window.geometry
1287+ return window_width, window_height
1288+
1289+ self.assertThat(
1290+ get_window_size,
1291+ Eventually(Equals((self.app_width, self.app_height))))
1292+
1293+ def _get_test_source_path(self):
1294+ if self._application_source_exists():
1295+ test_source_path = self._get_path_to_gallery_source()
1296+ else:
1297+ test_source_path = self._get_path_to_installed_gallery()
1298+ assert os.path.exists(test_source_path)
1299+ return test_source_path
1300+
1301 def _get_path_to_gallery_source(self):
1302 return os.path.join(
1303 ubuntuuitoolkit.tests.get_path_to_source_root(), 'examples',
1304
1305=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py'
1306--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-05-30 14:24:27 +0000
1307+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-07-18 18:17:44 +0000
1308@@ -1,6 +1,6 @@
1309 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1310 #
1311-# Copyright (C) 2012, 2013 Canonical Ltd.
1312+# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
1313 #
1314 # This program is free software; you can redistribute it and/or modify
1315 # it under the terms of the GNU Lesser General Public License as published by
1316@@ -16,14 +16,19 @@
1317
1318 """Tests for the Ubuntu UI Toolkit Gallery - Button component"""
1319
1320+import testscenarios
1321 from autopilot.matchers import Eventually
1322 from testtools.matchers import Equals
1323-from ubuntuuitoolkit.tests.gallery import GalleryTestCase
1324-
1325-
1326-class ButtonsTestCase(GalleryTestCase):
1327-
1328- scenarios = [
1329+
1330+from ubuntuuitoolkit import ubuntu_scenarios
1331+from ubuntuuitoolkit.tests import gallery
1332+
1333+import os
1334+
1335+
1336+class ButtonsTestCase(gallery.GalleryTestCase):
1337+
1338+ buttons_scenarios = [
1339 ('standard button', dict(
1340 button_name="button_text", is_enabled=True, color=None, icon=None,
1341 text="Call")),
1342@@ -44,6 +49,15 @@
1343 icon=None, text="Call"))
1344 ]
1345
1346+ scenarios = testscenarios.multiply_scenarios(
1347+ ubuntu_scenarios.get_device_simulation_scenarios(),
1348+ buttons_scenarios)
1349+
1350+ def setUp(self):
1351+ # Reset the locale to English
1352+ os.environ['LANGUAGE'] = 'en'
1353+ super(ButtonsTestCase, self).setUp()
1354+
1355 def test_buttons(self):
1356 self.open_page('buttonsElement')
1357
1358
1359=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py'
1360--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-06-18 05:35:24 +0000
1361+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-07-18 18:17:44 +0000
1362@@ -16,13 +16,18 @@
1363
1364 """Tests for the Ubuntu UI Toolkit Gallery"""
1365
1366+import testscenarios
1367+
1368 import ubuntuuitoolkit
1369+from ubuntuuitoolkit import ubuntu_scenarios
1370 from ubuntuuitoolkit.tests import gallery
1371
1372
1373 class GalleryAppTestCase(gallery.GalleryTestCase):
1374 """Generic tests for the Gallery"""
1375
1376+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
1377+
1378 def test_select_main_view_must_return_main_window_emulator(self):
1379 main_view = self.main_view
1380 self.assertIsInstance(main_view, ubuntuuitoolkit.MainView)
1381@@ -91,13 +96,17 @@
1382 'sheets', 'animations'
1383 ]
1384
1385- scenarios = [
1386+ pages_scenarios = [
1387 (name, dict(
1388 element_name=name+'Element',
1389 template_name=name+'Template'))
1390 for name in names
1391 ]
1392
1393+ scenarios = testscenarios.multiply_scenarios(
1394+ ubuntu_scenarios.get_device_simulation_scenarios(),
1395+ pages_scenarios)
1396+
1397 def test_open_page(self):
1398 self.open_page(self.element_name)
1399 element = self.main_view.select_single(
1400
1401=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py'
1402--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-05-30 14:24:27 +0000
1403+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-07-18 18:17:44 +0000
1404@@ -17,14 +17,20 @@
1405 """Tests for the Ubuntu UI Toolkit Gallery - OptionSelector component."""
1406
1407 import ubuntuuitoolkit
1408+from ubuntuuitoolkit import ubuntu_scenarios
1409 from ubuntuuitoolkit.tests.gallery import GalleryTestCase
1410
1411
1412 class OptionSelectorTestCase(GalleryTestCase):
1413
1414+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
1415+
1416 def setUp(self):
1417 super(OptionSelectorTestCase, self).setUp()
1418 self.open_page('optionSelectorsElement')
1419+ # Start with the toolbar closed to make the full page visible and be
1420+ # able to swipe it.
1421+ self.main_view.close_toolbar()
1422
1423 def test_select_option_from_collapsed_optionselector(self):
1424 collapsed_option_selector = self.main_view.select_single(
1425
1426=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py'
1427--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 2014-06-09 17:20:43 +0000
1428+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 2014-07-18 18:17:44 +0000
1429@@ -16,11 +16,14 @@
1430
1431 from autopilot import platform
1432
1433+from ubuntuuitoolkit import ubuntu_scenarios
1434 from ubuntuuitoolkit.tests import gallery
1435
1436
1437 class ScrollBarTestCase(gallery.GalleryTestCase):
1438
1439+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
1440+
1441 def setUp(self):
1442 super(ScrollBarTestCase, self).setUp()
1443 self.open_page('navigationElement')
1444@@ -30,9 +33,12 @@
1445 def move_mouse_to_thumb(self):
1446 # TODO we need a helper to move the interactive thumb.
1447 # --elopio 2014-05-06
1448- thumb = self.scrollbar.select_single(
1449+ thumb = self.get_mouse_thumb()
1450+ self.pointing_device.move_to_object(thumb)
1451+
1452+ def get_mouse_thumb(self):
1453+ return self.scrollbar.select_single(
1454 objectName='interactiveScrollbarThumb')
1455- self.pointing_device.move_to_object(thumb)
1456
1457 def test_scrollbar_must_start_without_interactive_thumb(self):
1458 self.assertEqual(self.scrollbar.interactive, False)
1459@@ -57,7 +63,12 @@
1460 self.assertEqual(flickable.is_child_visible(bottom_section), False)
1461
1462 self.move_mouse_to_thumb()
1463- x, y = self.pointing_device.position()
1464- self.pointing_device.drag(x, y, x, self.main_view.height)
1465+ mouse_thumb = self.get_mouse_thumb()
1466+ x, y, width, height = mouse_thumb.globalRect
1467+ start_x = stop_x = x + (width // 2)
1468+ start_y = y + (height // 0.8)
1469+
1470+ self.pointing_device.drag(
1471+ start_x, start_y, stop_x, self.main_view.height)
1472
1473 self.assertEqual(flickable.is_child_visible(bottom_section), True)
1474
1475=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py'
1476--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-05-30 14:24:27 +0000
1477+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-07-18 18:17:44 +0000
1478@@ -16,7 +16,9 @@
1479
1480 """Tests for the Ubuntu UI Toolkit Gallery - TextInput components"""
1481
1482-from ubuntuuitoolkit import emulators
1483+import testscenarios
1484+
1485+from ubuntuuitoolkit import emulators, ubuntu_scenarios
1486 from ubuntuuitoolkit.tests.gallery import GalleryTestCase
1487 import locale
1488
1489@@ -31,7 +33,7 @@
1490
1491 # text_to_write is a function to ensure
1492 # that locale is evaluated after setUp
1493- scenarios = [
1494+ text_input_scenarios = [
1495 ('standard textfield', dict(
1496 objectName='textfield_standard',
1497 text_to_write=text_to_write_string,
1498@@ -49,6 +51,10 @@
1499 expected_text='-100123'))
1500 ]
1501
1502+ scenarios = testscenarios.multiply_scenarios(
1503+ ubuntu_scenarios.get_device_simulation_scenarios(),
1504+ text_input_scenarios)
1505+
1506 def setUp(self):
1507 super(WriteAndClearTextInputTestCase, self).setUp()
1508 # Apply the user locale from the environment
1509@@ -74,6 +80,8 @@
1510
1511 class DisabledTextInputTestCase(GalleryTestCase):
1512
1513+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
1514+
1515 def setUp(self):
1516 super(DisabledTextInputTestCase, self).setUp()
1517 self.open_page('textinputsElement')
1518
1519=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py'
1520--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2014-05-30 14:24:27 +0000
1521+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2014-07-18 18:17:44 +0000
1522@@ -1,6 +1,6 @@
1523 # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1524 #
1525-# Copyright (C) 2012, 2013 Canonical Ltd.
1526+# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
1527 #
1528 # This program is free software; you can redistribute it and/or modify
1529 # it under the terms of the GNU Lesser General Public License as published by
1530@@ -14,15 +14,17 @@
1531 # You should have received a copy of the GNU Lesser General Public License
1532 # along with this program. If not, see <http://www.gnu.org/licenses/>.
1533
1534-from ubuntuuitoolkit import emulators
1535+import testscenarios
1536+
1537+from testtools.matchers import Equals
1538+
1539+from ubuntuuitoolkit import emulators, ubuntu_scenarios
1540 from ubuntuuitoolkit.tests import gallery
1541
1542-from testtools.matchers import Equals
1543-
1544
1545 class EnabledTogglesTestCase(gallery.GalleryTestCase):
1546
1547- scenarios = [
1548+ toggles_scenarios = [
1549 ('checkbox unchecked', dict(
1550 object_name='checkbox_unchecked', initial_state=False)),
1551 ('checkbox checked', dict(
1552@@ -33,6 +35,10 @@
1553 object_name='switch_checked', initial_state=True))
1554 ]
1555
1556+ scenarios = testscenarios.multiply_scenarios(
1557+ ubuntu_scenarios.get_device_simulation_scenarios(),
1558+ toggles_scenarios)
1559+
1560 def setUp(self):
1561 super(EnabledTogglesTestCase, self).setUp()
1562 self.open_page('togglesElement')
1563@@ -49,7 +55,7 @@
1564
1565 class DisabledTogglesTestCase(gallery.GalleryTestCase):
1566
1567- scenarios = [
1568+ toggles_scenarios = [
1569 ('checkbox disabled unchecked', dict(
1570 object_name='checkbox_disabled_unchecked', initial_state=False)),
1571 ('checkbox disabled checked', dict(
1572@@ -60,6 +66,10 @@
1573 object_name='switch_disabled_checked', initial_state=True))
1574 ]
1575
1576+ scenarios = testscenarios.multiply_scenarios(
1577+ ubuntu_scenarios.get_device_simulation_scenarios(),
1578+ toggles_scenarios)
1579+
1580 def setUp(self):
1581 super(DisabledTogglesTestCase, self).setUp()
1582 self.open_page('togglesElement')
1583
1584=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
1585--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-06-03 20:10:53 +0000
1586+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-07-18 18:17:44 +0000
1587@@ -24,10 +24,15 @@
1588 # Python 2 add-on: python-mock.
1589 import mock
1590 import testtools
1591-from autopilot import testcase as autopilot_testcase
1592-from testtools.matchers import Contains, FileExists, Not
1593+from autopilot import (
1594+ display,
1595+ platform,
1596+ testcase as autopilot_testcase
1597+)
1598+from autopilot.matchers import Eventually
1599+from testtools.matchers import Contains, Equals, FileExists, Not
1600
1601-from ubuntuuitoolkit import base, environment, fixture_setup
1602+from ubuntuuitoolkit import base, environment, fixture_setup, tests
1603
1604
1605 class FakeApplicationTestCase(testtools.TestCase):
1606@@ -304,3 +309,99 @@
1607 self.assertTrue(
1608 os.path.exists(
1609 os.path.join(os.environ.get('HOME'), '.Xauthority')))
1610+
1611+
1612+class HideUnity7LauncherTestCase(
1613+ tests.UbuntuUIToolkitWithFakeAppRunningTestCase):
1614+
1615+ def setUp(self):
1616+ if platform.model() != 'Desktop':
1617+ self.skipTest('Unity 7 runs only on desktop.')
1618+ self.useFixture(fixture_setup.HideUnity7Launcher())
1619+ super(HideUnity7LauncherTestCase, self).setUp()
1620+
1621+ def test_maximized_application_must_use_all_screen_width(self):
1622+ application = self.process_manager.get_running_applications()[0]
1623+ window = application.get_windows()[0]
1624+
1625+ # Maximize window.
1626+ screen = display.Display.create()
1627+ screen_width = screen.get_screen_width()
1628+ screen_height = screen.get_screen_height()
1629+ window.resize(screen_width, screen_height)
1630+
1631+ def get_window_width():
1632+ _, _, window_width, _ = window.geometry
1633+ return window_width
1634+
1635+ self.assertThat(
1636+ get_window_width,
1637+ Eventually(Equals(screen_width)))
1638+
1639+
1640+class FakeDisplay(object):
1641+
1642+ """Fake display with fixed widht and height for use in tests."""
1643+
1644+ def __init__(self, width, height):
1645+ super(FakeDisplay, self).__init__()
1646+ self.width = width
1647+ self.height = height
1648+
1649+ def get_screen_width(self):
1650+ return self.width
1651+
1652+ def get_screen_height(self):
1653+ return self.height
1654+
1655+
1656+class SimulateDeviceTestCase(autopilot_testcase.AutopilotTestCase):
1657+
1658+ scenarios = [
1659+ ('Device equal to screen', {
1660+ 'device_width': 100, 'device_height': 100, 'device_grid_unit': 20,
1661+ 'screen_width': 100, 'screen_height': 100,
1662+ 'expected_width': 100, 'expected_height': 100,
1663+ 'expected_grid_unit': 20}),
1664+ ('Device smaller than screen', {
1665+ 'device_width': 100, 'device_height': 90, 'device_grid_unit': 20,
1666+ 'screen_width': 110, 'screen_height': 100,
1667+ 'expected_width': 100, 'expected_height': 90,
1668+ 'expected_grid_unit': 20}),
1669+ ('Device wider than screen', {
1670+ 'device_width': 200, 'device_height': 90, 'device_grid_unit': 20,
1671+ 'screen_width': 110, 'screen_height': 100,
1672+ 'expected_width': 100, 'expected_height': 45,
1673+ 'expected_grid_unit': 10}),
1674+ ('Device taller than screen', {
1675+ 'device_width': 100, 'device_height': 180, 'device_grid_unit': 20,
1676+ 'screen_width': 110, 'screen_height': 100,
1677+ 'expected_width': 50, 'expected_height': 90,
1678+ 'expected_grid_unit': 10}),
1679+ ('Device bigger than screen', {
1680+ 'device_width': 200, 'device_height': 180, 'device_grid_unit': 20,
1681+ 'screen_width': 110, 'screen_height': 100,
1682+ 'expected_width': 100, 'expected_height': 90,
1683+ 'expected_grid_unit': 10}),
1684+ ]
1685+
1686+ def test_simulate_device_fixture_with_size_smaller_than_screen(self):
1687+ """Test the simulation of a device that fits the screen.
1688+
1689+ All the attributes of the fixture must remain the same.
1690+
1691+ """
1692+
1693+ simulate_device_fixture = fixture_setup.SimulateDevice(
1694+ self.device_width, self.device_height, self.device_grid_unit)
1695+ fake_display = FakeDisplay(self.screen_width, self.screen_height)
1696+ simulate_device_fixture._screen = fake_display
1697+
1698+ self.useFixture(simulate_device_fixture)
1699+
1700+ self.assertEqual(
1701+ int(os.environ.get('GRID_UNIT_PX')), self.expected_grid_unit)
1702+ self.assertEqual(
1703+ simulate_device_fixture.app_width, self.expected_width)
1704+ self.assertEqual(
1705+ simulate_device_fixture.app_height, self.expected_height)
1706
1707=== added file 'tests/autopilot/ubuntuuitoolkit/tests/test_ubuntu_scenarios.py'
1708--- tests/autopilot/ubuntuuitoolkit/tests/test_ubuntu_scenarios.py 1970-01-01 00:00:00 +0000
1709+++ tests/autopilot/ubuntuuitoolkit/tests/test_ubuntu_scenarios.py 2014-07-18 18:17:44 +0000
1710@@ -0,0 +1,70 @@
1711+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1712+#
1713+# Copyright (C) 2014 Canonical Ltd.
1714+#
1715+# This program is free software; you can redistribute it and/or modify
1716+# it under the terms of the GNU Lesser General Public License as published by
1717+# the Free Software Foundation; version 3.
1718+#
1719+# This program is distributed in the hope that it will be useful,
1720+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1721+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1722+# GNU Lesser General Public License for more details.
1723+#
1724+# You should have received a copy of the GNU Lesser General Public License
1725+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1726+
1727+try:
1728+ from unittest import mock
1729+except ImportError:
1730+ import mock
1731+
1732+import testtools
1733+
1734+from ubuntuuitoolkit import ubuntu_scenarios
1735+
1736+
1737+class ScenariosTestCase(testtools.TestCase):
1738+
1739+ def test_get_nexus_4_scenario(self):
1740+ expected_scenarios = [
1741+ ('Simulating Nexus 4 in desktop',
1742+ dict(app_width=768, app_height=1280, grid_unit_px=18)),
1743+ ]
1744+ with mock.patch('autopilot.platform.model') as mock_model:
1745+ mock_model.return_value = 'Desktop'
1746+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios(
1747+ devices=ubuntu_scenarios.NEXUS4_DEVICE)
1748+ self.assertEqual(expected_scenarios, scenarios)
1749+
1750+ def test_get_nexus_10_scenario(self):
1751+ expected_scenarios = [
1752+ ('Simulating Nexus 10 in desktop',
1753+ dict(app_width=2560, app_height=1600, grid_unit_px=20))
1754+ ]
1755+
1756+ with mock.patch('autopilot.platform.model') as mock_model:
1757+ mock_model.return_value = 'Desktop'
1758+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios(
1759+ devices=ubuntu_scenarios.NEXUS10_DEVICE)
1760+ self.assertEqual(expected_scenarios, scenarios)
1761+
1762+ def test_get_default_scenarios_must_return_supported_devices(self):
1763+ expected_scenarios = [
1764+ ('Simulating Nexus 4 in desktop',
1765+ dict(app_width=768, app_height=1280, grid_unit_px=18)),
1766+ ('Simulating Nexus 10 in desktop',
1767+ dict(app_width=2560, app_height=1600, grid_unit_px=20))
1768+ ]
1769+
1770+ with mock.patch('autopilot.platform.model') as mock_model:
1771+ mock_model.return_value = 'Desktop'
1772+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
1773+ self.assertEqual(expected_scenarios, scenarios)
1774+
1775+ def test_get_scenarios_on_device_must_return_no_simulation_scenarios(self):
1776+ with mock.patch('autopilot.platform.model') as mock_model:
1777+ mock_model.return_value = 'Not Desktop'
1778+ scenarios = ubuntu_scenarios.get_device_simulation_scenarios()
1779+
1780+ self.assertEqual([('Not Desktop', {})], scenarios)
1781
1782=== added file 'tests/autopilot/ubuntuuitoolkit/ubuntu_scenarios.py'
1783--- tests/autopilot/ubuntuuitoolkit/ubuntu_scenarios.py 1970-01-01 00:00:00 +0000
1784+++ tests/autopilot/ubuntuuitoolkit/ubuntu_scenarios.py 2014-07-18 18:17:44 +0000
1785@@ -0,0 +1,54 @@
1786+# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
1787+#
1788+# Copyright (C) 2014 Canonical Ltd.
1789+#
1790+# This program is free software; you can redistribute it and/or modify
1791+# it under the terms of the GNU Lesser General Public License as published by
1792+# the Free Software Foundation; version 3.
1793+#
1794+# This program is distributed in the hope that it will be useful,
1795+# but WITHOUT ANY WARRANTY; without even the implied warranty of
1796+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1797+# GNU Lesser General Public License for more details.
1798+#
1799+# You should have received a copy of the GNU Lesser General Public License
1800+# along with this program. If not, see <http://www.gnu.org/licenses/>.
1801+
1802+from autopilot import platform
1803+
1804+
1805+NEXUS4_DEVICE = 'Nexus4'
1806+NEXUS10_DEVICE = 'Nexus10'
1807+DEFAULT_DEVICES = (NEXUS4_DEVICE, NEXUS10_DEVICE)
1808+
1809+
1810+def get_device_simulation_scenarios(devices=DEFAULT_DEVICES):
1811+ """Return a list of devices to be simulated on tests.
1812+
1813+ :param devices: The device or devices to simulate. Default value is all the
1814+ officially supported devices.
1815+ :type devices: string or sequence of strings.
1816+ :return: A list of scenarios to be used with the testscenarios python
1817+ module, with the values of app_width, app_height and grid_unit
1818+ corresponding to the selected device.
1819+
1820+ """
1821+ if platform.model() == 'Desktop':
1822+ return _get_device_simulation_scenarios_for_desktop(devices)
1823+ else:
1824+ return [(platform.model(), {})]
1825+
1826+
1827+def _get_device_simulation_scenarios_for_desktop(devices):
1828+ scenarios = []
1829+ if NEXUS4_DEVICE in devices:
1830+ scenarios.append(
1831+ ('Simulating Nexus 4 in desktop',
1832+ dict(app_width=768, app_height=1280, grid_unit_px=18))
1833+ )
1834+ if NEXUS10_DEVICE in devices:
1835+ scenarios.append(
1836+ ('Simulating Nexus 10 in desktop',
1837+ dict(app_width=2560, app_height=1600, grid_unit_px=20))
1838+ )
1839+ return scenarios
1840
1841=== modified file 'tests/qmlapicheck.sh'
1842--- tests/qmlapicheck.sh 2014-06-19 07:21:53 +0000
1843+++ tests/qmlapicheck.sh 2014-07-18 18:17:44 +0000
1844@@ -25,7 +25,7 @@
1845 # Silence spam on stderr due to fonts
1846 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
1847 # https://bugreports.qt-project.org/browse/QTBUG-36243
1848- qmlplugindump $i 0.1 modules 1>> plugins.qmltypes
1849+ ALARM_BACKEND=memory qmlplugindump $i 0.1 modules 1>> plugins.qmltypes
1850 test $? != 0 && ERRORS=1
1851 done
1852 test $ERRORS = 1 && echo Error: qmlplugindump failed && exit 1
1853
1854=== modified file 'tests/unit/runtest.sh'
1855--- tests/unit/runtest.sh 2014-06-16 08:02:48 +0000
1856+++ tests/unit/runtest.sh 2014-07-18 18:17:44 +0000
1857@@ -45,6 +45,7 @@
1858 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
1859 # https://bugreports.qt-project.org/browse/QTBUG-36243
1860 QML2_IMPORT_PATH=../../../modules:$QML2_IMPORT_PATH UBUNTU_UI_TOOLKIT_THEMES_PATH=../../../modules \
1861+ ALARM_BACKEND=memory \
1862 $_CMD $_ARGS 2>&1 | grep -v 'QFontDatabase: Cannot find font directory'
1863 # Note: Get first command before the pipe, $? would be ambiguous
1864 RESULT=${PIPESTATUS[0]}
1865
1866=== modified file 'tests/unit/tst_components/tst_progressbar.qml'
1867--- tests/unit/tst_components/tst_progressbar.qml 2014-04-23 08:50:20 +0000
1868+++ tests/unit/tst_components/tst_progressbar.qml 2014-07-18 18:17:44 +0000
1869@@ -16,7 +16,8 @@
1870
1871 import QtQuick 2.0
1872 import QtTest 1.0
1873-import Ubuntu.Components 1.1
1874+// Note: See tst_progressbar11.qml for the newer API tests
1875+import Ubuntu.Components 1.0
1876
1877 TestCase {
1878 name: "ProgressBarAPI"
1879@@ -28,6 +29,10 @@
1880 compare(progressBar.indeterminate,newIndeterminated,"can set/get")
1881 }
1882
1883+ function test_showProgressPercentageExists() {
1884+ verify(!progressBar.hasOwnProperty("showProgressPercentage"), "Property absent")
1885+ }
1886+
1887 function test_maximumValue() {
1888 compare(progressBar.maximumValue,1.0,"is set to 1.0 by default")
1889 var newMaximumValue = 20.0
1890
1891=== added file 'tests/unit/tst_components/tst_progressbar11.qml'
1892--- tests/unit/tst_components/tst_progressbar11.qml 1970-01-01 00:00:00 +0000
1893+++ tests/unit/tst_components/tst_progressbar11.qml 2014-07-18 18:17:44 +0000
1894@@ -0,0 +1,38 @@
1895+/*
1896+ * Copyright 2014 Canonical Ltd.
1897+ *
1898+ * This program is free software; you can redistribute it and/or modify
1899+ * it under the terms of the GNU Lesser General Public License as published by
1900+ * the Free Software Foundation; version 3.
1901+ *
1902+ * This program is distributed in the hope that it will be useful,
1903+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1904+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1905+ * GNU Lesser General Public License for more details.
1906+ *
1907+ * You should have received a copy of the GNU Lesser General Public License
1908+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1909+ */
1910+
1911+import QtQuick 2.0
1912+import QtTest 1.0
1913+import Ubuntu.Components 1.1
1914+
1915+TestCase {
1916+ name: "ProgressBarAPI"
1917+
1918+ function test_showProgressPercentageExists() {
1919+ verify(progressBar.hasOwnProperty("showProgressPercentage"), "Property missing")
1920+ }
1921+
1922+ function test_noLabel() {
1923+ compare(progressBar.showProgressPercentage,true, "is set by default")
1924+ var newShowProgressPercentage = false
1925+ progressBar.showProgressPercentage = newShowProgressPercentage
1926+ compare(progressBar.showProgressPercentage, newShowProgressPercentage, "can set/get")
1927+ }
1928+
1929+ ProgressBar {
1930+ id: progressBar
1931+ }
1932+}
1933
1934=== added file 'tests/unit_x11/tst_components/tst_animator.qml'
1935--- tests/unit_x11/tst_components/tst_animator.qml 1970-01-01 00:00:00 +0000
1936+++ tests/unit_x11/tst_components/tst_animator.qml 2014-07-18 18:17:44 +0000
1937@@ -0,0 +1,75 @@
1938+/*
1939+ * Copyright 2014 Canonical Ltd.
1940+ *
1941+ * This program is free software; you can redistribute it and/or modify
1942+ * it under the terms of the GNU Lesser General Public License as published by
1943+ * the Free Software Foundation; version 3.
1944+ *
1945+ * This program is distributed in the hope that it will be useful,
1946+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1947+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1948+ * GNU Lesser General Public License for more details.
1949+ *
1950+ * You should have received a copy of the GNU Lesser General Public License
1951+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1952+ */
1953+
1954+
1955+/**
1956+ * Test to prevent regressions for bug: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1338602
1957+ * Activity Indicator crashes in QML/Widget mixed applications
1958+ */
1959+
1960+import QtQuick 2.2
1961+import QtQuick.Window 2.1
1962+import QtTest 1.0
1963+import Ubuntu.Components 1.1
1964+
1965+Item {
1966+ width: 360
1967+ height: 360
1968+ Window {
1969+ id: root
1970+ width: 360
1971+ height: 360
1972+
1973+ property int timeout: 500
1974+ property int runs: 20
1975+ property bool finished: false
1976+
1977+ TestCase {
1978+ name: "AnimatorRegressionTest"
1979+ when: windowShown
1980+
1981+ function test_show_hide () {
1982+ tryCompare(root,"finished",true,root.timeout * (root.runs+1));
1983+ }
1984+ }
1985+
1986+ Timer {
1987+ property int hits: 0
1988+ interval: root.timeout; running: !root.finished; repeat: !root.finished
1989+ onTriggered: {
1990+ hits++;
1991+ if (hits >= root.runs) {
1992+ root.visible = true;
1993+ root.finished = true;
1994+ return;
1995+ }
1996+
1997+ root.visible = !root.visible
1998+ }
1999+ }
2000+
2001+ Flow {
2002+ anchors.fill: parent
2003+ Repeater {
2004+ model: 3
2005+
2006+ ActivityIndicator {
2007+ running: true
2008+ }
2009+ }
2010+ }
2011+ }
2012+}
2013
2014=== modified file 'tests/unit_x11/tst_components/tst_textinput_touch.qml'
2015--- tests/unit_x11/tst_components/tst_textinput_touch.qml 2014-06-24 08:42:47 +0000
2016+++ tests/unit_x11/tst_components/tst_textinput_touch.qml 2014-07-18 18:17:44 +0000
2017@@ -192,15 +192,15 @@
2018 verify(selectedText !== "", "No text selected!");
2019
2020 popupSpy.target = findChild(data.input, "input_handler");
2021- TestExtras.touchLongPress(0, data.input, guPoint(1, 1));
2022+ TestExtras.touchLongPress(0, data.input, guPoint(2, 2));
2023 waitForRendering(data.input, 500);
2024 popupSpy.wait();
2025 compare(data.input.selectedText, selectedText, "Text selection should be the same!");
2026
2027 // cleanup
2028- TestExtras.touchRelease(0, data.input, guPoint(1, 1));
2029+ TestExtras.touchRelease(0, data.input, guPoint(2, 2));
2030 // dismiss popover
2031- TestExtras.touchClick(0, testMain, 0, 0);
2032+ TestExtras.touchClick(0, testMain, guPoint(0, 0));
2033 }
2034
2035 function test_drag_cursor_handler_data() {
2036@@ -275,9 +275,7 @@
2037 flickerSpy.target = outerFlicker;
2038 autoSizeTextArea.focus = data.focused;
2039 var editor = findChild(autoSizeTextArea, "text_input");
2040- wait(5000)
2041 TestExtras.touchDrag(0, editor, guPoint(0, 0), guPoint(0, 40));
2042- wait(5000)
2043 flickerSpy.wait();
2044 }
2045 }
2046
2047=== modified file 'tests/unit_x11/tst_test/tst_ubuntutestcase.qml'
2048--- tests/unit_x11/tst_test/tst_ubuntutestcase.qml 2014-06-24 07:01:06 +0000
2049+++ tests/unit_x11/tst_test/tst_ubuntutestcase.qml 2014-07-18 18:17:44 +0000
2050@@ -17,11 +17,12 @@
2051 import QtQuick 2.0
2052 import QtTest 1.0
2053 import Ubuntu.Test 1.0
2054+import Ubuntu.Components 1.0
2055
2056 Rectangle {
2057 id: root
2058 width: 800
2059- height: 600
2060+ height: 1000
2061
2062 Column {
2063 anchors.fill: parent
2064@@ -73,6 +74,9 @@
2065 height: 1000
2066 }
2067 }
2068+ TextField {
2069+ id: textField
2070+ }
2071 }
2072
2073 UbuntuTestCase {
2074@@ -173,6 +177,11 @@
2075 flick(flicker, flicker.width, flicker.height, -flicker.width, -flicker.height, 400, 100);
2076 movementSpy.wait();
2077 }
2078+ function test_typeString() {
2079+ textField.forceActiveFocus();
2080+ typeString("Hello Ubuntu");
2081+ tryCompare(textField, "text", "Hello Ubuntu");
2082+ }
2083
2084 SignalSpy {
2085 id: touchPressSpy

Subscribers

People subscribed via source and target branches

to status/vote changes: