Merge lp:~tpeeters/ubuntu-ui-toolkit/revert-ap16 into lp:ubuntu-ui-toolkit

Proposed by Tim Peeters
Status: Superseded
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/revert-ap16
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 2312 lines (+1002/-346)
47 files modified
.bzrignore (+1/-1)
components.api (+6/-0)
debian/control (+13/-1)
debian/ubuntu-ui-toolkit-autopilot.install (+0/-1)
debian/ubuntu-ui-toolkit-tools.install (+1/-0)
examples/ubuntu-ui-toolkit-gallery/gallery (+1/-1)
examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop (+1/-1)
src/Ubuntu/Components/1.0/Icon.qml (+4/-4)
src/Ubuntu/Components/1.2/TextInputPopover.qml (+0/-7)
src/Ubuntu/Components/1.3/PageWrapperUtils.js (+9/-2)
src/Ubuntu/Components/1.3/TextInputPopover.qml (+0/-6)
src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml (+3/-1)
src/Ubuntu/Components/Popups/1.2/PopupBase.qml (+1/-0)
src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml (+3/-1)
src/Ubuntu/Components/Popups/1.3/PopupBase.qml (+1/-0)
src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml (+1/-1)
src/Ubuntu/Components/plugin/plugin.cpp (+2/-0)
src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp (+3/-2)
src/Ubuntu/Components/plugin/sortfiltermodel.cpp (+5/-2)
src/Ubuntu/Components/plugin/ucactionitem.cpp (+61/-36)
src/Ubuntu/Components/plugin/ucactionitem.h (+13/-4)
src/Ubuntu/Components/plugin/uclistitem.cpp (+88/-49)
src/Ubuntu/Components/plugin/uclistitem.h (+0/-1)
src/Ubuntu/Components/plugin/uclistitem_p.h (+3/-7)
src/Ubuntu/Components/plugin/ucviewitemsattached.cpp (+0/-64)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py (+5/-0)
tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py (+27/-6)
tests/autopilot/ubuntuuitoolkit/base.py (+2/-3)
tests/autopilot/ubuntuuitoolkit/tests/__init__.py (+1/-2)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py (+56/-2)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml (+9/-10)
tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py (+4/-2)
tests/resources/listitems/ListItemTest.qml (+7/-2)
tests/resources/navigation/Blackbox.qml (+48/-0)
tests/tests.pro (+0/-2)
tests/uitk_test_plan.sh (+19/-8)
tests/unit_x11/tst_components/ListItemTestCase.qml (+4/-0)
tests/unit_x11/tst_components/ListItemTestCase13.qml (+14/-0)
tests/unit_x11/tst_components/tst_actionitem.qml (+178/-82)
tests/unit_x11/tst_components/tst_icon.qml (+35/-0)
tests/unit_x11/tst_components/tst_listitem.qml (+14/-14)
tests/unit_x11/tst_components/tst_listitem13.qml (+13/-14)
tests/unit_x11/tst_components/tst_listitem_extras.qml (+136/-4)
tests/unit_x11/tst_components/tst_popover.qml (+33/-0)
tests/unit_x11/tst_components/tst_popover13.qml (+174/-0)
ubuntu-sdk.pro (+1/-1)
ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro (+2/-2)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/revert-ap16
Reviewer Review Type Date Requested Status
Ubuntu SDK team Pending
Review via email: mp+272002@code.launchpad.net

Commit message

Undo the MR to support AP1.6.

Description of the change

Undo the MR to support AP1.6 because AP1.6 is not ready yet.

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 '.bzrignore'
--- .bzrignore 2015-08-18 21:07:56 +0000
+++ .bzrignore 2015-09-22 15:57:54 +0000
@@ -21,5 +21,5 @@
21tests/unit/tst_i18n/*/share/locale/en/LC_MESSAGES/*.mo21tests/unit/tst_i18n/*/share/locale/en/LC_MESSAGES/*.mo
22tests/unit/tst_units/dpr*/dpr*22tests/unit/tst_units/dpr*/dpr*
23tests/apicheck/apicheck23tests/apicheck/apicheck
24tests/launcher/launcher24ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher
25build_paths.inc25build_paths.inc
2626
=== modified file 'components.api'
--- components.api 2015-09-04 12:35:16 +0000
+++ components.api 2015-09-22 15:57:54 +0000
@@ -1244,6 +1244,12 @@
1244 property bool locked1244 property bool locked
1245 property bool opened1245 property bool opened
1246 property Item pageStack1246 property Item pageStack
1247Ubuntu.Components.UCApplication 1.0 0.1: QtObject
1248 property string applicationName
1249 property QtObject inputMethod
1250Ubuntu.Components.UCFontUtils 1.0 0.1: QtObject
1251 function double sizeToPixels(string size)
1252 function double modularScale(string size)
1247UCListItemDivider: Item1253UCListItemDivider: Item
1248 property color colorFrom1254 property color colorFrom
1249 property color colorTo1255 property color colorTo
12501256
=== modified file 'debian/control'
--- debian/control 2015-08-20 08:10:44 +0000
+++ debian/control 2015-09-22 15:57:54 +0000
@@ -120,7 +120,7 @@
120Package: ubuntu-ui-toolkit-examples120Package: ubuntu-ui-toolkit-examples
121Section: devel121Section: devel
122Architecture: any122Architecture: any
123Depends: qmlscene,123Depends: ubuntu-ui-toolkit-tools (>= ${source:Version}),
124 qtdeclarative5-ubuntu-ui-toolkit-plugin (= ${binary:Version}) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,124 qtdeclarative5-ubuntu-ui-toolkit-plugin (= ${binary:Version}) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
125 ubuntu-ui-toolkit-theme (= ${binary:Version}),125 ubuntu-ui-toolkit-theme (= ${binary:Version}),
126 qml-module-qtquick-xmllistmodel | qtdeclarative5-xmllistmodel-plugin,126 qml-module-qtquick-xmllistmodel | qtdeclarative5-xmllistmodel-plugin,
@@ -160,3 +160,15 @@
160 qml-module-qttest | qtdeclarative5-test-plugin,160 qml-module-qttest | qtdeclarative5-test-plugin,
161Description: Test package for Ubuntu UI Toolkit161Description: Test package for Ubuntu UI Toolkit
162 Autopilot tests for the ubuntu-ui-toolkit package162 Autopilot tests for the ubuntu-ui-toolkit package
163
164Package: ubuntu-ui-toolkit-tools
165Architecture: any
166Depends: ${misc:Depends},
167 ${shlibs:Depends}
168Description: Qt Components for Ubuntu - productive tools
169 Qt Components for Ubuntu offers a set of reusable user interface
170 components for Qt Quick 2 / QML.
171 .
172 This package contains the application launcher, which is a drop-in
173 replacement for qmlscene, oxideqmlscene, qml and derivatives.
174
163175
=== modified file 'debian/ubuntu-ui-toolkit-autopilot.install'
--- debian/ubuntu-ui-toolkit-autopilot.install 2015-04-29 13:02:11 +0000
+++ debian/ubuntu-ui-toolkit-autopilot.install 2015-09-22 15:57:54 +0000
@@ -1,3 +1,2 @@
1usr/lib/python31usr/lib/python3
2usr/lib/*/ubuntu-ui-toolkit/apicheck2usr/lib/*/ubuntu-ui-toolkit/apicheck
3usr/lib/*/ubuntu-ui-toolkit/launcher
43
=== added file 'debian/ubuntu-ui-toolkit-tools.install'
--- debian/ubuntu-ui-toolkit-tools.install 1970-01-01 00:00:00 +0000
+++ debian/ubuntu-ui-toolkit-tools.install 2015-09-22 15:57:54 +0000
@@ -0,0 +1,1 @@
1usr/bin/ubuntu-ui-toolkit-launcher
02
=== modified file 'examples/ubuntu-ui-toolkit-gallery/gallery'
--- examples/ubuntu-ui-toolkit-gallery/gallery 2015-08-11 15:42:46 +0000
+++ examples/ubuntu-ui-toolkit-gallery/gallery 2015-09-22 15:57:54 +0000
@@ -3,4 +3,4 @@
3. `dirname $0`/../../build_paths.inc3. `dirname $0`/../../build_paths.inc
44
5SCRIPT_DIRECTORY=`dirname $0`5SCRIPT_DIRECTORY=`dirname $0`
6$BUILD_DIR/tests/launcher/launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml6$BUILD_DIR/ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml
77
=== modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop'
--- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop 2014-11-17 11:52:44 +0000
+++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop 2015-09-22 15:57:54 +0000
@@ -1,6 +1,6 @@
1[Desktop Entry]1[Desktop Entry]
2Name=Ubuntu UI Toolkit Gallery2Name=Ubuntu UI Toolkit Gallery
3Exec=/usr/bin/qmlscene $@ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml3Exec=/usr/bin/ubuntu-ui-toolkit-launcher $@ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml
4Terminal=false4Terminal=false
5Type=Application5Type=Application
6X-Ubuntu-Touch=true6X-Ubuntu-Touch=true
77
=== modified file 'src/Ubuntu/Components/1.0/Icon.qml'
--- src/Ubuntu/Components/1.0/Icon.qml 2015-07-24 09:53:20 +0000
+++ src/Ubuntu/Components/1.0/Icon.qml 2015-09-22 15:57:54 +0000
@@ -55,19 +55,19 @@
55 }55 }
5656
57 cache: true57 cache: true
58 visible: !colorizedImage.active58 visible: !colorizedImage.visible
59 }59 }
6060
61 ShaderEffect {61 ShaderEffect {
62 id: colorizedImage62 id: colorizedImage
63 objectName: "shader"
6364
64 anchors.fill: parent65 anchors.fill: parent
65 visible: active
6666
67 // Whether or not a color has been set.67 // Whether or not a color has been set.
68 property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)68 visible: image.status == Image.Ready && keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)
6969
70 property Image source: active && image.status == Image.Ready ? image : null70 property Image source: image
71 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)71 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)
72 property color keyColorIn: "#808080"72 property color keyColorIn: "#808080"
73 property real threshold: 0.173 property real threshold: 0.1
7474
=== modified file 'src/Ubuntu/Components/1.2/TextInputPopover.qml'
--- src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-08-19 06:55:11 +0000
+++ src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-09-22 15:57:54 +0000
@@ -83,13 +83,6 @@
83 model: actions.length83 model: actions.length
84 AbstractButton {84 AbstractButton {
85 id: button85 id: button
86 /*
87 Workaround for autopilot used in the text input's context menu to access
88 action.text so we can get the proper button by text, action being not
89 accessible. https://bugs.launchpad.net/autopilot/+bug/1334599
90 */
91 // FIXME: AbstractButton has text property, which is getting the action.text, so no need to override!
92 property string text: action.text
93 width: Math.max(units.gu(5), implicitWidth) + units.gu(2)86 width: Math.max(units.gu(5), implicitWidth) + units.gu(2)
94 height: units.gu(6)87 height: units.gu(6)
95 action: actions[modelData]88 action: actions[modelData]
9689
=== modified file 'src/Ubuntu/Components/1.3/PageWrapperUtils.js'
--- src/Ubuntu/Components/1.3/PageWrapperUtils.js 2015-09-01 11:59:13 +0000
+++ src/Ubuntu/Components/1.3/PageWrapperUtils.js 2015-09-22 15:57:54 +0000
@@ -73,6 +73,7 @@
73 if (incubator.status != Component.Ready) {73 if (incubator.status != Component.Ready) {
74 incubator.onStatusChanged = incubatorStatusChanged;74 incubator.onStatusChanged = incubatorStatusChanged;
75 } else {75 } else {
76 pageWrapper.incubator = this;
76 incubatorStatusChanged(incubator.status);77 incubatorStatusChanged(incubator.status);
77 }78 }
78}79}
@@ -103,9 +104,15 @@
103 throw new Error("Error while loading page: " + pageComponent.errorString());104 throw new Error("Error while loading page: " + pageComponent.errorString());
104 } else {105 } else {
105 // create the object106 // create the object
106 pageWrapper.incubator = new Incubator(pageWrapper, pageComponent);
107 if (synchronous) {107 if (synchronous) {
108 pageWrapper.incubator.forceCompletion();108 if (pageWrapper.properties) {
109 // initialize the object with the given properties
110 pageWrapper.object = pageComponent.createObject(pageWrapper, pageWrapper.properties);
111 } else {
112 pageWrapper.object = pageComponent.createObject(pageWrapper);
113 }
114 } else {
115 pageWrapper.incubator = new Incubator(pageWrapper, pageComponent);
109 }116 }
110 pageWrapper.canDestroy = true;117 pageWrapper.canDestroy = true;
111 }118 }
112119
=== modified file 'src/Ubuntu/Components/1.3/TextInputPopover.qml'
--- src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-07-02 23:33:22 +0000
+++ src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-09-22 15:57:54 +0000
@@ -83,12 +83,6 @@
83 model: actions.length83 model: actions.length
84 AbstractButton {84 AbstractButton {
85 id: button85 id: button
86 /*
87 Workaround for autopilot used in the text input's context menu to access
88 action.text so we can get the proper button by text, action being not
89 accessible. https://bugs.launchpad.net/autopilot/+bug/1334599
90 */
91 property string text: action.text
92 width: Math.max(units.gu(5), implicitWidth) + units.gu(2)86 width: Math.max(units.gu(5), implicitWidth) + units.gu(2)
93 height: units.gu(6)87 height: units.gu(6)
94 action: actions[modelData]88 action: actions[modelData]
9589
=== modified file 'src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml'
--- src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml 2015-04-30 08:32:44 +0000
+++ src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml 2015-09-22 15:57:54 +0000
@@ -147,8 +147,10 @@
147 onStatusChanged: {147 onStatusChanged: {
148 if (item && status == Loader.Ready) {148 if (item && status == Loader.Ready) {
149 // set model data149 // set model data
150 if (item.hasOwnProperty("action"))150 if (item.hasOwnProperty("action")) {
151 item.action = modelData;151 item.action = modelData;
152 item.objectName = item.action.objectName + '_button';
153 }
152 if (item.hasOwnProperty("refModelData"))154 if (item.hasOwnProperty("refModelData"))
153 item.refModelData = modelData;155 item.refModelData = modelData;
154 if (item.hasOwnProperty("modelData"))156 if (item.hasOwnProperty("modelData"))
155157
=== modified file 'src/Ubuntu/Components/Popups/1.2/PopupBase.qml'
--- src/Ubuntu/Components/Popups/1.2/PopupBase.qml 2015-04-30 08:32:44 +0000
+++ src/Ubuntu/Components/Popups/1.2/PopupBase.qml 2015-09-22 15:57:54 +0000
@@ -161,6 +161,7 @@
161 }161 }
162162
163 MouseArea {163 MouseArea {
164 acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
164 anchors.fill: __foreground165 anchors.fill: __foreground
165 onWheel: wheel.accepted = true166 onWheel: wheel.accepted = true
166 }167 }
167168
=== modified file 'src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml'
--- src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2015-05-14 21:32:51 +0000
+++ src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2015-09-22 15:57:54 +0000
@@ -147,8 +147,10 @@
147 onStatusChanged: {147 onStatusChanged: {
148 if (item && status == Loader.Ready) {148 if (item && status == Loader.Ready) {
149 // set model data149 // set model data
150 if (item.hasOwnProperty("action"))150 if (item.hasOwnProperty("action")) {
151 item.action = modelData;151 item.action = modelData;
152 item.objectName = item.action.objectName + '_button';
153 }
152 if (item.hasOwnProperty("refModelData"))154 if (item.hasOwnProperty("refModelData"))
153 item.refModelData = modelData;155 item.refModelData = modelData;
154 if (item.hasOwnProperty("modelData"))156 if (item.hasOwnProperty("modelData"))
155157
=== modified file 'src/Ubuntu/Components/Popups/1.3/PopupBase.qml'
--- src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2015-04-29 08:55:31 +0000
+++ src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2015-09-22 15:57:54 +0000
@@ -161,6 +161,7 @@
161 }161 }
162162
163 MouseArea {163 MouseArea {
164 acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
164 anchors.fill: __foreground165 anchors.fill: __foreground
165 onWheel: wheel.accepted = true166 onWheel: wheel.accepted = true
166 }167 }
167168
=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml'
--- src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2015-09-04 09:32:31 +0000
+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2015-09-22 15:57:54 +0000
@@ -70,7 +70,7 @@
70 }70 }
7171
72 readonly property real maxItemWidth: parent.width / itemActions.actions.length72 readonly property real maxItemWidth: parent.width / itemActions.actions.length
73 readonly property real minItemWidth: units.gu(5) // 2GU icon + 2* 1.5GU margin73 readonly property real minItemWidth: units.gu(6) // 2GU icon + 2* 2GU margin
7474
75 Repeater {75 Repeater {
76 model: itemActions.actions76 model: itemActions.actions
7777
=== modified file 'src/Ubuntu/Components/plugin/plugin.cpp'
--- src/Ubuntu/Components/plugin/plugin.cpp 2015-08-31 15:43:14 +0000
+++ src/Ubuntu/Components/plugin/plugin.cpp 2015-09-22 15:57:54 +0000
@@ -163,7 +163,9 @@
163{163{
164 qmlRegisterType<UCAction>(uri, major, minor, "Action");164 qmlRegisterType<UCAction>(uri, major, minor, "Action");
165 qmlRegisterType<UCActionContext>(uri, major, minor, "ActionContext");165 qmlRegisterType<UCActionContext>(uri, major, minor, "ActionContext");
166 qmlRegisterUncreatableType<UCApplication>(uri, major, minor, "UCApplication", "Not instantiable");
166 qmlRegisterType<UCActionManager>(uri, major, minor, "ActionManager");167 qmlRegisterType<UCActionManager>(uri, major, minor, "ActionManager");
168 qmlRegisterUncreatableType<UCFontUtils>(uri, major, minor, "UCFontUtils", "Not instantiable");
167 qmlRegisterType<UCStyledItemBase>(uri, major, minor, "StyledItem");169 qmlRegisterType<UCStyledItemBase>(uri, major, minor, "StyledItem");
168 qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object");170 qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object");
169 qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase");171 qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase");
170172
=== modified file 'src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp'
--- src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp 2015-08-31 15:43:14 +0000
+++ src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp 2015-09-22 15:57:54 +0000
@@ -123,7 +123,8 @@
123 "No dragging will be possible.");123 "No dragging will be possible.");
124 }124 }
125 if (start) {125 if (start) {
126 pViewAttached->buildChangesList(false);126 // keep the mouse event in house
127 setKeepMouseGrab(true);
127 fromIndex = toIndex = index;128 fromIndex = toIndex = index;
128 lastPos = pos;129 lastPos = pos;
129 // create temp drag item130 // create temp drag item
@@ -152,7 +153,7 @@
152 }153 }
153 }154 }
154 // unlock flickables155 // unlock flickables
155 pViewAttached->clearChangesList();156 setKeepMouseGrab(false);
156 // perform drop157 // perform drop
157 UCListItemPrivate::get(item.data())->dragHandler->drop();158 UCListItemPrivate::get(item.data())->dragHandler->drop();
158 item = 0;159 item = 0;
159160
=== modified file 'src/Ubuntu/Components/plugin/sortfiltermodel.cpp'
--- src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-08-20 17:08:49 +0000
+++ src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-09-22 15:57:54 +0000
@@ -220,8 +220,11 @@
220{220{
221 QVariantMap res;221 QVariantMap res;
222 const QHash<int, QByteArray> roles = roleNames();222 const QHash<int, QByteArray> roles = roleNames();
223 for(int role = 0; role < roles.count(); role++)223 QHashIterator<int, QByteArray> i(roles);
224 res.insert (roles[role], data(row, role));224 while (i.hasNext()) {
225 i.next();
226 res.insert(i.value(), data(row, i.key()));
227 }
225 return res;228 return res;
226}229}
227230
228231
=== modified file 'src/Ubuntu/Components/plugin/ucactionitem.cpp'
--- src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-08-25 11:31:29 +0000
+++ src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-09-22 15:57:54 +0000
@@ -16,6 +16,10 @@
1616
17#include "ucactionitem.h"17#include "ucactionitem.h"
18#include "ucaction.h"18#include "ucaction.h"
19#include "ucstyleditembase_p.h"
20#define foreach Q_FOREACH
21#include <QtQml/private/qqmlbinding_p.h>
22#undef foreach
1923
20/*!24/*!
21 * \qmltype ActionItem25 * \qmltype ActionItem
@@ -40,8 +44,14 @@
40 , m_action(Q_NULLPTR)44 , m_action(Q_NULLPTR)
41 , m_flags(0)45 , m_flags(0)
42{46{
43 connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged);47 connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::enabledChanged2);
44 connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged);48 connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::visibleChanged2);
49}
50
51bool UCActionItem::hasBindingOnProperty(const QString &name)
52{
53 QQmlProperty property(this, name, qmlContext(this));
54 return QQmlPropertyPrivate::binding(property) != Q_NULLPTR;
45}55}
4656
47void UCActionItem::componentComplete()57void UCActionItem::componentComplete()
@@ -55,40 +65,47 @@
55 }65 }
56}66}
5767
58void UCActionItem::_q_visibleChanged()
59{
60 m_flags |= CustomVisible;
61 disconnect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged);
62}
63
64void UCActionItem::_q_enabledChanged()
65{
66 m_flags |= CustomEnabled;
67 disconnect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged);
68}
69
70// update visible property68// update visible property
71void UCActionItem::_q_updateVisible()69void UCActionItem::_q_visibleBinding()
72{70{
71 if (m_flags & CustomVisible) {
72 return;
73 }
74 if (hasBindingOnProperty(QStringLiteral("visible"))) {
75 m_flags |= CustomEnabled;
76 return;
77 }
73 bool visible = m_action ? m_action->m_visible : true;78 bool visible = m_action ? m_action->m_visible : true;
74 setVisible(visible);79 setVisible(visible);
75 // reset flag and reconnect signal handler disconnected by the
76 m_flags &= ~CustomVisible;
77 if (m_action) {
78 connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged);
79 }
80}80}
8181
82// update enabled property82// update enabled property
83void UCActionItem::_q_updateEnabled()83void UCActionItem::_q_enabledBinding()
84{84{
85 if (m_flags & CustomEnabled) {
86 return;
87 }
88 if (hasBindingOnProperty(QStringLiteral("enabled"))) {
89 m_flags |= CustomEnabled;
90 return;
91 }
85 bool enabled = m_action ? m_action->m_enabled : true;92 bool enabled = m_action ? m_action->m_enabled : true;
86 setEnabled(enabled);93 setEnabled(enabled);
87 // reset flag and reconnect signal handler disconnected by the94}
88 m_flags &= ~CustomEnabled;95
89 if (m_action) {96// setter called when bindings from QML set the value. Internal functions will
90 connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged);97// all use the setVisible setter, so initialization and (re)parenting related
91 }98// visible alteration won't set the custom flag
99void UCActionItem::setVisible2(bool visible)
100{
101 // set the custom flag and forward the value to the original proepry setter
102 m_flags |= CustomVisible;
103 setVisible(visible);
104}
105void UCActionItem::setEnabled2(bool enabled)
106{
107 m_flags |= CustomEnabled;
108 setEnabled(enabled);
92}109}
93110
94void UCActionItem::updateProperties()111void UCActionItem::updateProperties()
@@ -109,10 +126,14 @@
109 if (attach) {126 if (attach) {
110 connect(this, SIGNAL(triggered(QVariant)),127 connect(this, SIGNAL(triggered(QVariant)),
111 m_action, SLOT(trigger(QVariant)), Qt::DirectConnection);128 m_action, SLOT(trigger(QVariant)), Qt::DirectConnection);
112 connect(m_action, &UCAction::visibleChanged,129 if (!(m_flags & CustomVisible)) {
113 this, &UCActionItem::_q_updateVisible, Qt::DirectConnection);130 connect(m_action, &UCAction::visibleChanged,
114 connect(m_action, &UCAction::enabledChanged,131 this, &UCActionItem::_q_visibleBinding, Qt::DirectConnection);
115 this, &UCActionItem::_q_updateEnabled, Qt::DirectConnection);132 }
133 if (!(m_flags & CustomEnabled)) {
134 connect(m_action, &UCAction::enabledChanged,
135 this, &UCActionItem::_q_enabledBinding, Qt::DirectConnection);
136 }
116 if (!(m_flags & CustomText)) {137 if (!(m_flags & CustomText)) {
117 connect(m_action, &UCAction::textChanged,138 connect(m_action, &UCAction::textChanged,
118 this, &UCActionItem::textChanged, Qt::DirectConnection);139 this, &UCActionItem::textChanged, Qt::DirectConnection);
@@ -128,10 +149,14 @@
128 } else {149 } else {
129 disconnect(this, SIGNAL(triggered(QVariant)),150 disconnect(this, SIGNAL(triggered(QVariant)),
130 m_action, SLOT(trigger(QVariant)));151 m_action, SLOT(trigger(QVariant)));
131 disconnect(m_action, &UCAction::visibleChanged,152 if (!(m_flags & CustomVisible)) {
132 this, &UCActionItem::_q_updateVisible);153 disconnect(m_action, &UCAction::visibleChanged,
133 disconnect(m_action, &UCAction::enabledChanged,154 this, &UCActionItem::_q_visibleBinding);
134 this, &UCActionItem::_q_updateEnabled);155 }
156 if (!(m_flags & CustomEnabled)) {
157 disconnect(m_action, &UCAction::enabledChanged,
158 this, &UCActionItem::_q_enabledBinding);
159 }
135 if (!(m_flags & CustomText)) {160 if (!(m_flags & CustomText)) {
136 disconnect(m_action, &UCAction::textChanged,161 disconnect(m_action, &UCAction::textChanged,
137 this, &UCActionItem::textChanged);162 this, &UCActionItem::textChanged);
@@ -167,8 +192,8 @@
167 if (m_action) {192 if (m_action) {
168 attachAction(true);193 attachAction(true);
169 }194 }
170 _q_updateVisible();195 _q_visibleBinding();
171 _q_updateEnabled();196 _q_enabledBinding();
172 updateProperties();197 updateProperties();
173}198}
174199
175200
=== modified file 'src/Ubuntu/Components/plugin/ucactionitem.h'
--- src/Ubuntu/Components/plugin/ucactionitem.h 2015-08-25 11:31:29 +0000
+++ src/Ubuntu/Components/plugin/ucactionitem.h 2015-09-22 15:57:54 +0000
@@ -26,6 +26,10 @@
26 Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged)26 Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged)
27 Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource RESET resetIconSource NOTIFY iconSourceChanged)27 Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource RESET resetIconSource NOTIFY iconSourceChanged)
28 Q_PROPERTY(QString iconName READ iconName WRITE setIconName RESET resetIconName NOTIFY iconNameChanged)28 Q_PROPERTY(QString iconName READ iconName WRITE setIconName RESET resetIconName NOTIFY iconNameChanged)
29
30 // overrides
31 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled2 NOTIFY enabledChanged2)
32 Q_PROPERTY(bool visible READ isVisible WRITE setVisible2 NOTIFY visibleChanged2 FINAL)
29public:33public:
30 explicit UCActionItem(QQuickItem *parent = 0);34 explicit UCActionItem(QQuickItem *parent = 0);
3135
@@ -40,6 +44,9 @@
40 void setIconName(const QString &iconName);44 void setIconName(const QString &iconName);
41 void resetIconName();45 void resetIconName();
4246
47 void setVisible2(bool visible);
48 void setEnabled2(bool enabled);
49
43Q_SIGNALS:50Q_SIGNALS:
44 void actionChanged();51 void actionChanged();
45 void textChanged();52 void textChanged();
@@ -47,14 +54,15 @@
47 void iconNameChanged();54 void iconNameChanged();
48 void triggered(const QVariant &value);55 void triggered(const QVariant &value);
4956
57 void enabledChanged2();
58 void visibleChanged2();
59
50public Q_SLOTS:60public Q_SLOTS:
51 void trigger(const QVariant &value = QVariant());61 void trigger(const QVariant &value = QVariant());
5262
53protected Q_SLOTS:63protected Q_SLOTS:
54 void _q_visibleChanged();64 void _q_visibleBinding();
55 void _q_enabledChanged();65 void _q_enabledBinding();
56 void _q_updateVisible();
57 void _q_updateEnabled();
5866
59protected:67protected:
60 enum {68 enum {
@@ -72,6 +80,7 @@
7280
73 void componentComplete();81 void componentComplete();
7482
83 bool hasBindingOnProperty(const QString &name);
75 void updateProperties();84 void updateProperties();
76 void attachAction(bool attach);85 void attachAction(bool attach);
77};86};
7887
=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
--- src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-04 09:32:31 +0000
+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-22 15:57:54 +0000
@@ -474,7 +474,7 @@
474 if (parentAttached) {474 if (parentAttached) {
475 Q_Q(UCListItem);475 Q_Q(UCListItem);
476 // restore flickable's interactive and cleanup476 // restore flickable's interactive and cleanup
477 parentAttached->disableInteractive(q, false);477 q->setKeepMouseGrab(false);
478 // no need to listen flickables any longer478 // no need to listen flickables any longer
479 listenToRebind(false);479 listenToRebind(false);
480 }480 }
@@ -1123,7 +1123,7 @@
11231123
1124// grabs the left mouse button event by turning highlight on, and triggering1124// grabs the left mouse button event by turning highlight on, and triggering
1125// swipe events; child items should no longer get mouse events1125// swipe events; child items should no longer get mouse events
1126void UCListItemPrivate::grabLeftButtonEvents(QMouseEvent *event)1126void UCListItemPrivate::handleLeftButtonPress(QMouseEvent *event)
1127{1127{
1128 Q_Q(UCListItem);1128 Q_Q(UCListItem);
1129 button = event->button();1129 button = event->button();
@@ -1133,11 +1133,15 @@
1133 lastPos = pressedPos = event->localPos();1133 lastPos = pressedPos = event->localPos();
1134 // connect the Flickable to know when to rebound1134 // connect the Flickable to know when to rebound
1135 listenToRebind(true);1135 listenToRebind(true);
1136 if (swiped && parentAttached) {1136 if (swiped) {
1137 parentAttached->disableInteractive(q, true);1137 // grab now, and ungrab in snapOut
1138 q->setKeepMouseGrab(true);
1139 q->grabMouse();
1138 }1140 }
1139 // stop any ongoing animation!1141 // stop any ongoing animation!
1140 swipeEvent(event->localPos(), UCSwipeEvent::Started);1142 swipeEvent(event->localPos(), UCSwipeEvent::Started);
1143 // accept the event so we get the rest of the events as well
1144 event->accept();
1141}1145}
11421146
1143void UCListItem::mousePressEvent(QMouseEvent *event)1147void UCListItem::mousePressEvent(QMouseEvent *event)
@@ -1150,10 +1154,8 @@
1150 return;1154 return;
1151 }1155 }
1152 if (d->canHighlight() && !d->highlighted && event->button() == Qt::LeftButton) {1156 if (d->canHighlight() && !d->highlighted && event->button() == Qt::LeftButton) {
1153 d->grabLeftButtonEvents(event);1157 d->handleLeftButtonPress(event);
1154 }1158 }
1155 // accept the event so we get the rest of the events as well
1156 event->setAccepted(true);
1157}1159}
11581160
1159bool UCListItem13::shouldShowContextMenu(QMouseEvent *event)1161bool UCListItem13::shouldShowContextMenu(QMouseEvent *event)
@@ -1203,15 +1205,16 @@
1203}1205}
12041206
1205// ungrabs any previously grabbed left mouse button event1207// ungrabs any previously grabbed left mouse button event
1206void UCListItemPrivate::ungrabLeftButtonEvents(QMouseEvent *event)1208void UCListItemPrivate::handleLeftButtonRelease(QMouseEvent *event)
1207{1209{
1208 Q_Q(UCListItem);1210 Q_Q(UCListItem);
1209 // set released1211 // set released
1210 if (highlighted) {1212 if (highlighted) {
1211 // unblock ascending Flickables1213 // unblock ascending Flickables
1212 listenToRebind(false);1214 listenToRebind(false);
1213 if (parentAttached) {1215 q->setKeepMouseGrab(false);
1214 parentAttached->disableInteractive(q, false);1216 if (window && window->mouseGrabberItem() == q) {
1217 q->ungrabMouse();
1215 }1218 }
12161219
1217 if (!suppressClick) {1220 if (!suppressClick) {
@@ -1231,15 +1234,14 @@
1231 }1234 }
1232 }1235 }
1233 button = Qt::NoButton;1236 button = Qt::NoButton;
1237 event->accept();
1234}1238}
12351239
1236void UCListItem::mouseReleaseEvent(QMouseEvent *event)1240void UCListItem::mouseReleaseEvent(QMouseEvent *event)
1237{1241{
1238 UCStyledItemBase::mouseReleaseEvent(event);1242 UCStyledItemBase::mouseReleaseEvent(event);
1239 Q_D(UCListItem);1243 Q_D(UCListItem);
1240 d->ungrabLeftButtonEvents(event);1244 d->handleLeftButtonRelease(event);
1241 // make sure we ungrab the mouse!
1242 ungrabMouse();
1243}1245}
12441246
1245void UCListItem13::mouseReleaseEvent(QMouseEvent *event)1247void UCListItem13::mouseReleaseEvent(QMouseEvent *event)
@@ -1275,9 +1277,7 @@
1275 if (d->swipedOverThreshold(event->localPos(), d->pressedPos)) {1277 if (d->swipedOverThreshold(event->localPos(), d->pressedPos)) {
1276 // the press went out of the threshold area, enable move, if the direction allows it1278 // the press went out of the threshold area, enable move, if the direction allows it
1277 d->lastPos = event->localPos();1279 d->lastPos = event->localPos();
1278 if (d->parentAttached) {1280 setKeepMouseGrab(true);
1279 d->parentAttached->disableInteractive(this, true);
1280 }
1281 qreal mouseX = event->localPos().x();1281 qreal mouseX = event->localPos().x();
1282 qreal pressedX = d->pressedPos.x();1282 qreal pressedX = d->pressedPos.x();
1283 bool doSwipe = (d->leadingActions && (mouseX > pressedX)) ||1283 bool doSwipe = (d->leadingActions && (mouseX > pressedX)) ||
@@ -1298,42 +1298,81 @@
1298 }1298 }
1299}1299}
13001300
1301bool UCListItemPrivate::sendMouseEvent(QQuickItem *item, QMouseEvent *event)
1302{
1303 Q_UNUSED(item);
1304 Q_Q(UCListItem);
1305 QQuickItem *grabber = window ? window->mouseGrabberItem() : Q_NULLPTR;
1306 if (grabber == q) {
1307 // already the grabber, return
1308 return true;
1309 }
1310
1311 bool consumed = false;
1312 if (contentItem->contains(contentItem->mapFromScene(event->windowPos()))) {
1313 QPointF localPos = q->mapFromScene(event->windowPos());
1314
1315 switch (event->type()) {
1316 case QEvent::MouseButtonPress: {
1317 // remember pressed point over active areas
1318 if (event->button() == Qt::LeftButton) {
1319 if (swiped) {
1320 // handle as full press and grab the event from the children
1321 QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));
1322 handleLeftButtonPress(mouseEvent.data());
1323 consumed = true;
1324 } else {
1325 // remember the position
1326 pressedPos = localPos;
1327 button = event->button();
1328 }
1329 }
1330 break;
1331 }
1332 case QEvent::MouseButtonRelease: {
1333 QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));
1334 handleLeftButtonRelease(mouseEvent.data());
1335 suppressClick = false;
1336 break;
1337 }
1338 case QEvent::MouseMove: {
1339 if ((button == Qt::LeftButton) && swipedOverThreshold(localPos, pressedPos) && !highlighted) {
1340 // grab the event from the child, so the click doesn't happen anymore, and initiate swiping
1341 QMouseEvent pressed(QEvent::MouseButtonPress, localPos, event->windowPos(), event->screenPos(),
1342 Qt::LeftButton, event->buttons(), event->modifiers());
1343 handleLeftButtonPress(&pressed);
1344 // grab any further events so all land in the list item
1345 q->setKeepMouseGrab(true);
1346 q->grabMouse();
1347 consumed = true;
1348 }
1349 break;
1350 }
1351 default: break;
1352 }
1353 }
1354
1355 return consumed;
1356}
1357
1301bool UCListItem::childMouseEventFilter(QQuickItem *child, QEvent *event)1358bool UCListItem::childMouseEventFilter(QQuickItem *child, QEvent *event)
1302{1359{
1303 QEvent::Type type = event->type();1360 if (!isVisible() || !isEnabled()) {
1361 return UCStyledItemBase::childMouseEventFilter(child, event);
1362 }
1363
1304 Q_D(UCListItem);1364 Q_D(UCListItem);
1305 if (type == QEvent::MouseButtonPress) {1365 switch (event->type()) {
1306 // suppress click event if pressed over an active area, except Text, which can also handle1366 case QEvent::MouseButtonPress:
1307 // mouse clicks when content is an URL1367 case QEvent::MouseMove:
1308 QMouseEvent *mouse = static_cast<QMouseEvent*>(event);1368 case QEvent::MouseButtonRelease: {
1309 if (child->isEnabled() && (child->acceptedMouseButtons() & mouse->button()) && !qobject_cast<QQuickText*>(child)) {1369 if (d->sendMouseEvent(child, static_cast<QMouseEvent*>(event))) {
1310 // suppress click1370 return true;
1311 d->suppressClick = true;1371 }
1312 // listen for flickable to be able to rebind if movement started there!1372 }
1313 d->listenToRebind(true);1373 default: break;
1314 // if left button pressed, remember the position1374 }
1315 if (mouse->button() == Qt::LeftButton) {1375
1316 d->pressedPos = mapFromItem(child, mouse->localPos());
1317 d->button = mouse->button();
1318 }
1319 }
1320 } else if (type == QEvent::MouseButtonRelease) {
1321 Q_D(UCListItem);
1322 d->suppressClick = false;
1323 } else if (type == QEvent::MouseMove) {
1324 QMouseEvent *mouse = static_cast<QMouseEvent*>(event);
1325 const QPointF localPos = mapFromItem(child, mouse->localPos());
1326 if ((mouse->buttons() & Qt::LeftButton) && d->swipedOverThreshold(localPos, d->pressedPos) && !d->highlighted) {
1327 // grab the event from the child, so the click doesn't happen anymore, and initiate swiping
1328 QMouseEvent pressed(QEvent::MouseButtonPress, localPos, mouse->windowPos(), mouse->screenPos(),
1329 Qt::LeftButton, mouse->buttons(), mouse->modifiers());
1330 d->grabLeftButtonEvents(&pressed);
1331 // stop click and pressAndHold, then grab the mouse so children do not get the mouse events anymore
1332 d->suppressClick = true;
1333 d->pressAndHoldTimer.stop();
1334 grabMouse();
1335 }
1336 }
1337 return UCStyledItemBase::childMouseEventFilter(child, event);1376 return UCStyledItemBase::childMouseEventFilter(child, event);
1338}1377}
13391378
13401379
=== modified file 'src/Ubuntu/Components/plugin/uclistitem.h'
--- src/Ubuntu/Components/plugin/uclistitem.h 2015-09-04 09:32:31 +0000
+++ src/Ubuntu/Components/plugin/uclistitem.h 2015-09-22 15:57:54 +0000
@@ -180,7 +180,6 @@
180 static UCViewItemsAttached *qmlAttachedProperties(QObject *owner);180 static UCViewItemsAttached *qmlAttachedProperties(QObject *owner);
181181
182 bool listenToRebind(UCListItem *item, bool listen);182 bool listenToRebind(UCListItem *item, bool listen);
183 void disableInteractive(UCListItem *item, bool disable);
184 bool isMoving();183 bool isMoving();
185 bool isBoundTo(UCListItem *item);184 bool isBoundTo(UCListItem *item);
186185
187186
=== modified file 'src/Ubuntu/Components/plugin/uclistitem_p.h'
--- src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-01 07:16:59 +0000
+++ src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-22 15:57:54 +0000
@@ -68,8 +68,9 @@
68 void snapOut();68 void snapOut();
69 void swipeEvent(const QPointF &localPos, UCSwipeEvent::Status status);69 void swipeEvent(const QPointF &localPos, UCSwipeEvent::Status status);
70 bool swipedOverThreshold(const QPointF &mousePos, const QPointF relativePos);70 bool swipedOverThreshold(const QPointF &mousePos, const QPointF relativePos);
71 void grabLeftButtonEvents(QMouseEvent *event);71 void handleLeftButtonPress(QMouseEvent *event);
72 void ungrabLeftButtonEvents(QMouseEvent *event);72 void handleLeftButtonRelease(QMouseEvent *event);
73 bool sendMouseEvent(QQuickItem *item, QMouseEvent *event);
7374
74 quint16 defaultThemeVersion;75 quint16 defaultThemeVersion;
75 bool highlighted:1;76 bool highlighted:1;
@@ -138,8 +139,6 @@
138139
139 void clearFlickablesList();140 void clearFlickablesList();
140 void buildFlickablesList();141 void buildFlickablesList();
141 void clearChangesList();
142 void buildChangesList(const QVariant &newValue);
143 bool addSelectedItem(UCListItem *item);142 bool addSelectedItem(UCListItem *item);
144 bool removeSelectedItem(UCListItem *item);143 bool removeSelectedItem(UCListItem *item);
145 bool isItemSelected(UCListItem *item);144 bool isItemSelected(UCListItem *item);
@@ -157,13 +156,10 @@
157 QSet<int> selectedList;156 QSet<int> selectedList;
158 QMap<int, QPointer<UCListItem13> > expansionList;157 QMap<int, QPointer<UCListItem13> > expansionList;
159 QList< QPointer<QQuickFlickable> > flickables;158 QList< QPointer<QQuickFlickable> > flickables;
160 QList< PropertyChange* > changes;
161 QPointer<UCListItem> boundItem;159 QPointer<UCListItem> boundItem;
162 QPointer<UCListItem> disablerItem;
163 QQuickFlickable *listView;160 QQuickFlickable *listView;
164 ListItemDragArea *dragArea;161 ListItemDragArea *dragArea;
165 UCViewItemsAttached::ExpansionFlags expansionFlags;162 UCViewItemsAttached::ExpansionFlags expansionFlags;
166 bool globalDisabled:1;
167 bool selectable:1;163 bool selectable:1;
168 bool draggable:1;164 bool draggable:1;
169 bool ready:1;165 bool ready:1;
170166
=== modified file 'src/Ubuntu/Components/plugin/ucviewitemsattached.cpp'
--- src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-04 08:55:29 +0000
+++ src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-22 15:57:54 +0000
@@ -105,7 +105,6 @@
105 , listView(0)105 , listView(0)
106 , dragArea(0)106 , dragArea(0)
107 , expansionFlags(UCViewItemsAttached::Exclusive)107 , expansionFlags(UCViewItemsAttached::Exclusive)
108 , globalDisabled(false)
109 , selectable(false)108 , selectable(false)
110 , draggable(false)109 , draggable(false)
111 , ready(false)110 , ready(false)
@@ -114,7 +113,6 @@
114113
115UCViewItemsAttachedPrivate::~UCViewItemsAttachedPrivate()114UCViewItemsAttachedPrivate::~UCViewItemsAttachedPrivate()
116{115{
117 clearChangesList();
118 clearFlickablesList();116 clearFlickablesList();
119}117}
120118
@@ -155,33 +153,6 @@
155 }153 }
156}154}
157155
158void UCViewItemsAttachedPrivate::clearChangesList()
159{
160 // clear property change objects
161 qDeleteAll(changes);
162 changes.clear();
163}
164
165void UCViewItemsAttachedPrivate::buildChangesList(const QVariant &newValue)
166{
167 // collect all ascendant flickables
168 Q_Q(UCViewItemsAttached);
169 QQuickItem *item = qobject_cast<QQuickItem*>(q->parent());
170 if (!item) {
171 return;
172 }
173 clearChangesList();
174 while (item) {
175 QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(item);
176 if (flickable) {
177 PropertyChange *change = new PropertyChange(item, "interactive");
178 PropertyChange::setValue(change, newValue);
179 changes << change;
180 }
181 item = item->parentItem();
182 }
183}
184
185/*!156/*!
186 * \qmltype ViewItems157 * \qmltype ViewItems
187 * \instantiates UCViewItemsAttached158 * \instantiates UCViewItemsAttached
@@ -252,41 +223,6 @@
252 return d->boundItem == item;223 return d->boundItem == item;
253}224}
254225
255/*
256 * Disable/enable interactive flag for the ascendant flickables. The item is used
257 * to detect whether the same item is trying to enable the flickables which disabled
258 * it before. The enabled/disabled states are not equivalent to the enabled/disabled
259 * state of the interactive flag.
260 * When disabled, always the last item disabling will be kept as active disabler,
261 * and only the active disabler can enable (restore) the interactive flag state.
262 */
263void UCViewItemsAttached::disableInteractive(UCListItem *item, bool disable)
264{
265 Q_D(UCViewItemsAttached);
266 if (disable) {
267 // disabling or re-disabling
268 d->disablerItem = item;
269 if (d->globalDisabled == disable) {
270 // was already disabled, leave
271 return;
272 }
273 d->globalDisabled = true;
274 } else if (d->globalDisabled && d->disablerItem == item) {
275 // the one disabled it will enable
276 d->globalDisabled = false;
277 d->disablerItem.clear();
278 } else {
279 // !disabled && (!globalDisabled || item != d->disablerItem)
280 return;
281 }
282 if (disable) {
283 // (re)build changes list with disabling the interactive value
284 d->buildChangesList(false);
285 } else {
286 d->clearChangesList();
287 }
288}
289
290void UCViewItemsAttached::unbindItem()226void UCViewItemsAttached::unbindItem()
291{227{
292 Q_D(UCViewItemsAttached);228 Q_D(UCViewItemsAttached);
293229
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-06-23 13:22:10 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-09-22 15:57:54 +0000
@@ -34,6 +34,11 @@
34class AppHeader(_common.UbuntuUIToolkitCustomProxyObjectBase):34class AppHeader(_common.UbuntuUIToolkitCustomProxyObjectBase):
35 """AppHeader Autopilot custom proxy object."""35 """AppHeader Autopilot custom proxy object."""
3636
37 def __init__(self, *args):
38 super().__init__(*args)
39 if not hasattr(self, 'useDeprecatedToolbar'):
40 self.useDeprecatedToolbar = None
41
37 def ensure_visible(self):42 def ensure_visible(self):
38 if not self._is_visible():43 if not self._is_visible():
39 self._show()44 self._show()
4045
=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py'
--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2015-09-07 13:46:58 +0000
+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2015-09-22 15:57:54 +0000
@@ -81,16 +81,37 @@
81class ActionSelectionPopover(_common.UbuntuUIToolkitCustomProxyObjectBase):81class ActionSelectionPopover(_common.UbuntuUIToolkitCustomProxyObjectBase):
82 """ActionSelectionPopover Autopilot custom proxy object."""82 """ActionSelectionPopover Autopilot custom proxy object."""
8383
84 def click_action_button(self, action_object_name):
85 """Click an action button on the popover.
86
87 :parameter object_name: The QML objectName property of the action
88 :raise ToolkitException: If there is no visible button with that object
89 name or the popover is not open.
90
91 """
92
93 if not self.visible:
94 raise _common.ToolkitException('The popover is not open.')
95 try:
96 object_name = action_object_name + "_button"
97 button = self.select_single(objectName=object_name)
98 except dbus.StateNotFoundError:
99 raise _common.ToolkitException(
100 'Action with objectName "{0}" not found.'.format(object_name))
101 self.pointing_device.click_object(button)
102 if self.autoClose:
103 try:
104 self.visible.wait_for(False)
105 except dbus.StateNotFoundError:
106 # The popover was removed from the tree.
107 pass
108
84 def click_button_by_text(self, text):109 def click_button_by_text(self, text):
85 """Click a button on the popover.110 """Click a button on the popover.
86111
87 XXX We are receiving the text because there's no way to set the
88 objectName on the action. This is reported at
89 https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205144
90 --elopio - 2013-07-25
91
92 :parameter text: The text of the button.112 :parameter text: The text of the button.
93 :raise ToolkitException: If the popover is not open.113 :raise ToolkitException: If there is no visible button with that label
114 or the popover is not open.
94115
95 """116 """
96 if not self.visible:117 if not self.visible:
97118
=== modified file 'tests/autopilot/ubuntuuitoolkit/base.py'
--- tests/autopilot/ubuntuuitoolkit/base.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/base.py 2015-09-22 15:57:54 +0000
@@ -61,13 +61,12 @@
61def get_toolkit_launcher_command():61def get_toolkit_launcher_command():
62 root = ubuntuuitoolkit.tests.get_path_to_build_root()62 root = ubuntuuitoolkit.tests.get_path_to_build_root()
63 path_to_local_launcher = os.path.join(63 path_to_local_launcher = os.path.join(
64 root, 'tests', 'launcher', 'launcher')64 root, 'ubuntu-ui-toolkit-launcher', 'ubuntu-ui-toolkit-launcher')
65 if os.path.exists(path_to_local_launcher):65 if os.path.exists(path_to_local_launcher):
66 return path_to_local_launcher66 return path_to_local_launcher
67 else:67 else:
68 arch = ubuntuuitoolkit.base.get_host_multiarch()
69 path_to_installed_launcher = os.path.join(68 path_to_installed_launcher = os.path.join(
70 '/', 'usr', 'lib', arch, 'ubuntu-ui-toolkit', 'launcher')69 '/', 'usr', 'bin', 'ubuntu-ui-toolkit-launcher')
71 return path_to_installed_launcher70 return path_to_installed_launcher
7271
7372
7473
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py'
--- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2015-07-29 09:50:33 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2015-09-22 15:57:54 +0000
@@ -204,8 +204,7 @@
204 return orientationHelper204 return orientationHelper
205205
206 def checkPageHeader(self, pageTitle):206 def checkPageHeader(self, pageTitle):
207 orientationHelper = self.getOrientationHelper()207 header_label = self.main_view.select_single(
208 header_label = orientationHelper.select_single(
209 objectName="header_title_label", text=pageTitle)208 objectName="header_title_label", text=pageTitle)
210 self.assertThat(header_label, Not(Is(None)))209 self.assertThat(header_label, Not(Is(None)))
211 self.assertThat(header_label.visible, Eventually(Equals(True)))210 self.assertThat(header_label.visible, Eventually(Equals(True)))
212211
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-04-14 21:02:06 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-09-22 15:57:54 +0000
@@ -51,19 +51,30 @@
51 actions: ActionList {51 actions: ActionList {
52 Action {52 Action {
53 text: "Action one"53 text: "Action one"
54 objectName: "actionOne"
54 onTriggered: label.text = "Button clicked."55 onTriggered: label.text = "Button clicked."
56 },
57 Action {
58 text: "Action two"
59 objectName: "actionDisabled"
60 onTriggered: label.text = "Disabled button clicked."
61 },
62 Action {
63 text: "Action three"
64 objectName: "actionHidden"
65 onTriggered: label.text = "Hidden button clicked."
55 }66 }
56 }67 }
57 }68 }
58}69}
59""")70""")
6071
61 def test_action_selection_popover_custom_proxy_object(self):72 def test_custom_proxy_object(self):
62 popover = self.main_view.get_action_selection_popover(73 popover = self.main_view.get_action_selection_popover(
63 'test_actions_popover')74 'test_actions_popover')
64 self.assertIsInstance(popover, popups.ActionSelectionPopover)75 self.assertIsInstance(popover, popups.ActionSelectionPopover)
6576
66 def test_click_action_select_popover_button(self):77 def test_click_button_by_label(self):
67 label = self.app.select_single('Label', objectName='clicked_label')78 label = self.app.select_single('Label', objectName='clicked_label')
68 self.assertNotEqual(label.text, 'Button clicked.')79 self.assertNotEqual(label.text, 'Button clicked.')
69 self._open_popover()80 self._open_popover()
@@ -72,6 +83,49 @@
72 popover.click_button_by_text('Action one')83 popover.click_button_by_text('Action one')
73 self.assertEqual(label.text, 'Button clicked.')84 self.assertEqual(label.text, 'Button clicked.')
7485
86 def test_click_button_by_object_name(self):
87 label = self.app.select_single('Label', objectName='clicked_label')
88 self.assertNotEqual(label.text, 'Button clicked.')
89 self._open_popover()
90 popover = self.main_view.get_action_selection_popover(
91 'test_actions_popover')
92 popover.click_action_button('actionOne')
93 self.assertEqual(label.text, 'Button clicked.')
94
95 def test_click_unexisting_button_by_object_name(self):
96 self._open_popover()
97 popover = self.main_view.get_action_selection_popover(
98 'test_actions_popover')
99 error = self.assertRaises(
100 ubuntuuitoolkit.ToolkitException,
101 popover.click_action_button, 'actionTwo')
102 self.assertEqual(
103 str(error),
104 'Action with objectName "actionTwo" not found.')
105
106 def test_click_disabled_button_by_object_name(self):
107 self._open_popover()
108 popover = self.main_view.get_action_selection_popover(
109 'test_actions_popover')
110 # Disabled actions are not shown in ActionSelectionPopover
111 error = self.assertRaises(
112 ubuntuuitoolkit.ToolkitException,
113 popover.click_action_button, 'actionDisabled')
114 self.assertEqual(
115 str(error),
116 'Action with objectName "actionDisabled" not found.')
117
118 def test_click_hidden_button_by_object_name(self):
119 self._open_popover()
120 popover = self.main_view.get_action_selection_popover(
121 'test_actions_popover')
122 error = self.assertRaises(
123 ubuntuuitoolkit.ToolkitException,
124 popover.click_action_button, 'actionHidden')
125 self.assertEqual(
126 str(error),
127 'Action with objectName "actionHidden" not found.')
128
75 def _open_popover(self):129 def _open_popover(self):
76 open_button = self.main_view.select_single(130 open_button = self.main_view.select_single(
77 'Button', objectName='open_popover')131 'Button', objectName='open_popover')
78132
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml 2015-09-07 15:46:58 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml 2015-09-22 15:57:54 +0000
@@ -20,7 +20,6 @@
20MainView {20MainView {
21 width: units.gu(70)21 width: units.gu(70)
22 height: units.gu(60)22 height: units.gu(60)
23 useDeprecatedToolbar: true
24 objectName: "mainView"23 objectName: "mainView"
2524
26 Tabs {25 Tabs {
@@ -29,33 +28,33 @@
29 objectName: "tab1"28 objectName: "tab1"
30 title: "Tab1"29 title: "Tab1"
31 Page {30 Page {
32 tools: ToolbarItems {31 head.actions: [
33 ToolbarButton {32 Action {
34 text: "Test1"33 text: "Test1"
35 }34 }
36 }35 ]
37 }36 }
38 }37 }
39 Tab {38 Tab {
40 objectName: "tab2"39 objectName: "tab2"
41 title: "Tab2"40 title: "Tab2"
42 Page {41 Page {
43 tools: ToolbarItems {42 head.actions: [
44 ToolbarButton {43 Action {
45 text: "Test2"44 text: "Test2"
46 }45 }
47 }46 ]
48 }47 }
49 }48 }
50 Tab {49 Tab {
51 objectName: "tab3"50 objectName: "tab3"
52 title: "Tab3"51 title: "Tab3"
53 Page {52 Page {
54 tools: ToolbarItems {53 head.actions: [
55 ToolbarButton {54 Action {
56 text: "Test3"55 text: "Test3"
57 }56 }
58 }57 ]
59 }58 }
60 }59 }
61 }60 }
6261
=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py'
--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2015-09-07 15:46:58 +0000
+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2015-09-22 15:57:54 +0000
@@ -28,10 +28,12 @@
28 dir_path = os.path.dirname(path)28 dir_path = os.path.dirname(path)
29 deprecated_tabbar_test_qml_file_path = os.path.join(29 deprecated_tabbar_test_qml_file_path = os.path.join(
30 dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.qml')30 dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.qml')
31 deprecated_tabbar_test_qml_file_path = os.path.join(31 deprecated_tabbar_1_3_test_qml_file_path = os.path.join(
32 dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml')32 dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml')
33 new_header_test_qml_file_path = os.path.join(33 new_header_test_qml_file_path = os.path.join(
34 dir_path, 'test_tabs.TabsTestCase.new_header.qml')34 dir_path, 'test_tabs.TabsTestCase.new_header.qml')
35 new_header_1_3_test_qml_file_path = os.path.join(
36 dir_path, 'test_tabs.TabsTestCase.new_header.1.3.qml')
3537
36 scenarios = [38 scenarios = [
37 ('deprecated TabBar',39 ('deprecated TabBar',
@@ -39,7 +41,7 @@
39 ('deprecated TabBar 1.3',41 ('deprecated TabBar 1.3',
40 dict(test_qml_file_path=deprecated_tabbar_1_3_test_qml_file_path)),42 dict(test_qml_file_path=deprecated_tabbar_1_3_test_qml_file_path)),
41 ('new header',43 ('new header',
42 dict(test_qml_file_path=new_header_test_qml_file_path))44 dict(test_qml_file_path=new_header_test_qml_file_path)),
43 ('new header 1.3',45 ('new header 1.3',
44 dict(test_qml_file_path=new_header_1_3_test_qml_file_path))46 dict(test_qml_file_path=new_header_1_3_test_qml_file_path))
45 ]47 ]
4648
=== modified file 'tests/resources/listitems/ListItemTest.qml'
--- tests/resources/listitems/ListItemTest.qml 2015-07-30 13:27:32 +0000
+++ tests/resources/listitems/ListItemTest.qml 2015-09-22 15:57:54 +0000
@@ -15,8 +15,8 @@
15 */15 */
1616
17import QtQuick 2.417import QtQuick 2.4
18import Ubuntu.Components 1.318import Ubuntu.Components 1.2
19import Ubuntu.Components.Styles 1.319import Ubuntu.Components.Styles 1.2
20import QtQuick.Layouts 1.120import QtQuick.Layouts 1.1
2121
22MainView {22MainView {
@@ -263,6 +263,11 @@
263 Label {263 Label {
264 text: modelData + " Flickable item"264 text: modelData + " Flickable item"
265 }265 }
266 Button {
267 text: "Pressme..."
268 anchors.centerIn: parent
269 }
270
266 onClicked: divider.visible = !divider.visible271 onClicked: divider.visible = !divider.visible
267 }272 }
268 }273 }
269274
=== added file 'tests/resources/navigation/Blackbox.qml'
--- tests/resources/navigation/Blackbox.qml 1970-01-01 00:00:00 +0000
+++ tests/resources/navigation/Blackbox.qml 2015-09-22 15:57:54 +0000
@@ -0,0 +1,48 @@
1/*
2 * Copyright 2015 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
17import QtQuick 2.4
18import Ubuntu.Components 1.2
19
20MainView {
21 width: units.gu(40)
22 height: units.gu(60)
23 Component.onCompleted: pageStack.push(page1)
24
25 PageStack {
26 id: pageStack
27 }
28
29 Page {
30 id: page1
31 title: "one"
32 Button {
33 anchors.centerIn: parent
34 text: "next"
35 onClicked: pageStack.push(page2)
36 }
37 }
38 Page {
39 id: page2
40 title: "two"
41 visible: false
42
43 head.backAction: Action {
44 iconName: "back"
45 onTriggered: pageStack.pop()
46 }
47 }
48}
049
=== modified file 'tests/tests.pro'
--- tests/tests.pro 2015-05-20 14:47:16 +0000
+++ tests/tests.pro 2015-09-22 15:57:54 +0000
@@ -4,8 +4,6 @@
4autopilot_module.path = /usr/lib/python3/dist-packages/ubuntuuitoolkit4autopilot_module.path = /usr/lib/python3/dist-packages/ubuntuuitoolkit
5autopilot_module.files = autopilot/ubuntuuitoolkit/*5autopilot_module.files = autopilot/ubuntuuitoolkit/*
66
7SUBDIRS += launcher
8
9SUBDIRS += apicheck7SUBDIRS += apicheck
108
11INSTALLS += autopilot_module9INSTALLS += autopilot_module
1210
=== modified file 'tests/uitk_test_plan.sh'
--- tests/uitk_test_plan.sh 2015-07-13 08:04:32 +0000
+++ tests/uitk_test_plan.sh 2015-09-22 15:57:54 +0000
@@ -32,7 +32,7 @@
32SERIES="vivid"32SERIES="vivid"
33CHANNEL="ubuntu-touch/rc-proposed/${DISTRO}"33CHANNEL="ubuntu-touch/rc-proposed/${DISTRO}"
34PASSWORD="0000"34PASSWORD="0000"
35BOOTTIME=50035BOOTTIME=250
36ONLYCOMPARE=false36ONLYCOMPARE=false
37DISTUPGRADE=false37DISTUPGRADE=false
38BOOTSTRAP=false38BOOTSTRAP=false
@@ -56,7 +56,7 @@
56# comment out if filemanager AP:s broken56# comment out if filemanager AP:s broken
57# " filemanager"57# " filemanager"
58# " ubuntu_terminal_app"58# " ubuntu_terminal_app"
59 " -n unity8"59# " -n unity8"
60 " ubuntu_clock_app"60 " ubuntu_clock_app"
61# " -p dialer-app-autopilot dialer_app"61# " -p dialer-app-autopilot dialer_app"
62# " -p reminders-app-autopilot reminders"62# " -p reminders-app-autopilot reminders"
@@ -78,7 +78,7 @@
78 reminders-app-autopilot \78 reminders-app-autopilot \
79 address-book-app-autopilot \79 address-book-app-autopilot \
80# messaging-app-autopilot \80# messaging-app-autopilot \
81 unity8-autopilot \81# unity8-autopilot \
82 dialer-app-autopilot \82 dialer-app-autopilot \
83 camera-app-autopilot \83 camera-app-autopilot \
84 webbrowser-app-autopilot \84 webbrowser-app-autopilot \
@@ -89,6 +89,12 @@
89 ubuntu-system-settings-online-accounts-autopilot"89 ubuntu-system-settings-online-accounts-autopilot"
90# messaging-app-autopilot \90# messaging-app-autopilot \
9191
92declare -a UNREGISTERED_APPS=(
93 "com.ubuntu.terminal"
94 "com.ubuntu.calculator"
95 "com.ubuntu.shorts"
96)
97
92fatal_failure () {98fatal_failure () {
93 echo -e "\e[31mFailed operation:\e[0m $1"99 echo -e "\e[31mFailed operation:\e[0m $1"
94 exit100 exit
@@ -178,10 +184,13 @@
178 network184 network
179 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S reboot 2>&1|grep -v password"185 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S reboot 2>&1|grep -v password"
180 sleep_indicator 120186 sleep_indicator 120
181 # Required for at least rtm-14.09/mako, phablet-click-test-setup fails otherwise and we don't need terminal187 # Unregister few apps as they break phablet-click-test-setup or something else
182 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister com.ubuntu.terminal 2>&1|grep -v password"188 echo -e "Unregister few apps"
183 # Enable if calculator AP:s broken, to prevent phablet-click-test-setup trying to check out its tests.189 for APP_TO_UNREGISTER in "${UNREGISTERED_APPS[@]}"
184 #adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister com.ubuntu.calculator 2>&1|grep -v password"190 do
191 echo -e "\e[31m${APP_TO_UNREGISTER}\e[0m"
192 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister ${APP_TO_UNREGISTER} 2>&1|grep -v password"
193 done
185 echo -e "phablet-click-test-setup \e[31m${DISTRO} ${SERIES}\e[0m"194 echo -e "phablet-click-test-setup \e[31m${DISTRO} ${SERIES}\e[0m"
186 phablet-click-test-setup -s ${SERIALNUMBER} --distribution=${DISTRO} --series=${SERIES} 2>&1 || fatal_failure "phablet-click-test-setup has failed" 195 phablet-click-test-setup -s ${SERIALNUMBER} --distribution=${DISTRO} --series=${SERIES} 2>&1 || fatal_failure "phablet-click-test-setup has failed"
187 echo "Sleep after phablet-click-test-setup";196 echo "Sleep after phablet-click-test-setup";
@@ -200,6 +209,9 @@
200 network209 network
201 # TODO: hide the sudo output210 # TODO: hide the sudo output
202 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/ci-train-ppa-service/landing-${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/silo-${PPA}.list' 2>&1|grep -v password > /dev/null "211 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/ci-train-ppa-service/landing-${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/silo-${PPA}.list' 2>&1|grep -v password > /dev/null "
212 # pin up the silo
213 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo -e \"Package: *\nPin: release o=LP-PPA-ci-train-ppa-service-landing-${PPA}\nPin-Priority: 1100\" > /etc/apt/preferences.d/silo.pref' 2>&1|grep -v password > /dev/null "
214 # Resynchronize the package index files from their sources.
203 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null"215 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null"
204 else216 else
205 echo -e "Set up with the PPA \e[31m${PPA}\e[0m"217 echo -e "Set up with the PPA \e[31m${PPA}\e[0m"
@@ -208,7 +220,6 @@
208 network220 network
209 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/testing-ppa.list' 2>&1|grep -v password > /dev/null"221 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S bash -c 'echo \"deb http://ppa.launchpad.net/${PPA}/${DISTRO} ${SERIES} main\" > /etc/apt/sources.list.d/testing-ppa.list' 2>&1|grep -v password > /dev/null"
210 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null"222 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null"
211
212 fi223 fi
213 fi224 fi
214 adb -s ${SERIALNUMBER} shell rm -rf /home/phablet/autopilot/ubuntuuitoolkit225 adb -s ${SERIALNUMBER} shell rm -rf /home/phablet/autopilot/ubuntuuitoolkit
215226
=== modified file 'tests/unit_x11/tst_components/ListItemTestCase.qml'
--- tests/unit_x11/tst_components/ListItemTestCase.qml 2015-09-02 13:18:51 +0000
+++ tests/unit_x11/tst_components/ListItemTestCase.qml 2015-09-22 15:57:54 +0000
@@ -82,6 +82,10 @@
82 spyWait();82 spyWait();
83 }83 }
8484
85 function tugNoWait(item, x, y, dx, dy) {
86 TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy));
87 }
88
85 // returns the leading or trailing panel item89 // returns the leading or trailing panel item
86 function panelItem(item, leading) {90 function panelItem(item, leading) {
87 return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing"));91 return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing"));
8892
=== modified file 'tests/unit_x11/tst_components/ListItemTestCase13.qml'
--- tests/unit_x11/tst_components/ListItemTestCase13.qml 2015-09-02 10:55:46 +0000
+++ tests/unit_x11/tst_components/ListItemTestCase13.qml 2015-09-22 15:57:54 +0000
@@ -76,12 +76,26 @@
76 flick(item, x, y, dx, dy, 0, 0, undefined, undefined, 100);76 flick(item, x, y, dx, dy, 0, 0, undefined, undefined, 100);
77 }77 }
7878
79 // touch swipes
80 function swipeTouch(touchId, item, x, y, dx, dy) {
81 setupSpy(item, "contentMovementEnded");
82 flickTouch(touchId, item, x, y, dx, dy, 0, 100);
83 spyWait();
84 }
85 function swipeTouchNoWait(touchId, item, x, y, dx, dy) {
86 flickTouch(touchId, item, x, y, dx, dy, 0, 100);
87 }
88
79 function tug(item, x, y, dx, dy) {89 function tug(item, x, y, dx, dy) {
80 setupSpy(item, "contentMovementEnded");90 setupSpy(item, "contentMovementEnded");
81 TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy));91 TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy));
82 spyWait();92 spyWait();
83 }93 }
8494
95 function tugNoWait(item, x, y, dx, dy) {
96 TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy));
97 }
98
85 // returns the leading or trailing panel item99 // returns the leading or trailing panel item
86 function panelItem(item, leading) {100 function panelItem(item, leading) {
87 return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing"));101 return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing"));
88102
=== renamed file 'tests/unit/tst_components/tst_actionitem.qml' => 'tests/unit_x11/tst_components/tst_actionitem.qml'
--- tests/unit/tst_components/tst_actionitem.qml 2015-08-18 16:58:41 +0000
+++ tests/unit_x11/tst_components/tst_actionitem.qml 2015-09-22 15:57:54 +0000
@@ -18,86 +18,182 @@
18import QtTest 1.018import QtTest 1.0
19import Ubuntu.Components 1.119import Ubuntu.Components 1.1
2020
21TestCase {21Item {
22 name: "ActionItemAPI"22 id: main
2323 width: units.gu(20)
24 SignalSpy {24 height: units.gu(20)
25 id: triggerSpy25
26 target: action126 property bool customVisible: true
27 signalName: "triggered"27 property bool customEnabled: true
28 }28
2929 ActionItem {
30 function initTestCase() {30 id: item1
31 compare(item1.action, null, "action is null by default")31 SignalSpy {
32 compare(item1.text, "", "text is empty string set by default")32 id: signalSpy
33 compare(item1.iconSource, "", "iconSource is empty string by default")33 target: parent
34 compare(item1.iconName, "", "iconSource is empty string by default")34 }
35 }35 }
3636
37 function cleanup() {37 Component {
38 item1.action = null;38 id: dynamicItem
39 triggerSpy.clear();39 ActionItem {
40 }40 action: action1
4141 }
42 function test_action() {42 }
43 compare(item1.action, null,"Action is null by default")43 Component {
44 item1.action = action144 id: dynamicItem2
45 compare(item1.action, action1, "Action can be set")45 ActionItem {
46 compare(item1.text, action1.text, "text is automatically set to action text")46 action: action1
47 compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource")47 visible: customVisible
48 item1.triggered(null)48 enabled: customEnabled
49 triggerSpy.wait(400);49 }
50 }50 }
5151
52 // NOTE: This test must be run AFTER test_action(), otherwise setting the action will52 Action {
53 // not update the text53 id: action1
54 function test_text() {54 objectName: "action1"
55 compare(item1.text, "", "text is empty string by default")55 text: "actionText"
56 var newText = "new text"56 iconSource: "imageURL"
57 item1.text = newText57 }
58 compare(item1.text, newText, "text can be set")58 Action {
59 item1.text = ""59 id: action2
60 compare(item1.text, "", "text can be unset")60 objectName: "action2"
61 }61 }
6262
63 // NOTE: This test must be run AFTER test_action(), otherwise setting the action will63 Loader {
64 // will not update the iconSource64 id: loader
65 function test_iconSource() {65 asynchronous: false
66 compare(item1.iconSource, "", "iconSource is empty string by default")66 }
67 var newIconSource = Qt.resolvedUrl("../../../examples/ubuntu-ui-toolkit-gallery/small_avatar.png")67
68 item1.iconSource = newIconSource68 TestCase {
69 compare(item1.iconSource, newIconSource, "iconSource can be set")69 id: testCase
70 item1.iconSource = ""70 when: windowShown
71 compare(item1.iconSource, "", "iconSource can be unset")71 name: "ActionItemAPI"
72 }72
7373 SignalSpy {
74 // NOTE: This test must be run AFTER test_action(), otherwise setting the action will74 id: triggerSpy
75 // will not update the iconName75 target: action1
76 function test_iconName() {76 signalName: "triggered"
77 compare(item1.iconName, "", "iconName is empty string by default")77 }
78 var newIconName = "compose"78
79 item1.iconName = newIconName79 function initTestCase() {
80 compare(item1.iconName, newIconName, "iconName can be set")80 compare(item1.action, null, "action is null by default")
81 item1.iconName = ""81 compare(item1.text, "", "text is empty string set by default")
82 compare(item1.iconName, "", "iconName can be unset")82 compare(item1.iconSource, "", "iconSource is empty string by default")
83 }83 compare(item1.iconName, "", "iconSource is empty string by default")
8484 }
85 function test_signal_triggered() {85
86 signalSpy.signalName = "triggered";86 function cleanup() {
87 compare(signalSpy.valid,true,"triggered signal exists")87 loader.sourceComponent = null;
88 }88 item1.action = null;
8989 action1.visible = true;
90 ActionItem {90 action1.enabled = true;
91 id: item191 action2.visible = true;
92 SignalSpy {92 action2.enabled = true;
93 id: signalSpy93 main.customEnabled = true;
94 target: parent94 main.customVisible = true;
95 }95 triggerSpy.clear();
96 }96 }
9797
98 Action {98 function test_action() {
99 id: action199 compare(item1.action, null,"Action is null by default")
100 text: "actionText"100 item1.action = action1
101 iconSource: "imageURL"101 compare(item1.action, action1, "Action can be set")
102 }102 compare(item1.text, action1.text, "text is automatically set to action text")
103 compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource")
104 item1.triggered(null)
105 triggerSpy.wait(400);
106 }
107
108 // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
109 // not update the text
110 function test_text() {
111 compare(item1.text, "", "text is empty string by default")
112 var newText = "new text"
113 item1.text = newText
114 compare(item1.text, newText, "text can be set")
115 item1.text = ""
116 compare(item1.text, "", "text can be unset")
117 }
118
119 // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
120 // will not update the iconSource
121 function test_iconSource() {
122 compare(item1.iconSource, "", "iconSource is empty string by default")
123 var newIconSource = Qt.resolvedUrl("../../../examples/ubuntu-ui-toolkit-gallery/small_avatar.png")
124 item1.iconSource = newIconSource
125 compare(item1.iconSource, newIconSource, "iconSource can be set")
126 item1.iconSource = ""
127 compare(item1.iconSource, "", "iconSource can be unset")
128 }
129
130 // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
131 // will not update the iconName
132 function test_iconName() {
133 compare(item1.iconName, "", "iconName is empty string by default")
134 var newIconName = "compose"
135 item1.iconName = newIconName
136 compare(item1.iconName, newIconName, "iconName can be set")
137 item1.iconName = ""
138 compare(item1.iconName, "", "iconName can be unset")
139 }
140
141 function test_signal_triggered() {
142 signalSpy.signalName = "triggered";
143 compare(signalSpy.valid,true,"triggered signal exists")
144 }
145
146 function test_default_bindings_visible_enabled_data() {
147 return [
148 {tag: "visible", property: "visible"},
149 {tag: "enabled", property: "enabled"},
150 ];
151 }
152 function test_default_bindings_visible_enabled(data) {
153 item1.action = action1;
154 action1[data.property] = false;
155 compare(item1[data.property], action1[data.property], "The item1 and action1 '" + data.property + "' value differs");
156 }
157
158 function test_custom_bindings_visible_enabled_bug1495408_data() {
159 return [
160 {tag: "visible", component: dynamicItem, property: "visible"},
161 {tag: "enabled", component: dynamicItem, property: "enabled"},
162 {tag: "visible binding", component: dynamicItem2, property: "visible", customProperty: "customVisible"},
163 {tag: "enabled binding", component: dynamicItem2, property: "enabled", customProperty: "customEnabled"},
164 ];
165 }
166 function test_custom_bindings_visible_enabled_bug1495408(data) {
167 loader.sourceComponent = data.component;
168 var item = loader.item;
169 compare(item[data.property], action1[data.property], "The item and action1 '" + data.property + "' value differs");
170 if (data.customProperty) {
171 main[data.customProperty] = false;
172 } else {
173 item[data.property] = false;
174 }
175 // change the action so the internal bindings are updated
176 item.action = action2;
177 expectFail(data.tag, "default binding must be broken");
178 compare(item[data.property], item.action[data.property], "The item's and action's '" + data.property + "' value is the same");
179 }
180 function test_custom_bindings_visible_enabled_reparenting_bug1495408_data() {
181 return [
182 {tag: "visible binding", component: dynamicItem2, property: "visible"},
183 {tag: "enabled binding", component: dynamicItem2, property: "enabled"},
184 ];
185 }
186 function test_custom_bindings_visible_enabled_reparenting_bug1495408(data) {
187 loader.sourceComponent = dynamicItem2;
188 var item = loader.item;
189 compare(item[data.property], item.action[data.property], "The item and item.action '" + data.property + "' value differs");
190 // then reparent
191 item.parent = item1;
192 // change the action property
193
194 item.action[data.property] = false;
195 expectFail(data.tag, "default binding must be broken");
196 compare(item[data.property], item.action[data.property], "The item and action2 '" + data.property + "' value is the same");
197 }
198 }
103}199}
104200
=== modified file 'tests/unit_x11/tst_components/tst_icon.qml'
--- tests/unit_x11/tst_components/tst_icon.qml 2015-03-03 13:20:06 +0000
+++ tests/unit_x11/tst_components/tst_icon.qml 2015-09-22 15:57:54 +0000
@@ -64,6 +64,11 @@
64 name: "Icon"64 name: "Icon"
65 when: windowShown65 when: windowShown
6666
67 SignalSpy {
68 id: shaderSpy
69 signalName: 'onStatusChanged'
70 }
71
67 function cleanup() {72 function cleanup() {
68 icon2.name = "";73 icon2.name = "";
69 }74 }
@@ -93,5 +98,35 @@
93 "file:///usr/share/icons/suru/actions/scalable/search.svg",98 "file:///usr/share/icons/suru/actions/scalable/search.svg",
94 "Source of the image should equal icon2.source.");99 "Source of the image should equal icon2.source.");
95 }100 }
101
102 function test_keyColor() {
103 icon.visible = true;
104 var image = findChild(icon, "image");
105 var shader = findChild(icon, "shader");
106 shaderSpy.target = shader;
107
108 compare(icon.name, 'search');
109 compare(shader.visible, false);
110 compare(shader.status, ShaderEffect.Uncompiled)
111 icon.color = UbuntuColors.orange;
112 shaderSpy.wait();
113 compare(shader.status, ShaderEffect.Compiled)
114 compare(shader.keyColorOut, icon.color);
115 compare(shader.visible, true);
116 compare(shader.source, image);
117 icon.keyColor = UbuntuColors.purple;
118 compare(shader.keyColorIn, icon.keyColor);
119 // Unsetting the icon name should disable the shader
120 icon.name = '';
121 compare(icon.source, '');
122 compare(shader.visible, false);
123 // Let's get back to a valid source
124 icon.name = 'search';
125 compare(shader.visible, true);
126 compare(shader.source, image);
127 // Unsetting the keyColor should also disable the shader
128 icon.color = Qt.rgba(0.0, 0.0, 0.0, 0.0);
129 compare(shader.visible, false);
130 }
96 }131 }
97}132}
98133
=== modified file 'tests/unit_x11/tst_components/tst_listitem.qml'
--- tests/unit_x11/tst_components/tst_listitem.qml 2015-09-02 06:47:25 +0000
+++ tests/unit_x11/tst_components/tst_listitem.qml 2015-09-22 15:57:54 +0000
@@ -198,8 +198,8 @@
198 signalName: "onTriggered"198 signalName: "onTriggered"
199 }199 }
200 SignalSpy {200 SignalSpy {
201 id: interactiveSpy201 id: flickableSpy
202 signalName: "interactiveChanged"202 signalName: "movementStarted"
203 }203 }
204204
205 SignalSpy {205 SignalSpy {
@@ -227,7 +227,7 @@
227 actionSpy.clear();227 actionSpy.clear();
228 pressAndHoldSpy.clear();228 pressAndHoldSpy.clear();
229 buttonSpy.clear();229 buttonSpy.clear();
230 interactiveSpy.clear();230 flickableSpy.clear();
231 listView.interactive = true;231 listView.interactive = true;
232 listView.ViewItems.selectMode = false;232 listView.ViewItems.selectMode = false;
233 listView.ViewItems.dragMode = false;233 listView.ViewItems.dragMode = false;
@@ -235,8 +235,8 @@
235 mouseClick(defaults, 0, 0)235 mouseClick(defaults, 0, 0)
236 movingSpy.target = null;236 movingSpy.target = null;
237 movingSpy.clear();237 movingSpy.clear();
238 interactiveSpy.target = null;238 flickableSpy.target = null;
239 interactiveSpy.clear();239 flickableSpy.clear();
240 trailing.delegate = null;240 trailing.delegate = null;
241 listView.positionViewAtBeginning();241 listView.positionViewAtBeginning();
242 // keep additional timeout for proper cleanup242 // keep additional timeout for proper cleanup
@@ -434,6 +434,7 @@
434 rebound(data.clickOn, data.item)434 rebound(data.clickOn, data.item)
435 }435 }
436436
437 // the function tests whether the Flickable/ListView moves when the ListItem is swiped
437 function test_listview_not_interactive_while_tugged_data() {438 function test_listview_not_interactive_while_tugged_data() {
438 var item0 = findChild(listView, "listItem0");439 var item0 = findChild(listView, "listItem0");
439 var item1 = findChild(listView, "listItem1");440 var item1 = findChild(listView, "listItem1");
@@ -446,17 +447,15 @@
446 }447 }
447 function test_listview_not_interactive_while_tugged(data) {448 function test_listview_not_interactive_while_tugged(data) {
448 listView.positionViewAtBeginning();449 listView.positionViewAtBeginning();
449 interactiveSpy.target = listView;450 flickableSpy.target = listView;
450 compare(listView.interactive, true, "ListView is not interactive");451 compare(listView.interactive, true, "ListView is not interactive");
451 interactiveSpy.target = listView;
452 if (data.mouse) {452 if (data.mouse) {
453 swipe(data.item, data.pos.x, data.pos.y, data.dx, data.dy);453 swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
454 } else {454 } else {
455 tug(data.item, data.pos.x, data.pos.y, data.dx, data.dy);455 tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
456 }456 }
457 // animation should no longer be running!457 // animation should no longer be running!
458 compare(listView.interactive, true, "The ListView is still non-interactive!");458 compare(flickableSpy.count, 0, "Flickable moved!");
459 compare(interactiveSpy.count, 2, "Less/more times changed!");
460 // check if it snapped in459 // check if it snapped in
461 verify(data.item.contentItem.x != 0.0, "Not snapped in!!");460 verify(data.item.contentItem.x != 0.0, "Not snapped in!!");
462 // dismiss461 // dismiss
@@ -629,7 +628,7 @@
629 wait(2000);628 wait(2000);
630 verify(data.item.contentItem.x != data.item.contentItem.anchors.leftMargin, "Not snapped in");629 verify(data.item.contentItem.x != data.item.contentItem.anchors.leftMargin, "Not snapped in");
631630
632 var panel = panelItem(data.item, "Leading");631 var panel = panelItem(data.item, true);
633 var action = findChild(panel, "leading_2");632 var action = findChild(panel, "leading_2");
634 verify(action, "actions panel cannot be reached");633 verify(action, "actions panel cannot be reached");
635 // we test the action closest to the list item's contentItem634 // we test the action closest to the list item's contentItem
@@ -724,11 +723,12 @@
724 function test_listitem_blocks_ascendant_flickables() {723 function test_listitem_blocks_ascendant_flickables() {
725 var listItem = findChild(nestedListView, "listItem0");724 var listItem = findChild(nestedListView, "listItem0");
726 verify(listItem, "Cannot find test item");725 verify(listItem, "Cannot find test item");
727 interactiveSpy.target = testFlickable;726 flickableSpy.target = testFlickable;
728 // tug leading727 // tug leading
729 swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0);728 swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0);
730 // check if interactive got changed729 // check if interactive got changed
731 interactiveSpy.wait();730 expectFailContinue("", "Flickable should not move");
731 flickableSpy.wait(200);
732732
733 // cleanup!!!733 // cleanup!!!
734 rebound(listItem);734 rebound(listItem);
735735
=== modified file 'tests/unit_x11/tst_components/tst_listitem13.qml'
--- tests/unit_x11/tst_components/tst_listitem13.qml 2015-09-02 10:55:46 +0000
+++ tests/unit_x11/tst_components/tst_listitem13.qml 2015-09-22 15:57:54 +0000
@@ -198,8 +198,8 @@
198 signalName: "onTriggered"198 signalName: "onTriggered"
199 }199 }
200 SignalSpy {200 SignalSpy {
201 id: interactiveSpy201 id: flickableSpy
202 signalName: "interactiveChanged"202 signalName: "movementStarted"
203 }203 }
204204
205 SignalSpy {205 SignalSpy {
@@ -227,7 +227,7 @@
227 actionSpy.clear();227 actionSpy.clear();
228 pressAndHoldSpy.clear();228 pressAndHoldSpy.clear();
229 buttonSpy.clear();229 buttonSpy.clear();
230 interactiveSpy.clear();230 flickableSpy.clear();
231 listView.interactive = true;231 listView.interactive = true;
232 listView.ViewItems.selectMode = false;232 listView.ViewItems.selectMode = false;
233 listView.ViewItems.dragMode = false;233 listView.ViewItems.dragMode = false;
@@ -235,8 +235,8 @@
235 mouseClick(defaults, 0, 0)235 mouseClick(defaults, 0, 0)
236 movingSpy.target = null;236 movingSpy.target = null;
237 movingSpy.clear();237 movingSpy.clear();
238 interactiveSpy.target = null;238 flickableSpy.target = null;
239 interactiveSpy.clear();239 flickableSpy.clear();
240 trailing.delegate = null;240 trailing.delegate = null;
241 listView.positionViewAtBeginning();241 listView.positionViewAtBeginning();
242 // keep additional timeout for proper cleanup242 // keep additional timeout for proper cleanup
@@ -466,17 +466,15 @@
466 }466 }
467 function test_listview_not_interactive_while_tugged(data) {467 function test_listview_not_interactive_while_tugged(data) {
468 listView.positionViewAtBeginning();468 listView.positionViewAtBeginning();
469 interactiveSpy.target = listView;469 flickableSpy.target = listView;
470 compare(listView.interactive, true, "ListView is not interactive");470 compare(listView.interactive, true, "ListView is not interactive");
471 interactiveSpy.target = listView;
472 if (data.mouse) {471 if (data.mouse) {
473 swipe(data.item, data.pos.x, data.pos.y, data.dx, data.dy);472 swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
474 } else {473 } else {
475 tug(data.item, data.pos.x, data.pos.y, data.dx, data.dy);474 tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
476 }475 }
477 // animation should no longer be running!476 // animation should no longer be running!
478 compare(listView.interactive, true, "The ListView is still non-interactive!");477 compare(flickableSpy.count, 0, "Flickable moved!");
479 compare(interactiveSpy.count, 2, "Less/more times changed!");
480 // check if it snapped in478 // check if it snapped in
481 verify(data.item.contentItem.x != 0.0, "Not snapped in!!");479 verify(data.item.contentItem.x != 0.0, "Not snapped in!!");
482 // dismiss480 // dismiss
@@ -744,11 +742,12 @@
744 function test_listitem_blocks_ascendant_flickables() {742 function test_listitem_blocks_ascendant_flickables() {
745 var listItem = findChild(nestedListView, "listItem0");743 var listItem = findChild(nestedListView, "listItem0");
746 verify(listItem, "Cannot find test item");744 verify(listItem, "Cannot find test item");
747 interactiveSpy.target = testFlickable;745 flickableSpy.target = testFlickable;
748 // tug leading746 // tug leading
749 swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0);747 swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0);
750 // check if interactive got changed748 // check if interactive got changed
751 interactiveSpy.wait();749 expectFailContinue("", "Flickable should not move.");
750 flickableSpy.wait(200);
752751
753 // cleanup!!!752 // cleanup!!!
754 rebound(listItem);753 rebound(listItem);
@@ -1200,7 +1199,7 @@
12001199
1201 var icon = findChild(testItem, data.action);1200 var icon = findChild(testItem, data.action);
1202 verify(icon);1201 verify(icon);
1203 compare(icon.width, units.gu(5), "icon width should be the same no matter of the height set");1202 compare(icon.width, units.gu(6), "icon width should be the same no matter of the height set");
12041203
1205 rebound(testItem);1204 rebound(testItem);
12061205
12071206
=== modified file 'tests/unit_x11/tst_components/tst_listitem_extras.qml'
--- tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-09-02 10:55:46 +0000
+++ tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-09-22 15:57:54 +0000
@@ -30,18 +30,18 @@
30 Action {30 Action {
31 iconName: "starred"31 iconName: "starred"
32 text: 'Bookmark'32 text: 'Bookmark'
33 objectName: "leading_1"33 objectName: "trailing1"
34 },34 },
35 Action {35 Action {
36 iconName: "edit"36 iconName: "edit"
37 text: 'Edit'37 text: 'Edit'
38 objectName: "leading_2"38 objectName: "trailing2"
39 onTriggered: text = 'Edit Again'39 onTriggered: text = 'Edit Again'
40 },40 },
41 Action {41 Action {
42 iconName: "camcorder"42 iconName: "camcorder"
43 text: 'Record'43 text: 'Record'
44 objectName: "leading_3"44 objectName: "trailing3"
45 }45 }
46 ]46 ]
47 }47 }
@@ -50,7 +50,7 @@
50 actions: Action {50 actions: Action {
51 id: stockAction51 id: stockAction
52 iconName: "torch-on"52 iconName: "torch-on"
53 objectName: "stockAction"53 objectName: "leading1"
54 text: 'Switch lights on'54 text: 'Switch lights on'
55 }55 }
56 }56 }
@@ -80,6 +80,22 @@
80 onPressed: mouse.accepted = overlaidMouseArea.acceptEvent80 onPressed: mouse.accepted = overlaidMouseArea.acceptEvent
81 }81 }
82 }82 }
83 ListView {
84 id: listView
85 width: parent.width
86 height: 4 * units.gu(7) // 4 items
87 clip: true
88 model: 5
89 delegate: ListItem {
90 objectName: "listItem" + index
91 Label {
92 anchors.centerIn: parent
93 text: index
94 }
95
96 leadingActions: leading
97 }
98 }
83 }99 }
84100
85 ListItemTestCase13 {101 ListItemTestCase13 {
@@ -89,11 +105,16 @@
89 signalName: "clicked"105 signalName: "clicked"
90 }106 }
91107
108 function initTestCase() {
109 TestExtras.registerTouchDevice();
110 }
111
92 function cleanup() {112 function cleanup() {
93 rebound(testWithActiveItem);113 rebound(testWithActiveItem);
94 rebound(overlaidMouseArea);114 rebound(overlaidMouseArea);
95 clickSpy.target = null;115 clickSpy.target = null;
96 clickSpy.clear();116 clickSpy.clear();
117 wait(200);
97 }118 }
98119
99 function test_swipe_over_active_item() {120 function test_swipe_over_active_item() {
@@ -114,5 +135,116 @@
114 swipeNoWait(overlayArea, centerOf(overlayArea).x, centerOf(overlayArea).y, units.gu(10));135 swipeNoWait(overlayArea, centerOf(overlayArea).x, centerOf(overlayArea).y, units.gu(10));
115 spyWait();136 spyWait();
116 }137 }
138
139 function test_swipe_out_from_overlay_button_bug1497156_data() {
140 return [
141 {tag: "leading with mouse", touch: false, swipeInDx: units.gu(20), swipeOutDx: -units.gu(5)},
142 {tag: "trailing with mouse", touch: false, swipeInDx: -units.gu(20), swipeOutDx: units.gu(5)},
143 {tag: "leading with touch", touch: true, swipeInDx: units.gu(20), swipeOutDx: -units.gu(5)},
144 {tag: "trailing with touch", touch: true, swipeInDx: -units.gu(20), swipeOutDx: units.gu(5)},
145 ]
146 }
147 function test_swipe_out_from_overlay_button_bug1497156(data) {
148 // swipe in and out from teh same point
149 if (data.touch) {
150 tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeInDx, 0);
151 } else {
152 swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeInDx, 0);
153 }
154 verify(testWithActiveItem.contentItem.x != 0, "Not swiped in");
155 // swipe out
156 if (data.touch) {
157 tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeOutDx, 0);
158 } else {
159 swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeOutDx, 0);
160 }
161 tryCompareFunction(function() {
162 return testWithActiveItem.contentItem.x == testWithActiveItem.contentItem.anchors.leftMargin;
163 }, true, 500);
164 }
165
166 function test_swipe_over_contextual_actions_bug1486008_data() {
167 return [
168 {tag: "leading action with mouse", touch: false, dx: units.gu(20), leadingPanel: true, action: "leading1"},
169 {tag: "trailing action with mouse", touch: false, dx: -units.gu(20), leadingPanel: false, action: "trailing1"},
170 {tag: "leading action with touch", touch: true, dx: units.gu(20), leadingPanel: true, action: "leading1"},
171 {tag: "trailing action with touch", touch: true, dx: -units.gu(20), leadingPanel: false, action: "trailing1"},
172 ];
173 }
174 function test_swipe_over_contextual_actions_bug1486008(data) {
175 if (data.touch) {
176 tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
177 } else {
178 swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
179 }
180 var panel = panelItem(testWithActiveItem, data.leadingPanel);
181 var actionItem = findChild(panel, data.action);
182 verify(actionItem, data.action + " action not found.");
183 // swipe over the action
184 setupSpy(testWithActiveItem, "contentMovementStarted");
185 if (data.touch) {
186 tugNoWait(actionItem, centerOf(actionItem).x, centerOf(actionItem).y, -data.dx, 0);
187 } else {
188 swipeNoWait(actionItem, centerOf(actionItem).x, centerOf(actionItem).y, -data.dx, 0);
189 }
190 expectFail(data.tag, "should not swipe");
191 spyWait();
192 }
193
194 function test_button_inactive_while_swiped_data() {
195 return [
196 {tag: "mouse", touch: false, dx: units.gu(20)},
197 {tag: "touch", touch: true, dx: units.gu(20)},
198 ];
199 }
200 function test_button_inactive_while_swiped(data) {
201 clickSpy.target = activeItem;
202 if (data.touch) {
203 tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
204 TestExtras.touchClick(0, activeItem, centerOf(activeItem));
205 } else {
206 swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
207 mouseClick(activeItem, centerOf(activeItem).x, centerOf(activeItem).y);
208 }
209 expectFail(data.tag, "Button is inactive while swiped");
210 clickSpy.wait(200);
211 }
212
213 function test_click_before_and_after_snapout_bug1496468_data() {
214 var item0 = findChild(listView, "listItem0");
215 var item1 = findChild(listView, "listItem1");
216 return [
217 {tag: "mouse", touch: false, clickedItem: item0, swipedItem: item1, dx: units.gu(20), reboundDx: -units.gu(5)},
218 {tag: "touch", touch: true, clickedItem: item0, swipedItem: item1, dx: units.gu(20), reboundDx: -units.gu(5)},
219 ];
220 }
221 function test_click_before_and_after_snapout_bug1496468(data) {
222 clickSpy.target = data.clickedItem;
223 if (data.touch) {
224 TestExtras.touchClick(0, data.clickedItem, centerOf(data.clickedItem));
225 } else {
226 mouseClick(data.clickedItem, centerOf(data.clickedItem).x, centerOf(data.clickedItem).y);
227 }
228 clickSpy.wait(200);
229 // swipe in then rebound
230 if (data.touch) {
231 tug(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.dx, 0);
232 wait(200);
233 tug(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.reboundDx, 0);
234 } else {
235 swipe(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.dx, 0);
236 wait(200);
237 swipe(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.reboundDx, 0);
238 }
239 // then test click
240 clickSpy.target = data.swipedItem;
241 clickSpy.clear();
242 if (data.touch) {
243 TestExtras.touchClick(0, data.swipedItem, centerOf(data.swipedItem));
244 } else {
245 mouseClick(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y);
246 }
247 clickSpy.wait(200);
248 }
117 }249 }
118}250}
119251
=== modified file 'tests/unit_x11/tst_components/tst_popover.qml'
--- tests/unit_x11/tst_components/tst_popover.qml 2015-03-03 13:20:06 +0000
+++ tests/unit_x11/tst_components/tst_popover.qml 2015-09-22 15:57:54 +0000
@@ -29,6 +29,11 @@
29 y: main.height / 229 y: main.height / 2
30 height: units.gu(10)30 height: units.gu(10)
31 width: height31 width: height
32 MouseArea {
33 id: whiteSpace
34 anchors.fill: parent
35 acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
36 }
3237
33 Button {38 Button {
34 id: pressMe39 id: pressMe
@@ -68,6 +73,11 @@
68 id: popoverSpy73 id: popoverSpy
69 signalName: "hideCompleted"74 signalName: "hideCompleted"
70 }75 }
76 SignalSpy {
77 id: whiteSpy
78 signalName: "clicked"
79 target: whiteSpace
80 }
7181
72 Component {82 Component {
73 id: popoverComponent83 id: popoverComponent
@@ -116,6 +126,29 @@
116 popoverSpy.wait();126 popoverSpy.wait();
117 }127 }
118128
129 function test_popover_consumes_clicks_bug1488540_data() {
130 return [
131 { tag: 'Left-click', button: Qt.LeftButton },
132 { tag: 'Right-click', button: Qt.RightButton },
133 { tag: 'Middle-click', button: Qt.MiddleButton },
134 ]
135 }
136 function test_popover_consumes_clicks_bug1488540(data) {
137 mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2);
138 waitForRendering(pressMe);
139 verify(popoverSpy.target !== null, "The popover did not open");
140 var popover = popoverSpy.target;
141 // Click in the popover, the rectangle doesn't handle clicks
142 whiteSpy.clear();
143 mouseClick(popover, popover.width / 2, popover.height / 2, data.button);
144 // dismiss
145 mouseClick(main, 10, 10, Qt.LeftButton);
146 popoverSpy.wait();
147 // Did the click reach through the popover foreground?
148 compare(whiteSpy.count, 0, 'Click passed through popover foreground!');
149
150 }
151
119 function test_popover_follows_pointerTarget_bug1199502_data() {152 function test_popover_follows_pointerTarget_bug1199502_data() {
120 return [153 return [
121 { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 },154 { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 },
122155
=== added file 'tests/unit_x11/tst_components/tst_popover13.qml'
--- tests/unit_x11/tst_components/tst_popover13.qml 1970-01-01 00:00:00 +0000
+++ tests/unit_x11/tst_components/tst_popover13.qml 2015-09-22 15:57:54 +0000
@@ -0,0 +1,174 @@
1/*
2 * Copyright 2014-2015 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 */
16import QtQuick 2.0
17import QtTest 1.0
18import Ubuntu.Test 1.0
19import Ubuntu.Components 1.3
20import Ubuntu.Components.Popups 1.3
21
22MainView {
23 id: main
24 width: units.gu(50)
25 height: units.gu(71)
26
27 Rectangle {
28 id: rect
29 y: main.height / 2
30 height: units.gu(10)
31 width: height
32 MouseArea {
33 id: whiteSpace
34 anchors.fill: parent
35 acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
36 }
37
38 Button {
39 id: pressMe
40 anchors.top: parent.top
41 text: "Press me"
42 onClicked: {
43 testCase.resetPositions();
44 var popover = PopupUtils.open(popoverComponent, pressMe);
45 popoverSpy.target = testCase.findChild(popover, "popover_foreground");
46 popoverSpy.clear();
47 pressMe.parent.height = units.gu(25)
48 pressMe.anchors.top = parent.bottom
49 }
50 }
51
52 Button {
53 id: pushMe
54 anchors.bottom: parent.bottom
55 text: "Push me"
56 onClicked: {
57 testCase.resetPositions();
58 var popover = PopupUtils.open(popoverComponent, pushMe);
59 popoverSpy.target = testCase.findChild(popover, "popover_foreground");
60 popoverSpy.clear();
61 rect.y = main.height / 10
62 }
63 }
64 }
65 Label {
66 id: other
67 text: "Ignore me"
68 anchors.centerIn: parent
69 }
70
71 // spy to listen on the popover foreground's hideCompleted() signal
72 SignalSpy {
73 id: popoverSpy
74 signalName: "hideCompleted"
75 }
76 SignalSpy {
77 id: whiteSpy
78 signalName: "clicked"
79 target: whiteSpace
80 }
81
82 Component {
83 id: popoverComponent
84 Popover {
85 objectName: "popover"
86 Rectangle {
87 width: units.gu(20)
88 height: units.gu(20)
89 color: "blue"
90 }
91 }
92 }
93
94 UbuntuTestCase {
95 id: testCase
96 name: "PopoverTests"
97 when: windowShown
98
99 function resetPositions() {
100 pressMe.parent.height = units.gu(10)
101 rect.y = main.height / 2
102 }
103
104 function cleanup() {
105 resetPositions()
106 popoverSpy.target = null;
107 popoverSpy.clear();
108 waitForRendering(main, 500);
109 }
110
111 function test_dismiss_on_click_data() {
112 return [
113 {button: Qt.LeftButton},
114 {button: Qt.MiddleButton},
115 {button: Qt.RightButton},
116 ];
117 }
118
119 function test_dismiss_on_click(data) {
120 mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2);
121 waitForRendering(pressMe);
122 verify(popoverSpy.target !== null, "The popover did not open");
123
124 // dismiss
125 mouseClick(main, 10, 10, data.button);
126 popoverSpy.wait();
127 }
128
129 function test_popover_consumes_clicks_bug1488540_data() {
130 return [
131 { tag: 'Left-click', button: Qt.LeftButton },
132 { tag: 'Right-click', button: Qt.RightButton },
133 { tag: 'Middle-click', button: Qt.MiddleButton },
134 ]
135 }
136 function test_popover_consumes_clicks_bug1488540(data) {
137 mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2);
138 waitForRendering(pressMe);
139 verify(popoverSpy.target !== null, "The popover did not open");
140 var popover = popoverSpy.target;
141 // Click in the popover, the rectangle doesn't handle clicks
142 whiteSpy.clear();
143 mouseClick(popover, popover.width / 2, popover.height / 2, data.button);
144 // dismiss
145 mouseClick(main, 10, 10, Qt.LeftButton);
146 popoverSpy.wait();
147 // Did the click reach through the popover foreground?
148 compare(whiteSpy.count, 0, 'Click passed through popover foreground!');
149
150 }
151
152 function test_popover_follows_pointerTarget_bug1199502_data() {
153 return [
154 { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 },
155 // FIXME: { tag: "Moving parent", button: pushMe, dir: "up", y: 142.8 },
156 // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1427557
157 ]
158 }
159 function test_popover_follows_pointerTarget_bug1199502(data) {
160 mouseClick(data.button, data.button.width / 2, data.button.height / 2);
161 waitForRendering(data.button);
162 var dir = popoverSpy.target.direction
163 var popoverY = popoverSpy.target.y
164
165 // dismiss
166 mouseClick(main, 10, 10, Qt.LeftButton);
167 popoverSpy.wait();
168
169 // ensure popover was next to caller
170 compare(dir, data.dir, "Popover arrow is wrong")
171 compare(popoverY, data.y, "Popover isn't pointing at the caller")
172 }
173 }
174}
0175
=== modified file 'ubuntu-sdk.pro'
--- ubuntu-sdk.pro 2015-08-13 09:20:05 +0000
+++ ubuntu-sdk.pro 2015-09-22 15:57:54 +0000
@@ -8,7 +8,7 @@
8requires(qtHaveModule(quick))8requires(qtHaveModule(quick))
9load(qt_parts)9load(qt_parts)
1010
11SUBDIRS += po documentation11SUBDIRS += po documentation ubuntu-ui-toolkit-launcher
1212
13#when standalone we always want tests to be built13#when standalone we always want tests to be built
14!build_with_qt{14!build_with_qt{
1515
=== renamed directory 'tests/launcher' => 'ubuntu-ui-toolkit-launcher'
=== renamed file 'tests/launcher/launcher.pro' => 'ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro'
--- tests/launcher/launcher.pro 2014-06-17 07:12:49 +0000
+++ ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro 2015-09-22 15:57:54 +0000
@@ -6,8 +6,8 @@
6HEADERS += MouseTouchAdaptor.h6HEADERS += MouseTouchAdaptor.h
7SOURCES += launcher.cpp \7SOURCES += launcher.cpp \
8 MouseTouchAdaptor.cpp8 MouseTouchAdaptor.cpp
9installPath = $$[QT_INSTALL_LIBS]/ubuntu-ui-toolkit9installPath = $$[QT_INSTALL_PREFIX]/bin
10launcher.path = $$installPath10launcher.path = $$installPath
11launcher.files = launcher11launcher.files = ubuntu-ui-toolkit-launcher
12INSTALLS += launcher12INSTALLS += launcher
1313

Subscribers

People subscribed via source and target branches

to status/vote changes: