Merge lp:~zsombi/ubuntu-ui-toolkit/inverseMouseArea-update into lp:ubuntu-ui-toolkit
- inverseMouseArea-update
- Merge into trunk
Proposed by
Zsombor Egri
Status: | Superseded | ||||
---|---|---|---|---|---|
Proposed branch: | lp:~zsombi/ubuntu-ui-toolkit/inverseMouseArea-update | ||||
Merge into: | lp:ubuntu-ui-toolkit | ||||
Diff against target: |
1859 lines (+729/-327) 47 files modified
debian/changelog (+45/-0) debian/ubuntu-ui-toolkit-autopilot.install (+1/-0) examples/ubuntu-ui-toolkit-gallery/Template.qml (+4/-0) modules/Ubuntu/Components/ListItems/Empty.qml (+3/-23) modules/Ubuntu/Components/OrientationHelper.qml (+1/-1) modules/Ubuntu/Components/Popups/ComposerSheet.qml (+3/-0) modules/Ubuntu/Components/Popups/DefaultSheet.qml (+4/-0) modules/Ubuntu/Components/Popups/SheetBase.qml (+7/-1) modules/Ubuntu/Components/Scrollbar.qml (+1/-1) modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml (+13/-1) modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml (+5/-1) modules/Ubuntu/Components/plugin/filterbehavior.cpp (+8/-0) modules/Ubuntu/Components/plugin/filterbehavior.h (+2/-0) modules/Ubuntu/Components/plugin/inversemouseareatype.cpp (+9/-5) modules/Ubuntu/Components/plugin/inversemouseareatype.h (+1/-0) modules/Ubuntu/Components/plugin/sortbehavior.cpp (+8/-0) modules/Ubuntu/Components/plugin/sortbehavior.h (+2/-0) modules/Ubuntu/Components/plugin/uctheme.cpp (+6/-1) modules/Ubuntu/Test/plugin/plugin.pro (+1/-1) modules/Ubuntu/Test/plugin/uctestcase.cpp (+26/-0) modules/Ubuntu/Test/plugin/uctestcase.h (+69/-0) push_to_phone.sh (+41/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py (+10/-0) tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py (+13/-5) tests/autopilot/ubuntuuitoolkit/tests/__init__.py (+1/-112) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py (+62/-39) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py (+89/-60) tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py (+2/-0) tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py (+21/-7) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py (+1/-3) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py (+10/-30) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py (+1/-3) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py (+63/-0) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py (+2/-6) tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py (+2/-8) tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py (+1/-1) tests/launcher/launcher.cpp (+146/-0) tests/launcher/launcher.pro (+11/-0) tests/tests.pro (+2/-0) tests/unit/runtest.sh (+4/-1) tests/unit/unit.pro (+0/-2) tests/unit_x11/tst_components/tst_hide_chrome.qml (+5/-0) tests/unit_x11/tst_components/tst_popover.qml (+1/-0) tests/unit_x11/tst_components/tst_textarea.qml (+2/-0) tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml (+3/-0) tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp (+8/-14) tests/unit_x11/unit_x11.pro (+9/-1) |
||||
To merge this branch: | bzr merge lp:~zsombi/ubuntu-ui-toolkit/inverseMouseArea-update | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zoltan Balogh | Pending | ||
Review via email: mp+223588@code.launchpad.net |
Commit message
Reverting InverseMouseAre
Description of the change
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 'debian/changelog' |
2 | --- debian/changelog 2014-06-04 07:26:07 +0000 |
3 | +++ debian/changelog 2014-06-18 15:28:52 +0000 |
4 | @@ -1,3 +1,48 @@ |
5 | +ubuntu-ui-toolkit (0.1.46+14.10.20140602-0ubuntu2) UNRELEASED; urgency=medium |
6 | + |
7 | + [Leo Arias ] |
8 | + * On the autopilot helper for the header, fix the swipe to show |
9 | + when hidden. |
10 | + * Added a fixture for autopilot tests to use a fake home directory. |
11 | + Fixes: https://bugs.launchpad.net/bugs/1317639 |
12 | + * Cleaned the containers in unity test using the alternate |
13 | + launcher. |
14 | + * Fixed the creation of the fake Xauthority file on mako for the |
15 | + fixture tests. Fixes: https://bugs.launchpad.net/bugs/1326072 |
16 | + * Fixed the swipe to delete on the list item autopilot helper. |
17 | + Fixes: https://bugs.launchpad.net/bugs/1311392. |
18 | + * clean ups to the autopilot tests for the widget gallery. |
19 | + |
20 | + [ Christian Dywan ] |
21 | + * Add a launcher with a switch for the QQMLEngine. |
22 | + * The presence of a mouse enables the interactive thumb. |
23 | + Fixes: https://bugs.launchpad.net/bugs/1165173 |
24 | + * Initialize sort.order explicitly. |
25 | + Fixes: https://bugs.launchpad.net/bugs/1324087 |
26 | + * Swiping from Left to Right to Delete only. |
27 | + * Show explicit failure when test wasn't built yet. |
28 | + * Add push_to_phone script to push QML/ Python/ artwork. |
29 | + |
30 | + |
31 | + [ Tim Peeters ] |
32 | + * Anchor the internal PageTreeNode of PageStack to fill its parent. |
33 | + Fixes: https://bugs.launchpad.net/bugs/1322527 |
34 | + * Deprecate sheets. Fixes: https://bugs.launchpad.net/bugs/1304541 |
35 | + * Fix bug where header overflow action popover does not close when |
36 | + the associated action pushes a new page on the pagestack. |
37 | + Fixes: https://bugs.launchpad.net/bugs/1326963. |
38 | + |
39 | + [ Zsombor Egri] |
40 | + * Adding touch functions to UbuntuTestCase. |
41 | + * Qt5.3 related fixes. Fixes: |
42 | + https://bugs.launchpad.net/bugs/1324070, |
43 | + https://bugs.launchpad.net/bugs/1324088, |
44 | + https://bugs.launchpad.net/bugs/1324089. |
45 | + |
46 | + |
47 | + |
48 | + -- Zoltán Balogh <zoltan@bakter.hu> Wed, 04 Jun 2014 09:40:11 +0200 |
49 | + |
50 | ubuntu-ui-toolkit (0.1.46+14.10.20140602-0ubuntu1) utopic; urgency=low |
51 | |
52 | [ Christian Dywan ] |
53 | |
54 | === modified file 'debian/ubuntu-ui-toolkit-autopilot.install' |
55 | --- debian/ubuntu-ui-toolkit-autopilot.install 2014-02-21 23:39:43 +0000 |
56 | +++ debian/ubuntu-ui-toolkit-autopilot.install 2014-06-18 15:28:52 +0000 |
57 | @@ -1,2 +1,3 @@ |
58 | usr/lib/python3 |
59 | +usr/lib/ubuntu-ui-toolkit/launcher |
60 | usr/lib/python2.7 |
61 | |
62 | === modified file 'examples/ubuntu-ui-toolkit-gallery/Template.qml' |
63 | --- examples/ubuntu-ui-toolkit-gallery/Template.qml 2014-04-23 09:39:11 +0000 |
64 | +++ examples/ubuntu-ui-toolkit-gallery/Template.qml 2014-06-18 15:28:52 +0000 |
65 | @@ -30,6 +30,7 @@ |
66 | |
67 | Flickable { |
68 | id: flickable |
69 | + objectName: "TemplateFlickable" |
70 | anchors.fill: parent |
71 | anchors.topMargin: units.gu(2) |
72 | anchors.bottomMargin: units.gu(2) |
73 | @@ -46,6 +47,9 @@ |
74 | } |
75 | |
76 | Scrollbar { |
77 | + id: sb |
78 | + objectName: "TemplateScrollbar" |
79 | flickableItem: flickable |
80 | + property alias interactive: sb.__interactive |
81 | } |
82 | } |
83 | |
84 | === modified file 'modules/Ubuntu/Components/ListItems/Empty.qml' |
85 | --- modules/Ubuntu/Components/ListItems/Empty.qml 2014-05-12 16:40:44 +0000 |
86 | +++ modules/Ubuntu/Components/ListItems/Empty.qml 2014-06-18 15:28:52 +0000 |
87 | @@ -105,7 +105,7 @@ |
88 | /*! |
89 | \preliminary |
90 | \qmlproperty string swipingState |
91 | - The current swiping state ("SwipingLeft", "SwipingRight", "") |
92 | + The current swiping state ("SwipingRight" or "") |
93 | */ |
94 | readonly property alias swipingState: backgroundIndicator.state |
95 | |
96 | @@ -228,7 +228,7 @@ |
97 | __mouseArea.drag.target = body |
98 | held = true |
99 | __mouseArea.drag.maximumX = parent.width |
100 | - __mouseArea.drag.minimumX = (parent.width * -1) |
101 | + __mouseArea.drag.minimumX = 0 |
102 | backgroundIndicator.visible = true |
103 | } |
104 | |
105 | @@ -334,10 +334,8 @@ |
106 | onXChanged: { |
107 | if (x > 0) { |
108 | backgroundIndicator.state = "SwipingRight" |
109 | - } else if (x === 0) { |
110 | + } else { |
111 | backgroundIndicator.state = "" |
112 | - } else { |
113 | - backgroundIndicator.state = "SwipingLeft" |
114 | } |
115 | } |
116 | } |
117 | @@ -427,24 +425,6 @@ |
118 | target: confirmRemovalDialog |
119 | x: body.x - confirmRemovalDialog.width - units.gu(2) |
120 | } |
121 | - }, |
122 | - State { |
123 | - name: "SwipingLeft" |
124 | - AnchorChanges { |
125 | - target: backgroundIndicator |
126 | - anchors.left: body.right |
127 | - anchors.right: parent.right |
128 | - } |
129 | - |
130 | - PropertyChanges { |
131 | - target: backgroundIndicator |
132 | - opacity: 1.0 |
133 | - } |
134 | - |
135 | - PropertyChanges { |
136 | - target: confirmRemovalDialog |
137 | - x: units.gu(2) |
138 | - } |
139 | } |
140 | ] |
141 | } |
142 | |
143 | === modified file 'modules/Ubuntu/Components/OrientationHelper.qml' |
144 | --- modules/Ubuntu/Components/OrientationHelper.qml 2014-04-23 09:39:11 +0000 |
145 | +++ modules/Ubuntu/Components/OrientationHelper.qml 2014-06-18 15:28:52 +0000 |
146 | @@ -121,7 +121,7 @@ |
147 | http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop |
148 | */ |
149 | function applyOrientation() { |
150 | - if (windowActive) |
151 | + if (windowActive && window) |
152 | window.contentOrientation = Screen.orientation |
153 | } |
154 | |
155 | |
156 | === modified file 'modules/Ubuntu/Components/Popups/ComposerSheet.qml' |
157 | --- modules/Ubuntu/Components/Popups/ComposerSheet.qml 2014-04-23 08:50:20 +0000 |
158 | +++ modules/Ubuntu/Components/Popups/ComposerSheet.qml 2014-06-18 15:28:52 +0000 |
159 | @@ -20,6 +20,7 @@ |
160 | \qmltype ComposerSheet |
161 | \inherits SheetBase |
162 | \inqmlmodule Ubuntu.Components.Popups 1.0 |
163 | + \deprecated |
164 | \ingroup ubuntu-popups |
165 | \brief Much like the \l DefaultSheet the Composer Sheet allows an application to insert a content |
166 | view over the focused view without disrupting the navigation pattern. However the Composer Sheet |
167 | @@ -56,6 +57,8 @@ |
168 | } |
169 | } |
170 | \endqml |
171 | + |
172 | + \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.} |
173 | */ |
174 | |
175 | SheetBase { |
176 | |
177 | === modified file 'modules/Ubuntu/Components/Popups/DefaultSheet.qml' |
178 | --- modules/Ubuntu/Components/Popups/DefaultSheet.qml 2014-04-23 08:50:20 +0000 |
179 | +++ modules/Ubuntu/Components/Popups/DefaultSheet.qml 2014-06-18 15:28:52 +0000 |
180 | @@ -19,6 +19,7 @@ |
181 | |
182 | /*! |
183 | \qmltype DefaultSheet |
184 | + \deprecated |
185 | \inherits SheetBase |
186 | \inqmlmodule Ubuntu.Components.Popups 1.0 |
187 | \ingroup ubuntu-popups |
188 | @@ -58,6 +59,9 @@ |
189 | } |
190 | } |
191 | \endqml |
192 | + |
193 | + \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.} |
194 | + |
195 | */ |
196 | SheetBase { |
197 | id: sheet |
198 | |
199 | === modified file 'modules/Ubuntu/Components/Popups/SheetBase.qml' |
200 | --- modules/Ubuntu/Components/Popups/SheetBase.qml 2014-04-23 08:50:20 +0000 |
201 | +++ modules/Ubuntu/Components/Popups/SheetBase.qml 2014-06-18 15:28:52 +0000 |
202 | @@ -19,16 +19,22 @@ |
203 | |
204 | /*! |
205 | \qmltype SheetBase |
206 | + \deprecated |
207 | \inqmlmodule Ubuntu.Components.Popups 1.0 |
208 | \ingroup ubuntu-popups |
209 | \brief Parent class of different types of sheets. Not to be used directly. |
210 | |
211 | Examples: See subclasses. |
212 | - \b{This component is under heavy development.} |
213 | + \b{Sheets are deprecated. Consider using \l Dialog, \l Popover or \l PageStack instead.} |
214 | */ |
215 | PopupBase { |
216 | id: sheet |
217 | |
218 | + Component.onCompleted: { |
219 | + print("WARNING: Sheets are deprecated. " + |
220 | + "Consider using Dialog, Popover or PageStack instead.") |
221 | + } |
222 | + |
223 | /*! |
224 | \preliminary |
225 | \qmlproperty list<Object> container |
226 | |
227 | === modified file 'modules/Ubuntu/Components/Scrollbar.qml' |
228 | --- modules/Ubuntu/Components/Scrollbar.qml 2014-04-23 08:50:20 +0000 |
229 | +++ modules/Ubuntu/Components/Scrollbar.qml 2014-06-18 15:28:52 +0000 |
230 | @@ -87,7 +87,7 @@ |
231 | This property holds whether the scrollbar is active or passive. It is present |
232 | for testing purposes. |
233 | */ |
234 | - property bool __interactive: false |
235 | + property bool __interactive: __styleInstance !== null && __styleInstance.interactive |
236 | |
237 | implicitWidth: internals.vertical ? units.gu(4) : flickableItem.width |
238 | implicitHeight: !internals.vertical ? units.gu(4) : flickableItem.height |
239 | |
240 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml' |
241 | --- modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-05-14 13:21:10 +0000 |
242 | +++ modules/Ubuntu/Components/Themes/Ambiance/NewHeaderStyle.qml 2014-06-18 15:28:52 +0000 |
243 | @@ -259,9 +259,21 @@ |
244 | |
245 | Popover { |
246 | id: actionsOverflowPopover |
247 | - objectName: "actionsOverflowPopover" |
248 | + objectName: "actions_overflow_popover" |
249 | parent: QuickUtils.rootItem(actionsOverflowPopover) |
250 | caller: actionsOverflowButton |
251 | + |
252 | + Connections { |
253 | + target: styledItem |
254 | + onActionsChanged: { |
255 | + // Ensure the popover closes when actions change and |
256 | + // the list item below may be destroyed before its |
257 | + // onClicked is executed. See bug |
258 | + // https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1326963 |
259 | + actionsOverflowPopover.hide(); |
260 | + } |
261 | + } |
262 | + |
263 | Column { |
264 | anchors { |
265 | left: parent.left |
266 | |
267 | === modified file 'modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml' |
268 | --- modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml 2014-04-23 08:50:20 +0000 |
269 | +++ modules/Ubuntu/Components/Themes/Ambiance/ScrollbarStyle.qml 2014-06-18 15:28:52 +0000 |
270 | @@ -59,7 +59,7 @@ |
271 | property bool interactive: false |
272 | property real minimumSliderSize: units.gu(2) |
273 | |
274 | - property bool overlay: true |
275 | + property bool overlay: !interactive |
276 | property real overlayOpacityWhenShown: 0.6 |
277 | property real overlayOpacityWhenHidden: 0.0 |
278 | |
279 | @@ -222,6 +222,9 @@ |
280 | onReleased: mouse.accepted = false |
281 | } |
282 | |
283 | + // The presence of a mouse enables the interactive thumb |
284 | + // FIXME: Should use form factor hints |
285 | + InverseMouse.onEntered: interactive = true |
286 | |
287 | // The slider's position represents which part of the flickable is visible. |
288 | // The slider's size represents the size the visible part relative to the |
289 | @@ -401,6 +404,7 @@ |
290 | |
291 | Item { |
292 | id: thumb |
293 | + objectName: "interactiveScrollbarThumb" |
294 | |
295 | enabled: interactive |
296 | |
297 | |
298 | === modified file 'modules/Ubuntu/Components/plugin/filterbehavior.cpp' |
299 | --- modules/Ubuntu/Components/plugin/filterbehavior.cpp 2014-05-15 09:35:22 +0000 |
300 | +++ modules/Ubuntu/Components/plugin/filterbehavior.cpp 2014-06-18 15:28:52 +0000 |
301 | @@ -19,6 +19,14 @@ |
302 | |
303 | #include "filterbehavior.h" |
304 | |
305 | +FilterBehavior::FilterBehavior(QObject *parent) |
306 | + : QObject(parent) |
307 | + , m_property(QString()) |
308 | + , m_pattern(QRegExp()) |
309 | +{ |
310 | + |
311 | +} |
312 | + |
313 | QString |
314 | FilterBehavior::property() const |
315 | { |
316 | |
317 | === modified file 'modules/Ubuntu/Components/plugin/filterbehavior.h' |
318 | --- modules/Ubuntu/Components/plugin/filterbehavior.h 2014-05-15 09:35:22 +0000 |
319 | +++ modules/Ubuntu/Components/plugin/filterbehavior.h 2014-06-18 15:28:52 +0000 |
320 | @@ -29,6 +29,8 @@ |
321 | Q_PROPERTY(QRegExp pattern READ pattern WRITE setPattern NOTIFY patternChanged) |
322 | |
323 | public: |
324 | + explicit FilterBehavior(QObject *parent = 0); |
325 | + |
326 | QString property() const; |
327 | void setProperty(const QString& property); |
328 | QRegExp pattern() const; |
329 | |
330 | === modified file 'modules/Ubuntu/Components/plugin/inversemouseareatype.cpp' |
331 | --- modules/Ubuntu/Components/plugin/inversemouseareatype.cpp 2014-04-25 12:53:58 +0000 |
332 | +++ modules/Ubuntu/Components/plugin/inversemouseareatype.cpp 2014-06-18 15:28:52 +0000 |
333 | @@ -244,11 +244,6 @@ |
334 | */ |
335 | QObject::connect(this, &QQuickMouseArea::windowChanged, |
336 | this, &InverseMouseAreaType::resetFilterOnWindowUpdate); |
337 | - |
338 | - if (!m_sensingArea) { |
339 | - // get sensing area upon parent change |
340 | - QObject::connect(this, SIGNAL(parentChanged(QQuickItem*)), this, SLOT(update())); |
341 | - } |
342 | } |
343 | |
344 | InverseMouseAreaType::~InverseMouseAreaType() |
345 | @@ -291,6 +286,7 @@ |
346 | m_sensingArea = QuickUtils::instance().rootItem(this); |
347 | } |
348 | updateEventFilter(isEnabled() && isVisible() && m_topmostItem); |
349 | + QQuickMouseArea::update(); |
350 | } |
351 | /*! |
352 | \internal |
353 | @@ -302,6 +298,14 @@ |
354 | updateEventFilter(m_topmostItem); |
355 | } |
356 | |
357 | +void InverseMouseAreaType::itemChange(ItemChange change, const ItemChangeData &data) |
358 | +{ |
359 | + if (change == ItemParentHasChanged && data.item) { |
360 | + update(); |
361 | + } |
362 | + QQuickMouseArea::itemChange(change, data); |
363 | +} |
364 | + |
365 | void InverseMouseAreaType::componentComplete() |
366 | { |
367 | QQuickMouseArea::componentComplete(); |
368 | |
369 | === modified file 'modules/Ubuntu/Components/plugin/inversemouseareatype.h' |
370 | --- modules/Ubuntu/Components/plugin/inversemouseareatype.h 2014-03-20 10:01:21 +0000 |
371 | +++ modules/Ubuntu/Components/plugin/inversemouseareatype.h 2014-06-18 15:28:52 +0000 |
372 | @@ -32,6 +32,7 @@ |
373 | Q_INVOKABLE virtual bool contains(const QPointF &point) const; |
374 | |
375 | protected: |
376 | + void itemChange(ItemChange, const ItemChangeData &); |
377 | void componentComplete(); |
378 | bool eventFilter(QObject *, QEvent *); |
379 | |
380 | |
381 | === modified file 'modules/Ubuntu/Components/plugin/sortbehavior.cpp' |
382 | --- modules/Ubuntu/Components/plugin/sortbehavior.cpp 2014-05-15 09:35:22 +0000 |
383 | +++ modules/Ubuntu/Components/plugin/sortbehavior.cpp 2014-06-18 15:28:52 +0000 |
384 | @@ -19,6 +19,14 @@ |
385 | |
386 | #include "sortbehavior.h" |
387 | |
388 | +SortBehavior::SortBehavior(QObject *parent) |
389 | + : QObject(parent) |
390 | + , m_property(QString()) |
391 | + , m_order(Qt::AscendingOrder) |
392 | +{ |
393 | + |
394 | +} |
395 | + |
396 | QString |
397 | SortBehavior::property() const |
398 | { |
399 | |
400 | === modified file 'modules/Ubuntu/Components/plugin/sortbehavior.h' |
401 | --- modules/Ubuntu/Components/plugin/sortbehavior.h 2014-05-15 09:35:22 +0000 |
402 | +++ modules/Ubuntu/Components/plugin/sortbehavior.h 2014-06-18 15:28:52 +0000 |
403 | @@ -29,6 +29,8 @@ |
404 | Q_PROPERTY(Qt::SortOrder order READ order WRITE setOrder NOTIFY orderChanged) |
405 | |
406 | public: |
407 | + explicit SortBehavior(QObject *parent = 0); |
408 | + |
409 | QString property() const; |
410 | void setProperty(const QString& property); |
411 | Qt::SortOrder order() const; |
412 | |
413 | === modified file 'modules/Ubuntu/Components/plugin/uctheme.cpp' |
414 | --- modules/Ubuntu/Components/plugin/uctheme.cpp 2014-04-23 08:50:20 +0000 |
415 | +++ modules/Ubuntu/Components/plugin/uctheme.cpp 2014-06-18 15:28:52 +0000 |
416 | @@ -81,7 +81,12 @@ |
417 | QStringList pathList = envPath.split(':', QString::SkipEmptyParts); |
418 | if (pathList.isEmpty()) { |
419 | // get the default path list from generic data location, which contains |
420 | - // ~/.local/share and XDG_DATA_DIRS |
421 | + // XDG_DATA_DIRS |
422 | + QString xdgDirs = QLatin1String(getenv("XDG_DATA_DIRS")); |
423 | + if (!xdgDirs.isEmpty()) { |
424 | + pathList << xdgDirs.split(':', QString::SkipEmptyParts); |
425 | + } |
426 | + // ~/.local/share |
427 | pathList << QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation); |
428 | } |
429 | // fix folders |
430 | |
431 | === modified file 'modules/Ubuntu/Test/plugin/plugin.pro' |
432 | --- modules/Ubuntu/Test/plugin/plugin.pro 2013-12-16 17:37:48 +0000 |
433 | +++ modules/Ubuntu/Test/plugin/plugin.pro 2014-06-18 15:28:52 +0000 |
434 | @@ -1,6 +1,6 @@ |
435 | TEMPLATE = lib |
436 | TARGET = ../UbuntuTest |
437 | -QT += core-private qml qml-private quick quick-private |
438 | +QT += core-private qml qml-private quick quick-private gui-private |
439 | |
440 | equals(QT_MAJOR_VERSION, 5):lessThan(QT_MINOR_VERSION, 2) { |
441 | QT += v8-private |
442 | |
443 | === modified file 'modules/Ubuntu/Test/plugin/uctestcase.cpp' |
444 | --- modules/Ubuntu/Test/plugin/uctestcase.cpp 2014-03-28 17:02:52 +0000 |
445 | +++ modules/Ubuntu/Test/plugin/uctestcase.cpp 2014-06-18 15:28:52 +0000 |
446 | @@ -26,8 +26,11 @@ |
447 | #include <QtTest/QtTest> |
448 | #include <QtQuick/QQuickItem> |
449 | |
450 | +#include <qpa/qwindowsysteminterface.h> |
451 | + |
452 | Q_DECLARE_METATYPE(QList<QQmlError>) |
453 | |
454 | +QTouchDevice *UbuntuTestCase::m_touchDevice = 0; |
455 | /*! |
456 | * \ingroup ubuntu |
457 | * \brief UbuntuTestCase is the C++ pendant to the QML UbuntuTestCase. |
458 | @@ -60,3 +63,26 @@ |
459 | return m_spy->count(); |
460 | } |
461 | |
462 | +/*! |
463 | + * Registers a touch device if there's none registered. |
464 | + */ |
465 | +void UbuntuTestCase::registerTouchDevice() |
466 | +{ |
467 | + // check if there is any touch device registered in the system |
468 | + if (!m_touchDevice) { |
469 | + QList<const QTouchDevice*> touchDevices = QTouchDevice::devices(); |
470 | + Q_FOREACH(const QTouchDevice *device, touchDevices) { |
471 | + if (device->type() == QTouchDevice::TouchScreen) { |
472 | + m_touchDevice = const_cast<QTouchDevice*>(device); |
473 | + break; |
474 | + } |
475 | + } |
476 | + } |
477 | + // if none, register one |
478 | + if (!m_touchDevice) { |
479 | + m_touchDevice = new QTouchDevice; |
480 | + m_touchDevice->setType(QTouchDevice::TouchScreen); |
481 | + QWindowSystemInterface::registerTouchDevice(m_touchDevice); |
482 | + } |
483 | +} |
484 | + |
485 | |
486 | === modified file 'modules/Ubuntu/Test/plugin/uctestcase.h' |
487 | --- modules/Ubuntu/Test/plugin/uctestcase.h 2014-03-28 17:02:52 +0000 |
488 | +++ modules/Ubuntu/Test/plugin/uctestcase.h 2014-06-18 15:28:52 +0000 |
489 | @@ -19,10 +19,13 @@ |
490 | #ifndef UBUNTU_TEST_UBUNTUTESTCASE_H |
491 | #define UBUNTU_TEST_UBUNTUTESTCASE_H |
492 | |
493 | +#include <QtTest/QtTest> |
494 | #include <QtQuick/QQuickItem> |
495 | #include <QtQuick/QQuickView> |
496 | #include <QtTest/QSignalSpy> |
497 | |
498 | +#define CHECK_TOUCH_DEVICE() if (!checkTouchDevice(__FUNCTION__)) return |
499 | + |
500 | class UbuntuTestCase : public QQuickView |
501 | { |
502 | Q_OBJECT |
503 | @@ -40,8 +43,74 @@ |
504 | qFatal("Item '%s' found with unexpected type", qPrintable(objectName)); |
505 | qFatal("No item '%s' found", qPrintable(objectName)); |
506 | } |
507 | + |
508 | + static void registerTouchDevice(); |
509 | + |
510 | + inline static void touchPress(int touchId, QWindow *window, const QPoint &point) |
511 | + { |
512 | + CHECK_TOUCH_DEVICE(); |
513 | + QTest::touchEvent(window, m_touchDevice).press(touchId, point, window); |
514 | + } |
515 | + inline static void touchRelease(int touchId, QWindow *window, const QPoint &point) |
516 | + { |
517 | + CHECK_TOUCH_DEVICE(); |
518 | + QTest::touchEvent(window, m_touchDevice).release(touchId, point, window); |
519 | + } |
520 | + inline static void touchClick(int touchId, QWindow *window, const QPoint &point) |
521 | + { |
522 | + CHECK_TOUCH_DEVICE(); |
523 | + touchPress(touchId, window, point); |
524 | + QTest::qWait(10); |
525 | + touchRelease(touchId, window, point); |
526 | + } |
527 | + inline static void touchLongPress(int touchId, QWindow *window, const QPoint &point) |
528 | + { |
529 | + CHECK_TOUCH_DEVICE(); |
530 | + touchPress(touchId, window, point); |
531 | + QTest::qWait(800); |
532 | + } |
533 | + inline static void touchDoubleClick(int touchId, QWindow *window, const QPoint &point) |
534 | + { |
535 | + CHECK_TOUCH_DEVICE(); |
536 | + touchClick(touchId, window, point); |
537 | + QTest::qWait(10); |
538 | + touchClick(touchId, window, point); |
539 | + } |
540 | + inline static void touchMove(int touchId, QWindow *window, const QPoint &point) |
541 | + { |
542 | + CHECK_TOUCH_DEVICE(); |
543 | + QTest::touchEvent(window, m_touchDevice).move(touchId, point, window); |
544 | + } |
545 | + inline static void touchDrag(int touchId, QWindow *window, const QPoint &from, const QPoint &delta, int steps = 5) |
546 | + { |
547 | + touchPress(touchId, window, from); |
548 | + QTest::qWait(10); |
549 | + QTest::touchEvent(window, m_touchDevice).move(touchId, from, window); |
550 | + qreal stepDx = delta.x() / steps; |
551 | + qreal stepDy = delta.y() / steps; |
552 | + if (!delta.isNull()) { |
553 | + for (int i = 0; i < steps; i++) { |
554 | + QTest::qWait(10); |
555 | + QTest::touchEvent(window, m_touchDevice).move(touchId, from + QPoint(i * stepDx, i * stepDy), window); |
556 | + } |
557 | + } |
558 | + QTest::qWait(10); |
559 | + touchRelease(touchId, window, from + QPoint(stepDx, stepDy)); |
560 | + } |
561 | + |
562 | + |
563 | private: |
564 | QSignalSpy* m_spy; |
565 | + static QTouchDevice *m_touchDevice; |
566 | + |
567 | + static inline bool checkTouchDevice(const char *func) |
568 | + { |
569 | + if (!m_touchDevice) { |
570 | + qWarning() << QString("No touch device registered. Register one using registerTouchDevice() before using %1").arg(func); |
571 | + return false; |
572 | + } |
573 | + return true; |
574 | + } |
575 | }; |
576 | |
577 | #endif // UBUNTU_TEST_UBUNTUTESTCASE_H |
578 | |
579 | === added file 'push_to_phone.sh' |
580 | --- push_to_phone.sh 1970-01-01 00:00:00 +0000 |
581 | +++ push_to_phone.sh 2014-06-18 15:28:52 +0000 |
582 | @@ -0,0 +1,41 @@ |
583 | +#!/bin/sh |
584 | +# |
585 | +# Copyright 2014 Canonical Ltd. |
586 | +# |
587 | +# This program is free software; you can redistribute it and/or modify |
588 | +# it under the terms of the GNU Lesser General Public License as published by |
589 | +# the Free Software Foundation; version 3. |
590 | +# |
591 | +# This program is distributed in the hope that it will be useful, |
592 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
593 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
594 | +# GNU Lesser General Public License for more details. |
595 | +# |
596 | +# You should have received a copy of the GNU Lesser General Public License |
597 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
598 | +# |
599 | +# Author: Christian Dywan <christian.dywan@canonical.com> |
600 | + |
601 | +ARCH=arm-linux-gnueabihf |
602 | + |
603 | +# Make the image writable |
604 | +phablet-config writable-image || exit 1 |
605 | +# Copy selectively to avoid pushing binaries (arch conflict) and sources (unneeded) |
606 | +cd modules || exit 1 |
607 | +for i in $(ls Ubuntu/Components/*.qml 2>/dev/null); do |
608 | + echo modules/$i '->' /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/ |
609 | + adb push $i /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/ |
610 | +done |
611 | +for i in $(ls Ubuntu/Components/*.js 2>/dev/null); do |
612 | + echo modules/$i '->' /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/ |
613 | + adb push $i /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/ |
614 | +done |
615 | +cd .. |
616 | +for i in ListItems Pickers Popups Colors Styles Themes artwork; do |
617 | + adb push modules/Ubuntu/Components/$i/ /usr/lib/$ARCH/qt5/qml/Ubuntu/Components/$i || exit 1 |
618 | +done |
619 | +# Autopilot tests should always match the Toolkit |
620 | +adb push tests/autopilot/ubuntuuitoolkit/ /usr/lib/python2.7/dist-packages/ubuntuuitoolkit || exit 1 |
621 | +adb push examples/ubuntu-ui-toolkit-gallery/ /usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery || exit 1 |
622 | +# For launching the gallery easily |
623 | +adb push examples/ubuntu-ui-toolkit-gallery/*.desktop /usr/share/applications/ || exit 1 |
624 | |
625 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py' |
626 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-05-29 16:14:55 +0000 |
627 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/_flickable.py 2014-06-18 15:28:52 +0000 |
628 | @@ -40,6 +40,16 @@ |
629 | |
630 | class Scrollable(_common.UbuntuUIToolkitCustomProxyObjectBase): |
631 | |
632 | + @autopilot_logging.log_action(logger.info) |
633 | + def is_child_visible(self, child): |
634 | + """Determine if the child is visible. |
635 | + |
636 | + A child is visible if no scrolling is needed to reveal it. |
637 | + |
638 | + """ |
639 | + containers = self._get_containers() |
640 | + return self._is_child_visible(child, containers) |
641 | + |
642 | def _get_containers(self): |
643 | """Return a list with the containers to take into account when swiping. |
644 | |
645 | |
646 | === modified file 'tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py' |
647 | --- tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py 2014-04-25 18:39:51 +0000 |
648 | +++ tests/autopilot/ubuntuuitoolkit/_custom_proxy_objects/listitems.py 2014-06-18 15:28:52 +0000 |
649 | @@ -42,6 +42,9 @@ |
650 | def swipe_to_delete(self, direction='right'): |
651 | """Swipe the item in a specific direction.""" |
652 | if self.removable: |
653 | + # Swipe to delete is always right to left |
654 | + if direction == 'left': |
655 | + direction = 'right' |
656 | self._drag_pointing_device_to_delete(direction) |
657 | if self.confirmRemoval: |
658 | self.waitingConfirmationForRemoval.wait_for(True) |
659 | @@ -52,14 +55,19 @@ |
660 | 'The item "{0}" is not removable'.format(self.objectName)) |
661 | |
662 | def _drag_pointing_device_to_delete(self, direction): |
663 | - x, y, w, h = self.globalRect |
664 | - tx = x + (w // 8) |
665 | - ty = y + (h // 2) |
666 | + x, y, width, height = self.globalRect |
667 | + left_x = x + (width * 0.2) |
668 | + right_x = x + (width * 0.8) |
669 | + start_y = stop_y = y + (height // 2) |
670 | |
671 | if direction == 'right': |
672 | - self.pointing_device.drag(tx, ty, w, ty) |
673 | + start_x = left_x |
674 | + stop_x = right_x |
675 | + self.pointing_device.drag(start_x, start_y, stop_x, stop_y) |
676 | elif direction == 'left': |
677 | - self.pointing_device.drag(w - (w*0.1), ty, x, ty) |
678 | + start_x = right_x |
679 | + stop_x = left_x |
680 | + self.pointing_device.drag(start_x, start_y, stop_x, stop_y) |
681 | else: |
682 | raise _common.ToolkitException( |
683 | 'Invalid direction "{0}" used on swipe to delete function' |
684 | |
685 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/__init__.py' |
686 | --- tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-05-29 16:17:56 +0000 |
687 | +++ tests/autopilot/ubuntuuitoolkit/tests/__init__.py 2014-06-18 15:28:52 +0000 |
688 | @@ -1,6 +1,6 @@ |
689 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
690 | # |
691 | -# Copyright (C) 2012, 2013 Canonical Ltd. |
692 | +# Copyright (C) 2012, 2013, 2014 Canonical Ltd. |
693 | # |
694 | # This program is free software; you can redistribute it and/or modify |
695 | # it under the terms of the GNU Lesser General Public License as published by |
696 | @@ -142,91 +142,6 @@ |
697 | def main_view(self): |
698 | return self.app.select_single(emulators.MainView) |
699 | |
700 | - def checkListItem(self, itemText): |
701 | - item = self.getListItem(itemText) |
702 | - self.assertThat(item, Not(Is(None))) |
703 | - |
704 | - def getListItem(self, itemText): |
705 | - # XXX We shouldn't access the elements by text, because that's likely |
706 | - # to change often and might be translated. We should always use the |
707 | - # objectName instead. --elopio - 2013-06-26216 |
708 | - return self.main_view.select_single("Standard", text=itemText) |
709 | - |
710 | - def getWidgetLoaderAndListView(self): |
711 | - contentLoader = self.main_view.select_single( |
712 | - "QQuickLoader", objectName="contentLoader") |
713 | - listView = self.main_view.select_single( |
714 | - "QQuickListView", objectName="widgetList") |
715 | - self.assertThat(listView, Not(Is(None))) |
716 | - self.assertThat(listView.visible, Eventually(Equals(True))) |
717 | - return (contentLoader, listView) |
718 | - |
719 | - def loadItem(self, item): |
720 | - self.selectItem(item) |
721 | - contentLoader = self.main_view.select_single( |
722 | - "QQuickLoader", objectName="contentLoader") |
723 | - self.assertThat(contentLoader.progress, Eventually(Equals(1.0))) |
724 | - loadedPage = self.getListItem(item) |
725 | - self.assertThat(loadedPage, Not(Is(None))) |
726 | - #loadedPage is not a page, it is the list item which goes in |
727 | - #background when the item is selected, which changes the visible |
728 | - #property of item in list itself to False. So followin check |
729 | - #fails on Nexus 4. Commenting it for now. |
730 | - #self.assertThat(loadedPage.visible, Eventually(Equals(True))) |
731 | - |
732 | - def drag(self, itemText, itemTextTo): |
733 | - item = self.getListItem(itemText) |
734 | - itemTo = self.getListItem(itemTextTo) |
735 | - |
736 | - self.pointing_device.move_to_object(item) |
737 | - self.pointing_device.press() |
738 | - self.pointing_device.move_to_object(itemTo) |
739 | - self.pointing_device.release() |
740 | - |
741 | - def reveal_item_by_flick(self, item, flickable, direction): |
742 | - x1, y1, w1, h1 = item.globalRect |
743 | - x2, y2, w2, h2 = flickable.globalRect |
744 | - if direction is FlickDirection.UP: |
745 | - while y1 + h1 > y2 + h2: |
746 | - self.flick(flickable, direction) |
747 | - x1, y1, w1, h1 = item.globalRect |
748 | - elif direction is FlickDirection.DOWN: |
749 | - while y1 < y2: |
750 | - self.flick(flickable, direction) |
751 | - x1, y1, w1, h1 = item.globalRect |
752 | - |
753 | - def flick(self, flickable, direction, delta=40): |
754 | - """This funcito flicks the page from middle to the given direction.""" |
755 | - x, y, w, h = flickable.globalRect |
756 | - if direction == FlickDirection.UP: |
757 | - self.pointing_device.drag(x + w / 2, y + h / 2, x + w / 2, |
758 | - y + h / 2 - delta) |
759 | - flickable.flicking.wait_for(False) |
760 | - elif direction == FlickDirection.DOWN: |
761 | - self.pointing_device.drag(x + w / 2, y + h / 2, x + w / 2, |
762 | - y + h / 2 + delta) |
763 | - flickable.flicking.wait_for(False) |
764 | - else: |
765 | - raise ValueError("Invalid direction or not implementd yet") |
766 | - |
767 | - def selectItem(self, itemText): |
768 | - item = self.getListItem(itemText) |
769 | - x1, y1, w1, h1 = item.globalRect |
770 | - x2, y2, w2, h2 = self.main_view.globalRect |
771 | - |
772 | - orientationHelper = self.getOrientationHelper() |
773 | - rot = orientationHelper.rotation |
774 | - scrollTo = h2 / 2 - (y1 - h2 - h1) |
775 | - if rot == 0.0 and y1 > h2: |
776 | - self.pointing_device.drag(w2 / 2, h2 / 2, w2 / 2, scrollTo) |
777 | - |
778 | - self.assertThat(item.selected, Eventually(Equals(False))) |
779 | - |
780 | - self.pointing_device.move_to_object(item) |
781 | - self.pointing_device.click() |
782 | - |
783 | - self.assertThat(item.selected, Eventually(Equals(True))) |
784 | - |
785 | def getOrientationHelper(self): |
786 | orientationHelper = self.main_view.select_many( |
787 | "OrientationHelper")[0] |
788 | @@ -249,29 +164,3 @@ |
789 | obj = self.getObject(objectName) |
790 | self.pointing_device.move_to_object(obj) |
791 | self.pointing_device.click() |
792 | - |
793 | - def mousePress(self, objectName): |
794 | - obj = self.getObject(objectName) |
795 | - self.pointing_device.move_to_object(obj) |
796 | - self.pointing_device.press() |
797 | - |
798 | - def mouseRelease(self): |
799 | - self.pointing_device.release() |
800 | - |
801 | - def type_string(self, string): |
802 | - self.keyboard.type(string) |
803 | - |
804 | - def type_key(self, key): |
805 | - self.keyboard.key(key) |
806 | - |
807 | - def tap_clearButton(self, objectName): |
808 | - textField = self.getObject(objectName) |
809 | - self.assertIsNotNone(textField) |
810 | - self.pointing_device.click_object(textField) |
811 | - self.assertThat(textField.focus, Eventually(Equals(True))) |
812 | - self.assertThat(textField.hasClearButton, Eventually(Equals(True))) |
813 | - btn = textField.select_single("AbstractButton") |
814 | - self.assertIsNotNone(btn) |
815 | - self.assertThat(btn.visible, Eventually(Equals(True))) |
816 | - self.pointing_device.click_object(btn) |
817 | - self.assertThat(btn.pressed, Eventually(Equals(False))) |
818 | |
819 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py' |
820 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-05-19 09:46:05 +0000 |
821 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_flickable.py 2014-06-18 15:28:52 +0000 |
822 | @@ -14,53 +14,16 @@ |
823 | # You should have received a copy of the GNU Lesser General Public License |
824 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
825 | |
826 | +import os |
827 | |
828 | import testtools |
829 | - |
830 | import ubuntuuitoolkit |
831 | -from ubuntuuitoolkit import tests |
832 | +from ubuntuuitoolkit import fixture_setup, tests |
833 | from ubuntuuitoolkit._custom_proxy_objects import _common |
834 | |
835 | |
836 | class FlickableTestCase(testtools.TestCase): |
837 | |
838 | - def test_get_unity_top_container(self): |
839 | - """Test that we can get the top cointainer in Unity.""" |
840 | - # This tests bug http://pad.lv/1314390 |
841 | - # On Unity, the top container is not the first child as it is in all |
842 | - # the apps that have a MainView. This makes the first implementation of |
843 | - # _get_top_container fail. Instead of going from the top looking for |
844 | - # a container, we should start from the flickable until we find the |
845 | - # top-most container. |
846 | - # FIXME we are faking the QML tree because we have no way to launch |
847 | - # the app with a tree like the one in Unity8. kalikiana has a branch |
848 | - # with an alternate launcher that will let us clean this test. |
849 | - # --elopio - 2014-05-15. |
850 | - RootClass = type('obj', (object,), {'id': 'root'}) |
851 | - mock_root_instance = RootClass() |
852 | - # We consider a container is an object with a globalRect. |
853 | - MockNonContainerClass = type('obj', (object,), {}) |
854 | - mock_non_container = MockNonContainerClass() |
855 | - MockContainerClass = type( |
856 | - 'obj', (object,), {'id': 'container', 'globalRect': 'dummy'}) |
857 | - mock_container = MockContainerClass() |
858 | - mock_container.get_parent = lambda: mock_root_instance |
859 | - |
860 | - # The root instance has two children. This exposes the bug. |
861 | - mock_root_instance.get_children = lambda: [ |
862 | - mock_non_container, mock_container] |
863 | - |
864 | - dummy_state = {'id': '10'} |
865 | - flickable = ubuntuuitoolkit.QQuickFlickable( |
866 | - dummy_state, '/dummy'.encode(), 'dummy') |
867 | - |
868 | - flickable.get_root_instance = lambda: mock_root_instance |
869 | - # The top container of the flickable is its immediate parent. |
870 | - flickable.get_parent = lambda: mock_container |
871 | - |
872 | - top_container = flickable._get_top_container() |
873 | - self.assertEqual(top_container, mock_container) |
874 | - |
875 | def test_is_flickable_with_flicking_property_must_return_true(self): |
876 | """is_flickable returns True if flickable property exists.""" |
877 | dummy_id = (0, 0) |
878 | @@ -68,6 +31,7 @@ |
879 | state_with_flicking = {'id': dummy_id, 'flicking': dummy_flicking} |
880 | element = _common.UbuntuUIToolkitCustomProxyObjectBase( |
881 | state_with_flicking, '/dummy'.encode(), 'dummy') |
882 | + |
883 | with element.no_automatic_refreshing(): |
884 | self.assertTrue(element.is_flickable()) |
885 | |
886 | @@ -77,6 +41,7 @@ |
887 | state_without_flicking = {'id': dummy_id} |
888 | element = _common.UbuntuUIToolkitCustomProxyObjectBase( |
889 | state_without_flicking, '/dummy'.encode(), 'dummy') |
890 | + |
891 | with element.no_automatic_refreshing(): |
892 | self.assertFalse(element.is_flickable()) |
893 | |
894 | @@ -199,3 +164,61 @@ |
895 | |
896 | self.pointing_device.click_object(topButton) |
897 | self.assertEqual(self.label.text, 'topButton') |
898 | + |
899 | + |
900 | +class UnityFlickableTestCase(tests.QMLStringAppTestCase): |
901 | + |
902 | + test_qml = (""" |
903 | +import QtQuick 2.0 |
904 | +import Ubuntu.Components 0.1 |
905 | + |
906 | +MainView { |
907 | + width: units.gu(48) |
908 | + height: units.gu(60) |
909 | + |
910 | + Flickable { |
911 | + objectName: 'testFlickable' |
912 | + width: 200; height: 200 |
913 | + contentWidth: image.width; contentHeight: image.height |
914 | + } |
915 | +} |
916 | +""") |
917 | + |
918 | + def launch_application(self): |
919 | + fake_application = fixture_setup.FakeApplication( |
920 | + qml_file_contents=self.test_qml) |
921 | + self.useFixture(fake_application) |
922 | + |
923 | + self.app = self.launch_test_application( |
924 | + self.get_alternate_launch_command(), |
925 | + '-engine', |
926 | + '-I', tests._get_module_include_path(), |
927 | + fake_application.qml_file_path, |
928 | + '--desktop_file_hint={0}'.format( |
929 | + fake_application.desktop_file_path), |
930 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase, |
931 | + app_type='qt') |
932 | + |
933 | + def get_alternate_launch_command(self): |
934 | + root = tests.get_path_to_source_root() |
935 | + path_to_local_launcher = os.path.join( |
936 | + root, 'tests', 'launcher', 'launcher') |
937 | + if os.path.exists(path_to_local_launcher): |
938 | + return path_to_local_launcher |
939 | + else: |
940 | + path_to_installed_launcher = os.path.join( |
941 | + '/', 'usr', 'lib', 'ubuntu-ui-toolkit', 'launcher') |
942 | + return path_to_installed_launcher |
943 | + |
944 | + def test_get_unity_top_container(self): |
945 | + """Test that we can get the top cointainer in Unity.""" |
946 | + # This tests bug http://pad.lv/1314390 |
947 | + # On Unity, the top container is not the first child as it is in all |
948 | + # the apps that have a MainView. This makes the first implementation of |
949 | + # _get_top_container fail. Instead of going from the top looking for |
950 | + # a container, we should start from the flickable until we find the |
951 | + # top-most container. |
952 | + test_flickable = self.app.select_single( |
953 | + ubuntuuitoolkit.QQuickFlickable, objectName='testFlickable') |
954 | + top_container = test_flickable._get_top_container() |
955 | + self.assertIsInstance(top_container, ubuntuuitoolkit.MainView) |
956 | |
957 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py' |
958 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-05-29 18:18:43 +0000 |
959 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_header.py 2014-06-18 15:28:52 +0000 |
960 | @@ -18,6 +18,8 @@ |
961 | |
962 | import ubuntuuitoolkit |
963 | from ubuntuuitoolkit import tests |
964 | +from testtools.matchers import Equals |
965 | +from autopilot.matchers import Eventually |
966 | |
967 | |
968 | class HeaderTestCase(tests.QMLStringAppTestCase): |
969 | @@ -32,73 +34,93 @@ |
970 | |
971 | useDeprecatedToolbar: false |
972 | |
973 | - Page { |
974 | - title: "Test title" |
975 | - |
976 | - Flickable { |
977 | - anchors.fill: parent |
978 | - contentHeight: units.gu(120) |
979 | - objectName: "header_test_flickable" |
980 | - |
981 | - Label { |
982 | - id: label |
983 | - objectName: "clicked_label" |
984 | - anchors { |
985 | - top: parent.top |
986 | - horizontalCenter: parent.horizontalCenter |
987 | - } |
988 | - text: "No button clicked." |
989 | - } |
990 | - |
991 | - Button { |
992 | - objectName: "hide_actions_button" |
993 | - anchors { |
994 | - top: label.bottom |
995 | - topMargin: units.gu(5) |
996 | - horizontalCenter: parent.horizontalCenter |
997 | - } |
998 | - text: "Hide some actions" |
999 | - onClicked: { |
1000 | - cancelAction.visible = false; |
1001 | - for (var i=0; i < 3; i++) { |
1002 | - buttonRepeater.itemAt(i).action.visible = false; |
1003 | - } |
1004 | - // only three of five visible actions left |
1005 | - } |
1006 | - } |
1007 | - Label { |
1008 | - id: endLabel |
1009 | - objectName: "end_label" |
1010 | - anchors { |
1011 | - bottom: parent.bottom |
1012 | - horizontalCenter: parent.horizontalCenter |
1013 | - } |
1014 | - text: "The end." |
1015 | - } |
1016 | - } |
1017 | - |
1018 | - tools: ToolbarItems { |
1019 | - back: ToolbarButton { |
1020 | - action: Action { |
1021 | - id: cancelAction |
1022 | - iconName: "cancel" |
1023 | - text: "cancel" |
1024 | - onTriggered: label.text = "Cancel button clicked." |
1025 | - } |
1026 | - } |
1027 | - Repeater { |
1028 | - id: buttonRepeater |
1029 | - model: 5 |
1030 | + PageStack { |
1031 | + id: stack |
1032 | + Component.onCompleted: stack.push(page) |
1033 | + |
1034 | + Page { |
1035 | + title: "Test title" |
1036 | + id: page |
1037 | + |
1038 | + Flickable { |
1039 | + anchors.fill: parent |
1040 | + contentHeight: units.gu(120) |
1041 | + objectName: "header_test_flickable" |
1042 | + |
1043 | + Label { |
1044 | + id: label |
1045 | + objectName: "clicked_label" |
1046 | + anchors { |
1047 | + top: parent.top |
1048 | + horizontalCenter: parent.horizontalCenter |
1049 | + } |
1050 | + text: "No button clicked." |
1051 | + } |
1052 | + |
1053 | + Button { |
1054 | + objectName: "hide_actions_button" |
1055 | + anchors { |
1056 | + top: label.bottom |
1057 | + topMargin: units.gu(5) |
1058 | + horizontalCenter: parent.horizontalCenter |
1059 | + } |
1060 | + text: "Hide some actions" |
1061 | + onClicked: { |
1062 | + cancelAction.visible = false; |
1063 | + for (var i=0; i < 3; i++) { |
1064 | + buttonRepeater.itemAt(i).action.visible = false; |
1065 | + } |
1066 | + // only three of five visible actions left |
1067 | + } |
1068 | + } |
1069 | + Label { |
1070 | + id: endLabel |
1071 | + objectName: "end_label" |
1072 | + anchors { |
1073 | + bottom: parent.bottom |
1074 | + horizontalCenter: parent.horizontalCenter |
1075 | + } |
1076 | + text: "The end." |
1077 | + } |
1078 | + } |
1079 | + |
1080 | + tools: ToolbarItems { |
1081 | + back: ToolbarButton { |
1082 | + action: Action { |
1083 | + id: cancelAction |
1084 | + iconName: "cancel" |
1085 | + text: "cancel" |
1086 | + onTriggered: label.text = "Cancel button clicked." |
1087 | + } |
1088 | + } |
1089 | + Repeater { |
1090 | + id: buttonRepeater |
1091 | + model: 5 |
1092 | + ToolbarButton { |
1093 | + action: Action { |
1094 | + objectName: "action" + index |
1095 | + text: "text " + index |
1096 | + iconName: "add" |
1097 | + onTriggered: { |
1098 | + label.text = "Button "+index+" clicked."; |
1099 | + } |
1100 | + } |
1101 | + } |
1102 | + } |
1103 | ToolbarButton { |
1104 | action: Action { |
1105 | - objectName: "action" + index |
1106 | - text: "text " + index |
1107 | + objectName: "pushStackAction" |
1108 | + text: "Push page" |
1109 | iconName: "add" |
1110 | - onTriggered: label.text = "Button "+index+" clicked." |
1111 | + onTriggered: stack.push(pushMe) |
1112 | } |
1113 | } |
1114 | } |
1115 | } |
1116 | + Page { |
1117 | + title: "Pushed page" |
1118 | + id: pushMe |
1119 | + } |
1120 | } |
1121 | } |
1122 | """) |
1123 | @@ -125,6 +147,13 @@ |
1124 | self.header.click_action_button('action3') |
1125 | self.assertEqual(self.label.text, 'Button 3 clicked.') |
1126 | |
1127 | + def test_click_header_overflow_action_closes_popover_bug1326963(self): |
1128 | + overflow_popover = self.main_view.select_single( |
1129 | + 'Popover', |
1130 | + objectName='actions_overflow_popover') |
1131 | + self.header.click_action_button('pushStackAction') |
1132 | + self.assertThat(overflow_popover.visible, Eventually(Equals(False))) |
1133 | + |
1134 | def test_click_unexisting_header_action_button(self): |
1135 | error = self.assertRaises( |
1136 | ubuntuuitoolkit.ToolkitException, self.header.click_action_button, |
1137 | |
1138 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py' |
1139 | --- tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2014-04-25 18:39:51 +0000 |
1140 | +++ tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitems.py 2014-06-18 15:28:52 +0000 |
1141 | @@ -120,6 +120,7 @@ |
1142 | self.assertTrue(self._item.waitingConfirmationForRemoval) |
1143 | |
1144 | def test_swipe_item_to_left(self): |
1145 | + # This will do a right to left swipe behind the scenes |
1146 | self._item.swipe_to_delete('left') |
1147 | self.assertTrue(self._item.waitingConfirmationForRemoval) |
1148 | |
1149 | @@ -134,6 +135,7 @@ |
1150 | self.assertFalse(self._item.exists()) |
1151 | |
1152 | def test_delete_item_moving_left(self): |
1153 | + # This will do a right to left swipe behind the scenes |
1154 | self._item.swipe_to_delete('left') |
1155 | self._item.confirm_removal() |
1156 | self.assertFalse(self._item.exists()) |
1157 | |
1158 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py' |
1159 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2013-10-24 11:01:03 +0000 |
1160 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/__init__.py 2014-06-18 15:28:52 +0000 |
1161 | @@ -1,6 +1,6 @@ |
1162 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1163 | # |
1164 | -# Copyright (C) 2012, 2013 Canonical Ltd. |
1165 | +# Copyright (C) 2012, 2013, 2014 Canonical Ltd. |
1166 | # |
1167 | # This program is free software; you can redistribute it and/or modify |
1168 | # it under the terms of the GNU Lesser General Public License as published by |
1169 | @@ -19,10 +19,10 @@ |
1170 | import os |
1171 | import shutil |
1172 | |
1173 | -from ubuntuuitoolkit import tests |
1174 | - |
1175 | - |
1176 | -class GalleryTestCase(tests.QMLFileAppTestCase): |
1177 | +import ubuntuuitoolkit |
1178 | + |
1179 | + |
1180 | +class GalleryTestCase(ubuntuuitoolkit.tests.QMLFileAppTestCase): |
1181 | """Base class for gallery test cases.""" |
1182 | |
1183 | local_desktop_file_path = None |
1184 | @@ -39,7 +39,7 @@ |
1185 | |
1186 | def _get_path_to_gallery_source(self): |
1187 | return os.path.join( |
1188 | - tests.get_path_to_source_root(), 'examples', |
1189 | + ubuntuuitoolkit.tests.get_path_to_source_root(), 'examples', |
1190 | 'ubuntu-ui-toolkit-gallery') |
1191 | |
1192 | def _application_source_exists(self): |
1193 | @@ -58,7 +58,8 @@ |
1194 | self.test_source_path, |
1195 | 'ubuntu-ui-toolkit-gallery.desktop') |
1196 | if self._application_source_exists(): |
1197 | - local_desktop_file_dir = tests.get_local_desktop_file_directory() |
1198 | + local_desktop_file_dir = ( |
1199 | + ubuntuuitoolkit.tests.get_local_desktop_file_directory()) |
1200 | if not os.path.exists(local_desktop_file_dir): |
1201 | os.makedirs(local_desktop_file_dir) |
1202 | local_desktop_file_path = os.path.join( |
1203 | @@ -71,6 +72,19 @@ |
1204 | else: |
1205 | return desktop_file_path |
1206 | |
1207 | + def open_page(self, page): |
1208 | + """Open a page of the widget gallery. |
1209 | + |
1210 | + :param page: The objectName of the element in the index list that opens |
1211 | + the page. |
1212 | + |
1213 | + """ |
1214 | + list_view = self.main_view.select_single( |
1215 | + ubuntuuitoolkit.QQuickListView, objectName="widgetList") |
1216 | + list_view.click_element(page) |
1217 | + element = self.main_view.select_single('Standard', objectName=page) |
1218 | + element.selected.wait_for(True) |
1219 | + |
1220 | def tearDown(self): |
1221 | super(GalleryTestCase, self).tearDown() |
1222 | # We can't delete the desktop file before we close the application, |
1223 | |
1224 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py' |
1225 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-02-11 01:55:49 +0000 |
1226 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_buttons.py 2014-06-18 15:28:52 +0000 |
1227 | @@ -45,9 +45,7 @@ |
1228 | ] |
1229 | |
1230 | def test_buttons(self): |
1231 | - item = "Buttons" |
1232 | - self.loadItem(item) |
1233 | - self.checkPageHeader(item) |
1234 | + self.open_page('buttonsElement') |
1235 | |
1236 | button = self.app.select_single(objectName=self.button_name) |
1237 | self.assertIsNot(button, None) |
1238 | |
1239 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py' |
1240 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-05-26 12:37:32 +0000 |
1241 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_gallery.py 2014-06-18 15:28:52 +0000 |
1242 | @@ -1,6 +1,6 @@ |
1243 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1244 | # |
1245 | -# Copyright (C) 2012, 2013 Canonical Ltd. |
1246 | +# Copyright (C) 2012, 2013, 2014 Canonical Ltd. |
1247 | # |
1248 | # This program is free software; you can redistribute it and/or modify |
1249 | # it under the terms of the GNU Lesser General Public License as published by |
1250 | @@ -16,32 +16,19 @@ |
1251 | |
1252 | """Tests for the Ubuntu UI Toolkit Gallery""" |
1253 | |
1254 | -from autopilot.matchers import Eventually |
1255 | -from testtools.matchers import Is, Not, Equals |
1256 | - |
1257 | -from ubuntuuitoolkit import emulators |
1258 | +import ubuntuuitoolkit |
1259 | from ubuntuuitoolkit.tests import gallery |
1260 | |
1261 | |
1262 | -class GenericTests(gallery.GalleryTestCase): |
1263 | +class GalleryAppTestCase(gallery.GalleryTestCase): |
1264 | """Generic tests for the Gallery""" |
1265 | |
1266 | - def test_0_can_select_mainwindow(self): |
1267 | - """Must be able to select the main window.""" |
1268 | - |
1269 | - rootItem = self.main_view |
1270 | - self.assertThat(rootItem, Not(Is(None))) |
1271 | - self.assertThat(rootItem.visible, Eventually(Equals(True))) |
1272 | - |
1273 | - def test_navigation(self): |
1274 | - item = "Navigation" |
1275 | - self.loadItem(item) |
1276 | - self.checkPageHeader(item) |
1277 | + def test_select_main_view_must_return_main_window_emulator(self): |
1278 | + main_view = self.main_view |
1279 | + self.assertIsInstance(main_view, ubuntuuitoolkit.MainView) |
1280 | |
1281 | def test_slider(self): |
1282 | - item = "Slider" |
1283 | - self.loadItem(item) |
1284 | - self.checkPageHeader(item) |
1285 | + self.open_page('slidersElement') |
1286 | |
1287 | item_data = [ |
1288 | ["slider_standard"], |
1289 | @@ -57,9 +44,7 @@ |
1290 | # TODO: move slider value |
1291 | |
1292 | def test_progress_and_activity(self): |
1293 | - item = "Progress and activity" |
1294 | - self.loadItem(item) |
1295 | - self.checkPageHeader(item) |
1296 | + self.open_page('progressBarsElement') |
1297 | |
1298 | item_data = [ |
1299 | ["progressbar_standard"], |
1300 | @@ -79,9 +64,7 @@ |
1301 | # FIXME: https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1308979 |
1302 | return |
1303 | |
1304 | - item = "Ubuntu Shape" |
1305 | - self.loadItem(item) |
1306 | - self.checkPageHeader(item) |
1307 | + self.open_page('ubuntuShapesElement') |
1308 | |
1309 | item_data = [ |
1310 | ["ubuntushape_color_hex"], |
1311 | @@ -115,12 +98,9 @@ |
1312 | ] |
1313 | |
1314 | def test_open_page(self): |
1315 | - list_view = self.main_view.select_single( |
1316 | - emulators.QQuickListView, objectName="widgetList") |
1317 | - list_view.click_element(self.element_name) |
1318 | + self.open_page(self.element_name) |
1319 | element = self.main_view.select_single( |
1320 | 'Standard', objectName=self.element_name) |
1321 | - element.selected.wait_for(True) |
1322 | self.checkPageHeader(element.text) |
1323 | if self.template_name == 'textinputsTemplate': |
1324 | page_type = 'TextInputs' |
1325 | |
1326 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py' |
1327 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-05-23 09:50:42 +0000 |
1328 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_optionselector.py 2014-06-18 15:28:52 +0000 |
1329 | @@ -24,9 +24,7 @@ |
1330 | |
1331 | def setUp(self): |
1332 | super(OptionSelectorTestCase, self).setUp() |
1333 | - item = "Option Selector" |
1334 | - self.loadItem(item) |
1335 | - self.checkPageHeader(item) |
1336 | + self.open_page('optionSelectorsElement') |
1337 | |
1338 | def test_select_option_from_collapsed_optionselector(self): |
1339 | collapsed_option_selector = self.main_view.select_single( |
1340 | |
1341 | === added file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py' |
1342 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 1970-01-01 00:00:00 +0000 |
1343 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_scrollbar.py 2014-06-18 15:28:52 +0000 |
1344 | @@ -0,0 +1,63 @@ |
1345 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1346 | +# |
1347 | +# Copyright (C) 2014 Canonical Ltd. |
1348 | +# |
1349 | +# This program is free software; you can redistribute it and/or modify |
1350 | +# it under the terms of the GNU Lesser General Public License as published by |
1351 | +# the Free Software Foundation; version 3. |
1352 | +# |
1353 | +# This program is distributed in the hope that it will be useful, |
1354 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1355 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1356 | +# GNU Lesser General Public License for more details. |
1357 | +# |
1358 | +# You should have received a copy of the GNU Lesser General Public License |
1359 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1360 | + |
1361 | +from autopilot import platform |
1362 | + |
1363 | +from ubuntuuitoolkit.tests import gallery |
1364 | + |
1365 | + |
1366 | +class ScrollBarTestCase(gallery.GalleryTestCase): |
1367 | + |
1368 | + def setUp(self): |
1369 | + super(ScrollBarTestCase, self).setUp() |
1370 | + self.open_page('navigationElement') |
1371 | + self.scrollbar = self.main_view.wait_select_single( |
1372 | + 'Scrollbar', objectName="TemplateScrollbar") |
1373 | + |
1374 | + def move_mouse_to_thumb(self): |
1375 | + # TODO we need a helper to move the interactive thumb. |
1376 | + # --elopio 2014-05-06 |
1377 | + thumb = self.scrollbar.select_single( |
1378 | + objectName='interactiveScrollbarThumb') |
1379 | + self.pointing_device.move_to_object(thumb) |
1380 | + |
1381 | + def test_scrollbar_must_start_without_interactive_thumb(self): |
1382 | + self.assertEqual(self.scrollbar.interactive, False) |
1383 | + |
1384 | + def test_move_mouse_to_thumb_must_make_scrollbar_interactive(self): |
1385 | + if platform.model() != 'Desktop': |
1386 | + self.skipTest( |
1387 | + 'The interactive thumb is activated by the move of a mouse') |
1388 | + |
1389 | + self.move_mouse_to_thumb() |
1390 | + |
1391 | + self.assertEqual(self.scrollbar.interactive, True) |
1392 | + |
1393 | + def test_drag_thumb_down_must_make_bottom_visible(self): |
1394 | + if platform.model() != 'Desktop': |
1395 | + self.skipTest( |
1396 | + 'The interactive thumb is activated by the move of a mouse') |
1397 | + |
1398 | + bottom_section = self.main_view.select_single(className='PageStack') |
1399 | + flickable = self.main_view.select_single( |
1400 | + 'QQuickFlickable', objectName='TemplateFlickable') |
1401 | + self.assertEqual(flickable.is_child_visible(bottom_section), False) |
1402 | + |
1403 | + self.move_mouse_to_thumb() |
1404 | + x, y = self.pointing_device.position() |
1405 | + self.pointing_device.drag(x, y, x, self.main_view.height) |
1406 | + |
1407 | + self.assertEqual(flickable.is_child_visible(bottom_section), True) |
1408 | |
1409 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py' |
1410 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-04-30 09:40:17 +0000 |
1411 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_textinput.py 2014-06-18 15:28:52 +0000 |
1412 | @@ -54,9 +54,7 @@ |
1413 | # Apply the user locale from the environment |
1414 | # The UITK does the same, so the test must be localized |
1415 | locale.setlocale(locale.LC_ALL, "") |
1416 | - item = 'Text Field' |
1417 | - self.loadItem(item) |
1418 | - self.checkPageHeader(item) |
1419 | + self.open_page('textinputsElement') |
1420 | |
1421 | def test_write_on_textfield_must_update_text(self): |
1422 | textfield = self.main_view.select_single( |
1423 | @@ -78,9 +76,7 @@ |
1424 | |
1425 | def setUp(self): |
1426 | super(DisabledTextInputTestCase, self).setUp() |
1427 | - item = 'Text Field' |
1428 | - self.loadItem(item) |
1429 | - self.checkPageHeader(item) |
1430 | + self.open_page('textinputsElement') |
1431 | |
1432 | def test_textfield_disabled(self): |
1433 | textfield_disabled = self.main_view.select_single( |
1434 | |
1435 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py' |
1436 | --- tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2013-11-01 15:15:30 +0000 |
1437 | +++ tests/autopilot/ubuntuuitoolkit/tests/gallery/test_toggles.py 2014-06-18 15:28:52 +0000 |
1438 | @@ -35,10 +35,7 @@ |
1439 | |
1440 | def setUp(self): |
1441 | super(EnabledTogglesTestCase, self).setUp() |
1442 | - item = "Toggles" |
1443 | - self.checkListItem(item) |
1444 | - self.loadItem(item) |
1445 | - self.checkPageHeader(item) |
1446 | + self.open_page('togglesElement') |
1447 | |
1448 | def test_change_toggles_state(self): |
1449 | toggle = self.main_view.select_single( |
1450 | @@ -65,10 +62,7 @@ |
1451 | |
1452 | def setUp(self): |
1453 | super(DisabledTogglesTestCase, self).setUp() |
1454 | - item = "Toggles" |
1455 | - self.checkListItem(item) |
1456 | - self.loadItem(item) |
1457 | - self.checkPageHeader(item) |
1458 | + self.open_page('togglesElement') |
1459 | |
1460 | def test_change_toggles_state(self): |
1461 | toggle = self.main_view.select_single( |
1462 | |
1463 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py' |
1464 | --- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-05-28 09:42:30 +0000 |
1465 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-06-18 15:28:52 +0000 |
1466 | @@ -298,7 +298,7 @@ |
1467 | # home. |
1468 | self.useFixture(fixture_setup.FakeHome()) |
1469 | |
1470 | - open(os.path.join(os.environ.get('HOME'), '.Xauthority')).close() |
1471 | + open(os.path.join(os.environ.get('HOME'), '.Xauthority'), 'w').close() |
1472 | |
1473 | self.useFixture(fixture_setup.FakeHome()) |
1474 | self.assertTrue( |
1475 | |
1476 | === added directory 'tests/launcher' |
1477 | === added file 'tests/launcher/launcher.cpp' |
1478 | --- tests/launcher/launcher.cpp 1970-01-01 00:00:00 +0000 |
1479 | +++ tests/launcher/launcher.cpp 2014-06-18 15:28:52 +0000 |
1480 | @@ -0,0 +1,146 @@ |
1481 | +/* |
1482 | + * Copyright 2014 Canonical Ltd. |
1483 | + * |
1484 | + * This program is free software; you can redistribute it and/or modify |
1485 | + * it under the terms of the GNU Lesser General Public License as published by |
1486 | + * the Free Software Foundation; version 3. |
1487 | + * |
1488 | + * This program is distributed in the hope that it will be useful, |
1489 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1490 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1491 | + * GNU Lesser General Public License for more details. |
1492 | + * |
1493 | + * You should have received a copy of the GNU Lesser General Public License |
1494 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1495 | + * |
1496 | + * QML launcher with the ability to setup the QQuickView/ QQmlEngine differently |
1497 | + * |
1498 | + * Rationale: Different variants of qmlscene exist as well as C++ and Go apps |
1499 | + * This is to write Autopilot test cases that exhibit specific behavior |
1500 | + */ |
1501 | + |
1502 | +#include <iostream> |
1503 | +#include <QtCore/qdebug.h> |
1504 | +#include <QtQuick/QQuickView> |
1505 | +#include <QtGui/QGuiApplication> |
1506 | +#include <QtQml/QQmlEngine> |
1507 | +#include <QtQml/QQmlContext> |
1508 | +#include <QtCore/QFileInfo> |
1509 | +#include <QLibrary> |
1510 | +#include <QOpenGLContext> |
1511 | +#include <QtGui/private/qopenglcontext_p.h> |
1512 | +#include <QtQuick/private/qsgcontext_p.h> |
1513 | + |
1514 | +int usage() |
1515 | +{ |
1516 | + QString self(QGuiApplication::instance()->arguments().at(0)); |
1517 | + std::cout << "Usage\n " |
1518 | + << qPrintable(self) |
1519 | + << " -testability -frameless -engine" |
1520 | + << " --desktop_file_path=DESKTOP_FILE" |
1521 | + << " -I MODULE_PATH FILENAME\n"; |
1522 | + return 1; |
1523 | +} |
1524 | + |
1525 | +int main(int argc, const char *argv[]) |
1526 | +{ |
1527 | + // QPlatformIntegration::ThreadedOpenGL |
1528 | + setenv("QML_FORCE_THREADED_RENDERER", "1", 1); |
1529 | + // QPlatformIntegration::BufferQueueingOpenGL |
1530 | + setenv("QML_FIXED_ANIMATION_STEP", "1", 1); |
1531 | + // Oxide and QWebEngine need a shared context |
1532 | + QScopedPointer<QOpenGLContext> shareContext; |
1533 | + shareContext.reset(new QOpenGLContext); |
1534 | +#if QT_VERSION < QT_VERSION_CHECK(5, 3, 0) |
1535 | + QSGContext::setSharedOpenGLContext(shareContext.data()); |
1536 | +#else |
1537 | + QOpenGLContextPrivate::setGlobalShareContext(shareContext.data()); |
1538 | +#endif |
1539 | + QGuiApplication::setApplicationName("UITK Launcher"); |
1540 | + QGuiApplication application(argc, (char**)argv); |
1541 | + QStringList args (application.arguments()); |
1542 | + |
1543 | + int _testability(args.indexOf("-testability")); |
1544 | + args.removeAt(_testability); |
1545 | + int _frameless(args.indexOf("-frameless")); |
1546 | + args.removeAt(_frameless); |
1547 | + int _engine(args.indexOf("-engine")); |
1548 | + args.removeAt(_engine); |
1549 | + |
1550 | + Q_FOREACH(QString arg, args) { |
1551 | + if (arg.startsWith("--desktop_file_hint")) { |
1552 | + // This will not be used - it only needs to be ignored |
1553 | + int _desktop_file_hint(args.indexOf(arg)); |
1554 | + args.removeAt(_desktop_file_hint); |
1555 | + } |
1556 | + } |
1557 | + |
1558 | + // Testability is only supported out of the box by QApplication not QGuiApplication |
1559 | + if (_testability > -1 || getenv("QT_LOAD_TESTABILITY")) { |
1560 | + QLibrary testLib(QLatin1String("qttestability")); |
1561 | + if (testLib.load()) { |
1562 | + typedef void (*TasInitialize)(void); |
1563 | + TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init"); |
1564 | + if (initFunction) { |
1565 | + initFunction(); |
1566 | + } else { |
1567 | + qCritical("Library qttestability resolve failed!"); |
1568 | + return 1; |
1569 | + } |
1570 | + } else { |
1571 | + qCritical("Library qttestability load failed!"); |
1572 | + return 1; |
1573 | + } |
1574 | + } |
1575 | + |
1576 | + QQmlEngine* engine; |
1577 | + // The default constructor affects the components tree (autopilot vis) |
1578 | + QQuickView* view; |
1579 | + if (_engine > -1) { |
1580 | + view = new QQuickView(); |
1581 | + engine = view->engine(); |
1582 | + } else { |
1583 | + engine = new QQmlEngine(); |
1584 | + view = new QQuickView(engine, NULL); |
1585 | + } |
1586 | + |
1587 | + int _import(args.indexOf("-I")); |
1588 | + args.removeAt(_import); |
1589 | + if (_import > -1) { |
1590 | + if (args.count() > _import) { |
1591 | + QString importPath(args.at(_import)); |
1592 | + args.removeAt(_import); |
1593 | + engine->addImportPath(importPath); |
1594 | + } |
1595 | + } |
1596 | + |
1597 | + view->setResizeMode(QQuickView::SizeRootObjectToView); |
1598 | + view->setTitle("UI Toolkit QQuickView"); |
1599 | + if (_frameless > -1) { |
1600 | + view->setFlags(Qt::FramelessWindowHint); |
1601 | + } |
1602 | + |
1603 | + // The remaining unnamed argument must be a filename |
1604 | + if (args.count() == 1) { |
1605 | + qCritical() << "Missing filename"; |
1606 | + return usage(); |
1607 | + } |
1608 | + QString filename(args.at(1)); |
1609 | + // The first argument is the launcher itself |
1610 | + args.removeAt(0); |
1611 | + |
1612 | + QUrl source(QUrl::fromLocalFile(filename)); |
1613 | + view->setSource(source); |
1614 | + if (view->errors().count() > 0) { |
1615 | + return usage(); |
1616 | + } |
1617 | + view->show(); |
1618 | + |
1619 | + if (args.count() > 1) { |
1620 | + qCritical() << "Invalid arguments passed" << args; |
1621 | + return usage(); |
1622 | + } |
1623 | + |
1624 | + return application.exec(); |
1625 | +} |
1626 | + |
1627 | |
1628 | === added file 'tests/launcher/launcher.pro' |
1629 | --- tests/launcher/launcher.pro 1970-01-01 00:00:00 +0000 |
1630 | +++ tests/launcher/launcher.pro 2014-06-18 15:28:52 +0000 |
1631 | @@ -0,0 +1,11 @@ |
1632 | +TEMPLATE = app |
1633 | +QT += qml quick |
1634 | +# For setSharedOpenGLContext |
1635 | +QT += core-private gui-private quick-private |
1636 | +CONFIG += no_keywords |
1637 | +SOURCES += \ |
1638 | + launcher.cpp |
1639 | +launcher.path = /usr/lib/ubuntu-ui-toolkit |
1640 | +launcher.files = launcher |
1641 | +INSTALLS += launcher |
1642 | + |
1643 | |
1644 | === modified file 'tests/tests.pro' |
1645 | --- tests/tests.pro 2014-02-21 23:39:43 +0000 |
1646 | +++ tests/tests.pro 2014-06-18 15:28:52 +0000 |
1647 | @@ -7,4 +7,6 @@ |
1648 | autopilot2_module.path = /usr/lib/python2.7/dist-packages/ubuntuuitoolkit |
1649 | autopilot2_module.files = autopilot/ubuntuuitoolkit/* |
1650 | |
1651 | +SUBDIRS += launcher |
1652 | + |
1653 | INSTALLS += autopilot_module autopilot2_module |
1654 | |
1655 | === modified file 'tests/unit/runtest.sh' |
1656 | --- tests/unit/runtest.sh 2014-04-15 14:26:35 +0000 |
1657 | +++ tests/unit/runtest.sh 2014-06-18 15:28:52 +0000 |
1658 | @@ -38,7 +38,10 @@ |
1659 | |
1660 | function execute_test_cmd { |
1661 | echo "Executing $_CMD $_ARGS" |
1662 | - if [ $DISPLAY ]; then |
1663 | + if [ ! -x $_TARGET ]; then |
1664 | + echo "Error: $_TARGET wasn't built!" |
1665 | + RESULT=2 |
1666 | + elif [ $DISPLAY ]; then |
1667 | # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999 |
1668 | # https://bugreports.qt-project.org/browse/QTBUG-36243 |
1669 | QML2_IMPORT_PATH=../../../modules:$QML2_IMPORT_PATH UBUNTU_UI_TOOLKIT_THEMES_PATH=../../../modules \ |
1670 | |
1671 | === modified file 'tests/unit/unit.pro' |
1672 | --- tests/unit/unit.pro 2013-12-03 10:36:54 +0000 |
1673 | +++ tests/unit/unit.pro 2014-06-18 15:28:52 +0000 |
1674 | @@ -18,9 +18,7 @@ |
1675 | tst_scaling_image_provider \ |
1676 | tst_qquick_image_extension \ |
1677 | tst_performance \ |
1678 | - tst_ubuntu_shape \ |
1679 | tst_mainview \ |
1680 | - tst_page \ |
1681 | tst_i18n \ |
1682 | tst_arguments \ |
1683 | tst_argument \ |
1684 | |
1685 | === modified file 'tests/unit_x11/tst_components/tst_hide_chrome.qml' |
1686 | --- tests/unit_x11/tst_components/tst_hide_chrome.qml 2014-04-25 05:28:37 +0000 |
1687 | +++ tests/unit_x11/tst_components/tst_hide_chrome.qml 2014-06-18 15:28:52 +0000 |
1688 | @@ -61,6 +61,11 @@ |
1689 | when: windowShown |
1690 | id: testCase |
1691 | |
1692 | + function cleanup() { |
1693 | + // clean buffers |
1694 | + waitForRendering(mainView, 500); |
1695 | + } |
1696 | + |
1697 | function openToolbar() { |
1698 | var toolbar = mainView.__propagated.toolbar; |
1699 | toolbar.open(); |
1700 | |
1701 | === renamed file 'tests/unit/tst_components/tst_page.qml' => 'tests/unit_x11/tst_components/tst_page.qml' |
1702 | === modified file 'tests/unit_x11/tst_components/tst_popover.qml' |
1703 | --- tests/unit_x11/tst_components/tst_popover.qml 2014-04-17 14:14:43 +0000 |
1704 | +++ tests/unit_x11/tst_components/tst_popover.qml 2014-06-18 15:28:52 +0000 |
1705 | @@ -61,6 +61,7 @@ |
1706 | function cleanup() { |
1707 | popoverSpy.target = null; |
1708 | popoverSpy.clear(); |
1709 | + waitForRendering(main, 500); |
1710 | } |
1711 | |
1712 | function test_dismiss_on_click_data() { |
1713 | |
1714 | === renamed file 'tests/unit/tst_components/tst_quickutils.qml' => 'tests/unit_x11/tst_components/tst_quickutils.qml' |
1715 | === modified file 'tests/unit_x11/tst_components/tst_textarea.qml' |
1716 | --- tests/unit_x11/tst_components/tst_textarea.qml 2014-04-30 07:10:06 +0000 |
1717 | +++ tests/unit_x11/tst_components/tst_textarea.qml 2014-06-18 15:28:52 +0000 |
1718 | @@ -555,6 +555,7 @@ |
1719 | } |
1720 | |
1721 | function test_scroll_with_selected_text() { |
1722 | + skip("Flaky test, feature needs rewrite"); |
1723 | longText.focus = true; |
1724 | var handler = findChild(longText, "input_handler"); |
1725 | verify(handler); |
1726 | @@ -629,6 +630,7 @@ |
1727 | } |
1728 | |
1729 | function test_press_and_hold_over_selected_text() { |
1730 | + skip("Flaky test, feature will be rewritten"); |
1731 | longText.focus = true; |
1732 | var handler = findChild(longText, "input_handler"); |
1733 | var y = longText.height / 2; |
1734 | |
1735 | === renamed file 'tests/unit/tst_components/tst_toolbaritems.qml' => 'tests/unit_x11/tst_components/tst_toolbaritems.qml' |
1736 | === modified file 'tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml' |
1737 | --- tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml 2014-04-23 08:50:20 +0000 |
1738 | +++ tests/unit_x11/tst_inversemousearea/InverseMouseAreaInWindow.qml 2014-06-18 15:28:52 +0000 |
1739 | @@ -21,6 +21,7 @@ |
1740 | Item{ |
1741 | id: root |
1742 | property string log: "" |
1743 | +// onLogChanged: print("LOG", log) |
1744 | width: units.gu(100) |
1745 | height: units.gu(100) |
1746 | |
1747 | @@ -28,9 +29,11 @@ |
1748 | objectName: "isawindow" |
1749 | width: units.gu(50) |
1750 | height: units.gu(50) |
1751 | + visible: true |
1752 | |
1753 | Item { |
1754 | id: clickArea |
1755 | + objectName: "clickArea" |
1756 | anchors { |
1757 | left: parent.left |
1758 | right: parent.right |
1759 | |
1760 | === modified file 'tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp' |
1761 | --- tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp 2014-04-15 21:37:57 +0000 |
1762 | +++ tests/unit_x11/tst_inversemousearea/tst_inversemouseareatest.cpp 2014-06-18 15:28:52 +0000 |
1763 | @@ -22,10 +22,10 @@ |
1764 | #include <QtQuick/QQuickItem> |
1765 | #include <QtCore/QEvent> |
1766 | |
1767 | +#include "uctestcase.h" |
1768 | #include "inversemouseareatype.h" |
1769 | #include "ucunits.h" |
1770 | #include <private/qquickevents_p_p.h> |
1771 | -#include <qpa/qwindowsysteminterface.h> |
1772 | |
1773 | #define DOUBLECLICK_TIMEOUT 400 |
1774 | |
1775 | @@ -78,13 +78,6 @@ |
1776 | return QPointF(UCUnits::instance().gu(guX), UCUnits::instance().gu(guY)).toPoint(); |
1777 | } |
1778 | |
1779 | - void touchClick(QWindow *window, const QPoint &point) |
1780 | - { |
1781 | - QTest::touchEvent(window, device).press(0, point, window); |
1782 | - QTest::qWait(10); |
1783 | - QTest::touchEvent(window, device).release(0, point, window); |
1784 | - } |
1785 | - |
1786 | protected Q_SLOTS: |
1787 | void capturePressed(QQuickMouseEvent *event) |
1788 | { |
1789 | @@ -95,16 +88,14 @@ |
1790 | |
1791 | void initTestCase() |
1792 | { |
1793 | + // make sure we have a touch device installed |
1794 | + UbuntuTestCase::registerTouchDevice(); |
1795 | QString modules("../../../modules"); |
1796 | QVERIFY(QDir(modules).exists()); |
1797 | |
1798 | quickView = new QQuickView(0); |
1799 | quickEngine = quickView->engine(); |
1800 | |
1801 | - device = new QTouchDevice; |
1802 | - device->setType(QTouchDevice::TouchScreen); |
1803 | - QWindowSystemInterface::registerTouchDevice(device); |
1804 | - |
1805 | quickView->setGeometry(0,0, 240, 320); |
1806 | //add modules folder so we have access to the plugin from QML |
1807 | QStringList imports = quickEngine->importPathList(); |
1808 | @@ -139,7 +130,6 @@ |
1809 | QVERIFY(eventCleanup.isEmpty()); |
1810 | } |
1811 | |
1812 | - |
1813 | void testCase_PropagateEvents() |
1814 | { |
1815 | eventCleanup.clear(); |
1816 | @@ -167,10 +157,14 @@ |
1817 | InverseMouseAreaType *area = testArea("InverseMouseAreaInWindow.qml"); |
1818 | QVERIFY(area); |
1819 | quickView->show(); |
1820 | + QTest::qWaitForWindowExposed(quickView); |
1821 | |
1822 | QList<QQuickWindow *> l = quickView->rootObject()->findChildren<QQuickWindow*>("isawindow"); |
1823 | QVERIFY(l.count()); |
1824 | |
1825 | + QQuickItem *clickArea = quickView->rootObject()->findChild<QQuickItem*>("clickArea"); |
1826 | + QVERIFY(clickArea); |
1827 | + |
1828 | QTest::mouseClick(l[0], Qt::LeftButton, 0, QPoint(20, 10)); |
1829 | QTest::waitForEvents(); |
1830 | QCOMPARE(quickView->rootObject()->property("log").toString(), QString("IMA")); |
1831 | @@ -519,7 +513,7 @@ |
1832 | QCOMPARE(imaSpy.count(), 1); |
1833 | |
1834 | imaSpy.clear(); |
1835 | - touchClick(quickView, guPoint(20, 5)); |
1836 | + UbuntuTestCase::touchClick(0, quickView, guPoint(20, 5)); |
1837 | QCOMPARE(imaSpy.count(), 1); |
1838 | } |
1839 | |
1840 | |
1841 | === renamed directory 'tests/unit/tst_page' => 'tests/unit_x11/tst_page' |
1842 | === renamed directory 'tests/unit/tst_ubuntu_shape' => 'tests/unit_x11/tst_ubuntu_shape' |
1843 | === modified file 'tests/unit_x11/unit_x11.pro' |
1844 | --- tests/unit_x11/unit_x11.pro 2013-12-29 19:15:15 +0000 |
1845 | +++ tests/unit_x11/unit_x11.pro 2014-06-18 15:28:52 +0000 |
1846 | @@ -1,4 +1,12 @@ |
1847 | TEMPLATE = subdirs |
1848 | |
1849 | -SUBDIRS += tst_components tst_test tst_inversemousearea tst_recreateview tst_statesaver tst_theme_engine tst_orientation tst_layouts \ |
1850 | +SUBDIRS += tst_components \ |
1851 | + tst_ubuntu_shape \ |
1852 | + tst_page \ |
1853 | + tst_test \ |
1854 | + tst_inversemousearea \ |
1855 | + tst_recreateview \ |
1856 | + tst_statesaver \ |
1857 | + tst_theme_engine \ |
1858 | + tst_orientation tst_layouts \ |
1859 | tst_mousefilters |