Merge lp:~zsombi/ubuntu-ui-toolkit/inverseMouseArea-update into lp:ubuntu-ui-toolkit

Proposed by Zsombor Egri
Status: Superseded
Proposed branch: lp:~zsombi/ubuntu-ui-toolkit/inverseMouseArea-update
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 1859 lines (+729/-327)
47 files modified
debian/changelog (+45/-0)
debian/ubuntu-ui-toolkit-autopilot.install (+1/-0)
examples/ubuntu-ui-toolkit-gallery/Template.qml (+4/-0)
modules/Ubuntu/Components/ListItems/Empty.qml (+3/-23)
modules/Ubuntu/Components/OrientationHelper.qml (+1/-1)
modules/Ubuntu/Components/Popups/ComposerSheet.qml (+3/-0)
modules/Ubuntu/Components/Popups/DefaultSheet.qml (+4/-0)
modules/Ubuntu/Components/Popups/SheetBase.qml (+7/-1)
modules/Ubuntu/Components/Scrollbar.qml (+1/-1)
modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+13/-1)
modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml (+5/-1)
modules/Ubuntu/Components/plugin/filterbehavior.cpp (+8/-0)
modules/Ubuntu/Components/plugin/filterbehavior.h (+2/-0)
modules/Ubuntu/Components/plugin/inversemouseareatype.cpp (+9/-5)
modules/Ubuntu/Components/plugin/inversemouseareatype.h (+1/-0)
modules/Ubuntu/Components/plugin/sortbehavior.cpp (+8/-0)
modules/Ubuntu/Components/plugin/sortbehavior.h (+2/-0)
modules/Ubuntu/Components/plugin/uctheme.cpp (+6/-1)
modules/Ubuntu/Test/plugin/plugin.pro (+1/-1)
modules/Ubuntu/Test/plugin/uctestcase.cpp (+26/-0)
modules/Ubuntu/Test/plugin/uctestcase.h (+69/-0)
push_to_phone.sh (+41/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+10/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py (+13/-5)
tests/autopilot/ubuntuuitoolkit/tests/__init__.py (+1/-112)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+62/-39)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+89/-60)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py (+2/-0)
tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py (+21/-7)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py (+1/-3)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py (+10/-30)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py (+1/-3)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py (+63/-0)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py (+2/-6)
tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py (+2/-8)
tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py (+1/-1)
tests/launcher/launcher.cpp (+146/-0)
tests/launcher/launcher.pro (+11/-0)
tests/tests.pro (+2/-0)
tests/unit/runtest.sh (+4/-1)
tests/unit/unit.pro (+0/-2)
tests/unit_x11/tst_components/tst_hide_chrome.qml (+5/-0)
tests/unit_x11/tst_components/tst_popover.qml (+1/-0)
tests/unit_x11/tst_components/tst_textarea.qml (+2/-0)
tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml (+3/-0)
tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp (+8/-14)
tests/unit_x11/unit_x11.pro (+9/-1)
To merge this branch: bzr merge lp:~zsombi/ubuntu-ui-toolkit/inverseMouseArea-update
Reviewer Review Type Date Requested Status
Zoltan Balogh Pending
Review via email: mp+223588@code.launchpad.net

Commit message

Reverting InverseMouseAreaType updateArea() method to update(). Call super class update() method shadowed by the override.

To post a comment you must log in.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'debian/changelog'
--- debian/changelog 2014-06-04 07:26:07 +0000
+++ debian/changelog 2014-06-18 15:28:52 +0000
@@ -1,3 +1,48 @@
1ubuntu-ui-toolkit (0.1.46+14.10.20140602-0ubuntu2) UNRELEASED; urgency=medium
2
3 [Leo Arias ]
4 * On the autopilot helper for the header, fix the swipe to show
5 when hidden.
6 * Added a fixture for autopilot tests to use a fake home directory.
7 Fixes: https://bugs.launchpad.net/bugs/1317639
8 * Cleaned the containers in unity test using the alternate
9 launcher.
10 * Fixed the creation of the fake Xauthority file on mako for the
11 fixture tests. Fixes: https://bugs.launchpad.net/bugs/1326072
12 * Fixed the swipe to delete on the list item autopilot helper.
13 Fixes: https://bugs.launchpad.net/bugs/1311392.
14 * clean ups to the autopilot tests for the widget gallery.
15
16 [ Christian Dywan ]   
17 * Add a launcher with a switch for the QQMLEngine.
18 * The presence of a mouse enables the interactive thumb.
19 Fixes: https://bugs.launchpad.net/bugs/1165173
20 * Initialize sort.order explicitly.
21 Fixes: https://bugs.launchpad.net/bugs/1324087
22 * Swiping from Left to Right to Delete only.
23 * Show explicit failure when test wasn't built yet.
24 * Add push_to_phone script to push QML/ Python/ artwork.
25
26
27 [ Tim Peeters ]
28 * Anchor the internal PageTreeNode of PageStack to fill its parent.
29 Fixes: https://bugs.launchpad.net/bugs/1322527
30 * Deprecate sheets. Fixes: https://bugs.launchpad.net/bugs/1304541
31 * Fix bug where header overflow action popover does not close when
32 the associated action pushes a new page on the pagestack.
33 Fixes: https://bugs.launchpad.net/bugs/1326963.
34
35 [ Zsombor Egri]
36 * Adding touch functions to UbuntuTestCase.
37 * Qt5.3 related fixes. Fixes:
38 https://bugs.launchpad.net/bugs/1324070,
39 https://bugs.launchpad.net/bugs/1324088,
40 https://bugs.launchpad.net/bugs/1324089.
41
42
43
44 -- Zoltán Balogh <zoltan@bakter.hu> Wed, 04 Jun 2014 09:40:11 +0200
45
1ubuntu-ui-toolkit (0.1.46+14.10.20140602-0ubuntu1) utopic; urgency=low46ubuntu-ui-toolkit (0.1.46+14.10.20140602-0ubuntu1) utopic; urgency=low
247
3 [ Christian Dywan ]   48 [ Christian Dywan ]   
449
=== modified file 'debian/ubuntu-ui-toolkit-autopilot.install'
--- debian/ubuntu-ui-toolkit-autopilot.install 2014-02-21 23:39:43 +0000
+++ debian/ubuntu-ui-toolkit-autopilot.install 2014-06-18 15:28:52 +0000
@@ -1,2 +1,3 @@
1usr/lib/python31usr/lib/python3
2usr/lib/ubuntu-ui-toolkit/launcher
2usr/lib/python2.73usr/lib/python2.7
34
=== modified file 'examples/ubuntu-ui-toolkit-gallery/Template.qml'
--- examples/ubuntu-ui-toolkit-gallery/Template.qml 2014-04-23 09:39:11 +0000
+++ examples/ubuntu-ui-toolkit-gallery/Template.qml 2014-06-18 15:28:52 +0000
@@ -30,6 +30,7 @@
3030
31 Flickable {31 Flickable {
32 id: flickable32 id: flickable
33 objectName: "TemplateFlickable"
33 anchors.fill: parent34 anchors.fill: parent
34 anchors.topMargin: units.gu(2)35 anchors.topMargin: units.gu(2)
35 anchors.bottomMargin: units.gu(2)36 anchors.bottomMargin: units.gu(2)
@@ -46,6 +47,9 @@
46 }47 }
4748
48 Scrollbar {49 Scrollbar {
50 id: sb
51 objectName: "TemplateScrollbar"
49 flickableItem: flickable52 flickableItem: flickable
53 property alias interactive: sb.__interactive
50 }54 }
51}55}
5256
=== modified file 'modules/Ubuntu/Components/ListItems/Empty.qml'
--- modules/Ubuntu/Components/ListItems/Empty.qml 2014-05-12 16:40:44 +0000
+++ modules/Ubuntu/Components/ListItems/Empty.qml 2014-06-18 15:28:52 +0000
@@ -105,7 +105,7 @@
105 /*!105 /*!
106 \preliminary106 \preliminary
107 \qmlproperty string swipingState107 \qmlproperty string swipingState
108 The current swiping state ("SwipingLeft", "SwipingRight", "")108 The current swiping state ("SwipingRight" or "")
109 */109 */
110 readonly property alias swipingState: backgroundIndicator.state110 readonly property alias swipingState: backgroundIndicator.state
111111
@@ -228,7 +228,7 @@
228 __mouseArea.drag.target = body228 __mouseArea.drag.target = body
229 held = true229 held = true
230 __mouseArea.drag.maximumX = parent.width230 __mouseArea.drag.maximumX = parent.width
231 __mouseArea.drag.minimumX = (parent.width * -1)231 __mouseArea.drag.minimumX = 0
232 backgroundIndicator.visible = true232 backgroundIndicator.visible = true
233 }233 }
234234
@@ -334,10 +334,8 @@
334 onXChanged: {334 onXChanged: {
335 if (x > 0) {335 if (x > 0) {
336 backgroundIndicator.state = "SwipingRight"336 backgroundIndicator.state = "SwipingRight"
337 } else if (x === 0) {337 } else {
338 backgroundIndicator.state = ""338 backgroundIndicator.state = ""
339 } else {
340 backgroundIndicator.state = "SwipingLeft"
341 }339 }
342 }340 }
343 }341 }
@@ -427,24 +425,6 @@
427 target: confirmRemovalDialog425 target: confirmRemovalDialog
428 x: body.x - confirmRemovalDialog.width - units.gu(2)426 x: body.x - confirmRemovalDialog.width - units.gu(2)
429 }427 }
430 },
431 State {
432 name: "SwipingLeft"
433 AnchorChanges {
434 target: backgroundIndicator
435 anchors.left: body.right
436 anchors.right: parent.right
437 }
438
439 PropertyChanges {
440 target: backgroundIndicator
441 opacity: 1.0
442 }
443
444 PropertyChanges {
445 target: confirmRemovalDialog
446 x: units.gu(2)
447 }
448 }428 }
449 ]429 ]
450 }430 }
451431
=== modified file 'modules/Ubuntu/Components/OrientationHelper.qml'
--- modules/Ubuntu/Components/OrientationHelper.qml 2014-04-23 09:39:11 +0000
+++ modules/Ubuntu/Components/OrientationHelper.qml 2014-06-18 15:28:52 +0000
@@ -121,7 +121,7 @@
121 http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop121 http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop
122 */122 */
123 function applyOrientation() {123 function applyOrientation() {
124 if (windowActive)124 if (windowActive && window)
125 window.contentOrientation = Screen.orientation125 window.contentOrientation = Screen.orientation
126 }126 }
127127
128128
=== modified file 'modules/Ubuntu/Components/Popups/ComposerSheet.qml'
--- modules/Ubuntu/Components/Popups/ComposerSheet.qml 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/Popups/ComposerSheet.qml 2014-06-18 15:28:52 +0000
@@ -20,6 +20,7 @@
20 \qmltype ComposerSheet20 \qmltype ComposerSheet
21 \inherits SheetBase21 \inherits SheetBase
22 \inqmlmodule Ubuntu.Components.Popups 1.022 \inqmlmodule Ubuntu.Components.Popups 1.0
23 \deprecated
23 \ingroup ubuntu-popups24 \ingroup ubuntu-popups
24 \brief Much like the \l DefaultSheet the Composer Sheet allows an application to insert a content25 \brief Much like the \l DefaultSheet the Composer Sheet allows an application to insert a content
25 view over the focused view without disrupting the navigation pattern. However the Composer Sheet26 view over the focused view without disrupting the navigation pattern. However the Composer Sheet
@@ -56,6 +57,8 @@
56 }57 }
57 }58 }
58 \endqml59 \endqml
60
61 \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.}
59*/62*/
6063
61SheetBase {64SheetBase {
6265
=== modified file 'modules/Ubuntu/Components/Popups/DefaultSheet.qml'
--- modules/Ubuntu/Components/Popups/DefaultSheet.qml 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/Popups/DefaultSheet.qml 2014-06-18 15:28:52 +0000
@@ -19,6 +19,7 @@
1919
20/*!20/*!
21 \qmltype DefaultSheet21 \qmltype DefaultSheet
22 \deprecated
22 \inherits SheetBase23 \inherits SheetBase
23 \inqmlmodule Ubuntu.Components.Popups 1.024 \inqmlmodule Ubuntu.Components.Popups 1.0
24 \ingroup ubuntu-popups25 \ingroup ubuntu-popups
@@ -58,6 +59,9 @@
58 }59 }
59 }60 }
60 \endqml61 \endqml
62
63 \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.}
64
61*/65*/
62SheetBase {66SheetBase {
63 id: sheet67 id: sheet
6468
=== modified file 'modules/Ubuntu/Components/Popups/SheetBase.qml'
--- modules/Ubuntu/Components/Popups/SheetBase.qml 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/Popups/SheetBase.qml 2014-06-18 15:28:52 +0000
@@ -19,16 +19,22 @@
1919
20/*!20/*!
21 \qmltype SheetBase21 \qmltype SheetBase
22 \deprecated
22 \inqmlmodule Ubuntu.Components.Popups 1.023 \inqmlmodule Ubuntu.Components.Popups 1.0
23 \ingroup ubuntu-popups24 \ingroup ubuntu-popups
24 \brief Parent class of different types of sheets. Not to be used directly.25 \brief Parent class of different types of sheets. Not to be used directly.
2526
26 Examples: See subclasses.27 Examples: See subclasses.
27 \b{This component is under heavy development.}28 \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.}
28*/29*/
29PopupBase {30PopupBase {
30 id: sheet31 id: sheet
3132
33 Component.onCompleted: {
34 print("WARNING: Sheets are deprecated. " +
35 "Consider using Dialog, Popover or PageStack instead.")
36 }
37
32 /*!38 /*!
33 \preliminary39 \preliminary
34 \qmlproperty list<Object> container40 \qmlproperty list<Object> container
3541
=== modified file 'modules/Ubuntu/Components/Scrollbar.qml'
--- modules/Ubuntu/Components/Scrollbar.qml 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/Scrollbar.qml 2014-06-18 15:28:52 +0000
@@ -87,7 +87,7 @@
87 This property holds whether the scrollbar is active or passive. It is present87 This property holds whether the scrollbar is active or passive. It is present
88 for testing purposes.88 for testing purposes.
89 */89 */
90 property bool __interactive: false90 property bool __interactive: __styleInstance !== null && __styleInstance.interactive
9191
92 implicitWidth: internals.vertical ? units.gu(4) : flickableItem.width92 implicitWidth: internals.vertical ? units.gu(4) : flickableItem.width
93 implicitHeight: !internals.vertical ? units.gu(4) : flickableItem.height93 implicitHeight: !internals.vertical ? units.gu(4) : flickableItem.height
9494
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-14 13:21:10 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-06-18 15:28:52 +0000
@@ -259,9 +259,21 @@
259259
260 Popover {260 Popover {
261 id: actionsOverflowPopover261 id: actionsOverflowPopover
262 objectName: "actionsOverflowPopover"262 objectName: "actions_overflow_popover"
263 parent: QuickUtils.rootItem(actionsOverflowPopover)263 parent: QuickUtils.rootItem(actionsOverflowPopover)
264 caller: actionsOverflowButton264 caller: actionsOverflowButton
265
266 Connections {
267 target: styledItem
268 onActionsChanged: {
269 // Ensure the popover closes when actions change and
270 // the list item below may be destroyed before its
271 // onClicked is executed. See bug
272 // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1326963
273 actionsOverflowPopover.hide();
274 }
275 }
276
265 Column {277 Column {
266 anchors {278 anchors {
267 left: parent.left279 left: parent.left
268280
=== modified file 'modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml'
--- modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml 2014-06-18 15:28:52 +0000
@@ -59,7 +59,7 @@
59 property bool interactive: false59 property bool interactive: false
60 property real minimumSliderSize: units.gu(2)60 property real minimumSliderSize: units.gu(2)
6161
62 property bool overlay: true62 property bool overlay: !interactive
63 property real overlayOpacityWhenShown: 0.663 property real overlayOpacityWhenShown: 0.6
64 property real overlayOpacityWhenHidden: 0.064 property real overlayOpacityWhenHidden: 0.0
6565
@@ -222,6 +222,9 @@
222 onReleased: mouse.accepted = false222 onReleased: mouse.accepted = false
223 }223 }
224224
225 // The presence of a mouse enables the interactive thumb
226 // FIXME: Should use form factor hints
227 InverseMouse.onEntered: interactive = true
225228
226 // The slider's position represents which part of the flickable is visible.229 // The slider's position represents which part of the flickable is visible.
227 // The slider's size represents the size the visible part relative to the230 // The slider's size represents the size the visible part relative to the
@@ -401,6 +404,7 @@
401404
402 Item {405 Item {
403 id: thumb406 id: thumb
407 objectName: "interactiveScrollbarThumb"
404408
405 enabled: interactive409 enabled: interactive
406410
407411
=== modified file 'modules/Ubuntu/Components/plugin/filterbehavior.cpp'
--- modules/Ubuntu/Components/plugin/filterbehavior.cpp 2014-05-15 09:35:22 +0000
+++ modules/Ubuntu/Components/plugin/filterbehavior.cpp 2014-06-18 15:28:52 +0000
@@ -19,6 +19,14 @@
1919
20#include "filterbehavior.h"20#include "filterbehavior.h"
2121
22FilterBehavior::FilterBehavior(QObject *parent)
23 : QObject(parent)
24 , m_property(QString())
25 , m_pattern(QRegExp())
26{
27
28}
29
22QString30QString
23FilterBehavior::property() const31FilterBehavior::property() const
24{32{
2533
=== modified file 'modules/Ubuntu/Components/plugin/filterbehavior.h'
--- modules/Ubuntu/Components/plugin/filterbehavior.h 2014-05-15 09:35:22 +0000
+++ modules/Ubuntu/Components/plugin/filterbehavior.h 2014-06-18 15:28:52 +0000
@@ -29,6 +29,8 @@
29 Q_PROPERTY(QRegExp pattern READ pattern WRITE setPattern NOTIFY patternChanged)29 Q_PROPERTY(QRegExp pattern READ pattern WRITE setPattern NOTIFY patternChanged)
3030
31public:31public:
32 explicit FilterBehavior(QObject *parent = 0);
33
32 QString property() const;34 QString property() const;
33 void setProperty(const QString& property);35 void setProperty(const QString& property);
34 QRegExp pattern() const;36 QRegExp pattern() const;
3537
=== modified file 'modules/Ubuntu/Components/plugin/inversemouseareatype.cpp'
--- modules/Ubuntu/Components/plugin/inversemouseareatype.cpp 2014-04-25 12:53:58 +0000
+++ modules/Ubuntu/Components/plugin/inversemouseareatype.cpp 2014-06-18 15:28:52 +0000
@@ -244,11 +244,6 @@
244 */244 */
245 QObject::connect(this, &QQuickMouseArea::windowChanged,245 QObject::connect(this, &QQuickMouseArea::windowChanged,
246 this, &InverseMouseAreaType::resetFilterOnWindowUpdate);246 this, &InverseMouseAreaType::resetFilterOnWindowUpdate);
247
248 if (!m_sensingArea) {
249 // get sensing area upon parent change
250 QObject::connect(this, SIGNAL(parentChanged(QQuickItem*)), this, SLOT(update()));
251 }
252}247}
253248
254InverseMouseAreaType::~InverseMouseAreaType()249InverseMouseAreaType::~InverseMouseAreaType()
@@ -291,6 +286,7 @@
291 m_sensingArea = QuickUtils::instance().rootItem(this);286 m_sensingArea = QuickUtils::instance().rootItem(this);
292 }287 }
293 updateEventFilter(isEnabled() && isVisible() && m_topmostItem);288 updateEventFilter(isEnabled() && isVisible() && m_topmostItem);
289 QQuickMouseArea::update();
294}290}
295/*!291/*!
296 \internal292 \internal
@@ -302,6 +298,14 @@
302 updateEventFilter(m_topmostItem);298 updateEventFilter(m_topmostItem);
303}299}
304300
301void InverseMouseAreaType::itemChange(ItemChange change, const ItemChangeData &data)
302{
303 if (change == ItemParentHasChanged && data.item) {
304 update();
305 }
306 QQuickMouseArea::itemChange(change, data);
307}
308
305void InverseMouseAreaType::componentComplete()309void InverseMouseAreaType::componentComplete()
306{310{
307 QQuickMouseArea::componentComplete();311 QQuickMouseArea::componentComplete();
308312
=== modified file 'modules/Ubuntu/Components/plugin/inversemouseareatype.h'
--- modules/Ubuntu/Components/plugin/inversemouseareatype.h 2014-03-20 10:01:21 +0000
+++ modules/Ubuntu/Components/plugin/inversemouseareatype.h 2014-06-18 15:28:52 +0000
@@ -32,6 +32,7 @@
32 Q_INVOKABLE virtual bool contains(const QPointF &point) const;32 Q_INVOKABLE virtual bool contains(const QPointF &point) const;
3333
34protected:34protected:
35 void itemChange(ItemChange, const ItemChangeData &);
35 void componentComplete();36 void componentComplete();
36 bool eventFilter(QObject *, QEvent *);37 bool eventFilter(QObject *, QEvent *);
3738
3839
=== modified file 'modules/Ubuntu/Components/plugin/sortbehavior.cpp'
--- modules/Ubuntu/Components/plugin/sortbehavior.cpp 2014-05-15 09:35:22 +0000
+++ modules/Ubuntu/Components/plugin/sortbehavior.cpp 2014-06-18 15:28:52 +0000
@@ -19,6 +19,14 @@
1919
20#include "sortbehavior.h"20#include "sortbehavior.h"
2121
22SortBehavior::SortBehavior(QObject *parent)
23 : QObject(parent)
24 , m_property(QString())
25 , m_order(Qt::AscendingOrder)
26{
27
28}
29
22QString30QString
23SortBehavior::property() const31SortBehavior::property() const
24{32{
2533
=== modified file 'modules/Ubuntu/Components/plugin/sortbehavior.h'
--- modules/Ubuntu/Components/plugin/sortbehavior.h 2014-05-15 09:35:22 +0000
+++ modules/Ubuntu/Components/plugin/sortbehavior.h 2014-06-18 15:28:52 +0000
@@ -29,6 +29,8 @@
29 Q_PROPERTY(Qt::SortOrder order READ order WRITE setOrder NOTIFY orderChanged)29 Q_PROPERTY(Qt::SortOrder order READ order WRITE setOrder NOTIFY orderChanged)
3030
31public:31public:
32 explicit SortBehavior(QObject *parent = 0);
33
32 QString property() const;34 QString property() const;
33 void setProperty(const QString& property);35 void setProperty(const QString& property);
34 Qt::SortOrder order() const;36 Qt::SortOrder order() const;
3537
=== modified file 'modules/Ubuntu/Components/plugin/uctheme.cpp'
--- modules/Ubuntu/Components/plugin/uctheme.cpp 2014-04-23 08:50:20 +0000
+++ modules/Ubuntu/Components/plugin/uctheme.cpp 2014-06-18 15:28:52 +0000
@@ -81,7 +81,12 @@
81 QStringList pathList = envPath.split(':', QString::SkipEmptyParts);81 QStringList pathList = envPath.split(':', QString::SkipEmptyParts);
82 if (pathList.isEmpty()) {82 if (pathList.isEmpty()) {
83 // get the default path list from generic data location, which contains83 // get the default path list from generic data location, which contains
84 // ~/.local/share and XDG_DATA_DIRS84 // XDG_DATA_DIRS
85 QString xdgDirs = QLatin1String(getenv("XDG_DATA_DIRS"));
86 if (!xdgDirs.isEmpty()) {
87 pathList << xdgDirs.split(':', QString::SkipEmptyParts);
88 }
89 // ~/.local/share
85 pathList << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);90 pathList << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
86 }91 }
87 // fix folders92 // fix folders
8893
=== modified file 'modules/Ubuntu/Test/plugin/plugin.pro'
--- modules/Ubuntu/Test/plugin/plugin.pro 2013-12-16 17:37:48 +0000
+++ modules/Ubuntu/Test/plugin/plugin.pro 2014-06-18 15:28:52 +0000
@@ -1,6 +1,6 @@
1TEMPLATE = lib1TEMPLATE = lib
2TARGET = ../UbuntuTest2TARGET = ../UbuntuTest
3QT += core-private qml qml-private quick quick-private3QT += core-private qml qml-private quick quick-private gui-private
44
5equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) {5equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) {
6 QT += v8-private6 QT += v8-private
77
=== modified file 'modules/Ubuntu/Test/plugin/uctestcase.cpp'
--- modules/Ubuntu/Test/plugin/uctestcase.cpp 2014-03-28 17:02:52 +0000
+++ modules/Ubuntu/Test/plugin/uctestcase.cpp 2014-06-18 15:28:52 +0000
@@ -26,8 +26,11 @@
26#include <QtTest/QtTest>26#include <QtTest/QtTest>
27#include <QtQuick/QQuickItem>27#include <QtQuick/QQuickItem>
2828
29#include <qpa/qwindowsysteminterface.h>
30
29Q_DECLARE_METATYPE(QList<QQmlError>)31Q_DECLARE_METATYPE(QList<QQmlError>)
3032
33QTouchDevice *UbuntuTestCase::m_touchDevice = 0;
31/*!34/*!
32 * \ingroup ubuntu35 * \ingroup ubuntu
33 * \brief UbuntuTestCase is the C++ pendant to the QML UbuntuTestCase.36 * \brief UbuntuTestCase is the C++ pendant to the QML UbuntuTestCase.
@@ -60,3 +63,26 @@
60 return m_spy->count();63 return m_spy->count();
61}64}
6265
66/*!
67 * Registers a touch device if there's none registered.
68 */
69void UbuntuTestCase::registerTouchDevice()
70{
71 // check if there is any touch device registered in the system
72 if (!m_touchDevice) {
73 QList<const QTouchDevice*> touchDevices = QTouchDevice::devices();
74 Q_FOREACH(const QTouchDevice *device, touchDevices) {
75 if (device->type() == QTouchDevice::TouchScreen) {
76 m_touchDevice = const_cast<QTouchDevice*>(device);
77 break;
78 }
79 }
80 }
81 // if none, register one
82 if (!m_touchDevice) {
83 m_touchDevice = new QTouchDevice;
84 m_touchDevice->setType(QTouchDevice::TouchScreen);
85 QWindowSystemInterface::registerTouchDevice(m_touchDevice);
86 }
87}
88
6389
=== modified file 'modules/Ubuntu/Test/plugin/uctestcase.h'
--- modules/Ubuntu/Test/plugin/uctestcase.h 2014-03-28 17:02:52 +0000
+++ modules/Ubuntu/Test/plugin/uctestcase.h 2014-06-18 15:28:52 +0000
@@ -19,10 +19,13 @@
19#ifndef UBUNTU_TEST_UBUNTUTESTCASE_H19#ifndef UBUNTU_TEST_UBUNTUTESTCASE_H
20#define UBUNTU_TEST_UBUNTUTESTCASE_H20#define UBUNTU_TEST_UBUNTUTESTCASE_H
2121
22#include <QtTest/QtTest>
22#include <QtQuick/QQuickItem>23#include <QtQuick/QQuickItem>
23#include <QtQuick/QQuickView>24#include <QtQuick/QQuickView>
24#include <QtTest/QSignalSpy>25#include <QtTest/QSignalSpy>
2526
27#define CHECK_TOUCH_DEVICE() if (!checkTouchDevice(__FUNCTION__)) return
28
26class UbuntuTestCase : public QQuickView29class UbuntuTestCase : public QQuickView
27{30{
28 Q_OBJECT31 Q_OBJECT
@@ -40,8 +43,74 @@
40 qFatal("Item '%s' found with unexpected type", qPrintable(objectName));43 qFatal("Item '%s' found with unexpected type", qPrintable(objectName));
41 qFatal("No item '%s' found", qPrintable(objectName));44 qFatal("No item '%s' found", qPrintable(objectName));
42 }45 }
46
47 static void registerTouchDevice();
48
49 inline static void touchPress(int touchId, QWindow *window, const QPoint &point)
50 {
51 CHECK_TOUCH_DEVICE();
52 QTest::touchEvent(window, m_touchDevice).press(touchId, point, window);
53 }
54 inline static void touchRelease(int touchId, QWindow *window, const QPoint &point)
55 {
56 CHECK_TOUCH_DEVICE();
57 QTest::touchEvent(window, m_touchDevice).release(touchId, point, window);
58 }
59 inline static void touchClick(int touchId, QWindow *window, const QPoint &point)
60 {
61 CHECK_TOUCH_DEVICE();
62 touchPress(touchId, window, point);
63 QTest::qWait(10);
64 touchRelease(touchId, window, point);
65 }
66 inline static void touchLongPress(int touchId, QWindow *window, const QPoint &point)
67 {
68 CHECK_TOUCH_DEVICE();
69 touchPress(touchId, window, point);
70 QTest::qWait(800);
71 }
72 inline static void touchDoubleClick(int touchId, QWindow *window, const QPoint &point)
73 {
74 CHECK_TOUCH_DEVICE();
75 touchClick(touchId, window, point);
76 QTest::qWait(10);
77 touchClick(touchId, window, point);
78 }
79 inline static void touchMove(int touchId, QWindow *window, const QPoint &point)
80 {
81 CHECK_TOUCH_DEVICE();
82 QTest::touchEvent(window, m_touchDevice).move(touchId, point, window);
83 }
84 inline static void touchDrag(int touchId, QWindow *window, const QPoint &from, const QPoint &delta, int steps = 5)
85 {
86 touchPress(touchId, window, from);
87 QTest::qWait(10);
88 QTest::touchEvent(window, m_touchDevice).move(touchId, from, window);
89 qreal stepDx = delta.x() / steps;
90 qreal stepDy = delta.y() / steps;
91 if (!delta.isNull()) {
92 for (int i = 0; i < steps; i++) {
93 QTest::qWait(10);
94 QTest::touchEvent(window, m_touchDevice).move(touchId, from + QPoint(i * stepDx, i * stepDy), window);
95 }
96 }
97 QTest::qWait(10);
98 touchRelease(touchId, window, from + QPoint(stepDx, stepDy));
99 }
100
101
43private:102private:
44 QSignalSpy* m_spy;103 QSignalSpy* m_spy;
104 static QTouchDevice *m_touchDevice;
105
106 static inline bool checkTouchDevice(const char *func)
107 {
108 if (!m_touchDevice) {
109 qWarning() << QString("No touch device registered. Register one using registerTouchDevice() before using %1").arg(func);
110 return false;
111 }
112 return true;
113 }
45};114};
46115
47#endif // UBUNTU_TEST_UBUNTUTESTCASE_H116#endif // UBUNTU_TEST_UBUNTUTESTCASE_H
48117
=== added file 'push_to_phone.sh'
--- push_to_phone.sh 1970-01-01 00:00:00 +0000
+++ push_to_phone.sh 2014-06-18 15:28:52 +0000
@@ -0,0 +1,41 @@
1#!/bin/sh
2#
3# Copyright 2014 Canonical Ltd.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; version 3.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16#
17# Author: Christian Dywan <christian.dywan@canonical.com>
18
19ARCH=arm-linux-gnueabihf
20
21# Make the image writable
22phablet-config writable-image || exit 1
23# Copy selectively to avoid pushing binaries (arch conflict) and sources (unneeded)
24cd modules || exit 1
25for i in $(ls Ubuntu/Components/*.qml 2>/dev/null); do
26 echo modules/$i '->' /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
27 adb push $i /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
28done
29for i in $(ls Ubuntu/Components/*.js 2>/dev/null); do
30 echo modules/$i '->' /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
31 adb push $i /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/
32done
33cd ..
34for i in ListItems Pickers Popups Colors Styles Themes artwork; do
35 adb push modules/Ubuntu/Components/$i/ /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/$i || exit 1
36done
37# Autopilot tests should always match the Toolkit
38adb push tests/autopilot/ubuntuuitoolkit/ /usr/lib/python2.7/dist-packages/ubuntuuitoolkit || exit 1
39adb push examples/ubuntu-ui-toolkit-gallery/ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery || exit 1
40# For launching the gallery easily
41adb push examples/ubuntu-ui-toolkit-gallery/*.desktop /usr/share/applications/ || exit 1
042
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-29 16:14:55 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-06-18 15:28:52 +0000
@@ -40,6 +40,16 @@
4040
41class Scrollable(_common.UbuntuUIToolkitCustomProxyObjectBase):41class Scrollable(_common.UbuntuUIToolkitCustomProxyObjectBase):
4242
43 @autopilot_logging.log_action(logger.info)
44 def is_child_visible(self, child):
45 """Determine if the child is visible.
46
47 A child is visible if no scrolling is needed to reveal it.
48
49 """
50 containers = self._get_containers()
51 return self._is_child_visible(child, containers)
52
43 def _get_containers(self):53 def _get_containers(self):
44 """Return a list with the containers to take into account when swiping.54 """Return a list with the containers to take into account when swiping.
4555
4656
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py 2014-04-25 18:39:51 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py 2014-06-18 15:28:52 +0000
@@ -42,6 +42,9 @@
42 def swipe_to_delete(self, direction='right'):42 def swipe_to_delete(self, direction='right'):
43 """Swipe the item in a specific direction."""43 """Swipe the item in a specific direction."""
44 if self.removable:44 if self.removable:
45 # Swipe to delete is always right to left
46 if direction == 'left':
47 direction = 'right'
45 self._drag_pointing_device_to_delete(direction)48 self._drag_pointing_device_to_delete(direction)
46 if self.confirmRemoval:49 if self.confirmRemoval:
47 self.waitingConfirmationForRemoval.wait_for(True)50 self.waitingConfirmationForRemoval.wait_for(True)
@@ -52,14 +55,19 @@
52 'The item "{0}" is not removable'.format(self.objectName))55 'The item "{0}" is not removable'.format(self.objectName))
5356
54 def _drag_pointing_device_to_delete(self, direction):57 def _drag_pointing_device_to_delete(self, direction):
55 x, y, w, h = self.globalRect58 x, y, width, height = self.globalRect
56 tx = x + (w // 8)59 left_x = x + (width * 0.2)
57 ty = y + (h // 2)60 right_x = x + (width * 0.8)
61 start_y = stop_y = y + (height // 2)
5862
59 if direction == 'right':63 if direction == 'right':
60 self.pointing_device.drag(tx, ty, w, ty)64 start_x = left_x
65 stop_x = right_x
66 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
61 elif direction == 'left':67 elif direction == 'left':
62 self.pointing_device.drag(w - (w*0.1), ty, x, ty)68 start_x = right_x
69 stop_x = left_x
70 self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
63 else:71 else:
64 raise _common.ToolkitException(72 raise _common.ToolkitException(
65 'Invalid direction "{0}" used on swipe to delete function'73 'Invalid direction "{0}" used on swipe to delete function'
6674
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py'
--- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-05-29 16:17:56 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-06-18 15:28:52 +0000
@@ -1,6 +1,6 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#2#
3# Copyright (C) 2012, 2013 Canonical Ltd.3# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
4#4#
5# This program is free software; you can redistribute it and/or modify5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by6# it under the terms of the GNU Lesser General Public License as published by
@@ -142,91 +142,6 @@
142 def main_view(self):142 def main_view(self):
143 return self.app.select_single(emulators.MainView)143 return self.app.select_single(emulators.MainView)
144144
145 def checkListItem(self, itemText):
146 item = self.getListItem(itemText)
147 self.assertThat(item, Not(Is(None)))
148
149 def getListItem(self, itemText):
150 # XXX We shouldn't access the elements by text, because that's likely
151 # to change often and might be translated. We should always use the
152 # objectName instead. --elopio - 2013-06-26216
153 return self.main_view.select_single("Standard", text=itemText)
154
155 def getWidgetLoaderAndListView(self):
156 contentLoader = self.main_view.select_single(
157 "QQuickLoader", objectName="contentLoader")
158 listView = self.main_view.select_single(
159 "QQuickListView", objectName="widgetList")
160 self.assertThat(listView, Not(Is(None)))
161 self.assertThat(listView.visible, Eventually(Equals(True)))
162 return (contentLoader, listView)
163
164 def loadItem(self, item):
165 self.selectItem(item)
166 contentLoader = self.main_view.select_single(
167 "QQuickLoader", objectName="contentLoader")
168 self.assertThat(contentLoader.progress, Eventually(Equals(1.0)))
169 loadedPage = self.getListItem(item)
170 self.assertThat(loadedPage, Not(Is(None)))
171 #loadedPage is not a page, it is the list item which goes in
172 #background when the item is selected, which changes the visible
173 #property of item in list itself to False. So followin check
174 #fails on Nexus 4. Commenting it for now.
175 #self.assertThat(loadedPage.visible, Eventually(Equals(True)))
176
177 def drag(self, itemText, itemTextTo):
178 item = self.getListItem(itemText)
179 itemTo = self.getListItem(itemTextTo)
180
181 self.pointing_device.move_to_object(item)
182 self.pointing_device.press()
183 self.pointing_device.move_to_object(itemTo)
184 self.pointing_device.release()
185
186 def reveal_item_by_flick(self, item, flickable, direction):
187 x1, y1, w1, h1 = item.globalRect
188 x2, y2, w2, h2 = flickable.globalRect
189 if direction is FlickDirection.UP:
190 while y1 + h1 > y2 + h2:
191 self.flick(flickable, direction)
192 x1, y1, w1, h1 = item.globalRect
193 elif direction is FlickDirection.DOWN:
194 while y1 < y2:
195 self.flick(flickable, direction)
196 x1, y1, w1, h1 = item.globalRect
197
198 def flick(self, flickable, direction, delta=40):
199 """This funcito flicks the page from middle to the given direction."""
200 x, y, w, h = flickable.globalRect
201 if direction == FlickDirection.UP:
202 self.pointing_device.drag(x + w / 2, y + h / 2, x + w / 2,
203 y + h / 2 - delta)
204 flickable.flicking.wait_for(False)
205 elif direction == FlickDirection.DOWN:
206 self.pointing_device.drag(x + w / 2, y + h / 2, x + w / 2,
207 y + h / 2 + delta)
208 flickable.flicking.wait_for(False)
209 else:
210 raise ValueError("Invalid direction or not implementd yet")
211
212 def selectItem(self, itemText):
213 item = self.getListItem(itemText)
214 x1, y1, w1, h1 = item.globalRect
215 x2, y2, w2, h2 = self.main_view.globalRect
216
217 orientationHelper = self.getOrientationHelper()
218 rot = orientationHelper.rotation
219 scrollTo = h2 / 2 - (y1 - h2 - h1)
220 if rot == 0.0 and y1 > h2:
221 self.pointing_device.drag(w2 / 2, h2 / 2, w2 / 2, scrollTo)
222
223 self.assertThat(item.selected, Eventually(Equals(False)))
224
225 self.pointing_device.move_to_object(item)
226 self.pointing_device.click()
227
228 self.assertThat(item.selected, Eventually(Equals(True)))
229
230 def getOrientationHelper(self):145 def getOrientationHelper(self):
231 orientationHelper = self.main_view.select_many(146 orientationHelper = self.main_view.select_many(
232 "OrientationHelper")[0]147 "OrientationHelper")[0]
@@ -249,29 +164,3 @@
249 obj = self.getObject(objectName)164 obj = self.getObject(objectName)
250 self.pointing_device.move_to_object(obj)165 self.pointing_device.move_to_object(obj)
251 self.pointing_device.click()166 self.pointing_device.click()
252
253 def mousePress(self, objectName):
254 obj = self.getObject(objectName)
255 self.pointing_device.move_to_object(obj)
256 self.pointing_device.press()
257
258 def mouseRelease(self):
259 self.pointing_device.release()
260
261 def type_string(self, string):
262 self.keyboard.type(string)
263
264 def type_key(self, key):
265 self.keyboard.key(key)
266
267 def tap_clearButton(self, objectName):
268 textField = self.getObject(objectName)
269 self.assertIsNotNone(textField)
270 self.pointing_device.click_object(textField)
271 self.assertThat(textField.focus, Eventually(Equals(True)))
272 self.assertThat(textField.hasClearButton, Eventually(Equals(True)))
273 btn = textField.select_single("AbstractButton")
274 self.assertIsNotNone(btn)
275 self.assertThat(btn.visible, Eventually(Equals(True)))
276 self.pointing_device.click_object(btn)
277 self.assertThat(btn.pressed, Eventually(Equals(False)))
278167
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-05-19 09:46:05 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-06-18 15:28:52 +0000
@@ -14,53 +14,16 @@
14# You should have received a copy of the GNU Lesser General Public License14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.15# along with this program. If not, see <http://www.gnu.org/licenses/>.
1616
17import os
1718
18import testtools19import testtools
19
20import ubuntuuitoolkit20import ubuntuuitoolkit
21from ubuntuuitoolkit import tests21from ubuntuuitoolkit import fixture_setup, tests
22from ubuntuuitoolkit._custom_proxy_objects import _common22from ubuntuuitoolkit._custom_proxy_objects import _common
2323
2424
25class FlickableTestCase(testtools.TestCase):25class FlickableTestCase(testtools.TestCase):
2626
27 def test_get_unity_top_container(self):
28 """Test that we can get the top cointainer in Unity."""
29 # This tests bug http://pad.lv/1314390
30 # On Unity, the top container is not the first child as it is in all
31 # the apps that have a MainView. This makes the first implementation of
32 # _get_top_container fail. Instead of going from the top looking for
33 # a container, we should start from the flickable until we find the
34 # top-most container.
35 # FIXME we are faking the QML tree because we have no way to launch
36 # the app with a tree like the one in Unity8. kalikiana has a branch
37 # with an alternate launcher that will let us clean this test.
38 # --elopio - 2014-05-15.
39 RootClass = type('obj', (object,), {'id': 'root'})
40 mock_root_instance = RootClass()
41 # We consider a container is an object with a globalRect.
42 MockNonContainerClass = type('obj', (object,), {})
43 mock_non_container = MockNonContainerClass()
44 MockContainerClass = type(
45 'obj', (object,), {'id': 'container', 'globalRect': 'dummy'})
46 mock_container = MockContainerClass()
47 mock_container.get_parent = lambda: mock_root_instance
48
49 # The root instance has two children. This exposes the bug.
50 mock_root_instance.get_children = lambda: [
51 mock_non_container, mock_container]
52
53 dummy_state = {'id': '10'}
54 flickable = ubuntuuitoolkit.QQuickFlickable(
55 dummy_state, '/dummy'.encode(), 'dummy')
56
57 flickable.get_root_instance = lambda: mock_root_instance
58 # The top container of the flickable is its immediate parent.
59 flickable.get_parent = lambda: mock_container
60
61 top_container = flickable._get_top_container()
62 self.assertEqual(top_container, mock_container)
63
64 def test_is_flickable_with_flicking_property_must_return_true(self):27 def test_is_flickable_with_flicking_property_must_return_true(self):
65 """is_flickable returns True if flickable property exists."""28 """is_flickable returns True if flickable property exists."""
66 dummy_id = (0, 0)29 dummy_id = (0, 0)
@@ -68,6 +31,7 @@
68 state_with_flicking = {'id': dummy_id, 'flicking': dummy_flicking}31 state_with_flicking = {'id': dummy_id, 'flicking': dummy_flicking}
69 element = _common.UbuntuUIToolkitCustomProxyObjectBase(32 element = _common.UbuntuUIToolkitCustomProxyObjectBase(
70 state_with_flicking, '/dummy'.encode(), 'dummy')33 state_with_flicking, '/dummy'.encode(), 'dummy')
34
71 with element.no_automatic_refreshing():35 with element.no_automatic_refreshing():
72 self.assertTrue(element.is_flickable())36 self.assertTrue(element.is_flickable())
7337
@@ -77,6 +41,7 @@
77 state_without_flicking = {'id': dummy_id}41 state_without_flicking = {'id': dummy_id}
78 element = _common.UbuntuUIToolkitCustomProxyObjectBase(42 element = _common.UbuntuUIToolkitCustomProxyObjectBase(
79 state_without_flicking, '/dummy'.encode(), 'dummy')43 state_without_flicking, '/dummy'.encode(), 'dummy')
44
80 with element.no_automatic_refreshing():45 with element.no_automatic_refreshing():
81 self.assertFalse(element.is_flickable())46 self.assertFalse(element.is_flickable())
8247
@@ -199,3 +164,61 @@
199164
200 self.pointing_device.click_object(topButton)165 self.pointing_device.click_object(topButton)
201 self.assertEqual(self.label.text, 'topButton')166 self.assertEqual(self.label.text, 'topButton')
167
168
169class UnityFlickableTestCase(tests.QMLStringAppTestCase):
170
171 test_qml = ("""
172import QtQuick 2.0
173import Ubuntu.Components 0.1
174
175MainView {
176 width: units.gu(48)
177 height: units.gu(60)
178
179 Flickable {
180 objectName: 'testFlickable'
181 width: 200; height: 200
182 contentWidth: image.width; contentHeight: image.height
183 }
184}
185""")
186
187 def launch_application(self):
188 fake_application = fixture_setup.FakeApplication(
189 qml_file_contents=self.test_qml)
190 self.useFixture(fake_application)
191
192 self.app = self.launch_test_application(
193 self.get_alternate_launch_command(),
194 '-engine',
195 '-I', tests._get_module_include_path(),
196 fake_application.qml_file_path,
197 '--desktop_file_hint={0}'.format(
198 fake_application.desktop_file_path),
199 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase,
200 app_type='qt')
201
202 def get_alternate_launch_command(self):
203 root = tests.get_path_to_source_root()
204 path_to_local_launcher = os.path.join(
205 root, 'tests', 'launcher', 'launcher')
206 if os.path.exists(path_to_local_launcher):
207 return path_to_local_launcher
208 else:
209 path_to_installed_launcher = os.path.join(
210 '/', 'usr', 'lib', 'ubuntu-ui-toolkit', 'launcher')
211 return path_to_installed_launcher
212
213 def test_get_unity_top_container(self):
214 """Test that we can get the top cointainer in Unity."""
215 # This tests bug http://pad.lv/1314390
216 # On Unity, the top container is not the first child as it is in all
217 # the apps that have a MainView. This makes the first implementation of
218 # _get_top_container fail. Instead of going from the top looking for
219 # a container, we should start from the flickable until we find the
220 # top-most container.
221 test_flickable = self.app.select_single(
222 ubuntuuitoolkit.QQuickFlickable, objectName='testFlickable')
223 top_container = test_flickable._get_top_container()
224 self.assertIsInstance(top_container, ubuntuuitoolkit.MainView)
202225
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-29 18:18:43 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-18 15:28:52 +0000
@@ -18,6 +18,8 @@
1818
19import ubuntuuitoolkit19import ubuntuuitoolkit
20from ubuntuuitoolkit import tests20from ubuntuuitoolkit import tests
21from testtools.matchers import Equals
22from autopilot.matchers import Eventually
2123
2224
23class HeaderTestCase(tests.QMLStringAppTestCase):25class HeaderTestCase(tests.QMLStringAppTestCase):
@@ -32,73 +34,93 @@
3234
33 useDeprecatedToolbar: false35 useDeprecatedToolbar: false
3436
35 Page {37 PageStack {
36 title: "Test title"38 id: stack
3739 Component.onCompleted: stack.push(page)
38 Flickable {40
39 anchors.fill: parent41 Page {
40 contentHeight: units.gu(120)42 title: "Test title"
41 objectName: "header_test_flickable"43 id: page
4244
43 Label {45 Flickable {
44 id: label46 anchors.fill: parent
45 objectName: "clicked_label"47 contentHeight: units.gu(120)
46 anchors {48 objectName: "header_test_flickable"
47 top: parent.top49
48 horizontalCenter: parent.horizontalCenter50 Label {
49 }51 id: label
50 text: "No button clicked."52 objectName: "clicked_label"
51 }53 anchors {
5254 top: parent.top
53 Button {55 horizontalCenter: parent.horizontalCenter
54 objectName: "hide_actions_button"56 }
55 anchors {57 text: "No button clicked."
56 top: label.bottom58 }
57 topMargin: units.gu(5)59
58 horizontalCenter: parent.horizontalCenter60 Button {
59 }61 objectName: "hide_actions_button"
60 text: "Hide some actions"62 anchors {
61 onClicked: {63 top: label.bottom
62 cancelAction.visible = false;64 topMargin: units.gu(5)
63 for (var i=0; i < 3; i++) {65 horizontalCenter: parent.horizontalCenter
64 buttonRepeater.itemAt(i).action.visible = false;66 }
65 }67 text: "Hide some actions"
66 // only three of five visible actions left68 onClicked: {
67 }69 cancelAction.visible = false;
68 }70 for (var i=0; i < 3; i++) {
69 Label {71 buttonRepeater.itemAt(i).action.visible = false;
70 id: endLabel72 }
71 objectName: "end_label"73 // only three of five visible actions left
72 anchors {74 }
73 bottom: parent.bottom75 }
74 horizontalCenter: parent.horizontalCenter76 Label {
75 }77 id: endLabel
76 text: "The end."78 objectName: "end_label"
77 }79 anchors {
78 }80 bottom: parent.bottom
7981 horizontalCenter: parent.horizontalCenter
80 tools: ToolbarItems {82 }
81 back: ToolbarButton {83 text: "The end."
82 action: Action {84 }
83 id: cancelAction85 }
84 iconName: "cancel"86
85 text: "cancel"87 tools: ToolbarItems {
86 onTriggered: label.text = "Cancel button clicked."88 back: ToolbarButton {
87 }89 action: Action {
88 }90 id: cancelAction
89 Repeater {91 iconName: "cancel"
90 id: buttonRepeater92 text: "cancel"
91 model: 593 onTriggered: label.text = "Cancel button clicked."
94 }
95 }
96 Repeater {
97 id: buttonRepeater
98 model: 5
99 ToolbarButton {
100 action: Action {
101 objectName: "action" + index
102 text: "text " + index
103 iconName: "add"
104 onTriggered: {
105 label.text = "Button "+index+" clicked.";
106 }
107 }
108 }
109 }
92 ToolbarButton {110 ToolbarButton {
93 action: Action {111 action: Action {
94 objectName: "action" + index112 objectName: "pushStackAction"
95 text: "text " + index113 text: "Push page"
96 iconName: "add"114 iconName: "add"
97 onTriggered: label.text = "Button "+index+" clicked."115 onTriggered: stack.push(pushMe)
98 }116 }
99 }117 }
100 }118 }
101 }119 }
120 Page {
121 title: "Pushed page"
122 id: pushMe
123 }
102 }124 }
103}125}
104""")126""")
@@ -125,6 +147,13 @@
125 self.header.click_action_button('action3')147 self.header.click_action_button('action3')
126 self.assertEqual(self.label.text, 'Button 3 clicked.')148 self.assertEqual(self.label.text, 'Button 3 clicked.')
127149
150 def test_click_header_overflow_action_closes_popover_bug1326963(self):
151 overflow_popover = self.main_view.select_single(
152 'Popover',
153 objectName='actions_overflow_popover')
154 self.header.click_action_button('pushStackAction')
155 self.assertThat(overflow_popover.visible, Eventually(Equals(False)))
156
128 def test_click_unexisting_header_action_button(self):157 def test_click_unexisting_header_action_button(self):
129 error = self.assertRaises(158 error = self.assertRaises(
130 ubuntuuitoolkit.ToolkitException, self.header.click_action_button,159 ubuntuuitoolkit.ToolkitException, self.header.click_action_button,
131160
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2014-04-25 18:39:51 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2014-06-18 15:28:52 +0000
@@ -120,6 +120,7 @@
120 self.assertTrue(self._item.waitingConfirmationForRemoval)120 self.assertTrue(self._item.waitingConfirmationForRemoval)
121121
122 def test_swipe_item_to_left(self):122 def test_swipe_item_to_left(self):
123 # This will do a right to left swipe behind the scenes
123 self._item.swipe_to_delete('left')124 self._item.swipe_to_delete('left')
124 self.assertTrue(self._item.waitingConfirmationForRemoval)125 self.assertTrue(self._item.waitingConfirmationForRemoval)
125126
@@ -134,6 +135,7 @@
134 self.assertFalse(self._item.exists())135 self.assertFalse(self._item.exists())
135136
136 def test_delete_item_moving_left(self):137 def test_delete_item_moving_left(self):
138 # This will do a right to left swipe behind the scenes
137 self._item.swipe_to_delete('left')139 self._item.swipe_to_delete('left')
138 self._item.confirm_removal()140 self._item.confirm_removal()
139 self.assertFalse(self._item.exists())141 self.assertFalse(self._item.exists())
140142
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2013-10-24 11:01:03 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2014-06-18 15:28:52 +0000
@@ -1,6 +1,6 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#2#
3# Copyright (C) 2012, 2013 Canonical Ltd.3# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
4#4#
5# This program is free software; you can redistribute it and/or modify5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by6# it under the terms of the GNU Lesser General Public License as published by
@@ -19,10 +19,10 @@
19import os19import os
20import shutil20import shutil
2121
22from ubuntuuitoolkit import tests22import ubuntuuitoolkit
2323
2424
25class GalleryTestCase(tests.QMLFileAppTestCase):25class GalleryTestCase(ubuntuuitoolkit.tests.QMLFileAppTestCase):
26 """Base class for gallery test cases."""26 """Base class for gallery test cases."""
2727
28 local_desktop_file_path = None28 local_desktop_file_path = None
@@ -39,7 +39,7 @@
3939
40 def _get_path_to_gallery_source(self):40 def _get_path_to_gallery_source(self):
41 return os.path.join(41 return os.path.join(
42 tests.get_path_to_source_root(), 'examples',42 ubuntuuitoolkit.tests.get_path_to_source_root(), 'examples',
43 'ubuntu-ui-toolkit-gallery')43 'ubuntu-ui-toolkit-gallery')
4444
45 def _application_source_exists(self):45 def _application_source_exists(self):
@@ -58,7 +58,8 @@
58 self.test_source_path,58 self.test_source_path,
59 'ubuntu-ui-toolkit-gallery.desktop')59 'ubuntu-ui-toolkit-gallery.desktop')
60 if self._application_source_exists():60 if self._application_source_exists():
61 local_desktop_file_dir = tests.get_local_desktop_file_directory()61 local_desktop_file_dir = (
62 ubuntuuitoolkit.tests.get_local_desktop_file_directory())
62 if not os.path.exists(local_desktop_file_dir):63 if not os.path.exists(local_desktop_file_dir):
63 os.makedirs(local_desktop_file_dir)64 os.makedirs(local_desktop_file_dir)
64 local_desktop_file_path = os.path.join(65 local_desktop_file_path = os.path.join(
@@ -71,6 +72,19 @@
71 else:72 else:
72 return desktop_file_path73 return desktop_file_path
7374
75 def open_page(self, page):
76 """Open a page of the widget gallery.
77
78 :param page: The objectName of the element in the index list that opens
79 the page.
80
81 """
82 list_view = self.main_view.select_single(
83 ubuntuuitoolkit.QQuickListView, objectName="widgetList")
84 list_view.click_element(page)
85 element = self.main_view.select_single('Standard', objectName=page)
86 element.selected.wait_for(True)
87
74 def tearDown(self):88 def tearDown(self):
75 super(GalleryTestCase, self).tearDown()89 super(GalleryTestCase, self).tearDown()
76 # We can't delete the desktop file before we close the application,90 # We can't delete the desktop file before we close the application,
7791
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-02-11 01:55:49 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-06-18 15:28:52 +0000
@@ -45,9 +45,7 @@
45 ]45 ]
4646
47 def test_buttons(self):47 def test_buttons(self):
48 item = "Buttons"48 self.open_page('buttonsElement')
49 self.loadItem(item)
50 self.checkPageHeader(item)
5149
52 button = self.app.select_single(objectName=self.button_name)50 button = self.app.select_single(objectName=self.button_name)
53 self.assertIsNot(button, None)51 self.assertIsNot(button, None)
5452
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-05-26 12:37:32 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-06-18 15:28:52 +0000
@@ -1,6 +1,6 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#2#
3# Copyright (C) 2012, 2013 Canonical Ltd.3# Copyright (C) 2012, 2013, 2014 Canonical Ltd.
4#4#
5# This program is free software; you can redistribute it and/or modify5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by6# it under the terms of the GNU Lesser General Public License as published by
@@ -16,32 +16,19 @@
1616
17"""Tests for the Ubuntu UI Toolkit Gallery"""17"""Tests for the Ubuntu UI Toolkit Gallery"""
1818
19from autopilot.matchers import Eventually19import ubuntuuitoolkit
20from testtools.matchers import Is, Not, Equals
21
22from ubuntuuitoolkit import emulators
23from ubuntuuitoolkit.tests import gallery20from ubuntuuitoolkit.tests import gallery
2421
2522
26class GenericTests(gallery.GalleryTestCase):23class GalleryAppTestCase(gallery.GalleryTestCase):
27 """Generic tests for the Gallery"""24 """Generic tests for the Gallery"""
2825
29 def test_0_can_select_mainwindow(self):26 def test_select_main_view_must_return_main_window_emulator(self):
30 """Must be able to select the main window."""27 main_view = self.main_view
3128 self.assertIsInstance(main_view, ubuntuuitoolkit.MainView)
32 rootItem = self.main_view
33 self.assertThat(rootItem, Not(Is(None)))
34 self.assertThat(rootItem.visible, Eventually(Equals(True)))
35
36 def test_navigation(self):
37 item = "Navigation"
38 self.loadItem(item)
39 self.checkPageHeader(item)
4029
41 def test_slider(self):30 def test_slider(self):
42 item = "Slider"31 self.open_page('slidersElement')
43 self.loadItem(item)
44 self.checkPageHeader(item)
4532
46 item_data = [33 item_data = [
47 ["slider_standard"],34 ["slider_standard"],
@@ -57,9 +44,7 @@
57 # TODO: move slider value44 # TODO: move slider value
5845
59 def test_progress_and_activity(self):46 def test_progress_and_activity(self):
60 item = "Progress and activity"47 self.open_page('progressBarsElement')
61 self.loadItem(item)
62 self.checkPageHeader(item)
6348
64 item_data = [49 item_data = [
65 ["progressbar_standard"],50 ["progressbar_standard"],
@@ -79,9 +64,7 @@
79 # FIXME: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/130897964 # FIXME: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1308979
80 return65 return
8166
82 item = "Ubuntu Shape"67 self.open_page('ubuntuShapesElement')
83 self.loadItem(item)
84 self.checkPageHeader(item)
8568
86 item_data = [69 item_data = [
87 ["ubuntushape_color_hex"],70 ["ubuntushape_color_hex"],
@@ -115,12 +98,9 @@
115 ]98 ]
11699
117 def test_open_page(self):100 def test_open_page(self):
118 list_view = self.main_view.select_single(101 self.open_page(self.element_name)
119 emulators.QQuickListView, objectName="widgetList")
120 list_view.click_element(self.element_name)
121 element = self.main_view.select_single(102 element = self.main_view.select_single(
122 'Standard', objectName=self.element_name)103 'Standard', objectName=self.element_name)
123 element.selected.wait_for(True)
124 self.checkPageHeader(element.text)104 self.checkPageHeader(element.text)
125 if self.template_name == 'textinputsTemplate':105 if self.template_name == 'textinputsTemplate':
126 page_type = 'TextInputs'106 page_type = 'TextInputs'
127107
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-05-23 09:50:42 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-06-18 15:28:52 +0000
@@ -24,9 +24,7 @@
2424
25 def setUp(self):25 def setUp(self):
26 super(OptionSelectorTestCase, self).setUp()26 super(OptionSelectorTestCase, self).setUp()
27 item = "Option Selector"27 self.open_page('optionSelectorsElement')
28 self.loadItem(item)
29 self.checkPageHeader(item)
3028
31 def test_select_option_from_collapsed_optionselector(self):29 def test_select_option_from_collapsed_optionselector(self):
32 collapsed_option_selector = self.main_view.select_single(30 collapsed_option_selector = self.main_view.select_single(
3331
=== added file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 1970-01-01 00:00:00 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 2014-06-18 15:28:52 +0000
@@ -0,0 +1,63 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2#
3# Copyright (C) 2014 Canonical Ltd.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU Lesser General Public License as published by
7# the Free Software Foundation; version 3.
8#
9# This program is distributed in the hope that it will be useful,
10# but WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12# GNU Lesser General Public License for more details.
13#
14# You should have received a copy of the GNU Lesser General Public License
15# along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17from autopilot import platform
18
19from ubuntuuitoolkit.tests import gallery
20
21
22class ScrollBarTestCase(gallery.GalleryTestCase):
23
24 def setUp(self):
25 super(ScrollBarTestCase, self).setUp()
26 self.open_page('navigationElement')
27 self.scrollbar = self.main_view.wait_select_single(
28 'Scrollbar', objectName="TemplateScrollbar")
29
30 def move_mouse_to_thumb(self):
31 # TODO we need a helper to move the interactive thumb.
32 # --elopio 2014-05-06
33 thumb = self.scrollbar.select_single(
34 objectName='interactiveScrollbarThumb')
35 self.pointing_device.move_to_object(thumb)
36
37 def test_scrollbar_must_start_without_interactive_thumb(self):
38 self.assertEqual(self.scrollbar.interactive, False)
39
40 def test_move_mouse_to_thumb_must_make_scrollbar_interactive(self):
41 if platform.model() != 'Desktop':
42 self.skipTest(
43 'The interactive thumb is activated by the move of a mouse')
44
45 self.move_mouse_to_thumb()
46
47 self.assertEqual(self.scrollbar.interactive, True)
48
49 def test_drag_thumb_down_must_make_bottom_visible(self):
50 if platform.model() != 'Desktop':
51 self.skipTest(
52 'The interactive thumb is activated by the move of a mouse')
53
54 bottom_section = self.main_view.select_single(className='PageStack')
55 flickable = self.main_view.select_single(
56 'QQuickFlickable', objectName='TemplateFlickable')
57 self.assertEqual(flickable.is_child_visible(bottom_section), False)
58
59 self.move_mouse_to_thumb()
60 x, y = self.pointing_device.position()
61 self.pointing_device.drag(x, y, x, self.main_view.height)
62
63 self.assertEqual(flickable.is_child_visible(bottom_section), True)
064
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-04-30 09:40:17 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-06-18 15:28:52 +0000
@@ -54,9 +54,7 @@
54 # Apply the user locale from the environment54 # Apply the user locale from the environment
55 # The UITK does the same, so the test must be localized55 # The UITK does the same, so the test must be localized
56 locale.setlocale(locale.LC_ALL, "")56 locale.setlocale(locale.LC_ALL, "")
57 item = 'Text Field'57 self.open_page('textinputsElement')
58 self.loadItem(item)
59 self.checkPageHeader(item)
6058
61 def test_write_on_textfield_must_update_text(self):59 def test_write_on_textfield_must_update_text(self):
62 textfield = self.main_view.select_single(60 textfield = self.main_view.select_single(
@@ -78,9 +76,7 @@
7876
79 def setUp(self):77 def setUp(self):
80 super(DisabledTextInputTestCase, self).setUp()78 super(DisabledTextInputTestCase, self).setUp()
81 item = 'Text Field'79 self.open_page('textinputsElement')
82 self.loadItem(item)
83 self.checkPageHeader(item)
8480
85 def test_textfield_disabled(self):81 def test_textfield_disabled(self):
86 textfield_disabled = self.main_view.select_single(82 textfield_disabled = self.main_view.select_single(
8783
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py'
--- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2013-11-01 15:15:30 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2014-06-18 15:28:52 +0000
@@ -35,10 +35,7 @@
3535
36 def setUp(self):36 def setUp(self):
37 super(EnabledTogglesTestCase, self).setUp()37 super(EnabledTogglesTestCase, self).setUp()
38 item = "Toggles"38 self.open_page('togglesElement')
39 self.checkListItem(item)
40 self.loadItem(item)
41 self.checkPageHeader(item)
4239
43 def test_change_toggles_state(self):40 def test_change_toggles_state(self):
44 toggle = self.main_view.select_single(41 toggle = self.main_view.select_single(
@@ -65,10 +62,7 @@
6562
66 def setUp(self):63 def setUp(self):
67 super(DisabledTogglesTestCase, self).setUp()64 super(DisabledTogglesTestCase, self).setUp()
68 item = "Toggles"65 self.open_page('togglesElement')
69 self.checkListItem(item)
70 self.loadItem(item)
71 self.checkPageHeader(item)
7266
73 def test_change_toggles_state(self):67 def test_change_toggles_state(self):
74 toggle = self.main_view.select_single(68 toggle = self.main_view.select_single(
7569
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py'
--- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-05-28 09:42:30 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-06-18 15:28:52 +0000
@@ -298,7 +298,7 @@
298 # home.298 # home.
299 self.useFixture(fixture_setup.FakeHome())299 self.useFixture(fixture_setup.FakeHome())
300300
301 open(os.path.join(os.environ.get('HOME'), '.Xauthority')).close()301 open(os.path.join(os.environ.get('HOME'), '.Xauthority'), 'w').close()
302302
303 self.useFixture(fixture_setup.FakeHome())303 self.useFixture(fixture_setup.FakeHome())
304 self.assertTrue(304 self.assertTrue(
305305
=== added directory 'tests/launcher'
=== added file 'tests/launcher/launcher.cpp'
--- tests/launcher/launcher.cpp 1970-01-01 00:00:00 +0000
+++ tests/launcher/launcher.cpp 2014-06-18 15:28:52 +0000
@@ -0,0 +1,146 @@
1/*
2 * Copyright 2014 Canonical Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * QML launcher with the ability to setup the QQuickView/ QQmlEngine differently
17 *
18 * Rationale: Different variants of qmlscene exist as well as C++ and Go apps
19 * This is to write Autopilot test cases that exhibit specific behavior
20 */
21
22#include <iostream>
23#include <QtCore/qdebug.h>
24#include <QtQuick/QQuickView>
25#include <QtGui/QGuiApplication>
26#include <QtQml/QQmlEngine>
27#include <QtQml/QQmlContext>
28#include <QtCore/QFileInfo>
29#include <QLibrary>
30#include <QOpenGLContext>
31#include <QtGui/private/qopenglcontext_p.h>
32#include <QtQuick/private/qsgcontext_p.h>
33
34int usage()
35{
36 QString self(QGuiApplication::instance()->arguments().at(0));
37 std::cout << "Usage\n "
38 << qPrintable(self)
39 << " -testability -frameless -engine"
40 << " --desktop_file_path=DESKTOP_FILE"
41 << " -I MODULE_PATH FILENAME\n";
42 return 1;
43}
44
45int main(int argc, const char *argv[])
46{
47 // QPlatformIntegration::ThreadedOpenGL
48 setenv("QML_FORCE_THREADED_RENDERER", "1", 1);
49 // QPlatformIntegration::BufferQueueingOpenGL
50 setenv("QML_FIXED_ANIMATION_STEP", "1", 1);
51 // Oxide and QWebEngine need a shared context
52 QScopedPointer<QOpenGLContext> shareContext;
53 shareContext.reset(new QOpenGLContext);
54#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0)
55 QSGContext::setSharedOpenGLContext(shareContext.data());
56#else
57 QOpenGLContextPrivate::setGlobalShareContext(shareContext.data());
58#endif
59 QGuiApplication::setApplicationName("UITK Launcher");
60 QGuiApplication application(argc, (char**)argv);
61 QStringList args (application.arguments());
62
63 int _testability(args.indexOf("-testability"));
64 args.removeAt(_testability);
65 int _frameless(args.indexOf("-frameless"));
66 args.removeAt(_frameless);
67 int _engine(args.indexOf("-engine"));
68 args.removeAt(_engine);
69
70 Q_FOREACH(QString arg, args) {
71 if (arg.startsWith("--desktop_file_hint")) {
72 // This will not be used - it only needs to be ignored
73 int _desktop_file_hint(args.indexOf(arg));
74 args.removeAt(_desktop_file_hint);
75 }
76 }
77
78 // Testability is only supported out of the box by QApplication not QGuiApplication
79 if (_testability > -1 || getenv("QT_LOAD_TESTABILITY")) {
80 QLibrary testLib(QLatin1String("qttestability"));
81 if (testLib.load()) {
82 typedef void (*TasInitialize)(void);
83 TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
84 if (initFunction) {
85 initFunction();
86 } else {
87 qCritical("Library qttestability resolve failed!");
88 return 1;
89 }
90 } else {
91 qCritical("Library qttestability load failed!");
92 return 1;
93 }
94 }
95
96 QQmlEngine* engine;
97 // The default constructor affects the components tree (autopilot vis)
98 QQuickView* view;
99 if (_engine > -1) {
100 view = new QQuickView();
101 engine = view->engine();
102 } else {
103 engine = new QQmlEngine();
104 view = new QQuickView(engine, NULL);
105 }
106
107 int _import(args.indexOf("-I"));
108 args.removeAt(_import);
109 if (_import > -1) {
110 if (args.count() > _import) {
111 QString importPath(args.at(_import));
112 args.removeAt(_import);
113 engine->addImportPath(importPath);
114 }
115 }
116
117 view->setResizeMode(QQuickView::SizeRootObjectToView);
118 view->setTitle("UI Toolkit QQuickView");
119 if (_frameless > -1) {
120 view->setFlags(Qt::FramelessWindowHint);
121 }
122
123 // The remaining unnamed argument must be a filename
124 if (args.count() == 1) {
125 qCritical() << "Missing filename";
126 return usage();
127 }
128 QString filename(args.at(1));
129 // The first argument is the launcher itself
130 args.removeAt(0);
131
132 QUrl source(QUrl::fromLocalFile(filename));
133 view->setSource(source);
134 if (view->errors().count() > 0) {
135 return usage();
136 }
137 view->show();
138
139 if (args.count() > 1) {
140 qCritical() << "Invalid arguments passed" << args;
141 return usage();
142 }
143
144 return application.exec();
145}
146
0147
=== added file 'tests/launcher/launcher.pro'
--- tests/launcher/launcher.pro 1970-01-01 00:00:00 +0000
+++ tests/launcher/launcher.pro 2014-06-18 15:28:52 +0000
@@ -0,0 +1,11 @@
1TEMPLATE = app
2QT += qml quick
3# For setSharedOpenGLContext
4QT += core-private gui-private quick-private
5CONFIG += no_keywords
6SOURCES += \
7 launcher.cpp
8launcher.path = /usr/lib/ubuntu-ui-toolkit
9launcher.files = launcher
10INSTALLS += launcher
11
012
=== modified file 'tests/tests.pro'
--- tests/tests.pro 2014-02-21 23:39:43 +0000
+++ tests/tests.pro 2014-06-18 15:28:52 +0000
@@ -7,4 +7,6 @@
7autopilot2_module.path = /usr/lib/python2.7/dist-packages/ubuntuuitoolkit7autopilot2_module.path = /usr/lib/python2.7/dist-packages/ubuntuuitoolkit
8autopilot2_module.files = autopilot/ubuntuuitoolkit/*8autopilot2_module.files = autopilot/ubuntuuitoolkit/*
99
10SUBDIRS += launcher
11
10INSTALLS += autopilot_module autopilot2_module12INSTALLS += autopilot_module autopilot2_module
1113
=== modified file 'tests/unit/runtest.sh'
--- tests/unit/runtest.sh 2014-04-15 14:26:35 +0000
+++ tests/unit/runtest.sh 2014-06-18 15:28:52 +0000
@@ -38,7 +38,10 @@
3838
39function execute_test_cmd {39function execute_test_cmd {
40 echo "Executing $_CMD $_ARGS"40 echo "Executing $_CMD $_ARGS"
41 if [ $DISPLAY ]; then41 if [ ! -x $_TARGET ]; then
42 echo "Error: $_TARGET wasn't built!"
43 RESULT=2
44 elif [ $DISPLAY ]; then
42 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/125699945 # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999
43 # https://bugreports.qt-project.org/browse/QTBUG-3624346 # https://bugreports.qt-project.org/browse/QTBUG-36243
44 QML2_IMPORT_PATH=../../../modules:$QML2_IMPORT_PATH UBUNTU_UI_TOOLKIT_THEMES_PATH=../../../modules \47 QML2_IMPORT_PATH=../../../modules:$QML2_IMPORT_PATH UBUNTU_UI_TOOLKIT_THEMES_PATH=../../../modules \
4548
=== modified file 'tests/unit/unit.pro'
--- tests/unit/unit.pro 2013-12-03 10:36:54 +0000
+++ tests/unit/unit.pro 2014-06-18 15:28:52 +0000
@@ -18,9 +18,7 @@
18 tst_scaling_image_provider \18 tst_scaling_image_provider \
19 tst_qquick_image_extension \19 tst_qquick_image_extension \
20 tst_performance \20 tst_performance \
21 tst_ubuntu_shape \
22 tst_mainview \21 tst_mainview \
23 tst_page \
24 tst_i18n \22 tst_i18n \
25 tst_arguments \23 tst_arguments \
26 tst_argument \24 tst_argument \
2725
=== modified file 'tests/unit_x11/tst_components/tst_hide_chrome.qml'
--- tests/unit_x11/tst_components/tst_hide_chrome.qml 2014-04-25 05:28:37 +0000
+++ tests/unit_x11/tst_components/tst_hide_chrome.qml 2014-06-18 15:28:52 +0000
@@ -61,6 +61,11 @@
61 when: windowShown61 when: windowShown
62 id: testCase62 id: testCase
6363
64 function cleanup() {
65 // clean buffers
66 waitForRendering(mainView, 500);
67 }
68
64 function openToolbar() {69 function openToolbar() {
65 var toolbar = mainView.__propagated.toolbar;70 var toolbar = mainView.__propagated.toolbar;
66 toolbar.open();71 toolbar.open();
6772
=== renamed file 'tests/unit/tst_components/tst_page.qml' => 'tests/unit_x11/tst_components/tst_page.qml'
=== modified file 'tests/unit_x11/tst_components/tst_popover.qml'
--- tests/unit_x11/tst_components/tst_popover.qml 2014-04-17 14:14:43 +0000
+++ tests/unit_x11/tst_components/tst_popover.qml 2014-06-18 15:28:52 +0000
@@ -61,6 +61,7 @@
61 function cleanup() {61 function cleanup() {
62 popoverSpy.target = null;62 popoverSpy.target = null;
63 popoverSpy.clear();63 popoverSpy.clear();
64 waitForRendering(main, 500);
64 }65 }
6566
66 function test_dismiss_on_click_data() {67 function test_dismiss_on_click_data() {
6768
=== renamed file 'tests/unit/tst_components/tst_quickutils.qml' => 'tests/unit_x11/tst_components/tst_quickutils.qml'
=== modified file 'tests/unit_x11/tst_components/tst_textarea.qml'
--- tests/unit_x11/tst_components/tst_textarea.qml 2014-04-30 07:10:06 +0000
+++ tests/unit_x11/tst_components/tst_textarea.qml 2014-06-18 15:28:52 +0000
@@ -555,6 +555,7 @@
555 }555 }
556556
557 function test_scroll_with_selected_text() {557 function test_scroll_with_selected_text() {
558 skip("Flaky test, feature needs rewrite");
558 longText.focus = true;559 longText.focus = true;
559 var handler = findChild(longText, "input_handler");560 var handler = findChild(longText, "input_handler");
560 verify(handler);561 verify(handler);
@@ -629,6 +630,7 @@
629 }630 }
630631
631 function test_press_and_hold_over_selected_text() {632 function test_press_and_hold_over_selected_text() {
633 skip("Flaky test, feature will be rewritten");
632 longText.focus = true;634 longText.focus = true;
633 var handler = findChild(longText, "input_handler");635 var handler = findChild(longText, "input_handler");
634 var y = longText.height / 2;636 var y = longText.height / 2;
635637
=== renamed file 'tests/unit/tst_components/tst_toolbaritems.qml' => 'tests/unit_x11/tst_components/tst_toolbaritems.qml'
=== modified file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml'
--- tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml 2014-04-23 08:50:20 +0000
+++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml 2014-06-18 15:28:52 +0000
@@ -21,6 +21,7 @@
21Item{21Item{
22 id: root22 id: root
23 property string log: ""23 property string log: ""
24// onLogChanged: print("LOG", log)
24 width: units.gu(100)25 width: units.gu(100)
25 height: units.gu(100)26 height: units.gu(100)
2627
@@ -28,9 +29,11 @@
28 objectName: "isawindow"29 objectName: "isawindow"
29 width: units.gu(50)30 width: units.gu(50)
30 height: units.gu(50)31 height: units.gu(50)
32 visible: true
3133
32 Item {34 Item {
33 id: clickArea35 id: clickArea
36 objectName: "clickArea"
34 anchors {37 anchors {
35 left: parent.left38 left: parent.left
36 right: parent.right39 right: parent.right
3740
=== modified file 'tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp'
--- tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp 2014-04-15 21:37:57 +0000
+++ tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp 2014-06-18 15:28:52 +0000
@@ -22,10 +22,10 @@
22#include <QtQuick/QQuickItem>22#include <QtQuick/QQuickItem>
23#include <QtCore/QEvent>23#include <QtCore/QEvent>
2424
25#include "uctestcase.h"
25#include "inversemouseareatype.h"26#include "inversemouseareatype.h"
26#include "ucunits.h"27#include "ucunits.h"
27#include <private/qquickevents_p_p.h>28#include <private/qquickevents_p_p.h>
28#include <qpa/qwindowsysteminterface.h>
2929
30#define DOUBLECLICK_TIMEOUT 40030#define DOUBLECLICK_TIMEOUT 400
3131
@@ -78,13 +78,6 @@
78 return QPointF(UCUnits::instance().gu(guX), UCUnits::instance().gu(guY)).toPoint();78 return QPointF(UCUnits::instance().gu(guX), UCUnits::instance().gu(guY)).toPoint();
79 }79 }
8080
81 void touchClick(QWindow *window, const QPoint &point)
82 {
83 QTest::touchEvent(window, device).press(0, point, window);
84 QTest::qWait(10);
85 QTest::touchEvent(window, device).release(0, point, window);
86 }
87
88protected Q_SLOTS:81protected Q_SLOTS:
89 void capturePressed(QQuickMouseEvent *event)82 void capturePressed(QQuickMouseEvent *event)
90 {83 {
@@ -95,16 +88,14 @@
9588
96 void initTestCase()89 void initTestCase()
97 {90 {
91 // make sure we have a touch device installed
92 UbuntuTestCase::registerTouchDevice();
98 QString modules("../../../modules");93 QString modules("../../../modules");
99 QVERIFY(QDir(modules).exists());94 QVERIFY(QDir(modules).exists());
10095
101 quickView = new QQuickView(0);96 quickView = new QQuickView(0);
102 quickEngine = quickView->engine();97 quickEngine = quickView->engine();
10398
104 device = new QTouchDevice;
105 device->setType(QTouchDevice::TouchScreen);
106 QWindowSystemInterface::registerTouchDevice(device);
107
108 quickView->setGeometry(0,0, 240, 320);99 quickView->setGeometry(0,0, 240, 320);
109 //add modules folder so we have access to the plugin from QML100 //add modules folder so we have access to the plugin from QML
110 QStringList imports = quickEngine->importPathList();101 QStringList imports = quickEngine->importPathList();
@@ -139,7 +130,6 @@
139 QVERIFY(eventCleanup.isEmpty());130 QVERIFY(eventCleanup.isEmpty());
140 }131 }
141132
142
143 void testCase_PropagateEvents()133 void testCase_PropagateEvents()
144 {134 {
145 eventCleanup.clear();135 eventCleanup.clear();
@@ -167,10 +157,14 @@
167 InverseMouseAreaType *area = testArea("InverseMouseAreaInWindow.qml");157 InverseMouseAreaType *area = testArea("InverseMouseAreaInWindow.qml");
168 QVERIFY(area);158 QVERIFY(area);
169 quickView->show();159 quickView->show();
160 QTest::qWaitForWindowExposed(quickView);
170161
171 QList<QQuickWindow *> l = quickView->rootObject()->findChildren<QQuickWindow*>("isawindow");162 QList<QQuickWindow *> l = quickView->rootObject()->findChildren<QQuickWindow*>("isawindow");
172 QVERIFY(l.count());163 QVERIFY(l.count());
173164
165 QQuickItem *clickArea = quickView->rootObject()->findChild<QQuickItem*>("clickArea");
166 QVERIFY(clickArea);
167
174 QTest::mouseClick(l[0], Qt::LeftButton, 0, QPoint(20, 10));168 QTest::mouseClick(l[0], Qt::LeftButton, 0, QPoint(20, 10));
175 QTest::waitForEvents();169 QTest::waitForEvents();
176 QCOMPARE(quickView->rootObject()->property("log").toString(), QString("IMA"));170 QCOMPARE(quickView->rootObject()->property("log").toString(), QString("IMA"));
@@ -519,7 +513,7 @@
519 QCOMPARE(imaSpy.count(), 1);513 QCOMPARE(imaSpy.count(), 1);
520514
521 imaSpy.clear();515 imaSpy.clear();
522 touchClick(quickView, guPoint(20, 5));516 UbuntuTestCase::touchClick(0, quickView, guPoint(20, 5));
523 QCOMPARE(imaSpy.count(), 1);517 QCOMPARE(imaSpy.count(), 1);
524 }518 }
525519
526520
=== renamed directory 'tests/unit/tst_page' => 'tests/unit_x11/tst_page'
=== renamed directory 'tests/unit/tst_ubuntu_shape' => 'tests/unit_x11/tst_ubuntu_shape'
=== modified file 'tests/unit_x11/unit_x11.pro'
--- tests/unit_x11/unit_x11.pro 2013-12-29 19:15:15 +0000
+++ tests/unit_x11/unit_x11.pro 2014-06-18 15:28:52 +0000
@@ -1,4 +1,12 @@
1TEMPLATE = subdirs1TEMPLATE = subdirs
22
3SUBDIRS += tst_components tst_test tst_inversemousearea tst_recreateview tst_statesaver tst_theme_engine tst_orientation tst_layouts \3SUBDIRS += tst_components \
4 tst_ubuntu_shape \
5 tst_page \
6 tst_test \
7 tst_inversemousearea \
8 tst_recreateview \
9 tst_statesaver \
10 tst_theme_engine \
11 tst_orientation tst_layouts \
4 tst_mousefilters12 tst_mousefilters

Subscribers

People subscribed via source and target branches

to status/vote changes: