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
1=== modified file '.bzrignore'
2--- .bzrignore 2015-08-18 21:07:56 +0000
3+++ .bzrignore 2015-09-22 15:57:54 +0000
4@@ -21,5 +21,5 @@
5 tests/unit/tst_i18n/*/share/locale/en/LC_MESSAGES/*.mo
6 tests/unit/tst_units/dpr*/dpr*
7 tests/apicheck/apicheck
8-tests/launcher/launcher
9+ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher
10 build_paths.inc
11
12=== modified file 'components.api'
13--- components.api 2015-09-04 12:35:16 +0000
14+++ components.api 2015-09-22 15:57:54 +0000
15@@ -1244,6 +1244,12 @@
16 property bool locked
17 property bool opened
18 property Item pageStack
19+Ubuntu.Components.UCApplication 1.0 0.1: QtObject
20+ property string applicationName
21+ property QtObject inputMethod
22+Ubuntu.Components.UCFontUtils 1.0 0.1: QtObject
23+ function double sizeToPixels(string size)
24+ function double modularScale(string size)
25 UCListItemDivider: Item
26 property color colorFrom
27 property color colorTo
28
29=== modified file 'debian/control'
30--- debian/control 2015-08-20 08:10:44 +0000
31+++ debian/control 2015-09-22 15:57:54 +0000
32@@ -120,7 +120,7 @@
33 Package: ubuntu-ui-toolkit-examples
34 Section: devel
35 Architecture: any
36-Depends: qmlscene,
37+Depends: ubuntu-ui-toolkit-tools (>= ${source:Version}),
38 qtdeclarative5-ubuntu-ui-toolkit-plugin (= ${binary:Version}) | qtdeclarative5-ubuntu-ui-toolkit-plugin-gles,
39 ubuntu-ui-toolkit-theme (= ${binary:Version}),
40 qml-module-qtquick-xmllistmodel | qtdeclarative5-xmllistmodel-plugin,
41@@ -160,3 +160,15 @@
42 qml-module-qttest | qtdeclarative5-test-plugin,
43 Description: Test package for Ubuntu UI Toolkit
44 Autopilot tests for the ubuntu-ui-toolkit package
45+
46+Package: ubuntu-ui-toolkit-tools
47+Architecture: any
48+Depends: ${misc:Depends},
49+ ${shlibs:Depends}
50+Description: Qt Components for Ubuntu - productive tools
51+ Qt Components for Ubuntu offers a set of reusable user interface
52+ components for Qt Quick 2 / QML.
53+ .
54+ This package contains the application launcher, which is a drop-in
55+ replacement for qmlscene, oxideqmlscene, qml and derivatives.
56+
57
58=== modified file 'debian/ubuntu-ui-toolkit-autopilot.install'
59--- debian/ubuntu-ui-toolkit-autopilot.install 2015-04-29 13:02:11 +0000
60+++ debian/ubuntu-ui-toolkit-autopilot.install 2015-09-22 15:57:54 +0000
61@@ -1,3 +1,2 @@
62 usr/lib/python3
63 usr/lib/*/ubuntu-ui-toolkit/apicheck
64-usr/lib/*/ubuntu-ui-toolkit/launcher
65
66=== added file 'debian/ubuntu-ui-toolkit-tools.install'
67--- debian/ubuntu-ui-toolkit-tools.install 1970-01-01 00:00:00 +0000
68+++ debian/ubuntu-ui-toolkit-tools.install 2015-09-22 15:57:54 +0000
69@@ -0,0 +1,1 @@
70+usr/bin/ubuntu-ui-toolkit-launcher
71
72=== modified file 'examples/ubuntu-ui-toolkit-gallery/gallery'
73--- examples/ubuntu-ui-toolkit-gallery/gallery 2015-08-11 15:42:46 +0000
74+++ examples/ubuntu-ui-toolkit-gallery/gallery 2015-09-22 15:57:54 +0000
75@@ -3,4 +3,4 @@
76 . `dirname $0`/../../build_paths.inc
77
78 SCRIPT_DIRECTORY=`dirname $0`
79-$BUILD_DIR/tests/launcher/launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml
80+$BUILD_DIR/ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher $@ $SCRIPT_DIRECTORY/ubuntu-ui-toolkit-gallery.qml
81
82=== modified file 'examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop'
83--- examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop 2014-11-17 11:52:44 +0000
84+++ examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.desktop 2015-09-22 15:57:54 +0000
85@@ -1,6 +1,6 @@
86 [Desktop Entry]
87 Name=Ubuntu UI Toolkit Gallery
88-Exec=/usr/bin/qmlscene $@ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml
89+Exec=/usr/bin/ubuntu-ui-toolkit-launcher $@ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml
90 Terminal=false
91 Type=Application
92 X-Ubuntu-Touch=true
93
94=== modified file 'src/Ubuntu/Components/1.0/Icon.qml'
95--- src/Ubuntu/Components/1.0/Icon.qml 2015-07-24 09:53:20 +0000
96+++ src/Ubuntu/Components/1.0/Icon.qml 2015-09-22 15:57:54 +0000
97@@ -55,19 +55,19 @@
98 }
99
100 cache: true
101- visible: !colorizedImage.active
102+ visible: !colorizedImage.visible
103 }
104
105 ShaderEffect {
106 id: colorizedImage
107+ objectName: "shader"
108
109 anchors.fill: parent
110- visible: active
111
112 // Whether or not a color has been set.
113- property bool active: keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)
114+ visible: image.status == Image.Ready && keyColorOut != Qt.rgba(0.0, 0.0, 0.0, 0.0)
115
116- property Image source: active && image.status == Image.Ready ? image : null
117+ property Image source: image
118 property color keyColorOut: Qt.rgba(0.0, 0.0, 0.0, 0.0)
119 property color keyColorIn: "#808080"
120 property real threshold: 0.1
121
122=== modified file 'src/Ubuntu/Components/1.2/TextInputPopover.qml'
123--- src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-08-19 06:55:11 +0000
124+++ src/Ubuntu/Components/1.2/TextInputPopover.qml 2015-09-22 15:57:54 +0000
125@@ -83,13 +83,6 @@
126 model: actions.length
127 AbstractButton {
128 id: button
129- /*
130- Workaround for autopilot used in the text input's context menu to access
131- action.text so we can get the proper button by text, action being not
132- accessible. https://bugs.launchpad.net/autopilot/+bug/1334599
133- */
134- // FIXME: AbstractButton has text property, which is getting the action.text, so no need to override!
135- property string text: action.text
136 width: Math.max(units.gu(5), implicitWidth) + units.gu(2)
137 height: units.gu(6)
138 action: actions[modelData]
139
140=== modified file 'src/Ubuntu/Components/1.3/PageWrapperUtils.js'
141--- src/Ubuntu/Components/1.3/PageWrapperUtils.js 2015-09-01 11:59:13 +0000
142+++ src/Ubuntu/Components/1.3/PageWrapperUtils.js 2015-09-22 15:57:54 +0000
143@@ -73,6 +73,7 @@
144 if (incubator.status != Component.Ready) {
145 incubator.onStatusChanged = incubatorStatusChanged;
146 } else {
147+ pageWrapper.incubator = this;
148 incubatorStatusChanged(incubator.status);
149 }
150 }
151@@ -103,9 +104,15 @@
152 throw new Error("Error while loading page: " + pageComponent.errorString());
153 } else {
154 // create the object
155- pageWrapper.incubator = new Incubator(pageWrapper, pageComponent);
156 if (synchronous) {
157- pageWrapper.incubator.forceCompletion();
158+ if (pageWrapper.properties) {
159+ // initialize the object with the given properties
160+ pageWrapper.object = pageComponent.createObject(pageWrapper, pageWrapper.properties);
161+ } else {
162+ pageWrapper.object = pageComponent.createObject(pageWrapper);
163+ }
164+ } else {
165+ pageWrapper.incubator = new Incubator(pageWrapper, pageComponent);
166 }
167 pageWrapper.canDestroy = true;
168 }
169
170=== modified file 'src/Ubuntu/Components/1.3/TextInputPopover.qml'
171--- src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-07-02 23:33:22 +0000
172+++ src/Ubuntu/Components/1.3/TextInputPopover.qml 2015-09-22 15:57:54 +0000
173@@ -83,12 +83,6 @@
174 model: actions.length
175 AbstractButton {
176 id: button
177- /*
178- Workaround for autopilot used in the text input's context menu to access
179- action.text so we can get the proper button by text, action being not
180- accessible. https://bugs.launchpad.net/autopilot/+bug/1334599
181- */
182- property string text: action.text
183 width: Math.max(units.gu(5), implicitWidth) + units.gu(2)
184 height: units.gu(6)
185 action: actions[modelData]
186
187=== modified file 'src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml'
188--- src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml 2015-04-30 08:32:44 +0000
189+++ src/Ubuntu/Components/Popups/1.2/ActionSelectionPopover.qml 2015-09-22 15:57:54 +0000
190@@ -147,8 +147,10 @@
191 onStatusChanged: {
192 if (item && status == Loader.Ready) {
193 // set model data
194- if (item.hasOwnProperty("action"))
195+ if (item.hasOwnProperty("action")) {
196 item.action = modelData;
197+ item.objectName = item.action.objectName + '_button';
198+ }
199 if (item.hasOwnProperty("refModelData"))
200 item.refModelData = modelData;
201 if (item.hasOwnProperty("modelData"))
202
203=== modified file 'src/Ubuntu/Components/Popups/1.2/PopupBase.qml'
204--- src/Ubuntu/Components/Popups/1.2/PopupBase.qml 2015-04-30 08:32:44 +0000
205+++ src/Ubuntu/Components/Popups/1.2/PopupBase.qml 2015-09-22 15:57:54 +0000
206@@ -161,6 +161,7 @@
207 }
208
209 MouseArea {
210+ acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
211 anchors.fill: __foreground
212 onWheel: wheel.accepted = true
213 }
214
215=== modified file 'src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml'
216--- src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2015-05-14 21:32:51 +0000
217+++ src/Ubuntu/Components/Popups/1.3/ActionSelectionPopover.qml 2015-09-22 15:57:54 +0000
218@@ -147,8 +147,10 @@
219 onStatusChanged: {
220 if (item && status == Loader.Ready) {
221 // set model data
222- if (item.hasOwnProperty("action"))
223+ if (item.hasOwnProperty("action")) {
224 item.action = modelData;
225+ item.objectName = item.action.objectName + '_button';
226+ }
227 if (item.hasOwnProperty("refModelData"))
228 item.refModelData = modelData;
229 if (item.hasOwnProperty("modelData"))
230
231=== modified file 'src/Ubuntu/Components/Popups/1.3/PopupBase.qml'
232--- src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2015-04-29 08:55:31 +0000
233+++ src/Ubuntu/Components/Popups/1.3/PopupBase.qml 2015-09-22 15:57:54 +0000
234@@ -161,6 +161,7 @@
235 }
236
237 MouseArea {
238+ acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
239 anchors.fill: __foreground
240 onWheel: wheel.accepted = true
241 }
242
243=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml'
244--- src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2015-09-04 09:32:31 +0000
245+++ src/Ubuntu/Components/Themes/Ambiance/1.3/ListItemStyle.qml 2015-09-22 15:57:54 +0000
246@@ -70,7 +70,7 @@
247 }
248
249 readonly property real maxItemWidth: parent.width / itemActions.actions.length
250- readonly property real minItemWidth: units.gu(5) // 2GU icon + 2* 1.5GU margin
251+ readonly property real minItemWidth: units.gu(6) // 2GU icon + 2* 2GU margin
252
253 Repeater {
254 model: itemActions.actions
255
256=== modified file 'src/Ubuntu/Components/plugin/plugin.cpp'
257--- src/Ubuntu/Components/plugin/plugin.cpp 2015-08-31 15:43:14 +0000
258+++ src/Ubuntu/Components/plugin/plugin.cpp 2015-09-22 15:57:54 +0000
259@@ -163,7 +163,9 @@
260 {
261 qmlRegisterType<UCAction>(uri, major, minor, "Action");
262 qmlRegisterType<UCActionContext>(uri, major, minor, "ActionContext");
263+ qmlRegisterUncreatableType<UCApplication>(uri, major, minor, "UCApplication", "Not instantiable");
264 qmlRegisterType<UCActionManager>(uri, major, minor, "ActionManager");
265+ qmlRegisterUncreatableType<UCFontUtils>(uri, major, minor, "UCFontUtils", "Not instantiable");
266 qmlRegisterType<UCStyledItemBase>(uri, major, minor, "StyledItem");
267 qmlRegisterUncreatableType<UbuntuI18n>(uri, major, minor, "i18n", "Singleton object");
268 qmlRegisterExtendedType<QQuickImageBase, UCQQuickImageExtension>(uri, major, minor, "QQuickImageBase");
269
270=== modified file 'src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp'
271--- src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp 2015-08-31 15:43:14 +0000
272+++ src/Ubuntu/Components/plugin/privates/listitemdragarea.cpp 2015-09-22 15:57:54 +0000
273@@ -123,7 +123,8 @@
274 "No dragging will be possible.");
275 }
276 if (start) {
277- pViewAttached->buildChangesList(false);
278+ // keep the mouse event in house
279+ setKeepMouseGrab(true);
280 fromIndex = toIndex = index;
281 lastPos = pos;
282 // create temp drag item
283@@ -152,7 +153,7 @@
284 }
285 }
286 // unlock flickables
287- pViewAttached->clearChangesList();
288+ setKeepMouseGrab(false);
289 // perform drop
290 UCListItemPrivate::get(item.data())->dragHandler->drop();
291 item = 0;
292
293=== modified file 'src/Ubuntu/Components/plugin/sortfiltermodel.cpp'
294--- src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-08-20 17:08:49 +0000
295+++ src/Ubuntu/Components/plugin/sortfiltermodel.cpp 2015-09-22 15:57:54 +0000
296@@ -220,8 +220,11 @@
297 {
298 QVariantMap res;
299 const QHash<int, QByteArray> roles = roleNames();
300- for(int role = 0; role < roles.count(); role++)
301- res.insert (roles[role], data(row, role));
302+ QHashIterator<int, QByteArray> i(roles);
303+ while (i.hasNext()) {
304+ i.next();
305+ res.insert(i.value(), data(row, i.key()));
306+ }
307 return res;
308 }
309
310
311=== modified file 'src/Ubuntu/Components/plugin/ucactionitem.cpp'
312--- src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-08-25 11:31:29 +0000
313+++ src/Ubuntu/Components/plugin/ucactionitem.cpp 2015-09-22 15:57:54 +0000
314@@ -16,6 +16,10 @@
315
316 #include "ucactionitem.h"
317 #include "ucaction.h"
318+#include "ucstyleditembase_p.h"
319+#define foreach Q_FOREACH
320+#include <QtQml/private/qqmlbinding_p.h>
321+#undef foreach
322
323 /*!
324 * \qmltype ActionItem
325@@ -40,8 +44,14 @@
326 , m_action(Q_NULLPTR)
327 , m_flags(0)
328 {
329- connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged);
330- connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged);
331+ connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::enabledChanged2);
332+ connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::visibleChanged2);
333+}
334+
335+bool UCActionItem::hasBindingOnProperty(const QString &name)
336+{
337+ QQmlProperty property(this, name, qmlContext(this));
338+ return QQmlPropertyPrivate::binding(property) != Q_NULLPTR;
339 }
340
341 void UCActionItem::componentComplete()
342@@ -55,40 +65,47 @@
343 }
344 }
345
346-void UCActionItem::_q_visibleChanged()
347-{
348- m_flags |= CustomVisible;
349- disconnect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged);
350-}
351-
352-void UCActionItem::_q_enabledChanged()
353-{
354- m_flags |= CustomEnabled;
355- disconnect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged);
356-}
357-
358 // update visible property
359-void UCActionItem::_q_updateVisible()
360+void UCActionItem::_q_visibleBinding()
361 {
362+ if (m_flags & CustomVisible) {
363+ return;
364+ }
365+ if (hasBindingOnProperty(QStringLiteral("visible"))) {
366+ m_flags |= CustomEnabled;
367+ return;
368+ }
369 bool visible = m_action ? m_action->m_visible : true;
370 setVisible(visible);
371- // reset flag and reconnect signal handler disconnected by the
372- m_flags &= ~CustomVisible;
373- if (m_action) {
374- connect(this, &UCActionItem::visibleChanged, this, &UCActionItem::_q_visibleChanged);
375- }
376 }
377
378 // update enabled property
379-void UCActionItem::_q_updateEnabled()
380+void UCActionItem::_q_enabledBinding()
381 {
382+ if (m_flags & CustomEnabled) {
383+ return;
384+ }
385+ if (hasBindingOnProperty(QStringLiteral("enabled"))) {
386+ m_flags |= CustomEnabled;
387+ return;
388+ }
389 bool enabled = m_action ? m_action->m_enabled : true;
390 setEnabled(enabled);
391- // reset flag and reconnect signal handler disconnected by the
392- m_flags &= ~CustomEnabled;
393- if (m_action) {
394- connect(this, &UCActionItem::enabledChanged, this, &UCActionItem::_q_enabledChanged);
395- }
396+}
397+
398+// setter called when bindings from QML set the value. Internal functions will
399+// all use the setVisible setter, so initialization and (re)parenting related
400+// visible alteration won't set the custom flag
401+void UCActionItem::setVisible2(bool visible)
402+{
403+ // set the custom flag and forward the value to the original proepry setter
404+ m_flags |= CustomVisible;
405+ setVisible(visible);
406+}
407+void UCActionItem::setEnabled2(bool enabled)
408+{
409+ m_flags |= CustomEnabled;
410+ setEnabled(enabled);
411 }
412
413 void UCActionItem::updateProperties()
414@@ -109,10 +126,14 @@
415 if (attach) {
416 connect(this, SIGNAL(triggered(QVariant)),
417 m_action, SLOT(trigger(QVariant)), Qt::DirectConnection);
418- connect(m_action, &UCAction::visibleChanged,
419- this, &UCActionItem::_q_updateVisible, Qt::DirectConnection);
420- connect(m_action, &UCAction::enabledChanged,
421- this, &UCActionItem::_q_updateEnabled, Qt::DirectConnection);
422+ if (!(m_flags & CustomVisible)) {
423+ connect(m_action, &UCAction::visibleChanged,
424+ this, &UCActionItem::_q_visibleBinding, Qt::DirectConnection);
425+ }
426+ if (!(m_flags & CustomEnabled)) {
427+ connect(m_action, &UCAction::enabledChanged,
428+ this, &UCActionItem::_q_enabledBinding, Qt::DirectConnection);
429+ }
430 if (!(m_flags & CustomText)) {
431 connect(m_action, &UCAction::textChanged,
432 this, &UCActionItem::textChanged, Qt::DirectConnection);
433@@ -128,10 +149,14 @@
434 } else {
435 disconnect(this, SIGNAL(triggered(QVariant)),
436 m_action, SLOT(trigger(QVariant)));
437- disconnect(m_action, &UCAction::visibleChanged,
438- this, &UCActionItem::_q_updateVisible);
439- disconnect(m_action, &UCAction::enabledChanged,
440- this, &UCActionItem::_q_updateEnabled);
441+ if (!(m_flags & CustomVisible)) {
442+ disconnect(m_action, &UCAction::visibleChanged,
443+ this, &UCActionItem::_q_visibleBinding);
444+ }
445+ if (!(m_flags & CustomEnabled)) {
446+ disconnect(m_action, &UCAction::enabledChanged,
447+ this, &UCActionItem::_q_enabledBinding);
448+ }
449 if (!(m_flags & CustomText)) {
450 disconnect(m_action, &UCAction::textChanged,
451 this, &UCActionItem::textChanged);
452@@ -167,8 +192,8 @@
453 if (m_action) {
454 attachAction(true);
455 }
456- _q_updateVisible();
457- _q_updateEnabled();
458+ _q_visibleBinding();
459+ _q_enabledBinding();
460 updateProperties();
461 }
462
463
464=== modified file 'src/Ubuntu/Components/plugin/ucactionitem.h'
465--- src/Ubuntu/Components/plugin/ucactionitem.h 2015-08-25 11:31:29 +0000
466+++ src/Ubuntu/Components/plugin/ucactionitem.h 2015-09-22 15:57:54 +0000
467@@ -26,6 +26,10 @@
468 Q_PROPERTY(QString text READ text WRITE setText RESET resetText NOTIFY textChanged)
469 Q_PROPERTY(QUrl iconSource READ iconSource WRITE setIconSource RESET resetIconSource NOTIFY iconSourceChanged)
470 Q_PROPERTY(QString iconName READ iconName WRITE setIconName RESET resetIconName NOTIFY iconNameChanged)
471+
472+ // overrides
473+ Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled2 NOTIFY enabledChanged2)
474+ Q_PROPERTY(bool visible READ isVisible WRITE setVisible2 NOTIFY visibleChanged2 FINAL)
475 public:
476 explicit UCActionItem(QQuickItem *parent = 0);
477
478@@ -40,6 +44,9 @@
479 void setIconName(const QString &iconName);
480 void resetIconName();
481
482+ void setVisible2(bool visible);
483+ void setEnabled2(bool enabled);
484+
485 Q_SIGNALS:
486 void actionChanged();
487 void textChanged();
488@@ -47,14 +54,15 @@
489 void iconNameChanged();
490 void triggered(const QVariant &value);
491
492+ void enabledChanged2();
493+ void visibleChanged2();
494+
495 public Q_SLOTS:
496 void trigger(const QVariant &value = QVariant());
497
498 protected Q_SLOTS:
499- void _q_visibleChanged();
500- void _q_enabledChanged();
501- void _q_updateVisible();
502- void _q_updateEnabled();
503+ void _q_visibleBinding();
504+ void _q_enabledBinding();
505
506 protected:
507 enum {
508@@ -72,6 +80,7 @@
509
510 void componentComplete();
511
512+ bool hasBindingOnProperty(const QString &name);
513 void updateProperties();
514 void attachAction(bool attach);
515 };
516
517=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
518--- src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-04 09:32:31 +0000
519+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2015-09-22 15:57:54 +0000
520@@ -474,7 +474,7 @@
521 if (parentAttached) {
522 Q_Q(UCListItem);
523 // restore flickable's interactive and cleanup
524- parentAttached->disableInteractive(q, false);
525+ q->setKeepMouseGrab(false);
526 // no need to listen flickables any longer
527 listenToRebind(false);
528 }
529@@ -1123,7 +1123,7 @@
530
531 // grabs the left mouse button event by turning highlight on, and triggering
532 // swipe events; child items should no longer get mouse events
533-void UCListItemPrivate::grabLeftButtonEvents(QMouseEvent *event)
534+void UCListItemPrivate::handleLeftButtonPress(QMouseEvent *event)
535 {
536 Q_Q(UCListItem);
537 button = event->button();
538@@ -1133,11 +1133,15 @@
539 lastPos = pressedPos = event->localPos();
540 // connect the Flickable to know when to rebound
541 listenToRebind(true);
542- if (swiped && parentAttached) {
543- parentAttached->disableInteractive(q, true);
544+ if (swiped) {
545+ // grab now, and ungrab in snapOut
546+ q->setKeepMouseGrab(true);
547+ q->grabMouse();
548 }
549 // stop any ongoing animation!
550 swipeEvent(event->localPos(), UCSwipeEvent::Started);
551+ // accept the event so we get the rest of the events as well
552+ event->accept();
553 }
554
555 void UCListItem::mousePressEvent(QMouseEvent *event)
556@@ -1150,10 +1154,8 @@
557 return;
558 }
559 if (d->canHighlight() && !d->highlighted && event->button() == Qt::LeftButton) {
560- d->grabLeftButtonEvents(event);
561+ d->handleLeftButtonPress(event);
562 }
563- // accept the event so we get the rest of the events as well
564- event->setAccepted(true);
565 }
566
567 bool UCListItem13::shouldShowContextMenu(QMouseEvent *event)
568@@ -1203,15 +1205,16 @@
569 }
570
571 // ungrabs any previously grabbed left mouse button event
572-void UCListItemPrivate::ungrabLeftButtonEvents(QMouseEvent *event)
573+void UCListItemPrivate::handleLeftButtonRelease(QMouseEvent *event)
574 {
575 Q_Q(UCListItem);
576 // set released
577 if (highlighted) {
578 // unblock ascending Flickables
579 listenToRebind(false);
580- if (parentAttached) {
581- parentAttached->disableInteractive(q, false);
582+ q->setKeepMouseGrab(false);
583+ if (window && window->mouseGrabberItem() == q) {
584+ q->ungrabMouse();
585 }
586
587 if (!suppressClick) {
588@@ -1231,15 +1234,14 @@
589 }
590 }
591 button = Qt::NoButton;
592+ event->accept();
593 }
594
595 void UCListItem::mouseReleaseEvent(QMouseEvent *event)
596 {
597 UCStyledItemBase::mouseReleaseEvent(event);
598 Q_D(UCListItem);
599- d->ungrabLeftButtonEvents(event);
600- // make sure we ungrab the mouse!
601- ungrabMouse();
602+ d->handleLeftButtonRelease(event);
603 }
604
605 void UCListItem13::mouseReleaseEvent(QMouseEvent *event)
606@@ -1275,9 +1277,7 @@
607 if (d->swipedOverThreshold(event->localPos(), d->pressedPos)) {
608 // the press went out of the threshold area, enable move, if the direction allows it
609 d->lastPos = event->localPos();
610- if (d->parentAttached) {
611- d->parentAttached->disableInteractive(this, true);
612- }
613+ setKeepMouseGrab(true);
614 qreal mouseX = event->localPos().x();
615 qreal pressedX = d->pressedPos.x();
616 bool doSwipe = (d->leadingActions && (mouseX > pressedX)) ||
617@@ -1298,42 +1298,81 @@
618 }
619 }
620
621+bool UCListItemPrivate::sendMouseEvent(QQuickItem *item, QMouseEvent *event)
622+{
623+ Q_UNUSED(item);
624+ Q_Q(UCListItem);
625+ QQuickItem *grabber = window ? window->mouseGrabberItem() : Q_NULLPTR;
626+ if (grabber == q) {
627+ // already the grabber, return
628+ return true;
629+ }
630+
631+ bool consumed = false;
632+ if (contentItem->contains(contentItem->mapFromScene(event->windowPos()))) {
633+ QPointF localPos = q->mapFromScene(event->windowPos());
634+
635+ switch (event->type()) {
636+ case QEvent::MouseButtonPress: {
637+ // remember pressed point over active areas
638+ if (event->button() == Qt::LeftButton) {
639+ if (swiped) {
640+ // handle as full press and grab the event from the children
641+ QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));
642+ handleLeftButtonPress(mouseEvent.data());
643+ consumed = true;
644+ } else {
645+ // remember the position
646+ pressedPos = localPos;
647+ button = event->button();
648+ }
649+ }
650+ break;
651+ }
652+ case QEvent::MouseButtonRelease: {
653+ QScopedPointer<QMouseEvent> mouseEvent(QQuickWindowPrivate::cloneMouseEvent(event, &localPos));
654+ handleLeftButtonRelease(mouseEvent.data());
655+ suppressClick = false;
656+ break;
657+ }
658+ case QEvent::MouseMove: {
659+ if ((button == Qt::LeftButton) && swipedOverThreshold(localPos, pressedPos) && !highlighted) {
660+ // grab the event from the child, so the click doesn't happen anymore, and initiate swiping
661+ QMouseEvent pressed(QEvent::MouseButtonPress, localPos, event->windowPos(), event->screenPos(),
662+ Qt::LeftButton, event->buttons(), event->modifiers());
663+ handleLeftButtonPress(&pressed);
664+ // grab any further events so all land in the list item
665+ q->setKeepMouseGrab(true);
666+ q->grabMouse();
667+ consumed = true;
668+ }
669+ break;
670+ }
671+ default: break;
672+ }
673+ }
674+
675+ return consumed;
676+}
677+
678 bool UCListItem::childMouseEventFilter(QQuickItem *child, QEvent *event)
679 {
680- QEvent::Type type = event->type();
681+ if (!isVisible() || !isEnabled()) {
682+ return UCStyledItemBase::childMouseEventFilter(child, event);
683+ }
684+
685 Q_D(UCListItem);
686- if (type == QEvent::MouseButtonPress) {
687- // suppress click event if pressed over an active area, except Text, which can also handle
688- // mouse clicks when content is an URL
689- QMouseEvent *mouse = static_cast<QMouseEvent*>(event);
690- if (child->isEnabled() && (child->acceptedMouseButtons() & mouse->button()) && !qobject_cast<QQuickText*>(child)) {
691- // suppress click
692- d->suppressClick = true;
693- // listen for flickable to be able to rebind if movement started there!
694- d->listenToRebind(true);
695- // if left button pressed, remember the position
696- if (mouse->button() == Qt::LeftButton) {
697- d->pressedPos = mapFromItem(child, mouse->localPos());
698- d->button = mouse->button();
699- }
700- }
701- } else if (type == QEvent::MouseButtonRelease) {
702- Q_D(UCListItem);
703- d->suppressClick = false;
704- } else if (type == QEvent::MouseMove) {
705- QMouseEvent *mouse = static_cast<QMouseEvent*>(event);
706- const QPointF localPos = mapFromItem(child, mouse->localPos());
707- if ((mouse->buttons() & Qt::LeftButton) && d->swipedOverThreshold(localPos, d->pressedPos) && !d->highlighted) {
708- // grab the event from the child, so the click doesn't happen anymore, and initiate swiping
709- QMouseEvent pressed(QEvent::MouseButtonPress, localPos, mouse->windowPos(), mouse->screenPos(),
710- Qt::LeftButton, mouse->buttons(), mouse->modifiers());
711- d->grabLeftButtonEvents(&pressed);
712- // stop click and pressAndHold, then grab the mouse so children do not get the mouse events anymore
713- d->suppressClick = true;
714- d->pressAndHoldTimer.stop();
715- grabMouse();
716- }
717- }
718+ switch (event->type()) {
719+ case QEvent::MouseButtonPress:
720+ case QEvent::MouseMove:
721+ case QEvent::MouseButtonRelease: {
722+ if (d->sendMouseEvent(child, static_cast<QMouseEvent*>(event))) {
723+ return true;
724+ }
725+ }
726+ default: break;
727+ }
728+
729 return UCStyledItemBase::childMouseEventFilter(child, event);
730 }
731
732
733=== modified file 'src/Ubuntu/Components/plugin/uclistitem.h'
734--- src/Ubuntu/Components/plugin/uclistitem.h 2015-09-04 09:32:31 +0000
735+++ src/Ubuntu/Components/plugin/uclistitem.h 2015-09-22 15:57:54 +0000
736@@ -180,7 +180,6 @@
737 static UCViewItemsAttached *qmlAttachedProperties(QObject *owner);
738
739 bool listenToRebind(UCListItem *item, bool listen);
740- void disableInteractive(UCListItem *item, bool disable);
741 bool isMoving();
742 bool isBoundTo(UCListItem *item);
743
744
745=== modified file 'src/Ubuntu/Components/plugin/uclistitem_p.h'
746--- src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-01 07:16:59 +0000
747+++ src/Ubuntu/Components/plugin/uclistitem_p.h 2015-09-22 15:57:54 +0000
748@@ -68,8 +68,9 @@
749 void snapOut();
750 void swipeEvent(const QPointF &localPos, UCSwipeEvent::Status status);
751 bool swipedOverThreshold(const QPointF &mousePos, const QPointF relativePos);
752- void grabLeftButtonEvents(QMouseEvent *event);
753- void ungrabLeftButtonEvents(QMouseEvent *event);
754+ void handleLeftButtonPress(QMouseEvent *event);
755+ void handleLeftButtonRelease(QMouseEvent *event);
756+ bool sendMouseEvent(QQuickItem *item, QMouseEvent *event);
757
758 quint16 defaultThemeVersion;
759 bool highlighted:1;
760@@ -138,8 +139,6 @@
761
762 void clearFlickablesList();
763 void buildFlickablesList();
764- void clearChangesList();
765- void buildChangesList(const QVariant &newValue);
766 bool addSelectedItem(UCListItem *item);
767 bool removeSelectedItem(UCListItem *item);
768 bool isItemSelected(UCListItem *item);
769@@ -157,13 +156,10 @@
770 QSet<int> selectedList;
771 QMap<int, QPointer<UCListItem13> > expansionList;
772 QList< QPointer<QQuickFlickable> > flickables;
773- QList< PropertyChange* > changes;
774 QPointer<UCListItem> boundItem;
775- QPointer<UCListItem> disablerItem;
776 QQuickFlickable *listView;
777 ListItemDragArea *dragArea;
778 UCViewItemsAttached::ExpansionFlags expansionFlags;
779- bool globalDisabled:1;
780 bool selectable:1;
781 bool draggable:1;
782 bool ready:1;
783
784=== modified file 'src/Ubuntu/Components/plugin/ucviewitemsattached.cpp'
785--- src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-04 08:55:29 +0000
786+++ src/Ubuntu/Components/plugin/ucviewitemsattached.cpp 2015-09-22 15:57:54 +0000
787@@ -105,7 +105,6 @@
788 , listView(0)
789 , dragArea(0)
790 , expansionFlags(UCViewItemsAttached::Exclusive)
791- , globalDisabled(false)
792 , selectable(false)
793 , draggable(false)
794 , ready(false)
795@@ -114,7 +113,6 @@
796
797 UCViewItemsAttachedPrivate::~UCViewItemsAttachedPrivate()
798 {
799- clearChangesList();
800 clearFlickablesList();
801 }
802
803@@ -155,33 +153,6 @@
804 }
805 }
806
807-void UCViewItemsAttachedPrivate::clearChangesList()
808-{
809- // clear property change objects
810- qDeleteAll(changes);
811- changes.clear();
812-}
813-
814-void UCViewItemsAttachedPrivate::buildChangesList(const QVariant &newValue)
815-{
816- // collect all ascendant flickables
817- Q_Q(UCViewItemsAttached);
818- QQuickItem *item = qobject_cast<QQuickItem*>(q->parent());
819- if (!item) {
820- return;
821- }
822- clearChangesList();
823- while (item) {
824- QQuickFlickable *flickable = qobject_cast<QQuickFlickable*>(item);
825- if (flickable) {
826- PropertyChange *change = new PropertyChange(item, "interactive");
827- PropertyChange::setValue(change, newValue);
828- changes << change;
829- }
830- item = item->parentItem();
831- }
832-}
833-
834 /*!
835 * \qmltype ViewItems
836 * \instantiates UCViewItemsAttached
837@@ -252,41 +223,6 @@
838 return d->boundItem == item;
839 }
840
841-/*
842- * Disable/enable interactive flag for the ascendant flickables. The item is used
843- * to detect whether the same item is trying to enable the flickables which disabled
844- * it before. The enabled/disabled states are not equivalent to the enabled/disabled
845- * state of the interactive flag.
846- * When disabled, always the last item disabling will be kept as active disabler,
847- * and only the active disabler can enable (restore) the interactive flag state.
848- */
849-void UCViewItemsAttached::disableInteractive(UCListItem *item, bool disable)
850-{
851- Q_D(UCViewItemsAttached);
852- if (disable) {
853- // disabling or re-disabling
854- d->disablerItem = item;
855- if (d->globalDisabled == disable) {
856- // was already disabled, leave
857- return;
858- }
859- d->globalDisabled = true;
860- } else if (d->globalDisabled && d->disablerItem == item) {
861- // the one disabled it will enable
862- d->globalDisabled = false;
863- d->disablerItem.clear();
864- } else {
865- // !disabled && (!globalDisabled || item != d->disablerItem)
866- return;
867- }
868- if (disable) {
869- // (re)build changes list with disabling the interactive value
870- d->buildChangesList(false);
871- } else {
872- d->clearChangesList();
873- }
874-}
875-
876 void UCViewItemsAttached::unbindItem()
877 {
878 Q_D(UCViewItemsAttached);
879
880=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py'
881--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-06-23 13:22:10 +0000
882+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_header.py 2015-09-22 15:57:54 +0000
883@@ -34,6 +34,11 @@
884 class AppHeader(_common.UbuntuUIToolkitCustomProxyObjectBase):
885 """AppHeader Autopilot custom proxy object."""
886
887+ def __init__(self, *args):
888+ super().__init__(*args)
889+ if not hasattr(self, 'useDeprecatedToolbar'):
890+ self.useDeprecatedToolbar = None
891+
892 def ensure_visible(self):
893 if not self._is_visible():
894 self._show()
895
896=== modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py'
897--- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2015-09-07 13:46:58 +0000
898+++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/popups.py 2015-09-22 15:57:54 +0000
899@@ -81,16 +81,37 @@
900 class ActionSelectionPopover(_common.UbuntuUIToolkitCustomProxyObjectBase):
901 """ActionSelectionPopover Autopilot custom proxy object."""
902
903+ def click_action_button(self, action_object_name):
904+ """Click an action button on the popover.
905+
906+ :parameter object_name: The QML objectName property of the action
907+ :raise ToolkitException: If there is no visible button with that object
908+ name or the popover is not open.
909+
910+ """
911+
912+ if not self.visible:
913+ raise _common.ToolkitException('The popover is not open.')
914+ try:
915+ object_name = action_object_name + "_button"
916+ button = self.select_single(objectName=object_name)
917+ except dbus.StateNotFoundError:
918+ raise _common.ToolkitException(
919+ 'Action with objectName "{0}" not found.'.format(object_name))
920+ self.pointing_device.click_object(button)
921+ if self.autoClose:
922+ try:
923+ self.visible.wait_for(False)
924+ except dbus.StateNotFoundError:
925+ # The popover was removed from the tree.
926+ pass
927+
928 def click_button_by_text(self, text):
929 """Click a button on the popover.
930
931- XXX We are receiving the text because there's no way to set the
932- objectName on the action. This is reported at
933- https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1205144
934- --elopio - 2013-07-25
935-
936 :parameter text: The text of the button.
937- :raise ToolkitException: If the popover is not open.
938+ :raise ToolkitException: If there is no visible button with that label
939+ or the popover is not open.
940
941 """
942 if not self.visible:
943
944=== modified file 'tests/autopilot/ubuntuuitoolkit/base.py'
945--- tests/autopilot/ubuntuuitoolkit/base.py 2015-04-14 21:02:06 +0000
946+++ tests/autopilot/ubuntuuitoolkit/base.py 2015-09-22 15:57:54 +0000
947@@ -61,13 +61,12 @@
948 def get_toolkit_launcher_command():
949 root = ubuntuuitoolkit.tests.get_path_to_build_root()
950 path_to_local_launcher = os.path.join(
951- root, 'tests', 'launcher', 'launcher')
952+ root, 'ubuntu-ui-toolkit-launcher', 'ubuntu-ui-toolkit-launcher')
953 if os.path.exists(path_to_local_launcher):
954 return path_to_local_launcher
955 else:
956- arch = ubuntuuitoolkit.base.get_host_multiarch()
957 path_to_installed_launcher = os.path.join(
958- '/', 'usr', 'lib', arch, 'ubuntu-ui-toolkit', 'launcher')
959+ '/', 'usr', 'bin', 'ubuntu-ui-toolkit-launcher')
960 return path_to_installed_launcher
961
962
963
964=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py'
965--- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2015-07-29 09:50:33 +0000
966+++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2015-09-22 15:57:54 +0000
967@@ -204,8 +204,7 @@
968 return orientationHelper
969
970 def checkPageHeader(self, pageTitle):
971- orientationHelper = self.getOrientationHelper()
972- header_label = orientationHelper.select_single(
973+ header_label = self.main_view.select_single(
974 objectName="header_title_label", text=pageTitle)
975 self.assertThat(header_label, Not(Is(None)))
976 self.assertThat(header_label.visible, Eventually(Equals(True)))
977
978=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py'
979--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-04-14 21:02:06 +0000
980+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_popups.py 2015-09-22 15:57:54 +0000
981@@ -51,19 +51,30 @@
982 actions: ActionList {
983 Action {
984 text: "Action one"
985+ objectName: "actionOne"
986 onTriggered: label.text = "Button clicked."
987+ },
988+ Action {
989+ text: "Action two"
990+ objectName: "actionDisabled"
991+ onTriggered: label.text = "Disabled button clicked."
992+ },
993+ Action {
994+ text: "Action three"
995+ objectName: "actionHidden"
996+ onTriggered: label.text = "Hidden button clicked."
997 }
998 }
999 }
1000 }
1001 """)
1002
1003- def test_action_selection_popover_custom_proxy_object(self):
1004+ def test_custom_proxy_object(self):
1005 popover = self.main_view.get_action_selection_popover(
1006 'test_actions_popover')
1007 self.assertIsInstance(popover, popups.ActionSelectionPopover)
1008
1009- def test_click_action_select_popover_button(self):
1010+ def test_click_button_by_label(self):
1011 label = self.app.select_single('Label', objectName='clicked_label')
1012 self.assertNotEqual(label.text, 'Button clicked.')
1013 self._open_popover()
1014@@ -72,6 +83,49 @@
1015 popover.click_button_by_text('Action one')
1016 self.assertEqual(label.text, 'Button clicked.')
1017
1018+ def test_click_button_by_object_name(self):
1019+ label = self.app.select_single('Label', objectName='clicked_label')
1020+ self.assertNotEqual(label.text, 'Button clicked.')
1021+ self._open_popover()
1022+ popover = self.main_view.get_action_selection_popover(
1023+ 'test_actions_popover')
1024+ popover.click_action_button('actionOne')
1025+ self.assertEqual(label.text, 'Button clicked.')
1026+
1027+ def test_click_unexisting_button_by_object_name(self):
1028+ self._open_popover()
1029+ popover = self.main_view.get_action_selection_popover(
1030+ 'test_actions_popover')
1031+ error = self.assertRaises(
1032+ ubuntuuitoolkit.ToolkitException,
1033+ popover.click_action_button, 'actionTwo')
1034+ self.assertEqual(
1035+ str(error),
1036+ 'Action with objectName "actionTwo" not found.')
1037+
1038+ def test_click_disabled_button_by_object_name(self):
1039+ self._open_popover()
1040+ popover = self.main_view.get_action_selection_popover(
1041+ 'test_actions_popover')
1042+ # Disabled actions are not shown in ActionSelectionPopover
1043+ error = self.assertRaises(
1044+ ubuntuuitoolkit.ToolkitException,
1045+ popover.click_action_button, 'actionDisabled')
1046+ self.assertEqual(
1047+ str(error),
1048+ 'Action with objectName "actionDisabled" not found.')
1049+
1050+ def test_click_hidden_button_by_object_name(self):
1051+ self._open_popover()
1052+ popover = self.main_view.get_action_selection_popover(
1053+ 'test_actions_popover')
1054+ error = self.assertRaises(
1055+ ubuntuuitoolkit.ToolkitException,
1056+ popover.click_action_button, 'actionHidden')
1057+ self.assertEqual(
1058+ str(error),
1059+ 'Action with objectName "actionHidden" not found.')
1060+
1061 def _open_popover(self):
1062 open_button = self.main_view.select_single(
1063 'Button', objectName='open_popover')
1064
1065=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml'
1066--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml 2015-09-07 15:46:58 +0000
1067+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml 2015-09-22 15:57:54 +0000
1068@@ -20,7 +20,6 @@
1069 MainView {
1070 width: units.gu(70)
1071 height: units.gu(60)
1072- useDeprecatedToolbar: true
1073 objectName: "mainView"
1074
1075 Tabs {
1076@@ -29,33 +28,33 @@
1077 objectName: "tab1"
1078 title: "Tab1"
1079 Page {
1080- tools: ToolbarItems {
1081- ToolbarButton {
1082+ head.actions: [
1083+ Action {
1084 text: "Test1"
1085 }
1086- }
1087+ ]
1088 }
1089 }
1090 Tab {
1091 objectName: "tab2"
1092 title: "Tab2"
1093 Page {
1094- tools: ToolbarItems {
1095- ToolbarButton {
1096+ head.actions: [
1097+ Action {
1098 text: "Test2"
1099 }
1100- }
1101+ ]
1102 }
1103 }
1104 Tab {
1105 objectName: "tab3"
1106 title: "Tab3"
1107 Page {
1108- tools: ToolbarItems {
1109- ToolbarButton {
1110+ head.actions: [
1111+ Action {
1112 text: "Test3"
1113 }
1114- }
1115+ ]
1116 }
1117 }
1118 }
1119
1120=== modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py'
1121--- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2015-09-07 15:46:58 +0000
1122+++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_tabs.py 2015-09-22 15:57:54 +0000
1123@@ -28,10 +28,12 @@
1124 dir_path = os.path.dirname(path)
1125 deprecated_tabbar_test_qml_file_path = os.path.join(
1126 dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.qml')
1127- deprecated_tabbar_test_qml_file_path = os.path.join(
1128+ deprecated_tabbar_1_3_test_qml_file_path = os.path.join(
1129 dir_path, 'test_tabs.TabsTestCase.deprecated_TabBar.1.3.qml')
1130 new_header_test_qml_file_path = os.path.join(
1131 dir_path, 'test_tabs.TabsTestCase.new_header.qml')
1132+ new_header_1_3_test_qml_file_path = os.path.join(
1133+ dir_path, 'test_tabs.TabsTestCase.new_header.1.3.qml')
1134
1135 scenarios = [
1136 ('deprecated TabBar',
1137@@ -39,7 +41,7 @@
1138 ('deprecated TabBar 1.3',
1139 dict(test_qml_file_path=deprecated_tabbar_1_3_test_qml_file_path)),
1140 ('new header',
1141- dict(test_qml_file_path=new_header_test_qml_file_path))
1142+ dict(test_qml_file_path=new_header_test_qml_file_path)),
1143 ('new header 1.3',
1144 dict(test_qml_file_path=new_header_1_3_test_qml_file_path))
1145 ]
1146
1147=== modified file 'tests/resources/listitems/ListItemTest.qml'
1148--- tests/resources/listitems/ListItemTest.qml 2015-07-30 13:27:32 +0000
1149+++ tests/resources/listitems/ListItemTest.qml 2015-09-22 15:57:54 +0000
1150@@ -15,8 +15,8 @@
1151 */
1152
1153 import QtQuick 2.4
1154-import Ubuntu.Components 1.3
1155-import Ubuntu.Components.Styles 1.3
1156+import Ubuntu.Components 1.2
1157+import Ubuntu.Components.Styles 1.2
1158 import QtQuick.Layouts 1.1
1159
1160 MainView {
1161@@ -263,6 +263,11 @@
1162 Label {
1163 text: modelData + " Flickable item"
1164 }
1165+ Button {
1166+ text: "Pressme..."
1167+ anchors.centerIn: parent
1168+ }
1169+
1170 onClicked: divider.visible = !divider.visible
1171 }
1172 }
1173
1174=== added file 'tests/resources/navigation/Blackbox.qml'
1175--- tests/resources/navigation/Blackbox.qml 1970-01-01 00:00:00 +0000
1176+++ tests/resources/navigation/Blackbox.qml 2015-09-22 15:57:54 +0000
1177@@ -0,0 +1,48 @@
1178+/*
1179+ * Copyright 2015 Canonical Ltd.
1180+ *
1181+ * This program is free software; you can redistribute it and/or modify
1182+ * it under the terms of the GNU Lesser General Public License as published by
1183+ * the Free Software Foundation; version 3.
1184+ *
1185+ * This program is distributed in the hope that it will be useful,
1186+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1187+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1188+ * GNU Lesser General Public License for more details.
1189+ *
1190+ * You should have received a copy of the GNU Lesser General Public License
1191+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
1192+ */
1193+
1194+import QtQuick 2.4
1195+import Ubuntu.Components 1.2
1196+
1197+MainView {
1198+ width: units.gu(40)
1199+ height: units.gu(60)
1200+ Component.onCompleted: pageStack.push(page1)
1201+
1202+ PageStack {
1203+ id: pageStack
1204+ }
1205+
1206+ Page {
1207+ id: page1
1208+ title: "one"
1209+ Button {
1210+ anchors.centerIn: parent
1211+ text: "next"
1212+ onClicked: pageStack.push(page2)
1213+ }
1214+ }
1215+ Page {
1216+ id: page2
1217+ title: "two"
1218+ visible: false
1219+
1220+ head.backAction: Action {
1221+ iconName: "back"
1222+ onTriggered: pageStack.pop()
1223+ }
1224+ }
1225+}
1226
1227=== modified file 'tests/tests.pro'
1228--- tests/tests.pro 2015-05-20 14:47:16 +0000
1229+++ tests/tests.pro 2015-09-22 15:57:54 +0000
1230@@ -4,8 +4,6 @@
1231 autopilot_module.path = /usr/lib/python3/dist-packages/ubuntuuitoolkit
1232 autopilot_module.files = autopilot/ubuntuuitoolkit/*
1233
1234-SUBDIRS += launcher
1235-
1236 SUBDIRS += apicheck
1237
1238 INSTALLS += autopilot_module
1239
1240=== modified file 'tests/uitk_test_plan.sh'
1241--- tests/uitk_test_plan.sh 2015-07-13 08:04:32 +0000
1242+++ tests/uitk_test_plan.sh 2015-09-22 15:57:54 +0000
1243@@ -32,7 +32,7 @@
1244 SERIES="vivid"
1245 CHANNEL="ubuntu-touch/rc-proposed/${DISTRO}"
1246 PASSWORD="0000"
1247-BOOTTIME=500
1248+BOOTTIME=250
1249 ONLYCOMPARE=false
1250 DISTUPGRADE=false
1251 BOOTSTRAP=false
1252@@ -56,7 +56,7 @@
1253 # comment out if filemanager AP:s broken
1254 # " filemanager"
1255 # " ubuntu_terminal_app"
1256- " -n unity8"
1257+# " -n unity8"
1258 " ubuntu_clock_app"
1259 # " -p dialer-app-autopilot dialer_app"
1260 # " -p reminders-app-autopilot reminders"
1261@@ -78,7 +78,7 @@
1262 reminders-app-autopilot \
1263 address-book-app-autopilot \
1264 # messaging-app-autopilot \
1265- unity8-autopilot \
1266+# unity8-autopilot \
1267 dialer-app-autopilot \
1268 camera-app-autopilot \
1269 webbrowser-app-autopilot \
1270@@ -89,6 +89,12 @@
1271 ubuntu-system-settings-online-accounts-autopilot"
1272 # messaging-app-autopilot \
1273
1274+declare -a UNREGISTERED_APPS=(
1275+ "com.ubuntu.terminal"
1276+ "com.ubuntu.calculator"
1277+ "com.ubuntu.shorts"
1278+)
1279+
1280 fatal_failure () {
1281 echo -e "\e[31mFailed operation:\e[0m $1"
1282 exit
1283@@ -178,10 +184,13 @@
1284 network
1285 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S reboot 2>&1|grep -v password"
1286 sleep_indicator 120
1287- # Required for at least rtm-14.09/mako, phablet-click-test-setup fails otherwise and we don't need terminal
1288- adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister com.ubuntu.terminal 2>&1|grep -v password"
1289- # Enable if calculator AP:s broken, to prevent phablet-click-test-setup trying to check out its tests.
1290- #adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister com.ubuntu.calculator 2>&1|grep -v password"
1291+ # Unregister few apps as they break phablet-click-test-setup or something else
1292+ echo -e "Unregister few apps"
1293+ for APP_TO_UNREGISTER in "${UNREGISTERED_APPS[@]}"
1294+ do
1295+ echo -e "\e[31m${APP_TO_UNREGISTER}\e[0m"
1296+ adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S click unregister ${APP_TO_UNREGISTER} 2>&1|grep -v password"
1297+ done
1298 echo -e "phablet-click-test-setup \e[31m${DISTRO} ${SERIES}\e[0m"
1299 phablet-click-test-setup -s ${SERIALNUMBER} --distribution=${DISTRO} --series=${SERIES} 2>&1 || fatal_failure "phablet-click-test-setup has failed"
1300 echo "Sleep after phablet-click-test-setup";
1301@@ -200,6 +209,9 @@
1302 network
1303 # TODO: hide the sudo output
1304 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 "
1305+ # pin up the silo
1306+ 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 "
1307+ # Resynchronize the package index files from their sources.
1308 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null"
1309 else
1310 echo -e "Set up with the PPA \e[31m${PPA}\e[0m"
1311@@ -208,7 +220,6 @@
1312 network
1313 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"
1314 adb -s ${SERIALNUMBER} shell "echo ${PASSWORD}|sudo -S apt-get update 2>&1|grep -v password > /dev/null"
1315-
1316 fi
1317 fi
1318 adb -s ${SERIALNUMBER} shell rm -rf /home/phablet/autopilot/ubuntuuitoolkit
1319
1320=== modified file 'tests/unit_x11/tst_components/ListItemTestCase.qml'
1321--- tests/unit_x11/tst_components/ListItemTestCase.qml 2015-09-02 13:18:51 +0000
1322+++ tests/unit_x11/tst_components/ListItemTestCase.qml 2015-09-22 15:57:54 +0000
1323@@ -82,6 +82,10 @@
1324 spyWait();
1325 }
1326
1327+ function tugNoWait(item, x, y, dx, dy) {
1328+ TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy));
1329+ }
1330+
1331 // returns the leading or trailing panel item
1332 function panelItem(item, leading) {
1333 return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing"));
1334
1335=== modified file 'tests/unit_x11/tst_components/ListItemTestCase13.qml'
1336--- tests/unit_x11/tst_components/ListItemTestCase13.qml 2015-09-02 10:55:46 +0000
1337+++ tests/unit_x11/tst_components/ListItemTestCase13.qml 2015-09-22 15:57:54 +0000
1338@@ -76,12 +76,26 @@
1339 flick(item, x, y, dx, dy, 0, 0, undefined, undefined, 100);
1340 }
1341
1342+ // touch swipes
1343+ function swipeTouch(touchId, item, x, y, dx, dy) {
1344+ setupSpy(item, "contentMovementEnded");
1345+ flickTouch(touchId, item, x, y, dx, dy, 0, 100);
1346+ spyWait();
1347+ }
1348+ function swipeTouchNoWait(touchId, item, x, y, dx, dy) {
1349+ flickTouch(touchId, item, x, y, dx, dy, 0, 100);
1350+ }
1351+
1352 function tug(item, x, y, dx, dy) {
1353 setupSpy(item, "contentMovementEnded");
1354 TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy));
1355 spyWait();
1356 }
1357
1358+ function tugNoWait(item, x, y, dx, dy) {
1359+ TestExtras.touchDrag(0, item, Qt.point(x, y), Qt.point(dx, dy));
1360+ }
1361+
1362 // returns the leading or trailing panel item
1363 function panelItem(item, leading) {
1364 return findInvisibleChild(item, (leading ? "ListItemPanelLeading" : "ListItemPanelTrailing"));
1365
1366=== renamed file 'tests/unit/tst_components/tst_actionitem.qml' => 'tests/unit_x11/tst_components/tst_actionitem.qml'
1367--- tests/unit/tst_components/tst_actionitem.qml 2015-08-18 16:58:41 +0000
1368+++ tests/unit_x11/tst_components/tst_actionitem.qml 2015-09-22 15:57:54 +0000
1369@@ -18,86 +18,182 @@
1370 import QtTest 1.0
1371 import Ubuntu.Components 1.1
1372
1373-TestCase {
1374- name: "ActionItemAPI"
1375-
1376- SignalSpy {
1377- id: triggerSpy
1378- target: action1
1379- signalName: "triggered"
1380- }
1381-
1382- function initTestCase() {
1383- compare(item1.action, null, "action is null by default")
1384- compare(item1.text, "", "text is empty string set by default")
1385- compare(item1.iconSource, "", "iconSource is empty string by default")
1386- compare(item1.iconName, "", "iconSource is empty string by default")
1387- }
1388-
1389- function cleanup() {
1390- item1.action = null;
1391- triggerSpy.clear();
1392- }
1393-
1394- function test_action() {
1395- compare(item1.action, null,"Action is null by default")
1396- item1.action = action1
1397- compare(item1.action, action1, "Action can be set")
1398- compare(item1.text, action1.text, "text is automatically set to action text")
1399- compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource")
1400- item1.triggered(null)
1401- triggerSpy.wait(400);
1402- }
1403-
1404- // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
1405- // not update the text
1406- function test_text() {
1407- compare(item1.text, "", "text is empty string by default")
1408- var newText = "new text"
1409- item1.text = newText
1410- compare(item1.text, newText, "text can be set")
1411- item1.text = ""
1412- compare(item1.text, "", "text can be unset")
1413- }
1414-
1415- // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
1416- // will not update the iconSource
1417- function test_iconSource() {
1418- compare(item1.iconSource, "", "iconSource is empty string by default")
1419- var newIconSource = Qt.resolvedUrl("../../../examples/ubuntu-ui-toolkit-gallery/small_avatar.png")
1420- item1.iconSource = newIconSource
1421- compare(item1.iconSource, newIconSource, "iconSource can be set")
1422- item1.iconSource = ""
1423- compare(item1.iconSource, "", "iconSource can be unset")
1424- }
1425-
1426- // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
1427- // will not update the iconName
1428- function test_iconName() {
1429- compare(item1.iconName, "", "iconName is empty string by default")
1430- var newIconName = "compose"
1431- item1.iconName = newIconName
1432- compare(item1.iconName, newIconName, "iconName can be set")
1433- item1.iconName = ""
1434- compare(item1.iconName, "", "iconName can be unset")
1435- }
1436-
1437- function test_signal_triggered() {
1438- signalSpy.signalName = "triggered";
1439- compare(signalSpy.valid,true,"triggered signal exists")
1440- }
1441-
1442- ActionItem {
1443- id: item1
1444- SignalSpy {
1445- id: signalSpy
1446- target: parent
1447- }
1448- }
1449-
1450- Action {
1451- id: action1
1452- text: "actionText"
1453- iconSource: "imageURL"
1454- }
1455+Item {
1456+ id: main
1457+ width: units.gu(20)
1458+ height: units.gu(20)
1459+
1460+ property bool customVisible: true
1461+ property bool customEnabled: true
1462+
1463+ ActionItem {
1464+ id: item1
1465+ SignalSpy {
1466+ id: signalSpy
1467+ target: parent
1468+ }
1469+ }
1470+
1471+ Component {
1472+ id: dynamicItem
1473+ ActionItem {
1474+ action: action1
1475+ }
1476+ }
1477+ Component {
1478+ id: dynamicItem2
1479+ ActionItem {
1480+ action: action1
1481+ visible: customVisible
1482+ enabled: customEnabled
1483+ }
1484+ }
1485+
1486+ Action {
1487+ id: action1
1488+ objectName: "action1"
1489+ text: "actionText"
1490+ iconSource: "imageURL"
1491+ }
1492+ Action {
1493+ id: action2
1494+ objectName: "action2"
1495+ }
1496+
1497+ Loader {
1498+ id: loader
1499+ asynchronous: false
1500+ }
1501+
1502+ TestCase {
1503+ id: testCase
1504+ when: windowShown
1505+ name: "ActionItemAPI"
1506+
1507+ SignalSpy {
1508+ id: triggerSpy
1509+ target: action1
1510+ signalName: "triggered"
1511+ }
1512+
1513+ function initTestCase() {
1514+ compare(item1.action, null, "action is null by default")
1515+ compare(item1.text, "", "text is empty string set by default")
1516+ compare(item1.iconSource, "", "iconSource is empty string by default")
1517+ compare(item1.iconName, "", "iconSource is empty string by default")
1518+ }
1519+
1520+ function cleanup() {
1521+ loader.sourceComponent = null;
1522+ item1.action = null;
1523+ action1.visible = true;
1524+ action1.enabled = true;
1525+ action2.visible = true;
1526+ action2.enabled = true;
1527+ main.customEnabled = true;
1528+ main.customVisible = true;
1529+ triggerSpy.clear();
1530+ }
1531+
1532+ function test_action() {
1533+ compare(item1.action, null,"Action is null by default")
1534+ item1.action = action1
1535+ compare(item1.action, action1, "Action can be set")
1536+ compare(item1.text, action1.text, "text is automatically set to action text")
1537+ compare(item1.iconSource, action1.iconSource, "iconSource is automatically set to action iconSource")
1538+ item1.triggered(null)
1539+ triggerSpy.wait(400);
1540+ }
1541+
1542+ // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
1543+ // not update the text
1544+ function test_text() {
1545+ compare(item1.text, "", "text is empty string by default")
1546+ var newText = "new text"
1547+ item1.text = newText
1548+ compare(item1.text, newText, "text can be set")
1549+ item1.text = ""
1550+ compare(item1.text, "", "text can be unset")
1551+ }
1552+
1553+ // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
1554+ // will not update the iconSource
1555+ function test_iconSource() {
1556+ compare(item1.iconSource, "", "iconSource is empty string by default")
1557+ var newIconSource = Qt.resolvedUrl("../../../examples/ubuntu-ui-toolkit-gallery/small_avatar.png")
1558+ item1.iconSource = newIconSource
1559+ compare(item1.iconSource, newIconSource, "iconSource can be set")
1560+ item1.iconSource = ""
1561+ compare(item1.iconSource, "", "iconSource can be unset")
1562+ }
1563+
1564+ // NOTE: This test must be run AFTER test_action(), otherwise setting the action will
1565+ // will not update the iconName
1566+ function test_iconName() {
1567+ compare(item1.iconName, "", "iconName is empty string by default")
1568+ var newIconName = "compose"
1569+ item1.iconName = newIconName
1570+ compare(item1.iconName, newIconName, "iconName can be set")
1571+ item1.iconName = ""
1572+ compare(item1.iconName, "", "iconName can be unset")
1573+ }
1574+
1575+ function test_signal_triggered() {
1576+ signalSpy.signalName = "triggered";
1577+ compare(signalSpy.valid,true,"triggered signal exists")
1578+ }
1579+
1580+ function test_default_bindings_visible_enabled_data() {
1581+ return [
1582+ {tag: "visible", property: "visible"},
1583+ {tag: "enabled", property: "enabled"},
1584+ ];
1585+ }
1586+ function test_default_bindings_visible_enabled(data) {
1587+ item1.action = action1;
1588+ action1[data.property] = false;
1589+ compare(item1[data.property], action1[data.property], "The item1 and action1 '" + data.property + "' value differs");
1590+ }
1591+
1592+ function test_custom_bindings_visible_enabled_bug1495408_data() {
1593+ return [
1594+ {tag: "visible", component: dynamicItem, property: "visible"},
1595+ {tag: "enabled", component: dynamicItem, property: "enabled"},
1596+ {tag: "visible binding", component: dynamicItem2, property: "visible", customProperty: "customVisible"},
1597+ {tag: "enabled binding", component: dynamicItem2, property: "enabled", customProperty: "customEnabled"},
1598+ ];
1599+ }
1600+ function test_custom_bindings_visible_enabled_bug1495408(data) {
1601+ loader.sourceComponent = data.component;
1602+ var item = loader.item;
1603+ compare(item[data.property], action1[data.property], "The item and action1 '" + data.property + "' value differs");
1604+ if (data.customProperty) {
1605+ main[data.customProperty] = false;
1606+ } else {
1607+ item[data.property] = false;
1608+ }
1609+ // change the action so the internal bindings are updated
1610+ item.action = action2;
1611+ expectFail(data.tag, "default binding must be broken");
1612+ compare(item[data.property], item.action[data.property], "The item's and action's '" + data.property + "' value is the same");
1613+ }
1614+ function test_custom_bindings_visible_enabled_reparenting_bug1495408_data() {
1615+ return [
1616+ {tag: "visible binding", component: dynamicItem2, property: "visible"},
1617+ {tag: "enabled binding", component: dynamicItem2, property: "enabled"},
1618+ ];
1619+ }
1620+ function test_custom_bindings_visible_enabled_reparenting_bug1495408(data) {
1621+ loader.sourceComponent = dynamicItem2;
1622+ var item = loader.item;
1623+ compare(item[data.property], item.action[data.property], "The item and item.action '" + data.property + "' value differs");
1624+ // then reparent
1625+ item.parent = item1;
1626+ // change the action property
1627+
1628+ item.action[data.property] = false;
1629+ expectFail(data.tag, "default binding must be broken");
1630+ compare(item[data.property], item.action[data.property], "The item and action2 '" + data.property + "' value is the same");
1631+ }
1632+ }
1633 }
1634
1635=== modified file 'tests/unit_x11/tst_components/tst_icon.qml'
1636--- tests/unit_x11/tst_components/tst_icon.qml 2015-03-03 13:20:06 +0000
1637+++ tests/unit_x11/tst_components/tst_icon.qml 2015-09-22 15:57:54 +0000
1638@@ -64,6 +64,11 @@
1639 name: "Icon"
1640 when: windowShown
1641
1642+ SignalSpy {
1643+ id: shaderSpy
1644+ signalName: 'onStatusChanged'
1645+ }
1646+
1647 function cleanup() {
1648 icon2.name = "";
1649 }
1650@@ -93,5 +98,35 @@
1651 "file:///usr/share/icons/suru/actions/scalable/search.svg",
1652 "Source of the image should equal icon2.source.");
1653 }
1654+
1655+ function test_keyColor() {
1656+ icon.visible = true;
1657+ var image = findChild(icon, "image");
1658+ var shader = findChild(icon, "shader");
1659+ shaderSpy.target = shader;
1660+
1661+ compare(icon.name, 'search');
1662+ compare(shader.visible, false);
1663+ compare(shader.status, ShaderEffect.Uncompiled)
1664+ icon.color = UbuntuColors.orange;
1665+ shaderSpy.wait();
1666+ compare(shader.status, ShaderEffect.Compiled)
1667+ compare(shader.keyColorOut, icon.color);
1668+ compare(shader.visible, true);
1669+ compare(shader.source, image);
1670+ icon.keyColor = UbuntuColors.purple;
1671+ compare(shader.keyColorIn, icon.keyColor);
1672+ // Unsetting the icon name should disable the shader
1673+ icon.name = '';
1674+ compare(icon.source, '');
1675+ compare(shader.visible, false);
1676+ // Let's get back to a valid source
1677+ icon.name = 'search';
1678+ compare(shader.visible, true);
1679+ compare(shader.source, image);
1680+ // Unsetting the keyColor should also disable the shader
1681+ icon.color = Qt.rgba(0.0, 0.0, 0.0, 0.0);
1682+ compare(shader.visible, false);
1683+ }
1684 }
1685 }
1686
1687=== modified file 'tests/unit_x11/tst_components/tst_listitem.qml'
1688--- tests/unit_x11/tst_components/tst_listitem.qml 2015-09-02 06:47:25 +0000
1689+++ tests/unit_x11/tst_components/tst_listitem.qml 2015-09-22 15:57:54 +0000
1690@@ -198,8 +198,8 @@
1691 signalName: "onTriggered"
1692 }
1693 SignalSpy {
1694- id: interactiveSpy
1695- signalName: "interactiveChanged"
1696+ id: flickableSpy
1697+ signalName: "movementStarted"
1698 }
1699
1700 SignalSpy {
1701@@ -227,7 +227,7 @@
1702 actionSpy.clear();
1703 pressAndHoldSpy.clear();
1704 buttonSpy.clear();
1705- interactiveSpy.clear();
1706+ flickableSpy.clear();
1707 listView.interactive = true;
1708 listView.ViewItems.selectMode = false;
1709 listView.ViewItems.dragMode = false;
1710@@ -235,8 +235,8 @@
1711 mouseClick(defaults, 0, 0)
1712 movingSpy.target = null;
1713 movingSpy.clear();
1714- interactiveSpy.target = null;
1715- interactiveSpy.clear();
1716+ flickableSpy.target = null;
1717+ flickableSpy.clear();
1718 trailing.delegate = null;
1719 listView.positionViewAtBeginning();
1720 // keep additional timeout for proper cleanup
1721@@ -434,6 +434,7 @@
1722 rebound(data.clickOn, data.item)
1723 }
1724
1725+ // the function tests whether the Flickable/ListView moves when the ListItem is swiped
1726 function test_listview_not_interactive_while_tugged_data() {
1727 var item0 = findChild(listView, "listItem0");
1728 var item1 = findChild(listView, "listItem1");
1729@@ -446,17 +447,15 @@
1730 }
1731 function test_listview_not_interactive_while_tugged(data) {
1732 listView.positionViewAtBeginning();
1733- interactiveSpy.target = listView;
1734+ flickableSpy.target = listView;
1735 compare(listView.interactive, true, "ListView is not interactive");
1736- interactiveSpy.target = listView;
1737 if (data.mouse) {
1738- swipe(data.item, data.pos.x, data.pos.y, data.dx, data.dy);
1739+ swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
1740 } else {
1741- tug(data.item, data.pos.x, data.pos.y, data.dx, data.dy);
1742+ tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
1743 }
1744 // animation should no longer be running!
1745- compare(listView.interactive, true, "The ListView is still non-interactive!");
1746- compare(interactiveSpy.count, 2, "Less/more times changed!");
1747+ compare(flickableSpy.count, 0, "Flickable moved!");
1748 // check if it snapped in
1749 verify(data.item.contentItem.x != 0.0, "Not snapped in!!");
1750 // dismiss
1751@@ -629,7 +628,7 @@
1752 wait(2000);
1753 verify(data.item.contentItem.x != data.item.contentItem.anchors.leftMargin, "Not snapped in");
1754
1755- var panel = panelItem(data.item, "Leading");
1756+ var panel = panelItem(data.item, true);
1757 var action = findChild(panel, "leading_2");
1758 verify(action, "actions panel cannot be reached");
1759 // we test the action closest to the list item's contentItem
1760@@ -724,11 +723,12 @@
1761 function test_listitem_blocks_ascendant_flickables() {
1762 var listItem = findChild(nestedListView, "listItem0");
1763 verify(listItem, "Cannot find test item");
1764- interactiveSpy.target = testFlickable;
1765+ flickableSpy.target = testFlickable;
1766 // tug leading
1767 swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0);
1768 // check if interactive got changed
1769- interactiveSpy.wait();
1770+ expectFailContinue("", "Flickable should not move");
1771+ flickableSpy.wait(200);
1772
1773 // cleanup!!!
1774 rebound(listItem);
1775
1776=== modified file 'tests/unit_x11/tst_components/tst_listitem13.qml'
1777--- tests/unit_x11/tst_components/tst_listitem13.qml 2015-09-02 10:55:46 +0000
1778+++ tests/unit_x11/tst_components/tst_listitem13.qml 2015-09-22 15:57:54 +0000
1779@@ -198,8 +198,8 @@
1780 signalName: "onTriggered"
1781 }
1782 SignalSpy {
1783- id: interactiveSpy
1784- signalName: "interactiveChanged"
1785+ id: flickableSpy
1786+ signalName: "movementStarted"
1787 }
1788
1789 SignalSpy {
1790@@ -227,7 +227,7 @@
1791 actionSpy.clear();
1792 pressAndHoldSpy.clear();
1793 buttonSpy.clear();
1794- interactiveSpy.clear();
1795+ flickableSpy.clear();
1796 listView.interactive = true;
1797 listView.ViewItems.selectMode = false;
1798 listView.ViewItems.dragMode = false;
1799@@ -235,8 +235,8 @@
1800 mouseClick(defaults, 0, 0)
1801 movingSpy.target = null;
1802 movingSpy.clear();
1803- interactiveSpy.target = null;
1804- interactiveSpy.clear();
1805+ flickableSpy.target = null;
1806+ flickableSpy.clear();
1807 trailing.delegate = null;
1808 listView.positionViewAtBeginning();
1809 // keep additional timeout for proper cleanup
1810@@ -466,17 +466,15 @@
1811 }
1812 function test_listview_not_interactive_while_tugged(data) {
1813 listView.positionViewAtBeginning();
1814- interactiveSpy.target = listView;
1815+ flickableSpy.target = listView;
1816 compare(listView.interactive, true, "ListView is not interactive");
1817- interactiveSpy.target = listView;
1818 if (data.mouse) {
1819- swipe(data.item, data.pos.x, data.pos.y, data.dx, data.dy);
1820+ swipe(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
1821 } else {
1822- tug(data.item, data.pos.x, data.pos.y, data.dx, data.dy);
1823+ tug(data.item, data.pos.x, data.pos.y, data.dx, units.gu(5));
1824 }
1825 // animation should no longer be running!
1826- compare(listView.interactive, true, "The ListView is still non-interactive!");
1827- compare(interactiveSpy.count, 2, "Less/more times changed!");
1828+ compare(flickableSpy.count, 0, "Flickable moved!");
1829 // check if it snapped in
1830 verify(data.item.contentItem.x != 0.0, "Not snapped in!!");
1831 // dismiss
1832@@ -744,11 +742,12 @@
1833 function test_listitem_blocks_ascendant_flickables() {
1834 var listItem = findChild(nestedListView, "listItem0");
1835 verify(listItem, "Cannot find test item");
1836- interactiveSpy.target = testFlickable;
1837+ flickableSpy.target = testFlickable;
1838 // tug leading
1839 swipe(listItem, centerOf(listItem).x, centerOf(listItem).y, listItem.width / 2, 0);
1840 // check if interactive got changed
1841- interactiveSpy.wait();
1842+ expectFailContinue("", "Flickable should not move.");
1843+ flickableSpy.wait(200);
1844
1845 // cleanup!!!
1846 rebound(listItem);
1847@@ -1200,7 +1199,7 @@
1848
1849 var icon = findChild(testItem, data.action);
1850 verify(icon);
1851- compare(icon.width, units.gu(5), "icon width should be the same no matter of the height set");
1852+ compare(icon.width, units.gu(6), "icon width should be the same no matter of the height set");
1853
1854 rebound(testItem);
1855
1856
1857=== modified file 'tests/unit_x11/tst_components/tst_listitem_extras.qml'
1858--- tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-09-02 10:55:46 +0000
1859+++ tests/unit_x11/tst_components/tst_listitem_extras.qml 2015-09-22 15:57:54 +0000
1860@@ -30,18 +30,18 @@
1861 Action {
1862 iconName: "starred"
1863 text: 'Bookmark'
1864- objectName: "leading_1"
1865+ objectName: "trailing1"
1866 },
1867 Action {
1868 iconName: "edit"
1869 text: 'Edit'
1870- objectName: "leading_2"
1871+ objectName: "trailing2"
1872 onTriggered: text = 'Edit Again'
1873 },
1874 Action {
1875 iconName: "camcorder"
1876 text: 'Record'
1877- objectName: "leading_3"
1878+ objectName: "trailing3"
1879 }
1880 ]
1881 }
1882@@ -50,7 +50,7 @@
1883 actions: Action {
1884 id: stockAction
1885 iconName: "torch-on"
1886- objectName: "stockAction"
1887+ objectName: "leading1"
1888 text: 'Switch lights on'
1889 }
1890 }
1891@@ -80,6 +80,22 @@
1892 onPressed: mouse.accepted = overlaidMouseArea.acceptEvent
1893 }
1894 }
1895+ ListView {
1896+ id: listView
1897+ width: parent.width
1898+ height: 4 * units.gu(7) // 4 items
1899+ clip: true
1900+ model: 5
1901+ delegate: ListItem {
1902+ objectName: "listItem" + index
1903+ Label {
1904+ anchors.centerIn: parent
1905+ text: index
1906+ }
1907+
1908+ leadingActions: leading
1909+ }
1910+ }
1911 }
1912
1913 ListItemTestCase13 {
1914@@ -89,11 +105,16 @@
1915 signalName: "clicked"
1916 }
1917
1918+ function initTestCase() {
1919+ TestExtras.registerTouchDevice();
1920+ }
1921+
1922 function cleanup() {
1923 rebound(testWithActiveItem);
1924 rebound(overlaidMouseArea);
1925 clickSpy.target = null;
1926 clickSpy.clear();
1927+ wait(200);
1928 }
1929
1930 function test_swipe_over_active_item() {
1931@@ -114,5 +135,116 @@
1932 swipeNoWait(overlayArea, centerOf(overlayArea).x, centerOf(overlayArea).y, units.gu(10));
1933 spyWait();
1934 }
1935+
1936+ function test_swipe_out_from_overlay_button_bug1497156_data() {
1937+ return [
1938+ {tag: "leading with mouse", touch: false, swipeInDx: units.gu(20), swipeOutDx: -units.gu(5)},
1939+ {tag: "trailing with mouse", touch: false, swipeInDx: -units.gu(20), swipeOutDx: units.gu(5)},
1940+ {tag: "leading with touch", touch: true, swipeInDx: units.gu(20), swipeOutDx: -units.gu(5)},
1941+ {tag: "trailing with touch", touch: true, swipeInDx: -units.gu(20), swipeOutDx: units.gu(5)},
1942+ ]
1943+ }
1944+ function test_swipe_out_from_overlay_button_bug1497156(data) {
1945+ // swipe in and out from teh same point
1946+ if (data.touch) {
1947+ tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeInDx, 0);
1948+ } else {
1949+ swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeInDx, 0);
1950+ }
1951+ verify(testWithActiveItem.contentItem.x != 0, "Not swiped in");
1952+ // swipe out
1953+ if (data.touch) {
1954+ tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeOutDx, 0);
1955+ } else {
1956+ swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.swipeOutDx, 0);
1957+ }
1958+ tryCompareFunction(function() {
1959+ return testWithActiveItem.contentItem.x == testWithActiveItem.contentItem.anchors.leftMargin;
1960+ }, true, 500);
1961+ }
1962+
1963+ function test_swipe_over_contextual_actions_bug1486008_data() {
1964+ return [
1965+ {tag: "leading action with mouse", touch: false, dx: units.gu(20), leadingPanel: true, action: "leading1"},
1966+ {tag: "trailing action with mouse", touch: false, dx: -units.gu(20), leadingPanel: false, action: "trailing1"},
1967+ {tag: "leading action with touch", touch: true, dx: units.gu(20), leadingPanel: true, action: "leading1"},
1968+ {tag: "trailing action with touch", touch: true, dx: -units.gu(20), leadingPanel: false, action: "trailing1"},
1969+ ];
1970+ }
1971+ function test_swipe_over_contextual_actions_bug1486008(data) {
1972+ if (data.touch) {
1973+ tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
1974+ } else {
1975+ swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
1976+ }
1977+ var panel = panelItem(testWithActiveItem, data.leadingPanel);
1978+ var actionItem = findChild(panel, data.action);
1979+ verify(actionItem, data.action + " action not found.");
1980+ // swipe over the action
1981+ setupSpy(testWithActiveItem, "contentMovementStarted");
1982+ if (data.touch) {
1983+ tugNoWait(actionItem, centerOf(actionItem).x, centerOf(actionItem).y, -data.dx, 0);
1984+ } else {
1985+ swipeNoWait(actionItem, centerOf(actionItem).x, centerOf(actionItem).y, -data.dx, 0);
1986+ }
1987+ expectFail(data.tag, "should not swipe");
1988+ spyWait();
1989+ }
1990+
1991+ function test_button_inactive_while_swiped_data() {
1992+ return [
1993+ {tag: "mouse", touch: false, dx: units.gu(20)},
1994+ {tag: "touch", touch: true, dx: units.gu(20)},
1995+ ];
1996+ }
1997+ function test_button_inactive_while_swiped(data) {
1998+ clickSpy.target = activeItem;
1999+ if (data.touch) {
2000+ tug(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
2001+ TestExtras.touchClick(0, activeItem, centerOf(activeItem));
2002+ } else {
2003+ swipe(testWithActiveItem, centerOf(testWithActiveItem).x, centerOf(testWithActiveItem).y, data.dx, 0);
2004+ mouseClick(activeItem, centerOf(activeItem).x, centerOf(activeItem).y);
2005+ }
2006+ expectFail(data.tag, "Button is inactive while swiped");
2007+ clickSpy.wait(200);
2008+ }
2009+
2010+ function test_click_before_and_after_snapout_bug1496468_data() {
2011+ var item0 = findChild(listView, "listItem0");
2012+ var item1 = findChild(listView, "listItem1");
2013+ return [
2014+ {tag: "mouse", touch: false, clickedItem: item0, swipedItem: item1, dx: units.gu(20), reboundDx: -units.gu(5)},
2015+ {tag: "touch", touch: true, clickedItem: item0, swipedItem: item1, dx: units.gu(20), reboundDx: -units.gu(5)},
2016+ ];
2017+ }
2018+ function test_click_before_and_after_snapout_bug1496468(data) {
2019+ clickSpy.target = data.clickedItem;
2020+ if (data.touch) {
2021+ TestExtras.touchClick(0, data.clickedItem, centerOf(data.clickedItem));
2022+ } else {
2023+ mouseClick(data.clickedItem, centerOf(data.clickedItem).x, centerOf(data.clickedItem).y);
2024+ }
2025+ clickSpy.wait(200);
2026+ // swipe in then rebound
2027+ if (data.touch) {
2028+ tug(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.dx, 0);
2029+ wait(200);
2030+ tug(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.reboundDx, 0);
2031+ } else {
2032+ swipe(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.dx, 0);
2033+ wait(200);
2034+ swipe(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y, data.reboundDx, 0);
2035+ }
2036+ // then test click
2037+ clickSpy.target = data.swipedItem;
2038+ clickSpy.clear();
2039+ if (data.touch) {
2040+ TestExtras.touchClick(0, data.swipedItem, centerOf(data.swipedItem));
2041+ } else {
2042+ mouseClick(data.swipedItem, centerOf(data.swipedItem).x, centerOf(data.swipedItem).y);
2043+ }
2044+ clickSpy.wait(200);
2045+ }
2046 }
2047 }
2048
2049=== modified file 'tests/unit_x11/tst_components/tst_popover.qml'
2050--- tests/unit_x11/tst_components/tst_popover.qml 2015-03-03 13:20:06 +0000
2051+++ tests/unit_x11/tst_components/tst_popover.qml 2015-09-22 15:57:54 +0000
2052@@ -29,6 +29,11 @@
2053 y: main.height / 2
2054 height: units.gu(10)
2055 width: height
2056+ MouseArea {
2057+ id: whiteSpace
2058+ anchors.fill: parent
2059+ acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
2060+ }
2061
2062 Button {
2063 id: pressMe
2064@@ -68,6 +73,11 @@
2065 id: popoverSpy
2066 signalName: "hideCompleted"
2067 }
2068+ SignalSpy {
2069+ id: whiteSpy
2070+ signalName: "clicked"
2071+ target: whiteSpace
2072+ }
2073
2074 Component {
2075 id: popoverComponent
2076@@ -116,6 +126,29 @@
2077 popoverSpy.wait();
2078 }
2079
2080+ function test_popover_consumes_clicks_bug1488540_data() {
2081+ return [
2082+ { tag: 'Left-click', button: Qt.LeftButton },
2083+ { tag: 'Right-click', button: Qt.RightButton },
2084+ { tag: 'Middle-click', button: Qt.MiddleButton },
2085+ ]
2086+ }
2087+ function test_popover_consumes_clicks_bug1488540(data) {
2088+ mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2);
2089+ waitForRendering(pressMe);
2090+ verify(popoverSpy.target !== null, "The popover did not open");
2091+ var popover = popoverSpy.target;
2092+ // Click in the popover, the rectangle doesn't handle clicks
2093+ whiteSpy.clear();
2094+ mouseClick(popover, popover.width / 2, popover.height / 2, data.button);
2095+ // dismiss
2096+ mouseClick(main, 10, 10, Qt.LeftButton);
2097+ popoverSpy.wait();
2098+ // Did the click reach through the popover foreground?
2099+ compare(whiteSpy.count, 0, 'Click passed through popover foreground!');
2100+
2101+ }
2102+
2103 function test_popover_follows_pointerTarget_bug1199502_data() {
2104 return [
2105 { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 },
2106
2107=== added file 'tests/unit_x11/tst_components/tst_popover13.qml'
2108--- tests/unit_x11/tst_components/tst_popover13.qml 1970-01-01 00:00:00 +0000
2109+++ tests/unit_x11/tst_components/tst_popover13.qml 2015-09-22 15:57:54 +0000
2110@@ -0,0 +1,174 @@
2111+/*
2112+ * Copyright 2014-2015 Canonical Ltd.
2113+ *
2114+ * This program is free software; you can redistribute it and/or modify
2115+ * it under the terms of the GNU Lesser General Public License as published by
2116+ * the Free Software Foundation; version 3.
2117+ *
2118+ * This program is distributed in the hope that it will be useful,
2119+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2120+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2121+ * GNU Lesser General Public License for more details.
2122+ *
2123+ * You should have received a copy of the GNU Lesser General Public License
2124+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2125+ */
2126+import QtQuick 2.0
2127+import QtTest 1.0
2128+import Ubuntu.Test 1.0
2129+import Ubuntu.Components 1.3
2130+import Ubuntu.Components.Popups 1.3
2131+
2132+MainView {
2133+ id: main
2134+ width: units.gu(50)
2135+ height: units.gu(71)
2136+
2137+ Rectangle {
2138+ id: rect
2139+ y: main.height / 2
2140+ height: units.gu(10)
2141+ width: height
2142+ MouseArea {
2143+ id: whiteSpace
2144+ anchors.fill: parent
2145+ acceptedButtons: Qt.LeftButton | Qt.MiddleButton | Qt.RightButton
2146+ }
2147+
2148+ Button {
2149+ id: pressMe
2150+ anchors.top: parent.top
2151+ text: "Press me"
2152+ onClicked: {
2153+ testCase.resetPositions();
2154+ var popover = PopupUtils.open(popoverComponent, pressMe);
2155+ popoverSpy.target = testCase.findChild(popover, "popover_foreground");
2156+ popoverSpy.clear();
2157+ pressMe.parent.height = units.gu(25)
2158+ pressMe.anchors.top = parent.bottom
2159+ }
2160+ }
2161+
2162+ Button {
2163+ id: pushMe
2164+ anchors.bottom: parent.bottom
2165+ text: "Push me"
2166+ onClicked: {
2167+ testCase.resetPositions();
2168+ var popover = PopupUtils.open(popoverComponent, pushMe);
2169+ popoverSpy.target = testCase.findChild(popover, "popover_foreground");
2170+ popoverSpy.clear();
2171+ rect.y = main.height / 10
2172+ }
2173+ }
2174+ }
2175+ Label {
2176+ id: other
2177+ text: "Ignore me"
2178+ anchors.centerIn: parent
2179+ }
2180+
2181+ // spy to listen on the popover foreground's hideCompleted() signal
2182+ SignalSpy {
2183+ id: popoverSpy
2184+ signalName: "hideCompleted"
2185+ }
2186+ SignalSpy {
2187+ id: whiteSpy
2188+ signalName: "clicked"
2189+ target: whiteSpace
2190+ }
2191+
2192+ Component {
2193+ id: popoverComponent
2194+ Popover {
2195+ objectName: "popover"
2196+ Rectangle {
2197+ width: units.gu(20)
2198+ height: units.gu(20)
2199+ color: "blue"
2200+ }
2201+ }
2202+ }
2203+
2204+ UbuntuTestCase {
2205+ id: testCase
2206+ name: "PopoverTests"
2207+ when: windowShown
2208+
2209+ function resetPositions() {
2210+ pressMe.parent.height = units.gu(10)
2211+ rect.y = main.height / 2
2212+ }
2213+
2214+ function cleanup() {
2215+ resetPositions()
2216+ popoverSpy.target = null;
2217+ popoverSpy.clear();
2218+ waitForRendering(main, 500);
2219+ }
2220+
2221+ function test_dismiss_on_click_data() {
2222+ return [
2223+ {button: Qt.LeftButton},
2224+ {button: Qt.MiddleButton},
2225+ {button: Qt.RightButton},
2226+ ];
2227+ }
2228+
2229+ function test_dismiss_on_click(data) {
2230+ mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2);
2231+ waitForRendering(pressMe);
2232+ verify(popoverSpy.target !== null, "The popover did not open");
2233+
2234+ // dismiss
2235+ mouseClick(main, 10, 10, data.button);
2236+ popoverSpy.wait();
2237+ }
2238+
2239+ function test_popover_consumes_clicks_bug1488540_data() {
2240+ return [
2241+ { tag: 'Left-click', button: Qt.LeftButton },
2242+ { tag: 'Right-click', button: Qt.RightButton },
2243+ { tag: 'Middle-click', button: Qt.MiddleButton },
2244+ ]
2245+ }
2246+ function test_popover_consumes_clicks_bug1488540(data) {
2247+ mouseClick(pressMe, pressMe.width / 2, pressMe.height / 2);
2248+ waitForRendering(pressMe);
2249+ verify(popoverSpy.target !== null, "The popover did not open");
2250+ var popover = popoverSpy.target;
2251+ // Click in the popover, the rectangle doesn't handle clicks
2252+ whiteSpy.clear();
2253+ mouseClick(popover, popover.width / 2, popover.height / 2, data.button);
2254+ // dismiss
2255+ mouseClick(main, 10, 10, Qt.LeftButton);
2256+ popoverSpy.wait();
2257+ // Did the click reach through the popover foreground?
2258+ compare(whiteSpy.count, 0, 'Click passed through popover foreground!');
2259+
2260+ }
2261+
2262+ function test_popover_follows_pointerTarget_bug1199502_data() {
2263+ return [
2264+ { tag: "Moving pointerTarget", button: pressMe, dir: "down", y: 318 },
2265+ // FIXME: { tag: "Moving parent", button: pushMe, dir: "up", y: 142.8 },
2266+ // https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1427557
2267+ ]
2268+ }
2269+ function test_popover_follows_pointerTarget_bug1199502(data) {
2270+ mouseClick(data.button, data.button.width / 2, data.button.height / 2);
2271+ waitForRendering(data.button);
2272+ var dir = popoverSpy.target.direction
2273+ var popoverY = popoverSpy.target.y
2274+
2275+ // dismiss
2276+ mouseClick(main, 10, 10, Qt.LeftButton);
2277+ popoverSpy.wait();
2278+
2279+ // ensure popover was next to caller
2280+ compare(dir, data.dir, "Popover arrow is wrong")
2281+ compare(popoverY, data.y, "Popover isn't pointing at the caller")
2282+ }
2283+ }
2284+}
2285
2286=== modified file 'ubuntu-sdk.pro'
2287--- ubuntu-sdk.pro 2015-08-13 09:20:05 +0000
2288+++ ubuntu-sdk.pro 2015-09-22 15:57:54 +0000
2289@@ -8,7 +8,7 @@
2290 requires(qtHaveModule(quick))
2291 load(qt_parts)
2292
2293-SUBDIRS += po documentation
2294+SUBDIRS += po documentation ubuntu-ui-toolkit-launcher
2295
2296 #when standalone we always want tests to be built
2297 !build_with_qt{
2298
2299=== renamed directory 'tests/launcher' => 'ubuntu-ui-toolkit-launcher'
2300=== renamed file 'tests/launcher/launcher.pro' => 'ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro'
2301--- tests/launcher/launcher.pro 2014-06-17 07:12:49 +0000
2302+++ ubuntu-ui-toolkit-launcher/ubuntu-ui-toolkit-launcher.pro 2015-09-22 15:57:54 +0000
2303@@ -6,8 +6,8 @@
2304 HEADERS += MouseTouchAdaptor.h
2305 SOURCES += launcher.cpp \
2306 MouseTouchAdaptor.cpp
2307-installPath = $$[QT_INSTALL_LIBS]/ubuntu-ui-toolkit
2308+installPath = $$[QT_INSTALL_PREFIX]/bin
2309 launcher.path = $$installPath
2310-launcher.files = launcher
2311+launcher.files = ubuntu-ui-toolkit-launcher
2312 INSTALLS += launcher
2313

Subscribers

People subscribed via source and target branches

to status/vote changes: