Merge lp:~xnox/ubuntu-ui-toolkit/py32ap+listview-scroll_to_bottom+qmlapicheckverbose into lp:ubuntu-ui-toolkit
- py32ap+listview-scroll_to_bottom+qmlapicheckverbose
- Merge into trunk
Status: | Rejected |
---|---|
Rejected by: | Zoltan Balogh |
Proposed branch: | lp:~xnox/ubuntu-ui-toolkit/py32ap+listview-scroll_to_bottom+qmlapicheckverbose |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
607 lines (+224/-117) 15 files modified
components.api (+23/-0) debian/control (+9/-6) debian/rules (+1/-0) debian/ubuntu-ui-toolkit-autopilot.install (+2/-1) run_tests.sh (+2/-2) tests/autopilot/ubuntuuitoolkit/base.py (+3/-2) tests/autopilot/ubuntuuitoolkit/emulators.py (+79/-37) tests/autopilot/ubuntuuitoolkit/fixture_setup.py (+1/-1) tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py (+29/-54) tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py (+6/-1) tests/qmlapicheck.py (+4/-2) tests/qmlapicheck.sh (+52/-0) tests/tests.pro (+5/-2) tests/unit/add_qmlmakecheck.pri (+2/-8) ubuntu-sdk.pro (+6/-1) |
To merge this branch: | bzr merge lp:~xnox/ubuntu-ui-toolkit/py32ap+listview-scroll_to_bottom+qmlapicheckverbose |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Dimitri John Ledkov (community) | Approve | ||
Ubuntu SDK team | Pending | ||
Review via email: mp+208859@code.launchpad.net |
Commit message
Merge approved branches and resolve conflicts.
Description of the change
Merge approved branches and resolve conflicts.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:956
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Unmerged revisions
Preview Diff
1 | === modified file 'components.api' | |||
2 | --- components.api 2014-02-13 17:22:21 +0000 | |||
3 | +++ components.api 2014-02-28 17:59:31 +0000 | |||
4 | @@ -566,6 +566,11 @@ | |||
5 | 566 | modules/Ubuntu/PerformanceMetrics/PerformanceOverlay.qml | 566 | modules/Ubuntu/PerformanceMetrics/PerformanceOverlay.qml |
6 | 567 | Item | 567 | Item |
7 | 568 | property bool active | 568 | property bool active |
8 | 569 | modules/Ubuntu/Test/UbuntuTestCase.qml | ||
9 | 570 | TestCase | ||
10 | 571 | function findChild(obj,objectName) | ||
11 | 572 | function findInvisibleChild(obj,objectName) | ||
12 | 573 | function mouseMoveSlowly(item,x,y,dx,dy,steps,stepdelay) | ||
13 | 569 | plugins.qmltypes | 574 | plugins.qmltypes |
14 | 570 | name: "InverseMouseAreaType" | 575 | name: "InverseMouseAreaType" |
15 | 571 | prototype: "QQuickMouseArea" | 576 | prototype: "QQuickMouseArea" |
16 | @@ -750,6 +755,24 @@ | |||
17 | 750 | Parameter { name: "singular"; type: "string" } | 755 | Parameter { name: "singular"; type: "string" } |
18 | 751 | Parameter { name: "plural"; type: "string" } | 756 | Parameter { name: "plural"; type: "string" } |
19 | 752 | Parameter { name: "n"; type: "int" } | 757 | Parameter { name: "n"; type: "int" } |
20 | 758 | name: "ULConditionalLayout" | ||
21 | 759 | prototype: "QObject" | ||
22 | 760 | exports: ["ConditionalLayout 0.1"] | ||
23 | 761 | Property { name: "name"; type: "string" } | ||
24 | 762 | Property { name: "when"; type: "QQmlBinding"; isPointer: true } | ||
25 | 763 | Property { name: "layout"; type: "QQmlComponent"; isPointer: true } | ||
26 | 764 | name: "ULItemLayout" | ||
27 | 765 | prototype: "QQuickItem" | ||
28 | 766 | exports: ["ItemLayout 0.1"] | ||
29 | 767 | Property { name: "item"; type: "string" } | ||
30 | 768 | name: "ULLayouts" | ||
31 | 769 | prototype: "QQuickItem" | ||
32 | 770 | exports: ["Layouts 0.1"] | ||
33 | 771 | Property { name: "currentLayout"; type: "string"; isReadonly: true } | ||
34 | 772 | Property { name: "layouts"; type: "ULConditionalLayout"; isList: true; isReadonly: true } | ||
35 | 773 | name: "ULLayoutsAttached" | ||
36 | 774 | prototype: "QObject" | ||
37 | 775 | Property { name: "item"; type: "string" } | ||
38 | 753 | name: "UPMCpuUsage" | 776 | name: "UPMCpuUsage" |
39 | 754 | prototype: "QQuickItem" | 777 | prototype: "QQuickItem" |
40 | 755 | exports: ["CpuUsage 0.1"] | 778 | exports: ["CpuUsage 0.1"] |
41 | 756 | 779 | ||
42 | === modified file 'debian/control' | |||
43 | --- debian/control 2014-02-12 09:20:43 +0000 | |||
44 | +++ debian/control 2014-02-28 17:59:31 +0000 | |||
45 | @@ -6,6 +6,7 @@ | |||
46 | 6 | devscripts, | 6 | devscripts, |
47 | 7 | libgles2-mesa-dev, | 7 | libgles2-mesa-dev, |
48 | 8 | libglib2.0-dev, | 8 | libglib2.0-dev, |
49 | 9 | python3, | ||
50 | 9 | python, | 10 | python, |
51 | 10 | libqt5qml-graphicaleffects | libqt5graphicaleffects5, | 11 | libqt5qml-graphicaleffects | libqt5graphicaleffects5, |
52 | 11 | qt5-default, | 12 | qt5-default, |
53 | @@ -22,12 +23,12 @@ | |||
54 | 22 | qtdeclarative5-qtfeedback-plugin, | 23 | qtdeclarative5-qtfeedback-plugin, |
55 | 23 | qtdeclarative5-unity-action-plugin (>= 1.1.0), | 24 | qtdeclarative5-unity-action-plugin (>= 1.1.0), |
56 | 24 | qtdeclarative5-localstorage-plugin, | 25 | qtdeclarative5-localstorage-plugin, |
63 | 25 | qtdeclarative5-doc-html, | 26 | qtdeclarative5-doc-html, |
64 | 26 | qtwebkit5-doc-html, | 27 | qtwebkit5-doc-html, |
65 | 27 | qtsvg5-doc-html, | 28 | qtsvg5-doc-html, |
66 | 28 | qtscript5-doc-html, | 29 | qtscript5-doc-html, |
67 | 29 | qtmultimedia5-doc-html, | 30 | qtmultimedia5-doc-html, |
68 | 30 | unity-action-doc, | 31 | unity-action-doc, |
69 | 31 | devscripts, | 32 | devscripts, |
70 | 32 | libqt5organizer5, | 33 | libqt5organizer5, |
71 | 33 | qtpim5-dev, | 34 | qtpim5-dev, |
72 | @@ -133,6 +134,8 @@ | |||
73 | 133 | python-autopilot (>= 1.4), | 134 | python-autopilot (>= 1.4), |
74 | 134 | python-fixtures, | 135 | python-fixtures, |
75 | 135 | python-mock, | 136 | python-mock, |
76 | 137 | python3-fixtures, | ||
77 | 138 | python3-autopilot (>= 1.4), | ||
78 | 136 | ubuntu-ui-toolkit-examples (>= ${source:Version}), | 139 | ubuntu-ui-toolkit-examples (>= ${source:Version}), |
79 | 137 | Description: Test package for Ubuntu UI Toolkit | 140 | Description: Test package for Ubuntu UI Toolkit |
80 | 138 | Autopilot tests for the ubuntu-ui-toolkit package | 141 | Autopilot tests for the ubuntu-ui-toolkit package |
81 | 139 | 142 | ||
82 | === modified file 'debian/rules' | |||
83 | --- debian/rules 2014-01-22 16:25:25 +0000 | |||
84 | +++ debian/rules 2014-02-28 17:59:31 +0000 | |||
85 | @@ -11,6 +11,7 @@ | |||
86 | 11 | override_dh_auto_test: | 11 | override_dh_auto_test: |
87 | 12 | ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) | 12 | ifeq (,$(findstring nocheck,$(DEB_BUILD_OPTIONS))) |
88 | 13 | mkdir -p debian/tmp/home/run | 13 | mkdir -p debian/tmp/home/run |
89 | 14 | chmod +x tests/xvfb.sh | ||
90 | 14 | tests/xvfb.sh dh_auto_test || exit $? | 15 | tests/xvfb.sh dh_auto_test || exit $? |
91 | 15 | endif | 16 | endif |
92 | 16 | 17 | ||
93 | 17 | 18 | ||
94 | === modified file 'debian/ubuntu-ui-toolkit-autopilot.install' | |||
95 | --- debian/ubuntu-ui-toolkit-autopilot.install 2013-10-30 11:35:57 +0000 | |||
96 | +++ debian/ubuntu-ui-toolkit-autopilot.install 2014-02-28 17:59:31 +0000 | |||
97 | @@ -1,1 +1,2 @@ | |||
99 | 1 | usr/lib/python2.7/dist-packages/ubuntuuitoolkit | 1 | usr/lib/python3 |
100 | 2 | usr/lib/python2.7 | ||
101 | 2 | 3 | ||
102 | === modified file 'run_tests.sh' | |||
103 | --- run_tests.sh 2013-07-23 22:15:05 +0000 | |||
104 | +++ run_tests.sh 2014-02-28 17:59:31 +0000 | |||
105 | @@ -20,9 +20,9 @@ | |||
106 | 20 | echo running with arg: $1 | 20 | echo running with arg: $1 |
107 | 21 | 21 | ||
108 | 22 | if [ "$1" == "" ]; then | 22 | if [ "$1" == "" ]; then |
110 | 23 | autopilot run ubuntuuitoolkit | 23 | python3 -m autopilot.run run ubuntuuitoolkit |
111 | 24 | else | 24 | else |
113 | 25 | autopilot run -o ../../$1 -f xml -r -rd ../../ ubuntuuitoolkit | 25 | python3 -m autopilot.run run -o ../../$1 -f xml -r -rd ../../ ubuntuuitoolkit |
114 | 26 | fi | 26 | fi |
115 | 27 | 27 | ||
116 | 28 | exit 0 | 28 | exit 0 |
117 | 29 | 29 | ||
118 | === modified file 'tests/autopilot/ubuntuuitoolkit/base.py' | |||
119 | --- tests/autopilot/ubuntuuitoolkit/base.py 2013-11-15 05:11:10 +0000 | |||
120 | +++ tests/autopilot/ubuntuuitoolkit/base.py 2014-02-28 17:59:31 +0000 | |||
121 | @@ -31,8 +31,9 @@ | |||
122 | 31 | # configuration on devices and it seems the environment variable | 31 | # configuration on devices and it seems the environment variable |
123 | 32 | # QT_SELECT=qt5 doesn't work for autopilot tests. --Mirv - 2013-10-03 | 32 | # QT_SELECT=qt5 doesn't work for autopilot tests. --Mirv - 2013-10-03 |
124 | 33 | arch = subprocess.check_output( | 33 | arch = subprocess.check_output( |
127 | 34 | ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"]).strip() | 34 | ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"], |
128 | 35 | return '/usr/lib/{}/qt5/bin/qmlscene'.format(arch.decode()) | 35 | universal_newlines=True).strip() |
129 | 36 | return '/usr/lib/{}/qt5/bin/qmlscene'.format(arch) | ||
130 | 36 | 37 | ||
131 | 37 | 38 | ||
132 | 38 | class UbuntuUIToolkitAppTestCase(testcase.AutopilotTestCase): | 39 | class UbuntuUIToolkitAppTestCase(testcase.AutopilotTestCase): |
133 | 39 | 40 | ||
134 | === modified file 'tests/autopilot/ubuntuuitoolkit/emulators.py' | |||
135 | --- tests/autopilot/ubuntuuitoolkit/emulators.py 2014-01-30 15:26:21 +0000 | |||
136 | +++ tests/autopilot/ubuntuuitoolkit/emulators.py 2014-02-28 17:59:31 +0000 | |||
137 | @@ -15,7 +15,6 @@ | |||
138 | 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/>. |
139 | 16 | 16 | ||
140 | 17 | import logging | 17 | import logging |
141 | 18 | import time | ||
142 | 19 | from distutils import version | 18 | from distutils import version |
143 | 20 | 19 | ||
144 | 21 | import autopilot | 20 | import autopilot |
145 | @@ -527,7 +526,7 @@ | |||
146 | 527 | def click_element(self, objectName): | 526 | def click_element(self, objectName): |
147 | 528 | """Click an element from the list. | 527 | """Click an element from the list. |
148 | 529 | 528 | ||
150 | 530 | It swipes the element into view if it's not fully visible. | 529 | It swipes the element into view if it's center is not visible. |
151 | 531 | 530 | ||
152 | 532 | :parameter objectName: The objectName property of the element to click. | 531 | :parameter objectName: The objectName property of the element to click. |
153 | 533 | 532 | ||
154 | @@ -537,38 +536,81 @@ | |||
155 | 537 | self.pointing_device.click_object(element) | 536 | self.pointing_device.click_object(element) |
156 | 538 | 537 | ||
157 | 539 | def _swipe_element_into_view(self, objectName): | 538 | def _swipe_element_into_view(self, objectName): |
162 | 540 | element = self.select_single(objectName=objectName) | 539 | element = self._select_element(objectName) |
159 | 541 | x, y, width, height = self.globalRect | ||
160 | 542 | start_x = x + (width / 2) | ||
161 | 543 | start_y = y + (height / 2) | ||
163 | 544 | 540 | ||
166 | 545 | while not self._is_element_fully_visible(objectName): | 541 | while not self._is_element_clickable(objectName): |
165 | 546 | stop_x = start_x | ||
167 | 547 | if element.globalRect.y < self.globalRect.y: | 542 | if element.globalRect.y < self.globalRect.y: |
188 | 548 | stop_y = start_y + element.implicitHeight | 543 | self._show_more_elements_above() |
189 | 549 | else: | 544 | else: |
190 | 550 | stop_y = start_y - element.implicitHeight | 545 | self._show_more_elements_below() |
191 | 551 | 546 | ||
192 | 552 | if platform.model() == 'Desktop': | 547 | def _select_element(self, object_name): |
193 | 553 | # The drag on the desktop is done two fast, so we are left at | 548 | try: |
194 | 554 | # the bottom or at the top of the list, sometimes missing the | 549 | return self.select_single(objectName=object_name) |
195 | 555 | # element we are looking for. | 550 | except dbus.StateNotFoundError: |
196 | 556 | # TODO: use the slow drag once it's implemented: | 551 | # If the list is big, elements will only be created when we scroll |
197 | 557 | # https://bugs.launchpad.net/autopilot/+bug/1257055 | 552 | # them into view. |
198 | 558 | # --elopio - 2014-01-09 | 553 | self._scroll_to_top() |
199 | 559 | self.pointing_device.move(start_x, start_y) | 554 | while not self.atYEnd: |
200 | 560 | self.pointing_device.press() | 555 | self._show_more_elements_below() |
201 | 561 | self.pointing_device.move(stop_x, stop_y) | 556 | try: |
202 | 562 | time.sleep(0.3) | 557 | return self.select_single(objectName=object_name) |
203 | 563 | self.pointing_device.release() | 558 | except dbus.StateNotFoundError: |
204 | 564 | else: | 559 | pass |
205 | 565 | self.pointing_device.drag(start_x, start_y, stop_x, stop_y) | 560 | raise ToolkitEmulatorException( |
206 | 566 | 561 | 'List element with objectName "{}" not found.'.format( | |
207 | 567 | def _is_element_fully_visible(self, objectName): | 562 | object_name)) |
208 | 563 | |||
209 | 564 | @autopilot_logging.log_action(logger.info) | ||
210 | 565 | def _scroll_to_top(self): | ||
211 | 566 | x, y, width, height = self.globalRect | ||
212 | 567 | while not self.atYBeginning: | ||
213 | 568 | self._show_more_elements_above() | ||
214 | 569 | |||
215 | 570 | @autopilot_logging.log_action(logger.info) | ||
216 | 571 | def _show_more_elements_below(self): | ||
217 | 572 | if self.atYEnd: | ||
218 | 573 | raise ToolkitEmulatorException('There are no more elements below.') | ||
219 | 574 | else: | ||
220 | 575 | self._show_more_elements('below') | ||
221 | 576 | |||
222 | 577 | @autopilot_logging.log_action(logger.info) | ||
223 | 578 | def _show_more_elements_above(self): | ||
224 | 579 | if self.atYBeginning: | ||
225 | 580 | raise ToolkitEmulatorException('There are no more elements above.') | ||
226 | 581 | else: | ||
227 | 582 | self._show_more_elements('above') | ||
228 | 583 | |||
229 | 584 | def _show_more_elements(self, direction): | ||
230 | 585 | x, y, width, height = self.globalRect | ||
231 | 586 | start_x = stop_x = x + (width // 2) | ||
232 | 587 | # Start and stop just a little under the top of the list. | ||
233 | 588 | top = y + 5 | ||
234 | 589 | bottom = y + height - 5 | ||
235 | 590 | if direction == 'below': | ||
236 | 591 | start_y = bottom | ||
237 | 592 | stop_y = top | ||
238 | 593 | elif direction == 'above': | ||
239 | 594 | start_y = top | ||
240 | 595 | stop_y = bottom | ||
241 | 596 | else: | ||
242 | 597 | raise ToolkitEmulatorException( | ||
243 | 598 | 'Invalid direction {}.'.format(direction)) | ||
244 | 599 | self._slow_drag(start_x, stop_x, start_y, stop_y) | ||
245 | 600 | self.dragging.wait_for(False) | ||
246 | 601 | self.moving.wait_for(False) | ||
247 | 602 | |||
248 | 603 | def _slow_drag(self, start_x, stop_x, start_y, stop_y): | ||
249 | 604 | # If we drag too fast, we end up scrolling more than what we | ||
250 | 605 | # should, sometimes missing the element we are looking for. | ||
251 | 606 | self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate=5) | ||
252 | 607 | |||
253 | 608 | def _is_element_clickable(self, objectName): | ||
254 | 609 | """Return True if the center of the element is visible.""" | ||
255 | 568 | element = self.select_single(objectName=objectName) | 610 | element = self.select_single(objectName=objectName) |
259 | 569 | return (element.globalRect.y >= self.globalRect.y and | 611 | element_center = element.globalRect.y + element.globalRect.height // 2 |
260 | 570 | element.globalRect.y + element.globalRect.height <= | 612 | return (element_center >= self.globalRect.y and |
261 | 571 | self.globalRect.y + self.globalRect.height) | 613 | element_center <= self.globalRect.y + self.globalRect.height) |
262 | 572 | 614 | ||
263 | 573 | 615 | ||
264 | 574 | class Empty(UbuntuUIToolkitEmulatorBase): | 616 | class Empty(UbuntuUIToolkitEmulatorBase): |
265 | @@ -587,7 +629,7 @@ | |||
266 | 587 | @autopilot_logging.log_action(logger.info) | 629 | @autopilot_logging.log_action(logger.info) |
267 | 588 | def swipe_to_delete(self, direction='right'): | 630 | def swipe_to_delete(self, direction='right'): |
268 | 589 | """Swipe the item in a specific direction.""" | 631 | """Swipe the item in a specific direction.""" |
270 | 590 | if (self.removable): | 632 | if self.removable: |
271 | 591 | self._drag_pointing_device_to_delete(direction) | 633 | self._drag_pointing_device_to_delete(direction) |
272 | 592 | if self.confirmRemoval: | 634 | if self.confirmRemoval: |
273 | 593 | self.waitingConfirmationForRemoval.wait_for(True) | 635 | self.waitingConfirmationForRemoval.wait_for(True) |
274 | @@ -599,12 +641,12 @@ | |||
275 | 599 | 641 | ||
276 | 600 | def _drag_pointing_device_to_delete(self, direction): | 642 | def _drag_pointing_device_to_delete(self, direction): |
277 | 601 | x, y, w, h = self.globalRect | 643 | x, y, w, h = self.globalRect |
280 | 602 | tx = x + (w / 8) | 644 | tx = x + (w // 8) |
281 | 603 | ty = y + (h / 2) | 645 | ty = y + (h // 2) |
282 | 604 | 646 | ||
284 | 605 | if (direction == 'right'): | 647 | if direction == 'right': |
285 | 606 | self.pointing_device.drag(tx, ty, w, ty) | 648 | self.pointing_device.drag(tx, ty, w, ty) |
287 | 607 | elif (direction == 'left'): | 649 | elif direction == 'left': |
288 | 608 | self.pointing_device.drag(w - (w*0.1), ty, x, ty) | 650 | self.pointing_device.drag(w - (w*0.1), ty, x, ty) |
289 | 609 | else: | 651 | else: |
290 | 610 | raise ToolkitEmulatorException( | 652 | raise ToolkitEmulatorException( |
291 | @@ -622,7 +664,7 @@ | |||
292 | 622 | @autopilot_logging.log_action(logger.info) | 664 | @autopilot_logging.log_action(logger.info) |
293 | 623 | def confirm_removal(self): | 665 | def confirm_removal(self): |
294 | 624 | """Comfirm item removal if this was already swiped.""" | 666 | """Comfirm item removal if this was already swiped.""" |
296 | 625 | if (self.waitingConfirmationForRemoval): | 667 | if self.waitingConfirmationForRemoval: |
297 | 626 | deleteButton = self._get_confirm_button() | 668 | deleteButton = self._get_confirm_button() |
298 | 627 | self.pointing_device.click_object(deleteButton) | 669 | self.pointing_device.click_object(deleteButton) |
299 | 628 | self._wait_until_deleted() | 670 | self._wait_until_deleted() |
300 | 629 | 671 | ||
301 | === modified file 'tests/autopilot/ubuntuuitoolkit/fixture_setup.py' | |||
302 | --- tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-02-12 09:20:43 +0000 | |||
303 | +++ tests/autopilot/ubuntuuitoolkit/fixture_setup.py 2014-02-28 17:59:31 +0000 | |||
304 | @@ -87,7 +87,7 @@ | |||
305 | 87 | qmlscene=base.get_qmlscene_launch_command(), | 87 | qmlscene=base.get_qmlscene_launch_command(), |
306 | 88 | qml_file_path=qml_file_path)) | 88 | qml_file_path=qml_file_path)) |
307 | 89 | desktop_file.write('[Desktop Entry]\n') | 89 | desktop_file.write('[Desktop Entry]\n') |
309 | 90 | for key, value in self._desktop_file_dict.iteritems(): | 90 | for key, value in self._desktop_file_dict.items(): |
310 | 91 | desktop_file.write('{key}={value}\n'.format(key=key, value=value)) | 91 | desktop_file.write('{key}={value}\n'.format(key=key, value=value)) |
311 | 92 | desktop_file.close() | 92 | desktop_file.close() |
312 | 93 | return desktop_file.name | 93 | return desktop_file.name |
313 | 94 | 94 | ||
314 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py' | |||
315 | --- tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-01-13 15:23:25 +0000 | |||
316 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_emulators.py 2014-02-28 17:59:31 +0000 | |||
317 | @@ -14,7 +14,6 @@ | |||
318 | 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 |
319 | 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/>. |
320 | 16 | 16 | ||
321 | 17 | import mock | ||
322 | 18 | import time | 17 | import time |
323 | 19 | import unittest | 18 | import unittest |
324 | 20 | 19 | ||
325 | @@ -22,6 +21,10 @@ | |||
326 | 22 | from autopilot import input, platform | 21 | from autopilot import input, platform |
327 | 23 | from autopilot.introspection import dbus | 22 | from autopilot.introspection import dbus |
328 | 24 | from testtools.matchers import GreaterThan, LessThan | 23 | from testtools.matchers import GreaterThan, LessThan |
329 | 24 | try: | ||
330 | 25 | from unittest import mock | ||
331 | 26 | except ImportError: | ||
332 | 27 | import mock | ||
333 | 25 | 28 | ||
334 | 26 | from ubuntuuitoolkit import emulators, tests | 29 | from ubuntuuitoolkit import emulators, tests |
335 | 27 | 30 | ||
336 | @@ -574,47 +577,6 @@ | |||
337 | 574 | text: "No element clicked." | 577 | text: "No element clicked." |
338 | 575 | } | 578 | } |
339 | 576 | 579 | ||
340 | 577 | ListModel { | ||
341 | 578 | id: testModel | ||
342 | 579 | |||
343 | 580 | ListElement { | ||
344 | 581 | objectName: "testListElement1" | ||
345 | 582 | label: "test list element 1" | ||
346 | 583 | } | ||
347 | 584 | ListElement { | ||
348 | 585 | objectName: "testListElement2" | ||
349 | 586 | label: "test list element 2" | ||
350 | 587 | } | ||
351 | 588 | ListElement { | ||
352 | 589 | objectName: "testListElement3" | ||
353 | 590 | label: "test list element 3" | ||
354 | 591 | } | ||
355 | 592 | ListElement { | ||
356 | 593 | objectName: "testListElement4" | ||
357 | 594 | label: "test list element 4" | ||
358 | 595 | } | ||
359 | 596 | ListElement { | ||
360 | 597 | objectName: "testListElement5" | ||
361 | 598 | label: "test list element 5" | ||
362 | 599 | } | ||
363 | 600 | ListElement { | ||
364 | 601 | objectName: "testListElement6" | ||
365 | 602 | label: "test list element 6" | ||
366 | 603 | } | ||
367 | 604 | ListElement { | ||
368 | 605 | objectName: "testListElement7" | ||
369 | 606 | label: "test list element 7" | ||
370 | 607 | } | ||
371 | 608 | ListElement { | ||
372 | 609 | objectName: "testListElement8" | ||
373 | 610 | label: "test list element 8" | ||
374 | 611 | } | ||
375 | 612 | ListElement { | ||
376 | 613 | objectName: "testListElement9" | ||
377 | 614 | label: "test list element 9" | ||
378 | 615 | } | ||
379 | 616 | } | ||
380 | 617 | |||
381 | 618 | ListView { | 580 | ListView { |
382 | 619 | id: testListView | 581 | id: testListView |
383 | 620 | objectName: "testListView" | 582 | objectName: "testListView" |
384 | @@ -622,13 +584,13 @@ | |||
385 | 622 | anchors.right: parent.right | 584 | anchors.right: parent.right |
386 | 623 | height: column.height - clickedLabel.paintedHeight | 585 | height: column.height - clickedLabel.paintedHeight |
387 | 624 | clip: true | 586 | clip: true |
389 | 625 | model: testModel | 587 | model: 20 |
390 | 626 | 588 | ||
391 | 627 | delegate: ListItem.Standard { | 589 | delegate: ListItem.Standard { |
396 | 628 | text: model.label | 590 | objectName: "testListElement%1".arg(index) |
397 | 629 | objectName: model.objectName | 591 | text: "test list element %1".arg(index) |
398 | 630 | onClicked: clickedLabel.text = model.objectName | 592 | onClicked: clickedLabel.text = objectName |
399 | 631 | height: units.gu(5) | 593 | height: units.gu(5) |
400 | 632 | } | 594 | } |
401 | 633 | } | 595 | } |
402 | 634 | } | 596 | } |
403 | @@ -648,32 +610,45 @@ | |||
404 | 648 | self.assertIsInstance(self.list_view, emulators.QQuickListView) | 610 | self.assertIsInstance(self.list_view, emulators.QQuickListView) |
405 | 649 | 611 | ||
406 | 650 | def test_click_element(self): | 612 | def test_click_element(self): |
409 | 651 | self.list_view.click_element('testListElement1') | 613 | self.list_view.click_element('testListElement0') |
410 | 652 | self.assertEqual(self.label.text, 'testListElement1') | 614 | self.assertEqual(self.label.text, 'testListElement0') |
411 | 653 | 615 | ||
412 | 654 | def test_click_element_outside_view_below(self): | 616 | def test_click_element_outside_view_below(self): |
413 | 655 | # Click the first element out of view to make sure we are not scrolling | 617 | # Click the first element out of view to make sure we are not scrolling |
414 | 656 | # to the bottom at once. | 618 | # to the bottom at once. |
415 | 657 | self.assertFalse( | 619 | self.assertFalse( |
417 | 658 | self.list_view._is_element_fully_visible('testListElement5')) | 620 | self.list_view._is_element_clickable('testListElement5')) |
418 | 659 | 621 | ||
419 | 660 | self.list_view.click_element('testListElement5') | 622 | self.list_view.click_element('testListElement5') |
420 | 661 | self.assertEqual(self.label.text, 'testListElement5') | 623 | self.assertEqual(self.label.text, 'testListElement5') |
421 | 662 | 624 | ||
422 | 663 | def test_click_element_outside_view_above(self): | 625 | def test_click_element_outside_view_above(self): |
423 | 664 | # First we need to scroll to the 8th element in order for the 9th to be | ||
424 | 665 | # created. | ||
425 | 666 | self.list_view.click_element('testListElement8') | ||
426 | 667 | self.list_view.click_element('testListElement9') | 626 | self.list_view.click_element('testListElement9') |
427 | 668 | 627 | ||
428 | 669 | # Click the first element out of view to make sure we are not scrolling | 628 | # Click the first element out of view to make sure we are not scrolling |
429 | 670 | # to the top at once. | 629 | # to the top at once. |
430 | 671 | self.assertFalse( | 630 | self.assertFalse( |
432 | 672 | self.list_view._is_element_fully_visible('testListElement4')) | 631 | self.list_view._is_element_clickable('testListElement4')) |
433 | 673 | 632 | ||
434 | 674 | self.list_view.click_element('testListElement4') | 633 | self.list_view.click_element('testListElement4') |
435 | 675 | self.assertEqual(self.label.text, 'testListElement4') | 634 | self.assertEqual(self.label.text, 'testListElement4') |
436 | 676 | 635 | ||
437 | 636 | def test_click_element_not_created_at_start(self): | ||
438 | 637 | objectName = 'testListElement19' | ||
439 | 638 | self.assertRaises( | ||
440 | 639 | dbus.StateNotFoundError, | ||
441 | 640 | self.list_view.select_single, | ||
442 | 641 | objectName=objectName) | ||
443 | 642 | self.list_view.click_element(objectName) | ||
444 | 643 | |||
445 | 644 | def test_click_unexisting_element(self): | ||
446 | 645 | error = self.assertRaises( | ||
447 | 646 | emulators.ToolkitEmulatorException, | ||
448 | 647 | self.list_view.click_element, | ||
449 | 648 | 'unexisting') | ||
450 | 649 | self.assertEqual( | ||
451 | 650 | str(error), 'List element with objectName "unexisting" not found.') | ||
452 | 651 | |||
453 | 677 | 652 | ||
454 | 678 | class SwipeToDeleteTestCase(tests.QMLStringAppTestCase): | 653 | class SwipeToDeleteTestCase(tests.QMLStringAppTestCase): |
455 | 679 | 654 | ||
456 | 680 | 655 | ||
457 | === modified file 'tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py' | |||
458 | --- tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-02-12 18:41:20 +0000 | |||
459 | +++ tests/autopilot/ubuntuuitoolkit/tests/test_fixture_setup.py 2014-02-28 17:59:31 +0000 | |||
460 | @@ -16,7 +16,12 @@ | |||
461 | 16 | 16 | ||
462 | 17 | import os | 17 | import os |
463 | 18 | 18 | ||
465 | 19 | import mock | 19 | try: |
466 | 20 | # Python 3. | ||
467 | 21 | from unittest import mock | ||
468 | 22 | except ImportError: | ||
469 | 23 | # Python 2 add-on: python-mock. | ||
470 | 24 | import mock | ||
471 | 20 | import testtools | 25 | import testtools |
472 | 21 | from autopilot import testcase as autopilot_testcase | 26 | from autopilot import testcase as autopilot_testcase |
473 | 22 | from testtools.matchers import Contains, Not, FileExists | 27 | from testtools.matchers import Contains, Not, FileExists |
474 | 23 | 28 | ||
475 | === modified file 'tests/qmlapicheck.py' | |||
476 | --- tests/qmlapicheck.py 2013-12-11 11:28:29 +0000 | |||
477 | +++ tests/qmlapicheck.py 2014-02-28 17:59:31 +0000 | |||
478 | @@ -1,4 +1,4 @@ | |||
480 | 1 | #!/usr/bin/env python | 1 | #!/usr/bin/env python3 |
481 | 2 | # -*- coding: utf-8 -*- | 2 | # -*- coding: utf-8 -*- |
482 | 3 | # | 3 | # |
483 | 4 | # Copyright 2013 Canonical Ltd. | 4 | # Copyright 2013 Canonical Ltd. |
484 | @@ -65,7 +65,9 @@ | |||
485 | 65 | fileinput.nextfile() | 65 | fileinput.nextfile() |
486 | 66 | 66 | ||
487 | 67 | inputfiles.sort() | 67 | inputfiles.sort() |
489 | 68 | for line in fileinput.input(inputfiles): | 68 | |
490 | 69 | hook = fileinput.hook_encoded('utf-8') | ||
491 | 70 | for line in fileinput.input(inputfiles, openhook=hook): | ||
492 | 69 | # New file | 71 | # New file |
493 | 70 | if fileinput.isfirstline(): | 72 | if fileinput.isfirstline(): |
494 | 71 | in_block = 0 | 73 | in_block = 0 |
495 | 72 | 74 | ||
496 | === added file 'tests/qmlapicheck.sh' | |||
497 | --- tests/qmlapicheck.sh 1970-01-01 00:00:00 +0000 | |||
498 | +++ tests/qmlapicheck.sh 2014-02-28 17:59:31 +0000 | |||
499 | @@ -0,0 +1,52 @@ | |||
500 | 1 | #!/usr/bin/env sh | ||
501 | 2 | # | ||
502 | 3 | # Copyright 2013 Canonical Ltd. | ||
503 | 4 | # | ||
504 | 5 | # This program is free software; you can redistribute it and/or modify | ||
505 | 6 | # it under the terms of the GNU Lesser General Public License as published by | ||
506 | 7 | # the Free Software Foundation; version 3. | ||
507 | 8 | # | ||
508 | 9 | # This program is distributed in the hope that it will be useful, | ||
509 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
510 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
511 | 12 | # GNU Lesser General Public License for more details. | ||
512 | 13 | # | ||
513 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
514 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
515 | 16 | # | ||
516 | 17 | ################################################################################ | ||
517 | 18 | QML="modules/Ubuntu/*/qmldir modules/Ubuntu/Components/Colors/UbuntuColors.qml modules/Ubuntu/Components/*/qmldir modules/Ubuntu/Components/Pickers/PickerPanel.qml" | ||
518 | 19 | CPP="Ubuntu.Components Ubuntu.Layouts Ubuntu.PerformanceMetrics" | ||
519 | 20 | |||
520 | 21 | echo Dumping QML API of C++ components | ||
521 | 22 | echo '' > plugins.qmltypes | ||
522 | 23 | for i in $CPP; do | ||
523 | 24 | # Silence spam on stderr due to fonts | ||
524 | 25 | # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999 | ||
525 | 26 | # https://bugreports.qt-project.org/browse/QTBUG-36243 | ||
526 | 27 | qmlplugindump $i 0.1 modules 2>/dev/null >> plugins.qmltypes | ||
527 | 28 | done | ||
528 | 29 | STATUS=$? | ||
529 | 30 | test $STATUS = 0 || ERRORS=1 | ||
530 | 31 | test $STATUS = 0 || echo $RESULTS | ||
531 | 32 | |||
532 | 33 | echo Running QML API check for $QML | ||
533 | 34 | # Palette gets included in Qt 5.2 qmlplugindump even though it's qml | ||
534 | 35 | BUILTINS=QQuick,QQml,U1db::,Palette python3 tests/qmlapicheck.py $QML plugins.qmltypes > components.api.new | ||
535 | 36 | STATUS=$? | ||
536 | 37 | test $STATUS = 0 || ERRORS=1 | ||
537 | 38 | test $STATUS = 0 || echo $RESULTS | ||
538 | 39 | |||
539 | 40 | echo Verifying the diff between existing and generated API | ||
540 | 41 | diff -Fqml -u components.api components.api.new | ||
541 | 42 | STATUS=$? | ||
542 | 43 | test $STATUS = 0 || ERRORS=1 | ||
543 | 44 | test $STATUS = 0 || echo $RESULTS | ||
544 | 45 | |||
545 | 46 | if [ "x$ERRORS" != "x1" ]; then | ||
546 | 47 | echo API is all fine. | ||
547 | 48 | exit 0 | ||
548 | 49 | else | ||
549 | 50 | echo API test failed with errors. Did you forget to update components.api? | ||
550 | 51 | exit 1 | ||
551 | 52 | fi | ||
552 | 0 | 53 | ||
553 | === modified file 'tests/tests.pro' | |||
554 | --- tests/tests.pro 2013-10-30 11:35:57 +0000 | |||
555 | +++ tests/tests.pro 2014-02-28 17:59:31 +0000 | |||
556 | @@ -1,7 +1,10 @@ | |||
557 | 1 | TEMPLATE = subdirs | 1 | TEMPLATE = subdirs |
558 | 2 | SUBDIRS += unit unit_x11 | 2 | SUBDIRS += unit unit_x11 |
559 | 3 | 3 | ||
561 | 4 | autopilot_module.path = /usr/lib/python2.7/dist-packages/ubuntuuitoolkit | 4 | autopilot_module.path = /usr/lib/python3/dist-packages/ubuntuuitoolkit |
562 | 5 | autopilot_module.files = autopilot/ubuntuuitoolkit/* | 5 | autopilot_module.files = autopilot/ubuntuuitoolkit/* |
563 | 6 | 6 | ||
565 | 7 | INSTALLS += autopilot_module | 7 | autopilot2_module.path = /usr/lib/python2.7/dist-packages/ubuntuuitoolkit |
566 | 8 | autopilot2_module.files = autopilot/ubuntuuitoolkit/* | ||
567 | 9 | |||
568 | 10 | INSTALLS += autopilot_module autopilot2_module | ||
569 | 8 | 11 | ||
570 | === modified file 'tests/unit/add_qmlmakecheck.pri' | |||
571 | --- tests/unit/add_qmlmakecheck.pri 2014-02-11 12:42:55 +0000 | |||
572 | +++ tests/unit/add_qmlmakecheck.pri 2014-02-28 17:59:31 +0000 | |||
573 | @@ -8,11 +8,5 @@ | |||
574 | 8 | check.commands += ../../unit/runtest.sh $${TARGET} $${TEST} minimal; | 8 | check.commands += ../../unit/runtest.sh $${TARGET} $${TEST} minimal; |
575 | 9 | } | 9 | } |
576 | 10 | check.commands += cd ../../..; | 10 | check.commands += cd ../../..; |
585 | 11 | # Silence spam on stderr due to fonts | 11 | check.commands += sh tests/qmlapicheck.sh || exit 1; |
586 | 12 | # https://bugs.launchpad.net/ubuntu-ui-toolkit/+bug/1256999 | 12 | check.commands += cd tests/unit |
579 | 13 | # https://bugreports.qt-project.org/browse/QTBUG-36243 | ||
580 | 14 | check.commands += qmlplugindump Ubuntu.Components 0.1 modules 2>/dev/null > plugins.qmltypes; | ||
581 | 15 | check.commands += qmlplugindump Ubuntu.PerformanceMetrics 0.1 modules 2>/dev/null >> plugins.qmltypes; | ||
582 | 16 | # Palette gets included in Qt 5.2 qmlplugindump even though it's qml | ||
583 | 17 | check.commands += BUILTINS=QQuick,QQml,U1db::,Palette python tests/qmlapicheck.py modules/Ubuntu/Components/qmldir modules/Ubuntu/Components/Colors/UbuntuColors.qml modules/Ubuntu/Components/Pickers/PickerPanel.qml modules/Ubuntu/Components/*/qmldir modules/Ubuntu/PerformanceMetrics/qmldir plugins.qmltypes > components.api.new; | ||
584 | 18 | check.commands += diff -Fqml -u components.api components.api.new || exit 1; cd tests/unit | ||
587 | 19 | 13 | ||
588 | === modified file 'ubuntu-sdk.pro' | |||
589 | --- ubuntu-sdk.pro 2013-12-12 13:01:56 +0000 | |||
590 | +++ ubuntu-sdk.pro 2014-02-28 17:59:31 +0000 | |||
591 | @@ -22,10 +22,15 @@ | |||
592 | 22 | QMAKE_EXTRA_TARGETS += test_api | 22 | QMAKE_EXTRA_TARGETS += test_api |
593 | 23 | 23 | ||
594 | 24 | test_components.target = test-components | 24 | test_components.target = test-components |
596 | 25 | test_components.commands = cd tests/autopilot; autopilot run ubuntuuitoolkit | 25 | test_components.commands = cd tests/autopilot; python3 -m autopilot.run run ubuntuuitoolkit |
597 | 26 | test_components.depends = modules/ubuntu-ui-toolkit.pro | 26 | test_components.depends = modules/ubuntu-ui-toolkit.pro |
598 | 27 | QMAKE_EXTRA_TARGETS += test_components | 27 | QMAKE_EXTRA_TARGETS += test_components |
599 | 28 | 28 | ||
600 | 29 | test_components2.target = test-components2 | ||
601 | 30 | test_components2.commands = cd tests/autopilot; python2 -m autopilot.run run ubuntuuitoolkit | ||
602 | 31 | test_components2.depends = modules/ubuntu-ui-toolkit.pro | ||
603 | 32 | QMAKE_EXTRA_TARGETS += test_components2 | ||
604 | 33 | |||
605 | 29 | qmluitests.target = qmluitests | 34 | qmluitests.target = qmluitests |
606 | 30 | qmluitests.commands = cd tests/unit_x11; make check | 35 | qmluitests.commands = cd tests/unit_x11; make check |
607 | 31 | qmluitests.depends = modules/ubuntu-ui-toolkit.pro | 36 | qmluitests.depends = modules/ubuntu-ui-toolkit.pro |
This branch merges and resolves conflicts between:
* lp:~xnox/ubuntu-ui-toolkit/py32ap
* lp:~kalikiana/ubuntu-ui-toolkit/qmlapicheckverbose
* lp:~elopio/ubuntu-ui-toolkit/listview-scroll_to_bottom