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