Merge lp:~elopio/ubuntu-ui-toolkit/pep8_and_copyright into lp:ubuntu-ui-toolkit
- pep8_and_copyright
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Florian Boucault |
Approved revision: | 611 |
Merged at revision: | 623 |
Proposed branch: | lp:~elopio/ubuntu-ui-toolkit/pep8_and_copyright |
Merge into: | lp:ubuntu-ui-toolkit |
Diff against target: |
673 lines (+205/-150) 6 files modified
tests/autopilot/UbuntuUiToolkit/__init__.py (+14/-5) tests/autopilot/UbuntuUiToolkit/emulators/__init__.py (+14/-5) tests/autopilot/UbuntuUiToolkit/emulators/main_window.py (+16/-6) tests/autopilot/UbuntuUiToolkit/tests/__init__.py (+51/-38) tests/autopilot/UbuntuUiToolkit/tests/gallery/__init__.py (+14/-6) tests/autopilot/UbuntuUiToolkit/tests/gallery/test_gallery.py (+96/-90) |
To merge this branch: | bzr merge lp:~elopio/ubuntu-ui-toolkit/pep8_and_copyright |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot | continuous-integration | Approve | |
Ubuntu SDK team | Pending | ||
Review via email: mp+173984@code.launchpad.net |
Commit message
Fixed the pep8 errors and copyright notices.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:610
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:611
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'tests/autopilot/UbuntuUiToolkit/__init__.py' | |||
2 | --- tests/autopilot/UbuntuUiToolkit/__init__.py 2013-07-03 17:03:25 +0000 | |||
3 | +++ tests/autopilot/UbuntuUiToolkit/__init__.py 2013-07-12 04:03:28 +0000 | |||
4 | @@ -1,8 +1,17 @@ | |||
5 | 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 -*- |
11 | 2 | # Copyright 2012 Canonical | 2 | # |
12 | 3 | # | 3 | # Copyright (C) 2012, 2013 Canonical Ltd. |
13 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # |
14 | 5 | # under the terms of the GNU Lesser General Public License version 3, as published | 5 | # This program is free software; you can redistribute it and/or modify |
15 | 6 | # by the Free Software Foundation. | 6 | # it under the terms of the GNU Lesser General Public License as published by |
16 | 7 | # the Free Software Foundation; version 3. | ||
17 | 8 | # | ||
18 | 9 | # This program is distributed in the hope that it will be useful, | ||
19 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | 12 | # GNU Lesser General Public License for more details. | ||
22 | 13 | # | ||
23 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
24 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
25 | 7 | 16 | ||
26 | 8 | """Ubuntu UI Toolkit autopilot tests and emulators - top level package.""" | 17 | """Ubuntu UI Toolkit autopilot tests and emulators - top level package.""" |
27 | 9 | 18 | ||
28 | === modified file 'tests/autopilot/UbuntuUiToolkit/emulators/__init__.py' | |||
29 | --- tests/autopilot/UbuntuUiToolkit/emulators/__init__.py 2013-07-03 17:03:25 +0000 | |||
30 | +++ tests/autopilot/UbuntuUiToolkit/emulators/__init__.py 2013-07-12 04:03:28 +0000 | |||
31 | @@ -1,6 +1,15 @@ | |||
32 | 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 -*- |
38 | 2 | # Copyright 2012 Canonical | 2 | # |
39 | 3 | # | 3 | # Copyright (C) 2012, 2013 Canonical Ltd. |
40 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # |
41 | 5 | # under the terms of the GNU General Public License version 3, as published | 5 | # This program is free software; you can redistribute it and/or modify |
42 | 6 | # by the Free Software Foundation. | 6 | # it under the terms of the GNU Lesser General Public License as published by |
43 | 7 | # the Free Software Foundation; version 3. | ||
44 | 8 | # | ||
45 | 9 | # This program is distributed in the hope that it will be useful, | ||
46 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
47 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
48 | 12 | # GNU Lesser General Public License for more details. | ||
49 | 13 | # | ||
50 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
51 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
52 | 7 | 16 | ||
53 | === modified file 'tests/autopilot/UbuntuUiToolkit/emulators/main_window.py' | |||
54 | --- tests/autopilot/UbuntuUiToolkit/emulators/main_window.py 2013-07-05 07:14:36 +0000 | |||
55 | +++ tests/autopilot/UbuntuUiToolkit/emulators/main_window.py 2013-07-12 04:03:28 +0000 | |||
56 | @@ -1,9 +1,19 @@ | |||
57 | 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 -*- |
63 | 2 | # Copyright 2013 Canonical | 2 | # |
64 | 3 | # | 3 | # Copyright (C) 2013 Canonical Ltd. |
65 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # |
66 | 5 | # under the terms of the GNU General Public License version 3, as published | 5 | # This program is free software; you can redistribute it and/or modify |
67 | 6 | # by the Free Software Foundation. | 6 | # it under the terms of the GNU Lesser General Public License as published by |
68 | 7 | # the Free Software Foundation; version 3. | ||
69 | 8 | # | ||
70 | 9 | # This program is distributed in the hope that it will be useful, | ||
71 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
72 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
73 | 12 | # GNU Lesser General Public License for more details. | ||
74 | 13 | # | ||
75 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
76 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
77 | 16 | |||
78 | 7 | 17 | ||
79 | 8 | class MainWindow(object): | 18 | class MainWindow(object): |
80 | 9 | """An emulator class that makes it easy to interact with the camera-app.""" | 19 | """An emulator class that makes it easy to interact with the camera-app.""" |
81 | @@ -17,6 +27,6 @@ | |||
82 | 17 | 27 | ||
83 | 18 | def get_object(self, typeName, name): | 28 | def get_object(self, typeName, name): |
84 | 19 | return self.app.select_single(typeName, objectName=name) | 29 | return self.app.select_single(typeName, objectName=name) |
86 | 20 | 30 | ||
87 | 21 | def get_object_by_text(self, typeName, itemText): | 31 | def get_object_by_text(self, typeName, itemText): |
88 | 22 | return self.app.select_single(typeName, text=itemText) | 32 | return self.app.select_single(typeName, text=itemText) |
89 | 23 | 33 | ||
90 | === modified file 'tests/autopilot/UbuntuUiToolkit/tests/__init__.py' | |||
91 | --- tests/autopilot/UbuntuUiToolkit/tests/__init__.py 2013-07-03 17:03:25 +0000 | |||
92 | +++ tests/autopilot/UbuntuUiToolkit/tests/__init__.py 2013-07-12 04:03:28 +0000 | |||
93 | @@ -1,9 +1,18 @@ | |||
94 | 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 -*- |
100 | 2 | # Copyright 2012 Canonical | 2 | # |
101 | 3 | # | 3 | # Copyright (C) 2012, 2013 Canonical Ltd. |
102 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # |
103 | 5 | # under the terms of the GNU Lesser General Public License version 3, as published | 5 | # This program is free software; you can redistribute it and/or modify |
104 | 6 | # by the Free Software Foundation. | 6 | # it under the terms of the GNU Lesser General Public License as published by |
105 | 7 | # the Free Software Foundation; version 3. | ||
106 | 8 | # | ||
107 | 9 | # This program is distributed in the hope that it will be useful, | ||
108 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
109 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
110 | 12 | # GNU Lesser General Public License for more details. | ||
111 | 13 | # | ||
112 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
113 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
114 | 7 | 16 | ||
115 | 8 | """Ubuntu UI Toolkit autopilot tests.""" | 17 | """Ubuntu UI Toolkit autopilot tests.""" |
116 | 9 | 18 | ||
117 | @@ -20,6 +29,7 @@ | |||
118 | 20 | 29 | ||
119 | 21 | from UbuntuUiToolkit.emulators.main_window import MainWindow | 30 | from UbuntuUiToolkit.emulators.main_window import MainWindow |
120 | 22 | 31 | ||
121 | 32 | |||
122 | 23 | def get_module_include_path(): | 33 | def get_module_include_path(): |
123 | 24 | return os.path.abspath( | 34 | return os.path.abspath( |
124 | 25 | os.path.join( | 35 | os.path.join( |
125 | @@ -29,22 +39,22 @@ | |||
126 | 29 | '..', | 39 | '..', |
127 | 30 | '..', | 40 | '..', |
128 | 31 | 'modules') | 41 | 'modules') |
130 | 32 | ) | 42 | ) |
131 | 33 | 43 | ||
132 | 34 | 44 | ||
133 | 35 | class UbuntuUiToolkitTestCase(AutopilotTestCase): | 45 | class UbuntuUiToolkitTestCase(AutopilotTestCase): |
134 | 36 | 46 | ||
136 | 37 | """A common test case class that provides several useful methods for SDK tests.""" | 47 | """Common test case class for SDK tests.""" |
137 | 38 | 48 | ||
138 | 39 | if model() == 'Desktop': | 49 | if model() == 'Desktop': |
139 | 40 | scenarios = [ | 50 | scenarios = [ |
141 | 41 | ('with mouse', dict(input_device_class=Mouse)) | 51 | ('with mouse', dict(input_device_class=Mouse)) |
142 | 42 | ] | 52 | ] |
143 | 43 | else: | 53 | else: |
144 | 44 | scenarios = [ | 54 | scenarios = [ |
146 | 45 | ('with touch', dict(input_device_class=Touch)) | 55 | ('with touch', dict(input_device_class=Touch)) |
147 | 46 | ] | 56 | ] |
149 | 47 | 57 | ||
150 | 48 | def setUp(self): | 58 | def setUp(self): |
151 | 49 | self.pointing_device = Pointer(self.input_device_class.create()) | 59 | self.pointing_device = Pointer(self.input_device_class.create()) |
152 | 50 | super(UbuntuUiToolkitTestCase, self).setUp() | 60 | super(UbuntuUiToolkitTestCase, self).setUp() |
153 | @@ -54,8 +64,8 @@ | |||
154 | 54 | # If the test class has defined a 'test_qml' class attribute then we | 64 | # If the test class has defined a 'test_qml' class attribute then we |
155 | 55 | # write it to disk and launch it inside the Qml Viewer. If not, then we | 65 | # write it to disk and launch it inside the Qml Viewer. If not, then we |
156 | 56 | # silently do nothing (presumably the test has something else planned). | 66 | # silently do nothing (presumably the test has something else planned). |
159 | 57 | arch = subprocess.check_output(["dpkg-architecture", | 67 | arch = subprocess.check_output( |
160 | 58 | "-qDEB_HOST_MULTIARCH"]).strip() | 68 | ["dpkg-architecture", "-qDEB_HOST_MULTIARCH"]).strip() |
161 | 59 | if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring): | 69 | if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring): |
162 | 60 | qml_path = mktemp(suffix='.qml') | 70 | qml_path = mktemp(suffix='.qml') |
163 | 61 | open(qml_path, 'w').write(self.test_qml) | 71 | open(qml_path, 'w').write(self.test_qml) |
164 | @@ -66,37 +76,40 @@ | |||
165 | 66 | "-I", get_module_include_path(), | 76 | "-I", get_module_include_path(), |
166 | 67 | qml_path) | 77 | qml_path) |
167 | 68 | 78 | ||
169 | 69 | if hasattr(self, 'test_qml_file') and isinstance(self.test_qml_file, basestring): | 79 | if (hasattr(self, 'test_qml_file') and |
170 | 80 | isinstance(self.test_qml_file, basestring)): | ||
171 | 70 | qml_path = self.test_qml_file | 81 | qml_path = self.test_qml_file |
172 | 71 | self.app = self.launch_test_application( | 82 | self.app = self.launch_test_application( |
173 | 72 | "/usr/lib/" + arch + "/qt5/bin/qmlscene", | 83 | "/usr/lib/" + arch + "/qt5/bin/qmlscene", |
174 | 73 | "-I", get_module_include_path(), | 84 | "-I", get_module_include_path(), |
175 | 74 | qml_path) | 85 | qml_path) |
176 | 75 | 86 | ||
179 | 76 | self.assertThat(self.main_window.get_qml_view().visible, | 87 | self.assertThat( |
180 | 77 | Eventually(Equals(True))) | 88 | self.main_window.get_qml_view().visible, Eventually(Equals(True))) |
181 | 78 | 89 | ||
182 | 79 | def checkListItem(self, itemText): | 90 | def checkListItem(self, itemText): |
183 | 80 | item = self.main_window.get_object_by_text("Standard", itemText) | 91 | item = self.main_window.get_object_by_text("Standard", itemText) |
185 | 81 | self.assertThat(item, Not(Is(None))); | 92 | self.assertThat(item, Not(Is(None))) |
186 | 82 | 93 | ||
187 | 83 | def getListItem(self, itemText): | 94 | def getListItem(self, itemText): |
188 | 84 | return self.main_window.get_object_by_text("Standard", itemText) | 95 | return self.main_window.get_object_by_text("Standard", itemText) |
189 | 85 | 96 | ||
190 | 86 | def getWidgetLoaderAndListView(self): | 97 | def getWidgetLoaderAndListView(self): |
192 | 87 | contentLoader = self.main_window.get_object("QQuickLoader", "contentLoader") | 98 | contentLoader = self.main_window.get_object( |
193 | 99 | "QQuickLoader", "contentLoader") | ||
194 | 88 | listView = self.main_window.get_object("QQuickListView", "widgetList") | 100 | listView = self.main_window.get_object("QQuickListView", "widgetList") |
197 | 89 | self.assertThat(listView, Not(Is(None))); | 101 | self.assertThat(listView, Not(Is(None))) |
198 | 90 | self.assertThat(listView.visible, Eventually(Equals(True))); | 102 | self.assertThat(listView.visible, Eventually(Equals(True))) |
199 | 91 | return (contentLoader, listView) | 103 | return (contentLoader, listView) |
200 | 92 | 104 | ||
201 | 93 | def loadItem(self, item): | 105 | def loadItem(self, item): |
203 | 94 | contentLoader = self.main_window.get_object("QQuickLoader", "contentLoader") | 106 | contentLoader = self.main_window.get_object( |
204 | 107 | "QQuickLoader", "contentLoader") | ||
205 | 95 | self.selectItem(item) | 108 | self.selectItem(item) |
207 | 96 | self.assertThat(contentLoader.progress,Eventually(Equals(1.0))) | 109 | self.assertThat(contentLoader.progress, Eventually(Equals(1.0))) |
208 | 97 | loadedPage = self.main_window.get_object_by_text("Standard", item) | 110 | loadedPage = self.main_window.get_object_by_text("Standard", item) |
211 | 98 | self.assertThat(loadedPage, Not(Is(None))); | 111 | self.assertThat(loadedPage, Not(Is(None))) |
212 | 99 | self.assertThat(loadedPage.visible, Eventually(Equals(True))); | 112 | self.assertThat(loadedPage.visible, Eventually(Equals(True))) |
213 | 100 | 113 | ||
214 | 101 | def drag(self, itemText, itemTextTo): | 114 | def drag(self, itemText, itemTextTo): |
215 | 102 | item = self.getListItem(itemText) | 115 | item = self.getListItem(itemText) |
216 | @@ -118,37 +131,38 @@ | |||
217 | 118 | 131 | ||
218 | 119 | def getMainView(self): | 132 | def getMainView(self): |
219 | 120 | mainView = self.app.select_many("MainView")[0] | 133 | mainView = self.app.select_many("MainView")[0] |
221 | 121 | self.assertThat(mainView, Not(Is(None))); | 134 | self.assertThat(mainView, Not(Is(None))) |
222 | 122 | return mainView | 135 | return mainView |
223 | 123 | 136 | ||
224 | 124 | def getOrientationHelper(self): | 137 | def getOrientationHelper(self): |
227 | 125 | orientationHelper = self.getMainView().select_many("OrientationHelper")[0] | 138 | orientationHelper = self.getMainView().select_many( |
228 | 126 | self.assertThat(orientationHelper, Not(Is(None))); | 139 | "OrientationHelper")[0] |
229 | 140 | self.assertThat(orientationHelper, Not(Is(None))) | ||
230 | 127 | return orientationHelper | 141 | return orientationHelper |
231 | 128 | 142 | ||
236 | 129 | def checkPageHeader(self,pageTitle): | 143 | def checkPageHeader(self, pageTitle): |
237 | 130 | orientationHelper = self.getOrientationHelper(); | 144 | orientationHelper = self.getOrientationHelper() |
238 | 131 | header = orientationHelper.select_many("Header",title=pageTitle)[0] | 145 | header = orientationHelper.select_many("Header", title=pageTitle)[0] |
239 | 132 | self.assertThat(header, Not(Is(None))); | 146 | self.assertThat(header, Not(Is(None))) |
240 | 133 | return header | 147 | return header |
241 | 134 | 148 | ||
243 | 135 | def getObject(self,objectName): | 149 | def getObject(self, objectName): |
244 | 136 | obj = self.app.select_single(objectName=objectName) | 150 | obj = self.app.select_single(objectName=objectName) |
246 | 137 | self.assertThat(obj, Not(Is(None))); | 151 | self.assertThat(obj, Not(Is(None))) |
247 | 138 | return obj | 152 | return obj |
248 | 139 | 153 | ||
250 | 140 | def tap(self,objectName): | 154 | def tap(self, objectName): |
251 | 141 | obj = self.getObject(objectName) | 155 | obj = self.getObject(objectName) |
252 | 142 | self.pointing_device.move_to_object(obj) | 156 | self.pointing_device.move_to_object(obj) |
253 | 143 | self.pointing_device.click() | 157 | self.pointing_device.click() |
254 | 144 | 158 | ||
256 | 145 | def mousePress(self,objectName): | 159 | def mousePress(self, objectName): |
257 | 146 | obj = self.getObject(objectName) | 160 | obj = self.getObject(objectName) |
258 | 147 | self.pointing_device.move_to_object(obj) | 161 | self.pointing_device.move_to_object(obj) |
259 | 148 | self.pointing_device.press() | 162 | self.pointing_device.press() |
260 | 149 | 163 | ||
261 | 150 | def mouseRelease(self): | 164 | def mouseRelease(self): |
263 | 151 | self.pointing_device.release() | 165 | self.pointing_device.release() |
264 | 152 | 166 | ||
265 | 153 | def type_string(self, string): | 167 | def type_string(self, string): |
266 | 154 | self.keyboard.type(string) | 168 | self.keyboard.type(string) |
267 | @@ -156,9 +170,9 @@ | |||
268 | 156 | def type_key(self, key): | 170 | def type_key(self, key): |
269 | 157 | self.keyboard.key(key) | 171 | self.keyboard.key(key) |
270 | 158 | 172 | ||
272 | 159 | def tap_clearButton(self,objectName): | 173 | def tap_clearButton(self, objectName): |
273 | 160 | textField = self.getObject(objectName) | 174 | textField = self.getObject(objectName) |
275 | 161 | self.assertThat(textField.hasClearButton, Equals(True)); | 175 | self.assertThat(textField.hasClearButton, Equals(True)) |
276 | 162 | btn = textField.select_single("AbstractButton") | 176 | btn = textField.select_single("AbstractButton") |
277 | 163 | self.pointing_device.move_to_object(btn) | 177 | self.pointing_device.move_to_object(btn) |
278 | 164 | self.pointing_device.click() | 178 | self.pointing_device.click() |
279 | @@ -166,4 +180,3 @@ | |||
280 | 166 | @property | 180 | @property |
281 | 167 | def main_window(self): | 181 | def main_window(self): |
282 | 168 | return MainWindow(self.app) | 182 | return MainWindow(self.app) |
283 | 169 | |||
284 | 170 | 183 | ||
285 | === modified file 'tests/autopilot/UbuntuUiToolkit/tests/gallery/__init__.py' | |||
286 | --- tests/autopilot/UbuntuUiToolkit/tests/gallery/__init__.py 2013-07-03 17:03:25 +0000 | |||
287 | +++ tests/autopilot/UbuntuUiToolkit/tests/gallery/__init__.py 2013-07-12 04:03:28 +0000 | |||
288 | @@ -1,9 +1,17 @@ | |||
289 | 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 -*- |
296 | 2 | # Copyright 2012 Canonical | 2 | # |
297 | 3 | # | 3 | # Copyright (C) 2012, 2013 Canonical Ltd. |
298 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # |
299 | 5 | # under the terms of the GNU Lesser General Public License version 3, as published | 5 | # This program is free software; you can redistribute it and/or modify |
300 | 6 | # by the Free Software Foundation. | 6 | # it under the terms of the GNU Lesser General Public License as published by |
301 | 7 | 7 | # the Free Software Foundation; version 3. | |
302 | 8 | # | ||
303 | 9 | # This program is distributed in the hope that it will be useful, | ||
304 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
305 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
306 | 12 | # GNU Lesser General Public License for more details. | ||
307 | 13 | # | ||
308 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
309 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
310 | 8 | 16 | ||
311 | 9 | """Tests for the Ubuntu UI Toolkit Gallery""" | 17 | """Tests for the Ubuntu UI Toolkit Gallery""" |
312 | 10 | 18 | ||
313 | === modified file 'tests/autopilot/UbuntuUiToolkit/tests/gallery/test_gallery.py' | |||
314 | --- tests/autopilot/UbuntuUiToolkit/tests/gallery/test_gallery.py 2013-07-03 18:38:13 +0000 | |||
315 | +++ tests/autopilot/UbuntuUiToolkit/tests/gallery/test_gallery.py 2013-07-12 04:03:28 +0000 | |||
316 | @@ -1,9 +1,18 @@ | |||
317 | 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 -*- |
323 | 2 | # Copyright 2012 Canonical | 2 | # |
324 | 3 | # | 3 | # Copyright (C) 2012, 2013 Canonical Ltd. |
325 | 4 | # This program is free software: you can redistribute it and/or modify it | 4 | # |
326 | 5 | # under the terms of the GNU Lesser General Public License version 3, as published | 5 | # This program is free software; you can redistribute it and/or modify |
327 | 6 | # by the Free Software Foundation. | 6 | # it under the terms of the GNU Lesser General Public License as published by |
328 | 7 | # the Free Software Foundation; version 3. | ||
329 | 8 | # | ||
330 | 9 | # This program is distributed in the hope that it will be useful, | ||
331 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
332 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
333 | 12 | # GNU Lesser General Public License for more details. | ||
334 | 13 | # | ||
335 | 14 | # You should have received a copy of the GNU Lesser General Public License | ||
336 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
337 | 7 | 16 | ||
338 | 8 | """Tests for the Ubuntu UI Toolkit Gallery""" | 17 | """Tests for the Ubuntu UI Toolkit Gallery""" |
339 | 9 | 18 | ||
340 | @@ -22,40 +31,45 @@ | |||
341 | 22 | 31 | ||
342 | 23 | # Support both running from system and in the source directory | 32 | # Support both running from system and in the source directory |
343 | 24 | runPath = os.path.dirname(os.path.realpath(__file__)) | 33 | runPath = os.path.dirname(os.path.realpath(__file__)) |
345 | 25 | localSourceFile = runPath + "/../../../../../examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml" | 34 | localSourceFile = ( |
346 | 35 | runPath + | ||
347 | 36 | "/../../../../../examples/ubuntu-ui-toolkit-gallery/" | ||
348 | 37 | "ubuntu-ui-toolkit-gallery.qml") | ||
349 | 26 | if (os.path.isfile(localSourceFile)): | 38 | if (os.path.isfile(localSourceFile)): |
350 | 27 | print "Using local source directory" | 39 | print "Using local source directory" |
351 | 28 | test_qml_file = localSourceFile | 40 | test_qml_file = localSourceFile |
352 | 29 | else: | 41 | else: |
353 | 30 | print "Using system QML file" | 42 | print "Using system QML file" |
355 | 31 | test_qml_file = "/usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/ubuntu-ui-toolkit-gallery.qml" | 43 | test_qml_file = ( |
356 | 44 | "/usr/lib/ubuntu-ui-toolkit/examples/ubuntu-ui-toolkit-gallery/" | ||
357 | 45 | "ubuntu-ui-toolkit-gallery.qml") | ||
358 | 32 | 46 | ||
359 | 33 | def test_0_can_select_mainwindow(self): | 47 | def test_0_can_select_mainwindow(self): |
360 | 34 | """Must be able to select the main window.""" | 48 | """Must be able to select the main window.""" |
361 | 35 | 49 | ||
362 | 36 | rootItem = self.main_window.get_qml_view() | 50 | rootItem = self.main_window.get_qml_view() |
363 | 37 | self.assertThat(rootItem, Not(Is(None))) | 51 | self.assertThat(rootItem, Not(Is(None))) |
365 | 38 | self.assertThat(rootItem.visible,Eventually(Equals(True))) | 52 | self.assertThat(rootItem.visible, Eventually(Equals(True))) |
366 | 39 | 53 | ||
367 | 40 | def test_can_select_listview(self): | 54 | def test_can_select_listview(self): |
373 | 41 | """Must be able to select the listview from main""" | 55 | """Must be able to select the listview from main""" |
374 | 42 | 56 | ||
375 | 43 | contentLoader,listView = self.getWidgetLoaderAndListView(); | 57 | contentLoader, listView = self.getWidgetLoaderAndListView() |
376 | 44 | 58 | ||
377 | 45 | # Don't have the first, already selected item as the first item to check | 59 | # Don't have the first, already selected item as the first item to |
378 | 60 | # check. | ||
379 | 46 | items = [ | 61 | items = [ |
392 | 47 | "Navigation", | 62 | "Navigation", |
393 | 48 | "Toggles", | 63 | "Toggles", |
394 | 49 | "Buttons", | 64 | "Buttons", |
395 | 50 | "Slider", | 65 | "Slider", |
396 | 51 | "Text Field", | 66 | "Text Field", |
397 | 52 | "Progress and activity", | 67 | "Progress and activity", |
398 | 53 | "Ubuntu Shape", | 68 | "Ubuntu Shape", |
399 | 54 | "Icons", | 69 | "Icons", |
400 | 55 | "Label", | 70 | "Label", |
401 | 56 | "List Items", | 71 | "List Items", |
402 | 57 | ] | 72 | ] |
391 | 58 | |||
403 | 59 | 73 | ||
404 | 60 | for item in items: | 74 | for item in items: |
405 | 61 | self.checkListItem(item) | 75 | self.checkListItem(item) |
406 | @@ -63,20 +77,20 @@ | |||
407 | 63 | self.checkPageHeader(item) | 77 | self.checkPageHeader(item) |
408 | 64 | 78 | ||
409 | 65 | # scroll view to expose more items | 79 | # scroll view to expose more items |
411 | 66 | self.drag("Icons","Text Field") | 80 | self.drag("Icons", "Text Field") |
412 | 67 | 81 | ||
414 | 68 | # Wait for the scrolling to finish, the next click fails on the | 82 | # Wait for the scrolling to finish, the next click fails on the |
415 | 69 | # slower Intel machine but succeeds on AMD and NVIDIA. | 83 | # slower Intel machine but succeeds on AMD and NVIDIA. |
416 | 70 | # (LP: #1180226) | 84 | # (LP: #1180226) |
417 | 71 | time.sleep(1) | 85 | time.sleep(1) |
418 | 72 | 86 | ||
419 | 73 | # now that we have more items, lets continue | 87 | # now that we have more items, lets continue |
420 | 74 | items = [ | 88 | items = [ |
426 | 75 | "Dialog", | 89 | "Dialog", |
427 | 76 | "Popover", | 90 | "Popover", |
428 | 77 | "Sheet", | 91 | "Sheet", |
429 | 78 | "Animations" | 92 | "Animations" |
430 | 79 | ] | 93 | ] |
431 | 80 | 94 | ||
432 | 81 | for item in items: | 95 | for item in items: |
433 | 82 | self.checkListItem(item) | 96 | self.checkListItem(item) |
434 | @@ -96,14 +110,14 @@ | |||
435 | 96 | 110 | ||
436 | 97 | # check default states | 111 | # check default states |
437 | 98 | item_data = [ | 112 | item_data = [ |
446 | 99 | ["checkbox_unchecked",False,True], | 113 | ["checkbox_unchecked", False, True], |
447 | 100 | ["checkbox_checked",True,True], | 114 | ["checkbox_checked", True, True], |
448 | 101 | ["checkbox_disabled_unchecked",False,False], | 115 | ["checkbox_disabled_unchecked", False, False], |
449 | 102 | ["checkbox_disabled_checked",True,False], | 116 | ["checkbox_disabled_checked", True, False], |
450 | 103 | ["switch_unchecked",False,True], | 117 | ["switch_unchecked", False, True], |
451 | 104 | ["switch_checked",True,True], | 118 | ["switch_checked", True, True], |
452 | 105 | ["switch_disabled_unchecked",False,False], | 119 | ["switch_disabled_unchecked", False, False], |
453 | 106 | ["switch_disabled_checked",True,False] | 120 | ["switch_disabled_checked", True, False] |
454 | 107 | ] | 121 | ] |
455 | 108 | 122 | ||
456 | 109 | for data in item_data: | 123 | for data in item_data: |
457 | @@ -114,7 +128,7 @@ | |||
458 | 114 | obj = self.getObject(objName) | 128 | obj = self.getObject(objName) |
459 | 115 | self.assertThat(obj.checked, Equals(objChecked)) | 129 | self.assertThat(obj.checked, Equals(objChecked)) |
460 | 116 | self.assertThat(obj.enabled, Equals(objEnabled)) | 130 | self.assertThat(obj.enabled, Equals(objEnabled)) |
462 | 117 | 131 | ||
463 | 118 | # try to interact with objects | 132 | # try to interact with objects |
464 | 119 | self.tap(objName) | 133 | self.tap(objName) |
465 | 120 | 134 | ||
466 | @@ -129,12 +143,12 @@ | |||
467 | 129 | self.checkPageHeader(item) | 143 | self.checkPageHeader(item) |
468 | 130 | 144 | ||
469 | 131 | item_data = [ | 145 | item_data = [ |
476 | 132 | ["button_text",True,None,None,"Call"], | 146 | ["button_text", True, None, None, "Call"], |
477 | 133 | ["button_text_disabled",False,None,None,"Call"], | 147 | ["button_text_disabled", False, None, None, "Call"], |
478 | 134 | ["button_color",True,[0,0,0,255],None,"Call"], | 148 | ["button_color", True, [0, 0, 0, 255], None, "Call"], |
479 | 135 | ["button_iconsource",True,None,"call.png",None], | 149 | ["button_iconsource", True, None, "call.png", None], |
480 | 136 | ["button_iconsource_right_text",True,None,"call.png","Call"], | 150 | ["button_iconsource_right_text", True, None, "call.png", "Call"], |
481 | 137 | ["button_iconsource_left_text",True,None,"call.png","Call"] | 151 | ["button_iconsource_left_text", True, None, "call.png", "Call"] |
482 | 138 | ] | 152 | ] |
483 | 139 | 153 | ||
484 | 140 | for data in item_data: | 154 | for data in item_data: |
485 | @@ -148,15 +162,15 @@ | |||
486 | 148 | self.assertThat(obj.enabled, Equals(objEnabled)) | 162 | self.assertThat(obj.enabled, Equals(objEnabled)) |
487 | 149 | 163 | ||
488 | 150 | print obj.color | 164 | print obj.color |
490 | 151 | if (objColor != None): | 165 | if (objColor is not None): |
491 | 152 | self.assertThat(obj.color, Equals(objColor)) | 166 | self.assertThat(obj.color, Equals(objColor)) |
492 | 153 | 167 | ||
494 | 154 | if (objIcon != None): | 168 | if (objIcon is not None): |
495 | 155 | self.assertThat(obj.iconSource.endswith(objIcon), Equals(True)) | 169 | self.assertThat(obj.iconSource.endswith(objIcon), Equals(True)) |
496 | 156 | 170 | ||
498 | 157 | if (objText != None): | 171 | if (objText is not None): |
499 | 158 | self.assertThat(obj.text, Equals(objText)) | 172 | self.assertThat(obj.text, Equals(objText)) |
501 | 159 | 173 | ||
502 | 160 | # try to interact with objects | 174 | # try to interact with objects |
503 | 161 | self.mousePress(objName) | 175 | self.mousePress(objName) |
504 | 162 | 176 | ||
505 | @@ -168,16 +182,16 @@ | |||
506 | 168 | self.mouseRelease() | 182 | self.mouseRelease() |
507 | 169 | 183 | ||
508 | 170 | self.assertThat(obj.pressed, Equals(False)) | 184 | self.assertThat(obj.pressed, Equals(False)) |
510 | 171 | 185 | ||
511 | 172 | def test_slider(self): | 186 | def test_slider(self): |
512 | 173 | item = "Slider" | 187 | item = "Slider" |
513 | 174 | self.loadItem(item) | 188 | self.loadItem(item) |
514 | 175 | self.checkPageHeader(item) | 189 | self.checkPageHeader(item) |
515 | 176 | 190 | ||
516 | 177 | item_data = [ | 191 | item_data = [ |
520 | 178 | [ "slider_standard" ], | 192 | ["slider_standard"], |
521 | 179 | [ "slider_live" ], | 193 | ["slider_live"], |
522 | 180 | [ "slider_range" ] | 194 | ["slider_range"] |
523 | 181 | ] | 195 | ] |
524 | 182 | 196 | ||
525 | 183 | for data in item_data: | 197 | for data in item_data: |
526 | @@ -186,18 +200,18 @@ | |||
527 | 186 | self.tap(objName) | 200 | self.tap(objName) |
528 | 187 | 201 | ||
529 | 188 | # TODO: move slider value | 202 | # TODO: move slider value |
531 | 189 | 203 | ||
532 | 190 | # def test_textarea(self): | 204 | # def test_textarea(self): |
533 | 191 | # item = "Text Field" | 205 | # item = "Text Field" |
534 | 192 | # self.loadItem(item) | 206 | # self.loadItem(item) |
535 | 193 | # self.checkPageHeader(item) | 207 | # self.checkPageHeader(item) |
536 | 194 | 208 | ||
537 | 195 | # template_textinputs = self.getObject("textinputs") | 209 | # template_textinputs = self.getObject("textinputs") |
539 | 196 | 210 | ||
540 | 197 | # item_data = [ | 211 | # item_data = [ |
542 | 198 | # [ "textarea_default", True, -1, template_textinputs.longText, None ], | 212 | # ["textarea_default", True, -1, template_textinputs.longText, None ], |
543 | 199 | # [ "textarea_expanding", True, -1, "", None], | 213 | # [ "textarea_expanding", True, -1, "", None], |
545 | 200 | # [ "textarea_richtext", True, -1, template_textinputs.richText, None ] | 214 | # [ "textarea_richtext", True, -1, template_textinputs.richText, None ] |
546 | 201 | # ] | 215 | # ] |
547 | 202 | 216 | ||
548 | 203 | # for data in item_data: | 217 | # for data in item_data: |
549 | @@ -211,7 +225,7 @@ | |||
550 | 211 | # self.tap(objName) | 225 | # self.tap(objName) |
551 | 212 | 226 | ||
552 | 213 | # self.assertThat(obj.enabled, Equals(objEnabled)) | 227 | # self.assertThat(obj.enabled, Equals(objEnabled)) |
554 | 214 | # # self.assertThat(obj.focus, Equals(obj.enabled)) | 228 | # # self.assertThat(obj.focus, Equals(obj.enabled)) |
555 | 215 | # self.assertThat(obj.highlighted, Equals(obj.focus)) | 229 | # self.assertThat(obj.highlighted, Equals(obj.focus)) |
556 | 216 | # #self.assertThat(obj.hasClearButton, Equals(True)) | 230 | # #self.assertThat(obj.hasClearButton, Equals(True)) |
557 | 217 | # self.assertThat(obj.text, Equals(objText)) | 231 | # self.assertThat(obj.text, Equals(objText)) |
558 | @@ -225,21 +239,18 @@ | |||
559 | 225 | 239 | ||
560 | 226 | # self.assertThat(obj.text,Equals("Hello World!")) | 240 | # self.assertThat(obj.text,Equals("Hello World!")) |
561 | 227 | 241 | ||
562 | 228 | |||
563 | 229 | |||
564 | 230 | |||
565 | 231 | def test_textfield(self): | 242 | def test_textfield(self): |
566 | 232 | item = "Text Field" | 243 | item = "Text Field" |
567 | 233 | self.loadItem(item) | 244 | self.loadItem(item) |
568 | 234 | self.checkPageHeader(item) | 245 | self.checkPageHeader(item) |
569 | 235 | 246 | ||
570 | 236 | template_textinputs = self.getObject("textinputs") | 247 | template_textinputs = self.getObject("textinputs") |
572 | 237 | 248 | ||
573 | 238 | item_data = [ | 249 | item_data = [ |
578 | 239 | [ "textfield_standard", True, 0, "", None ], | 250 | ["textfield_standard", True, 0, "", None], |
579 | 240 | [ "textfield_password", True, 2, "password", None ], | 251 | ["textfield_password", True, 2, "password", None], |
580 | 241 | [ "textfield_numbers", True, 0, "123", True ], | 252 | ["textfield_numbers", True, 0, "123", True], |
581 | 242 | [ "textfield_disabled", False, 0, "", None ], | 253 | ["textfield_disabled", False, 0, "", None], |
582 | 243 | ] | 254 | ] |
583 | 244 | 255 | ||
584 | 245 | for data in item_data: | 256 | for data in item_data: |
585 | @@ -253,25 +264,26 @@ | |||
586 | 253 | self.tap(objName) | 264 | self.tap(objName) |
587 | 254 | 265 | ||
588 | 255 | self.assertThat(obj.enabled, Equals(objEnabled)) | 266 | self.assertThat(obj.enabled, Equals(objEnabled)) |
590 | 256 | self.assertThat(obj.focus, Equals(obj.enabled)) | 267 | self.assertThat(obj.focus, Equals(obj.enabled)) |
591 | 257 | self.assertThat(obj.highlighted, Equals(obj.focus)) | 268 | self.assertThat(obj.highlighted, Equals(obj.focus)) |
592 | 258 | self.assertThat(obj.errorHighlight, Equals(False)) | 269 | self.assertThat(obj.errorHighlight, Equals(False)) |
593 | 259 | self.assertThat(obj.acceptableInput, Equals(True)) | 270 | self.assertThat(obj.acceptableInput, Equals(True)) |
594 | 260 | self.assertThat(obj.hasClearButton, Equals(True)) | 271 | self.assertThat(obj.hasClearButton, Equals(True)) |
595 | 261 | self.assertThat(obj.text, Equals(objText)) | 272 | self.assertThat(obj.text, Equals(objText)) |
596 | 262 | 273 | ||
598 | 263 | if (objEchoMode!=-1): | 274 | if (objEchoMode != -1): |
599 | 264 | self.assertThat(obj.echoMode, Equals(objEchoMode)) | 275 | self.assertThat(obj.echoMode, Equals(objEchoMode)) |
601 | 265 | 276 | ||
602 | 266 | if (objNumbersOnly): | 277 | if (objNumbersOnly): |
603 | 267 | self.type_string("abc") | 278 | self.type_string("abc") |
605 | 268 | self.assertThat(obj.text,Equals(objText)) | 279 | self.assertThat(obj.text, Equals(objText)) |
606 | 269 | self.assertThat(obj.errorHighlight, Equals(False)) | 280 | self.assertThat(obj.errorHighlight, Equals(False)) |
607 | 270 | self.assertThat(obj.acceptableInput, Equals(True)) | 281 | self.assertThat(obj.acceptableInput, Equals(True)) |
608 | 271 | else: | 282 | else: |
609 | 272 | self.type_string("Hello World!") | 283 | self.type_string("Hello World!") |
610 | 273 | if (objEnabled): | 284 | if (objEnabled): |
612 | 274 | self.assertThat(obj.text, Equals("%sHello World!" % (objText))) | 285 | self.assertThat( |
613 | 286 | obj.text, Equals("%sHello World!" % (objText))) | ||
614 | 275 | self.assertThat(obj.errorHighlight, Equals(False)) | 287 | self.assertThat(obj.errorHighlight, Equals(False)) |
615 | 276 | self.assertThat(obj.acceptableInput, Equals(True)) | 288 | self.assertThat(obj.acceptableInput, Equals(True)) |
616 | 277 | else: | 289 | else: |
617 | @@ -279,18 +291,15 @@ | |||
618 | 279 | 291 | ||
619 | 280 | self.tap_clearButton(objName) | 292 | self.tap_clearButton(objName) |
620 | 281 | 293 | ||
621 | 282 | |||
622 | 283 | |||
623 | 284 | |||
624 | 285 | def test_progress_and_activity(self): | 294 | def test_progress_and_activity(self): |
625 | 286 | item = "Progress and activity" | 295 | item = "Progress and activity" |
626 | 287 | self.loadItem(item) | 296 | self.loadItem(item) |
627 | 288 | self.checkPageHeader(item) | 297 | self.checkPageHeader(item) |
628 | 289 | 298 | ||
629 | 290 | item_data = [ | 299 | item_data = [ |
633 | 291 | [ "progressbar_standard" ], | 300 | ["progressbar_standard"], |
634 | 292 | [ "progressbar_indeterminate" ], | 301 | ["progressbar_indeterminate"], |
635 | 293 | [ "activityindicator_standard" ] | 302 | ["activityindicator_standard"] |
636 | 294 | ] | 303 | ] |
637 | 295 | 304 | ||
638 | 296 | for data in item_data: | 305 | for data in item_data: |
639 | @@ -299,7 +308,6 @@ | |||
640 | 299 | self.tap(objName) | 308 | self.tap(objName) |
641 | 300 | 309 | ||
642 | 301 | # TODO: check for properties | 310 | # TODO: check for properties |
643 | 302 | |||
644 | 303 | 311 | ||
645 | 304 | def test_ubuntushape(self): | 312 | def test_ubuntushape(self): |
646 | 305 | item = "Ubuntu Shape" | 313 | item = "Ubuntu Shape" |
647 | @@ -307,18 +315,16 @@ | |||
648 | 307 | self.checkPageHeader(item) | 315 | self.checkPageHeader(item) |
649 | 308 | 316 | ||
650 | 309 | item_data = [ | 317 | item_data = [ |
659 | 310 | [ "ubuntushape_color_hex" ], | 318 | ["ubuntushape_color_hex"], |
660 | 311 | [ "ubuntushape_color_lightblue" ], | 319 | ["ubuntushape_color_lightblue"], |
661 | 312 | [ "ubuntushape_color_darkgray" ], | 320 | ["ubuntushape_color_darkgray"], |
662 | 313 | [ "ubuntushape_image" ], | 321 | ["ubuntushape_image"], |
663 | 314 | [ "ubuntushape_radius_small" ], | 322 | ["ubuntushape_radius_small"], |
664 | 315 | [ "ubuntushape_radius_medium" ], | 323 | ["ubuntushape_radius_medium"], |
665 | 316 | [ "ubuntushape_sizes_15_6" ], | 324 | ["ubuntushape_sizes_15_6"], |
666 | 317 | [ "ubuntushape_sizes_10_14" ] | 325 | ["ubuntushape_sizes_10_14"] |
667 | 318 | ] | 326 | ] |
668 | 319 | 327 | ||
669 | 320 | for data in item_data: | 328 | for data in item_data: |
670 | 321 | objName = data[0] | 329 | objName = data[0] |
671 | 322 | obj = self.getObject(objName) | 330 | obj = self.getObject(objName) |
672 | 323 | |||
673 | 324 |
PASSED: Continuous integration, rev:609 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- ci/305/ jenkins. qa.ubuntu. com/job/ generic- mediumtests- saucy/956 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-amd64- ci/162 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-armhf- ci/162 jenkins. qa.ubuntu. com/job/ ubuntu- ui-toolkit- saucy-armhf- ci/162/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy/960 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- saucy/960/ artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- runner- saucy/823
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins: 8080/job/ ubuntu- ui-toolkit- ci/305/ rebuild
http://