Merge lp:~nskaggs/qtcreator-plugin-ubuntu/update-qml-autopilot into lp:qtcreator-plugin-ubuntu
- update-qml-autopilot
- Merge into trunk
Status: | Merged |
---|---|
Approved by: | Zoltan Balogh |
Approved revision: | 405 |
Merged at revision: | 396 |
Proposed branch: | lp:~nskaggs/qtcreator-plugin-ubuntu/update-qml-autopilot |
Merge into: | lp:qtcreator-plugin-ubuntu |
Diff against target: |
2450 lines (+1273/-674) 46 files modified
share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/CMakeLists.txt (+11/-9) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/CMakeLists.txt (+7/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/__init__.py (+38/-129) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/__init__.py (+54/-1) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/test_main.py (+18/-20) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/run (+4/-4) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit/tst_main.qml (+41/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/backend/CMakeLists.txt (+3/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/wizard.xml (+46/-45) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro (+6/-2) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/__init__.py (+41/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py (+54/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py (+21/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/run (+11/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit/tst_main.qml (+41/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro (+10/-0) share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml (+40/-35) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro (+13/-3) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/__init__.py (+41/-0) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py (+54/-0) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py (+21/-0) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/run (+11/-0) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit/tst_main.qml (+41/-0) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro (+9/-0) share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml (+49/-41) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro (+6/-2) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/__init__.py (+41/-0) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py (+54/-0) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py (+21/-0) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/run (+11/-0) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit/tst_main.qml (+41/-0) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro (+9/-1) share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml (+45/-40) share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py (+36/-71) share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/test_main.py (+0/-24) share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/__init__.py (+54/-0) share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/test_main.py (+21/-0) share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/run (+3/-3) share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml (+46/-47) share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/CMakeLists.txt (+4/-0) share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/__init__.py (+38/-129) share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/__init__.py (+54/-1) share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/test_main.py (+18/-20) share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/run (+4/-4) share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit/tst_main.qml (+41/-0) share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/wizard.xml (+41/-43) |
To merge this branch: | bzr merge lp:~nskaggs/qtcreator-plugin-ubuntu/update-qml-autopilot |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Zoltan Balogh | Approve | ||
PS Jenkins bot | continuous-integration | Approve | |
Max Brustkern (community) | Approve | ||
Leo Arias | Pending | ||
Review via email: mp+259164@code.launchpad.net |
Commit message
Update qml based templates to best practicies
Description of the change
Update the qml template for autopilot. I also copied the qml templates from the single qml template to all the other templates. This means all qml templates should have the same test templates covering unit and functional testing.
FYI, This will fail if someone makes a project with something like a "-" or other character in it. This is because autopilot imports the folder as a module and it needs to be valid. This is not a new problem but it would also be nice to solve it while we are in here :-) Ideas?
For review purposes, don't be put off by the diff size. All the template updates are the same, so you can focus on one.
PS Jenkins bot (ps-jenkins) wrote : | # |
- 394. By Nicholas Skaggs
-
rename main -> tests
- 395. By Nicholas Skaggs
-
fix package naming
- 396. By Nicholas Skaggs
-
fix naming
- 397. By Nicholas Skaggs
-
update other cmake template
- 398. By Nicholas Skaggs
-
flake8 and renames
- 399. By Nicholas Skaggs
-
more flake8
- 400. By Nicholas Skaggs
-
reversed __init__.py files
- 401. By Nicholas Skaggs
-
flake8
- 402. By Nicholas Skaggs
-
update all other qml templates to be the same
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:396
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 403. By Nicholas Skaggs
-
update wizard descriptions
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:403
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Nicholas Skaggs (nskaggs) wrote : | # |
Just fyi, I've confirmed this also runs as expected on the device, from the sdk, adt, etc.
- 404. By Nicholas Skaggs
-
merge benjamin's fixes to show testfiles
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:404
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
- 405. By Nicholas Skaggs
-
merge benjamin's fixes
- Unify naming of unittest subdirectories (qml vs unit)
- Add custom "check" and "autopilot" targets to easily run tests
- Fix targets in CMake buildfiles
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:405
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/CMakeLists.txt' |
2 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/CMakeLists.txt 2015-05-06 08:49:21 +0000 |
3 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/CMakeLists.txt 2015-05-26 21:42:21 +0000 |
4 | @@ -58,15 +58,17 @@ |
5 | |
6 | add_custom_target("autopilot" chmod +x ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run |
7 | COMMAND ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run |
8 | - DEPENDS %ProjectName%backend %ProjectName%backend-qmldir |
9 | - WORKING_DIRECTORY ./app) |
10 | - |
11 | -add_custom_target("check" /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/app/tests/unit -import ${CMAKE_BINARY_DIR}/backend |
12 | - DEPENDS %ProjectName%backend %ProjectName%backend-qmldir |
13 | - WORKING_DIRECTORY ./app) |
14 | - |
15 | -add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/%ProjectName%.qml |
16 | - DEPENDS %ProjectName%backend %ProjectName%backend-qmldir |
17 | + DEPENDS %ClickHookName:s%backend %ClickHookName:s%backend-qmldir |
18 | + WORKING_DIRECTORY ./app) |
19 | + |
20 | +add_custom_target("check" |
21 | + COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/backend/tests/unit -import ${CMAKE_BINARY_DIR}/backend |
22 | + COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/app/tests/unit -import ${CMAKE_BINARY_DIR}/backend |
23 | + DEPENDS %ClickHookName:s%backend %ClickHookName:s%backend-qmldir |
24 | + WORKING_DIRECTORY ./app) |
25 | + |
26 | +add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/Main.qml |
27 | + DEPENDS %ClickHookName:s%backend %ClickHookName:s%backend-qmldir |
28 | WORKING_DIRECTORY ./app) |
29 | |
30 | # No op custom target for all not compiled files, so they show up in the QtCreator project tree |
31 | |
32 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/CMakeLists.txt' |
33 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/CMakeLists.txt 2015-01-15 09:48:38 +0000 |
34 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/CMakeLists.txt 2015-05-26 21:42:21 +0000 |
35 | @@ -9,3 +9,10 @@ |
36 | install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DESKTOP_DIR}) |
37 | install(FILES ${QML_JS_FILES} DESTINATION ${%ProjectName:u%_DIR}) |
38 | |
39 | +# Make the autpilot files visible in qtcreator |
40 | +file(GLOB_RECURSE AUTOPILOT_TEST_FILES *.py) |
41 | +add_custom_target(%ProjectName:l%_AutopilotFiles ALL SOURCES ${AUTOPILOT_TEST_FILES}) |
42 | + |
43 | +# Make the unit test files visible in qtcreator |
44 | +file(GLOB_RECURSE UNIT_TEST_FILES tests/unit/*.qml) |
45 | +add_custom_target(%ProjectName:l%_UnitTestFiles ALL SOURCES ${UNIT_TEST_FILES}) |
46 | |
47 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/__init__.py' |
48 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/__init__.py 2014-02-05 22:28:56 +0000 |
49 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000 |
50 | @@ -1,132 +1,41 @@ |
51 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
52 | - |
53 | -"""Ubuntu Touch App autopilot tests.""" |
54 | - |
55 | -from os import remove |
56 | -import os.path |
57 | -from tempfile import mktemp |
58 | -import subprocess |
59 | - |
60 | -from autopilot.input import Mouse, Touch, Pointer |
61 | -from autopilot.matchers import Eventually |
62 | -from autopilot.platform import model |
63 | -from testtools.matchers import Is, Not, Equals |
64 | -from autopilot.testcase import AutopilotTestCase |
65 | - |
66 | -def get_module_include_path(): |
67 | - return os.path.abspath( |
68 | - os.path.join( |
69 | - os.path.dirname(__file__), |
70 | - '..', |
71 | - '..', |
72 | - '..', |
73 | - '..', |
74 | - 'backend', |
75 | - 'modules') |
76 | - ) |
77 | - |
78 | - |
79 | -class UbuntuTouchAppTestCase(AutopilotTestCase): |
80 | - """A common test case class that provides several useful methods for the tests.""" |
81 | - |
82 | - if model() == 'Desktop': |
83 | - scenarios = [ |
84 | - ('with mouse', dict(input_device_class=Mouse)) |
85 | - ] |
86 | - else: |
87 | - scenarios = [ |
88 | - ('with touch', dict(input_device_class=Touch)) |
89 | - ] |
90 | +"""Application autopilot helpers.""" |
91 | + |
92 | +import logging |
93 | +import ubuntuuitoolkit |
94 | + |
95 | +logger = logging.getLogger(__name__) |
96 | + |
97 | + |
98 | +class AppException(ubuntuuitoolkit.ToolkitException): |
99 | + |
100 | + """Exception raised when there are problems with the Application.""" |
101 | + |
102 | + |
103 | +class TouchApp(object): |
104 | + |
105 | + """Autopilot helper object for the application.""" |
106 | + |
107 | + def __init__(self, app_proxy, test_type): |
108 | + self.app = app_proxy |
109 | + self.test_type = test_type |
110 | + self.main_view = self.app.select_single(MainView) |
111 | |
112 | @property |
113 | - def main_window(self): |
114 | - return MainWindow(self.app) |
115 | - |
116 | - |
117 | - def setUp(self): |
118 | - self.pointing_device = Pointer(self.input_device_class.create()) |
119 | - super(UbuntuTouchAppTestCase, self).setUp() |
120 | - self.launch_test_qml() |
121 | - |
122 | - |
123 | - def launch_test_qml(self): |
124 | - # If the test class has defined a 'test_qml' class attribute then we |
125 | - # write it to disk and launch it inside the QML Scene. If not, then we |
126 | - # silently do nothing (presumably the test has something else planned). |
127 | - arch = subprocess.check_output(["dpkg-architecture", |
128 | - "-qDEB_HOST_MULTIARCH"]).strip() |
129 | - if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring): |
130 | - qml_path = mktemp(suffix='.qml') |
131 | - open(qml_path, 'w').write(self.test_qml) |
132 | - self.addCleanup(remove, qml_path) |
133 | - |
134 | - self.app = self.launch_test_application( |
135 | - "/usr/lib/" + arch + "/qt5/bin/qmlscene", |
136 | - "-I", get_module_include_path(), |
137 | - qml_path, |
138 | - app_type='qt') |
139 | - |
140 | - if hasattr(self, 'test_qml_file') and isinstance(self.test_qml_file, basestring): |
141 | - qml_path = self.test_qml_file |
142 | - self.app = self.launch_test_application( |
143 | - "/usr/lib/" + arch + "/qt5/bin/qmlscene", |
144 | - "-I", get_module_include_path(), |
145 | - qml_path, |
146 | - app_type='qt') |
147 | - |
148 | - self.assertThat(self.get_qml_view().visible, Eventually(Equals(True))) |
149 | - |
150 | - |
151 | - def get_qml_view(self): |
152 | - """Get the main QML view""" |
153 | - |
154 | - return self.app.select_single("QQuickView") |
155 | - |
156 | - def get_mainview(self): |
157 | - """Get the QML MainView""" |
158 | - |
159 | - mainView = self.app.select_single("MainView") |
160 | - self.assertThat(mainView, Not(Is(None))) |
161 | - return mainView |
162 | - |
163 | - |
164 | - def get_object(self,objectName): |
165 | - """Get a object based on the objectName""" |
166 | - |
167 | - obj = self.app.select_single(objectName=objectName) |
168 | - self.assertThat(obj, Not(Is(None))) |
169 | - return obj |
170 | - |
171 | - |
172 | - def mouse_click(self,objectName): |
173 | - """Move mouse on top of the object and click on it""" |
174 | - |
175 | - obj = self.get_object(objectName) |
176 | - self.pointing_device.move_to_object(obj) |
177 | - self.pointing_device.click() |
178 | - |
179 | - |
180 | - def mouse_press(self,objectName): |
181 | - """Move mouse on top of the object and press mouse button (without releasing it)""" |
182 | - |
183 | - obj = self.get_object(objectName) |
184 | - self.pointing_device.move_to_object(obj) |
185 | - self.pointing_device.press() |
186 | - |
187 | - |
188 | - def mouse_release(self): |
189 | - """Release mouse button""" |
190 | - |
191 | - self.pointing_device.release() |
192 | - |
193 | - |
194 | - def type_string(self, string): |
195 | - """Type a string with keyboard""" |
196 | - |
197 | - self.keyboard.type(string) |
198 | - |
199 | - |
200 | - def type_key(self, key): |
201 | - """Type a single key with keyboard""" |
202 | - |
203 | - self.keyboard.key(key) |
204 | + def pointing_device(self): |
205 | + return self.app.pointing_device |
206 | + |
207 | + |
208 | +class MainView(ubuntuuitoolkit.MainView): |
209 | + |
210 | + """A helper that makes it easy to interact with the mainview""" |
211 | + |
212 | + def __init__(self, *args): |
213 | + super(MainView, self).__init__(*args) |
214 | + self.visible.wait_for(True, 30) |
215 | + |
216 | + def get_button(self): |
217 | + return self.select_single('Button', objectName="button") |
218 | + |
219 | + def get_label(self): |
220 | + return self.select_single('Label', objectName="label") |
221 | \ No newline at end of file |
222 | |
223 | === renamed directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main' => 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests' |
224 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/__init__.py' |
225 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/__init__.py 2015-01-17 04:53:32 +0000 |
226 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000 |
227 | @@ -1,1 +1,54 @@ |
228 | -""" A Main.qml test suite """ |
229 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
230 | +"""Ubuntu Touch App Autopilot tests.""" |
231 | + |
232 | +import os |
233 | +import logging |
234 | + |
235 | +import %ProjectName% |
236 | + |
237 | +from autopilot.testcase import AutopilotTestCase |
238 | +from autopilot import logging as autopilot_logging |
239 | + |
240 | +import ubuntuuitoolkit |
241 | +from ubuntuuitoolkit import base |
242 | + |
243 | +logger = logging.getLogger(__name__) |
244 | + |
245 | + |
246 | +class BaseTestCase(AutopilotTestCase): |
247 | + |
248 | + """A common test case class |
249 | + |
250 | + """ |
251 | + |
252 | + local_location = os.path.dirname(os.path.dirname(os.getcwd())) |
253 | + local_location_qml = os.path.join(local_location, 'Main.qml') |
254 | + click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%') |
255 | + |
256 | + def setUp(self): |
257 | + super(BaseTestCase, self).setUp() |
258 | + self.launcher, self.test_type = self.get_launcher_and_type() |
259 | + self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type) |
260 | + |
261 | + def get_launcher_and_type(self): |
262 | + if os.path.exists(self.local_location_qml): |
263 | + launcher = self.launch_test_local |
264 | + test_type = 'local' |
265 | + else: |
266 | + launcher = self.launch_test_click |
267 | + test_type = 'click' |
268 | + return launcher, test_type |
269 | + |
270 | + @autopilot_logging.log_action(logger.info) |
271 | + def launch_test_local(self): |
272 | + return self.launch_test_application( |
273 | + base.get_qmlscene_launch_command(), |
274 | + self.local_location_qml, |
275 | + app_type='qt', |
276 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
277 | + |
278 | + @autopilot_logging.log_action(logger.info) |
279 | + def launch_test_click(self): |
280 | + return self.launch_click_package( |
281 | + self.click_package, |
282 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
283 | \ No newline at end of file |
284 | |
285 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/test_main.py' |
286 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/test_main.py 2015-05-06 08:49:21 +0000 |
287 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000 |
288 | @@ -1,23 +1,21 @@ |
289 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
290 | |
291 | -"""Tests for the Hello World""" |
292 | - |
293 | from autopilot.matchers import Eventually |
294 | -from textwrap import dedent |
295 | -from testtools.matchers import Is, Not, Equals |
296 | -from testtools import skip |
297 | -import os |
298 | -from %ProjectName% import UbuntuTouchAppTestCase |
299 | - |
300 | - |
301 | -class MainTests(UbuntuTouchAppTestCase): |
302 | - """Generic tests for the Hello World""" |
303 | - |
304 | - test_qml_file = "%s/%s/Main.qml" % (os.path.dirname(os.path.realpath(__file__)),"../../../..") |
305 | - |
306 | - def test_0_can_select_mainView(self): |
307 | - """Must be able to select the mainview.""" |
308 | - |
309 | - mainView = self.get_mainview() |
310 | - self.assertThat(mainView.visible,Eventually(Equals(True))) |
311 | - |
312 | +from testtools.matchers import Equals |
313 | +from %ProjectName% import tests |
314 | + |
315 | + |
316 | +class MainViewTestCase(tests.BaseTestCase): |
317 | + """Tests for the mainview""" |
318 | + |
319 | + def setUp(self): |
320 | + super(MainViewTestCase, self).setUp() |
321 | + |
322 | + def test_click_button(self): |
323 | + # Find and click the button |
324 | + button = self.app.main_view.get_button() |
325 | + self.app.pointing_device.click_object(button) |
326 | + |
327 | + # Make an assertion about what should happen |
328 | + label = self.app.main_view.get_label() |
329 | + self.assertThat(label.text, Eventually(Equals('..world!'))) |
330 | \ No newline at end of file |
331 | |
332 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/run' |
333 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/run 2014-06-30 15:20:18 +0000 |
334 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/run 2015-05-26 21:42:21 +0000 |
335 | @@ -1,11 +1,11 @@ |
336 | #!/bin/bash |
337 | |
338 | -if [[ -z `which autopilot` ]]; then |
339 | - echo "Autopilot is not installed. Skip" |
340 | +if [[ -z `which autopilot3` ]]; then |
341 | + echo "python3-autopilot is not installed. Skip" |
342 | exit |
343 | fi |
344 | |
345 | SCRIPTPATH=`dirname $0` |
346 | pushd ${SCRIPTPATH} |
347 | -autopilot run %ProjectName% |
348 | -popd |
349 | +autopilot3 run %ProjectName% |
350 | +popd |
351 | \ No newline at end of file |
352 | |
353 | === added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit' |
354 | === added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit/tst_main.qml' |
355 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000 |
356 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000 |
357 | @@ -0,0 +1,41 @@ |
358 | +import QtQuick 2.0 |
359 | +import QtTest 1.0 |
360 | +import Ubuntu.Test 1.0 |
361 | +import "../../" |
362 | +// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase |
363 | + |
364 | +// Execute these tests with: |
365 | +// qmltestrunner |
366 | + |
367 | +Item { |
368 | + |
369 | + width: units.gu(100) |
370 | + height: units.gu(75) |
371 | + |
372 | + // The objects |
373 | + Main { |
374 | + id: main |
375 | + } |
376 | + |
377 | + UbuntuTestCase { |
378 | + name: "MainTestCase" |
379 | + |
380 | + when: windowShown |
381 | + |
382 | + |
383 | + function init() { |
384 | + var label = findChild(main, "label"); |
385 | + // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method |
386 | + compare("Hello world..", label.text); |
387 | + } |
388 | + |
389 | + function test_clickButtonMustChangeLabel() { |
390 | + var button = findChild(main, "button"); |
391 | + var buttonCenter = centerOf(button) |
392 | + mouseClick(button, buttonCenter.x, buttonCenter.y); |
393 | + var label = findChild(main, "label"); |
394 | + // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method |
395 | + tryCompare(label, "text", "..from Cpp Backend", 1); |
396 | + } |
397 | + } |
398 | +} |
399 | |
400 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/backend/CMakeLists.txt' |
401 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/backend/CMakeLists.txt 2014-07-10 15:35:32 +0000 |
402 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/backend/CMakeLists.txt 2015-05-26 21:42:21 +0000 |
403 | @@ -8,6 +8,9 @@ |
404 | modules/%ClickHookName:s%/mytype.cpp |
405 | ) |
406 | |
407 | +# Make the unit test files visible on qtcreator |
408 | +add_custom_target(%ClickHookName:s%backend_UNITTEST_QML_FILES ALL SOURCES "tests/unit/tst_mytype.qml") |
409 | + |
410 | add_library(%ClickHookName:s%backend MODULE |
411 | ${%ClickHookName:s%backend_SRCS} |
412 | ) |
413 | |
414 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/wizard.xml' |
415 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/wizard.xml 2015-05-06 08:49:21 +0000 |
416 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/wizard.xml 2015-05-26 21:42:21 +0000 |
417 | @@ -1,73 +1,74 @@ |
418 | <?xml version="1.0" encoding="UTF-8"?> |
419 | <wizard version="1" kind="project" firstpage="10" id="A4_UbuntuAppWBackendPlusTabsCMake'" category="A.UbuntuProject" |
420 | - platformIndependent="true" |
421 | + platformIndependent="true" |
422 | class="ubuntu-project-cmake" |
423 | - featuresRequired="" |
424 | + featuresRequired="" |
425 | > |
426 | <icon>../share/ubuntu.png</icon> |
427 | <description>A simple C++ based QtQuick2 Extension Library with |
428 | simple UI written in QML. |
429 | |
430 | -Includes also |
431 | +Also includes: |
432 | - a unit test for C++ |
433 | - unit and functional tests for QML |
434 | </description> |
435 | <displayname>QML App with C++ plugin (cmake)</displayname> |
436 | <displaycategory>Ubuntu</displaycategory> |
437 | <files> |
438 | - <file source="CMakeLists.txt" target="CMakeLists.txt" openproject="true"/> |
439 | - <file source="backend/CMakeLists.txt" target="backend/CMakeLists.txt" openeditor="false"/> |
440 | - <file source="backend/modules/displayName/backend.h" target="backend/modules/%ClickHookName:s%/backend.h" openeditor="false"/> |
441 | - <file source="backend/modules/displayName/backend.cpp" target="backend/modules/%ClickHookName:s%/backend.cpp" openeditor="false"/> |
442 | - <file source="backend/modules/displayName/mytype.h" target="backend/modules/%ClickHookName:s%/mytype.h" openeditor="false"/> |
443 | - <file source="backend/modules/displayName/mytype.cpp" target="backend/modules/%ClickHookName:s%/mytype.cpp" openeditor="false"/> |
444 | - <file source="backend/modules/displayName/qmldir" target="backend/modules/%ClickHookName:s%/qmldir" openeditor="false"/> |
445 | - <file source="backend/tests/unit/tst_mytype.qml" target="backend/tests/unit/tst_mytype.qml" openeditor="false"/> |
446 | - <file source="app/graphics/toolbarIcon@8.png" target="app/graphics/toolbarIcon@8.png" openeditor="false" binary="true"/> |
447 | - <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/> |
448 | - <file source="app/graphics/displayName.png" target="app/graphics/%ProjectName%.png" openeditor="false" binary="true"/> |
449 | - <file source="app/CMakeLists.txt" target="app/CMakeLists.txt" openeditor="false"/> |
450 | - <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/> |
451 | - <file source="app/tests/autopilot/displayName/main/test_main.py" target="app/tests/autopilot/%ProjectName%/main/test_main.py" openeditor="false"/> |
452 | - <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
453 | - <file source="app/tests/autopilot/displayName/main/__init__.py" target="app/tests/autopilot/%ProjectName%/main/__init__.py" openeditor="false"/> |
454 | - <file source="cmake/Click.cmake" target="cmake/Click.cmake" openeditor="false"/> |
455 | - <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/> |
456 | - <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/> |
457 | - <file source="app/Main.qml" target="app/Main.qml" openeditor="true"/> |
458 | - <file source="po/CMakeLists.txt" target="po/CMakeLists.txt" openeditor="false"/> |
459 | + <file source="CMakeLists.txt" target="CMakeLists.txt" openproject="true"/> |
460 | + <file source="backend/CMakeLists.txt" target="backend/CMakeLists.txt" openeditor="false"/> |
461 | + <file source="backend/modules/displayName/backend.h" target="backend/modules/%ClickHookName:s%/backend.h" openeditor="false"/> |
462 | + <file source="backend/modules/displayName/backend.cpp" target="backend/modules/%ClickHookName:s%/backend.cpp" openeditor="false"/> |
463 | + <file source="backend/modules/displayName/mytype.h" target="backend/modules/%ClickHookName:s%/mytype.h" openeditor="false"/> |
464 | + <file source="backend/modules/displayName/mytype.cpp" target="backend/modules/%ClickHookName:s%/mytype.cpp" openeditor="false"/> |
465 | + <file source="backend/modules/displayName/qmldir" target="backend/modules/%ClickHookName:s%/qmldir" openeditor="false"/> |
466 | + <file source="backend/tests/unit/tst_mytype.qml" target="backend/tests/unit/tst_mytype.qml" openeditor="false"/> |
467 | + <file source="app/graphics/toolbarIcon@8.png" target="app/graphics/toolbarIcon@8.png" openeditor="false" binary="true"/> |
468 | + <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/> |
469 | + <file source="app/graphics/displayName.png" target="app/graphics/%ProjectName%.png" openeditor="false" binary="true"/> |
470 | + <file source="app/CMakeLists.txt" target="app/CMakeLists.txt" openeditor="false"/> |
471 | + <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/> |
472 | + <file source="app/tests/autopilot/displayName/tests/test_main.py" target="app/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/> |
473 | + <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
474 | + <file source="app/tests/autopilot/displayName/tests/__init__.py" target="app/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/> |
475 | + <file source="app/tests/unit/tst_main.qml" target="app/tests/unit/tst_main.qml" openeditor="false"/> |
476 | + <file source="cmake/Click.cmake" target="cmake/Click.cmake" openeditor="false"/> |
477 | + <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/> |
478 | + <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/> |
479 | + <file source="app/Main.qml" target="app/Main.qml" openeditor="true"/> |
480 | + <file source="po/CMakeLists.txt" target="po/CMakeLists.txt" openeditor="false"/> |
481 | </files> |
482 | |
483 | - <!-- Create a 2nd wizard page with click package parameters --> |
484 | - <fieldpagetitle>Click package parameters</fieldpagetitle> |
485 | - <fields> |
486 | - <field mandatory="true" name="ClickDomain"> |
487 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
488 | - defaulttext="" placeholdertext="Nickname"/> |
489 | - <fielddescription>Nickname:</fielddescription> |
490 | - </field> |
491 | - <field mandatory="true" name="ClickMaintainer"> |
492 | - <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
493 | - defaulttext="" placeholdertext="Maintainer"/> |
494 | - <fielddescription>Maintainer:</fielddescription> |
495 | - </field> |
496 | - <field mandatory="true" name="ClickHookName"> |
497 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
498 | - defaulttext="myapp" placeholdertext="app hook name"/> |
499 | - <fielddescription>App name:</fielddescription> |
500 | - </field> |
501 | + <!-- Create a 2nd wizard page with click package parameters --> |
502 | + <fieldpagetitle>Click package parameters</fieldpagetitle> |
503 | + <fields> |
504 | + <field mandatory="true" name="ClickDomain"> |
505 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
506 | + defaulttext="" placeholdertext="Nickname"/> |
507 | + <fielddescription>Nickname:</fielddescription> |
508 | + </field> |
509 | + <field mandatory="true" name="ClickMaintainer"> |
510 | + <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
511 | + defaulttext="" placeholdertext="Maintainer"/> |
512 | + <fielddescription>Maintainer:</fielddescription> |
513 | + </field> |
514 | + <field mandatory="true" name="ClickHookName"> |
515 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
516 | + defaulttext="myapp" placeholdertext="app hook name"/> |
517 | + <fielddescription>App name:</fielddescription> |
518 | + </field> |
519 | <field name="ClickFrameworkVersion"> |
520 | <fieldcontrol class="QComboBox" defaultindex="0"> |
521 | <comboentries> |
522 | - <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
523 | - <comboentry value="ubuntu-sdk-dummy-framework"> |
524 | + <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
525 | + <comboentry value="ubuntu-sdk-dummy-framework"> |
526 | <comboentrytext>Dummy Framework</comboentrytext> |
527 | </comboentry> |
528 | </comboentries> |
529 | </fieldcontrol> |
530 | <fielddescription>Framework:</fielddescription> |
531 | </field> |
532 | - </fields> |
533 | + </fields> |
534 | <validationrules> |
535 | <validationrule condition='/^(.*)\s+<(.*@.*)>$/.test("%ClickMaintainer%")'> |
536 | <message>Invalid format for maintainer (should be like "Joe Bloggs <joe.bloggs@isp.com>")</message> |
537 | |
538 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro' |
539 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro 2015-01-16 10:50:52 +0000 |
540 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro 2015-05-26 21:42:21 +0000 |
541 | @@ -4,14 +4,18 @@ |
542 | RESOURCES += %ClickHookName%.qrc |
543 | |
544 | QML_FILES += $$files(*.qml,true) \ |
545 | - $$files(*.js,true) |
546 | + $$files(*.js,true) |
547 | |
548 | CONF_FILES += %ClickHookName%.apparmor \ |
549 | %ClickHookName%.desktop \ |
550 | %ClickHookName%.png |
551 | |
552 | +AP_TEST_FILES += tests/autopilot/run \ |
553 | + $$files(tests/*.py,true) |
554 | + |
555 | OTHER_FILES += $${CONF_FILES} \ |
556 | - $${QML_FILES} |
557 | + $${QML_FILES} \ |
558 | + $${AP_TEST_FILES} |
559 | |
560 | #specify where the qml/js files are installed to |
561 | qml_files.path = /%ClickHookName% |
562 | |
563 | === added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests' |
564 | === added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot' |
565 | === added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName' |
566 | === added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/__init__.py' |
567 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/__init__.py 1970-01-01 00:00:00 +0000 |
568 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000 |
569 | @@ -0,0 +1,41 @@ |
570 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
571 | +"""Application autopilot helpers.""" |
572 | + |
573 | +import logging |
574 | +import ubuntuuitoolkit |
575 | + |
576 | +logger = logging.getLogger(__name__) |
577 | + |
578 | + |
579 | +class AppException(ubuntuuitoolkit.ToolkitException): |
580 | + |
581 | + """Exception raised when there are problems with the Application.""" |
582 | + |
583 | + |
584 | +class TouchApp(object): |
585 | + |
586 | + """Autopilot helper object for the application.""" |
587 | + |
588 | + def __init__(self, app_proxy, test_type): |
589 | + self.app = app_proxy |
590 | + self.test_type = test_type |
591 | + self.main_view = self.app.select_single(MainView) |
592 | + |
593 | + @property |
594 | + def pointing_device(self): |
595 | + return self.app.pointing_device |
596 | + |
597 | + |
598 | +class MainView(ubuntuuitoolkit.MainView): |
599 | + |
600 | + """A helper that makes it easy to interact with the mainview""" |
601 | + |
602 | + def __init__(self, *args): |
603 | + super(MainView, self).__init__(*args) |
604 | + self.visible.wait_for(True, 30) |
605 | + |
606 | + def get_button(self): |
607 | + return self.select_single('Button', objectName="button") |
608 | + |
609 | + def get_label(self): |
610 | + return self.select_single('Label', objectName="label") |
611 | \ No newline at end of file |
612 | |
613 | === added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests' |
614 | === added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py' |
615 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000 |
616 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000 |
617 | @@ -0,0 +1,54 @@ |
618 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
619 | +"""Ubuntu Touch App Autopilot tests.""" |
620 | + |
621 | +import os |
622 | +import logging |
623 | + |
624 | +import %ProjectName% |
625 | + |
626 | +from autopilot.testcase import AutopilotTestCase |
627 | +from autopilot import logging as autopilot_logging |
628 | + |
629 | +import ubuntuuitoolkit |
630 | +from ubuntuuitoolkit import base |
631 | + |
632 | +logger = logging.getLogger(__name__) |
633 | + |
634 | + |
635 | +class BaseTestCase(AutopilotTestCase): |
636 | + |
637 | + """A common test case class |
638 | + |
639 | + """ |
640 | + |
641 | + local_location = os.path.dirname(os.path.dirname(os.getcwd())) |
642 | + local_location_qml = os.path.join(local_location, 'Main.qml') |
643 | + click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%') |
644 | + |
645 | + def setUp(self): |
646 | + super(BaseTestCase, self).setUp() |
647 | + self.launcher, self.test_type = self.get_launcher_and_type() |
648 | + self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type) |
649 | + |
650 | + def get_launcher_and_type(self): |
651 | + if os.path.exists(self.local_location_qml): |
652 | + launcher = self.launch_test_local |
653 | + test_type = 'local' |
654 | + else: |
655 | + launcher = self.launch_test_click |
656 | + test_type = 'click' |
657 | + return launcher, test_type |
658 | + |
659 | + @autopilot_logging.log_action(logger.info) |
660 | + def launch_test_local(self): |
661 | + return self.launch_test_application( |
662 | + base.get_qmlscene_launch_command(), |
663 | + self.local_location_qml, |
664 | + app_type='qt', |
665 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
666 | + |
667 | + @autopilot_logging.log_action(logger.info) |
668 | + def launch_test_click(self): |
669 | + return self.launch_click_package( |
670 | + self.click_package, |
671 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
672 | \ No newline at end of file |
673 | |
674 | === added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py' |
675 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000 |
676 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000 |
677 | @@ -0,0 +1,21 @@ |
678 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
679 | + |
680 | +from autopilot.matchers import Eventually |
681 | +from testtools.matchers import Equals |
682 | +from %ProjectName% import tests |
683 | + |
684 | + |
685 | +class MainViewTestCase(tests.BaseTestCase): |
686 | + """Tests for the mainview""" |
687 | + |
688 | + def setUp(self): |
689 | + super(MainViewTestCase, self).setUp() |
690 | + |
691 | + def test_click_button(self): |
692 | + # Find and click the button |
693 | + button = self.app.main_view.get_button() |
694 | + self.app.pointing_device.click_object(button) |
695 | + |
696 | + # Make an assertion about what should happen |
697 | + label = self.app.main_view.get_label() |
698 | + self.assertThat(label.text, Eventually(Equals('..world!'))) |
699 | \ No newline at end of file |
700 | |
701 | === added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/run' |
702 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/run 1970-01-01 00:00:00 +0000 |
703 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/run 2015-05-26 21:42:21 +0000 |
704 | @@ -0,0 +1,11 @@ |
705 | +#!/bin/bash |
706 | + |
707 | +if [[ -z `which autopilot3` ]]; then |
708 | + echo "python3-autopilot is not installed. Skip" |
709 | + exit |
710 | +fi |
711 | + |
712 | +SCRIPTPATH=`dirname $0` |
713 | +pushd ${SCRIPTPATH} |
714 | +autopilot3 run %ProjectName% |
715 | +popd |
716 | \ No newline at end of file |
717 | |
718 | === added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit' |
719 | === added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit/tst_main.qml' |
720 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000 |
721 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000 |
722 | @@ -0,0 +1,41 @@ |
723 | +import QtQuick 2.0 |
724 | +import QtTest 1.0 |
725 | +import Ubuntu.Test 1.0 |
726 | +import "../../" |
727 | +// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase |
728 | + |
729 | +// Execute these tests with: |
730 | +// qmltestrunner |
731 | + |
732 | +Item { |
733 | + |
734 | + width: units.gu(100) |
735 | + height: units.gu(75) |
736 | + |
737 | + // The objects |
738 | + Main { |
739 | + id: main |
740 | + } |
741 | + |
742 | + UbuntuTestCase { |
743 | + name: "MainTestCase" |
744 | + |
745 | + when: windowShown |
746 | + |
747 | + |
748 | + function init() { |
749 | + var label = findChild(main, "label"); |
750 | + // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method |
751 | + compare("Hello world..", label.text); |
752 | + } |
753 | + |
754 | + function test_clickButtonMustChangeLabel() { |
755 | + var button = findChild(main, "button"); |
756 | + var buttonCenter = centerOf(button) |
757 | + mouseClick(button, buttonCenter.x, buttonCenter.y); |
758 | + var label = findChild(main, "label"); |
759 | + // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method |
760 | + tryCompare(label, "text", "..from Cpp Backend", 1); |
761 | + } |
762 | + } |
763 | +} |
764 | |
765 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro' |
766 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro 2015-01-16 10:50:52 +0000 |
767 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro 2015-05-26 21:42:21 +0000 |
768 | @@ -31,4 +31,14 @@ |
769 | # compiled and installed into the right place in the click package |
770 | UBUNTU_PO_FILES+=$$files(po/*.po) |
771 | |
772 | +aptest.target = autopilot |
773 | +aptest.commands = QML2_IMPORT_PATH=$$OUT_PWD/backend bash $$PWD/app/tests/autopilot/run |
774 | +aptest.depends = sub-app sub-backend-App |
775 | + |
776 | +unittest.target = check |
777 | +unittest.commands = /usr/bin/qmltestrunner -input $$PWD/backend/tests/unit -import $$OUT_PWD/backend |
778 | +unittest.commands += && /usr/bin/qmltestrunner -input $$PWD/app/tests/unit -import $$OUT_PWD/backend |
779 | +unittest.depends = sub-app sub-backend-App |
780 | + |
781 | +QMAKE_EXTRA_TARGETS += aptest unittest |
782 | |
783 | |
784 | === modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml' |
785 | --- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml 2015-02-04 17:42:14 +0000 |
786 | +++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml 2015-05-26 21:42:21 +0000 |
787 | @@ -1,14 +1,14 @@ |
788 | <?xml version="1.0" encoding="UTF-8"?> |
789 | <wizard version="1" kind="project" firstpage="10" id="A4_UbuntuAppBackendQmake'" category="A.UbuntuProject" |
790 | - platformIndependent="true" |
791 | + platformIndependent="true" |
792 | class="ubuntu-project-qmake" |
793 | - featuresRequired="" |
794 | + featuresRequired="" |
795 | > |
796 | <icon>../share/ubuntu.png</icon> |
797 | <description>A simple C++ based QtQuick2 Extension Library with |
798 | simple UI written in QML. |
799 | |
800 | -Includes also |
801 | +Also includes: |
802 | - a unit test for C++ |
803 | - unit and functional tests for QML |
804 | |
805 | @@ -21,11 +21,16 @@ |
806 | <!-- MANIFEST PARTS --> |
807 | <file source="manifest.json.in" openeditor="true"/> |
808 | <!-- APP PARTS --> |
809 | - <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/> |
810 | - <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/> |
811 | + <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/> |
812 | + <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/> |
813 | <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/> |
814 | <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/> |
815 | <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/> |
816 | + <file source="appName/tests/autopilot/run" target="%ClickHookName%/tests/autopilot/run" openeditor="false"/> |
817 | + <file source="appName/tests/autopilot/displayName/tests/test_main.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/> |
818 | + <file source="appName/tests/autopilot/displayName/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
819 | + <file source="appName/tests/autopilot/displayName/tests/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/> |
820 | + <file source="appName/tests/unit/tst_main.qml" target="%ClickHookName%/tests/unit/tst_main.qml" openeditor="false"/> |
821 | <file source="backend/displayName/backend.h" target="backend/%ClickHookName:s%/backend.h" openeditor="false"/> |
822 | <file source="backend/displayName/backend.cpp" target="backend/%ClickHookName:s%/backend.cpp" openeditor="false"/> |
823 | <file source="backend/displayName/mytype.h" target="backend/%ClickHookName:s%/mytype.h" openeditor="false"/> |
824 | @@ -35,36 +40,36 @@ |
825 | <file source="backend/tests/unit/tst_mytype.qml" target="backend/tests/unit/tst_mytype.qml" openeditor="false"/> |
826 | </files> |
827 | |
828 | - <!-- Create a 2nd wizard page with click package parameters --> |
829 | - <fieldpagetitle>Click package parameters</fieldpagetitle> |
830 | - <fields> |
831 | - <field mandatory="true" name="ClickDomain"> |
832 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
833 | - defaulttext="" placeholdertext="Nickname"/> |
834 | - <fielddescription>Nickname:</fielddescription> |
835 | - </field> |
836 | - <field mandatory="true" name="ClickMaintainer"> |
837 | - <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
838 | - defaulttext="" placeholdertext="Maintainer"/> |
839 | - <fielddescription>Maintainer:</fielddescription> |
840 | - </field> |
841 | - <field mandatory="true" name="ClickHookName"> |
842 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
843 | - defaulttext="app" placeholdertext="app hook name"/> |
844 | - <fielddescription>App name:</fielddescription> |
845 | - </field> |
846 | - <field name="ClickFrameworkVersion"> |
847 | - <fieldcontrol class="QComboBox" defaultindex="0"> |
848 | - <comboentries> |
849 | - <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
850 | - <comboentry value="ubuntu-sdk-dummy-framework"> |
851 | - <comboentrytext>Dummy Framework</comboentrytext> |
852 | - </comboentry> |
853 | - </comboentries> |
854 | - </fieldcontrol> |
855 | - <fielddescription>Framework:</fielddescription> |
856 | - </field> |
857 | - </fields> |
858 | + <!-- Create a 2nd wizard page with click package parameters --> |
859 | + <fieldpagetitle>Click package parameters</fieldpagetitle> |
860 | + <fields> |
861 | + <field mandatory="true" name="ClickDomain"> |
862 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
863 | + defaulttext="" placeholdertext="Nickname"/> |
864 | + <fielddescription>Nickname:</fielddescription> |
865 | + </field> |
866 | + <field mandatory="true" name="ClickMaintainer"> |
867 | + <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
868 | + defaulttext="" placeholdertext="Maintainer"/> |
869 | + <fielddescription>Maintainer:</fielddescription> |
870 | + </field> |
871 | + <field mandatory="true" name="ClickHookName"> |
872 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
873 | + defaulttext="app" placeholdertext="app hook name"/> |
874 | + <fielddescription>App name:</fielddescription> |
875 | + </field> |
876 | + <field name="ClickFrameworkVersion"> |
877 | + <fieldcontrol class="QComboBox" defaultindex="0"> |
878 | + <comboentries> |
879 | + <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
880 | + <comboentry value="ubuntu-sdk-dummy-framework"> |
881 | + <comboentrytext>Dummy Framework</comboentrytext> |
882 | + </comboentry> |
883 | + </comboentries> |
884 | + </fieldcontrol> |
885 | + <fielddescription>Framework:</fielddescription> |
886 | + </field> |
887 | + </fields> |
888 | <validationrules> |
889 | <validationrule condition='/^(.*)\s+<(.*@.*)>$/.test("%ClickMaintainer%")'> |
890 | <message>Invalid format for maintainer (should be like "Joe Bloggs <joe.bloggs@isp.com>")</message> |
891 | |
892 | === modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro' |
893 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro 2015-01-12 09:34:07 +0000 |
894 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro 2015-05-26 21:42:21 +0000 |
895 | @@ -9,14 +9,24 @@ |
896 | |
897 | RESOURCES += %ClickHookName%.qrc |
898 | |
899 | -OTHER_FILES += %ClickHookName%.apparmor \ |
900 | +QML_FILES += $$files(*.qml,true) \ |
901 | + $$files(*.js,true) |
902 | + |
903 | +CONF_FILES += %ClickHookName%.apparmor \ |
904 | %ClickHookName%.desktop \ |
905 | %ClickHookName%.png |
906 | |
907 | +AP_TEST_FILES += tests/autopilot/run \ |
908 | + $$files(tests/*.py,true) |
909 | + |
910 | +#show all the files in QtCreator |
911 | +OTHER_FILES += $${CONF_FILES} \ |
912 | + $${QML_FILES} \ |
913 | + $${AP_TEST_FILES} |
914 | + |
915 | #specify where the config files are installed to |
916 | config_files.path = /%ClickHookName% |
917 | -config_files.files += $${OTHER_FILES} |
918 | -message($$config_files.files) |
919 | +config_files.files += $${CONF_FILES} |
920 | INSTALLS+=config_files |
921 | |
922 | # Default rules for deployment. |
923 | |
924 | === added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests' |
925 | === added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot' |
926 | === added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName' |
927 | === added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/__init__.py' |
928 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/__init__.py 1970-01-01 00:00:00 +0000 |
929 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000 |
930 | @@ -0,0 +1,41 @@ |
931 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
932 | +"""Application autopilot helpers.""" |
933 | + |
934 | +import logging |
935 | +import ubuntuuitoolkit |
936 | + |
937 | +logger = logging.getLogger(__name__) |
938 | + |
939 | + |
940 | +class AppException(ubuntuuitoolkit.ToolkitException): |
941 | + |
942 | + """Exception raised when there are problems with the Application.""" |
943 | + |
944 | + |
945 | +class TouchApp(object): |
946 | + |
947 | + """Autopilot helper object for the application.""" |
948 | + |
949 | + def __init__(self, app_proxy, test_type): |
950 | + self.app = app_proxy |
951 | + self.test_type = test_type |
952 | + self.main_view = self.app.select_single(MainView) |
953 | + |
954 | + @property |
955 | + def pointing_device(self): |
956 | + return self.app.pointing_device |
957 | + |
958 | + |
959 | +class MainView(ubuntuuitoolkit.MainView): |
960 | + |
961 | + """A helper that makes it easy to interact with the mainview""" |
962 | + |
963 | + def __init__(self, *args): |
964 | + super(MainView, self).__init__(*args) |
965 | + self.visible.wait_for(True, 30) |
966 | + |
967 | + def get_button(self): |
968 | + return self.select_single('Button', objectName="button") |
969 | + |
970 | + def get_label(self): |
971 | + return self.select_single('Label', objectName="label") |
972 | \ No newline at end of file |
973 | |
974 | === added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests' |
975 | === added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py' |
976 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000 |
977 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000 |
978 | @@ -0,0 +1,54 @@ |
979 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
980 | +"""Ubuntu Touch App Autopilot tests.""" |
981 | + |
982 | +import os |
983 | +import logging |
984 | + |
985 | +import %ProjectName% |
986 | + |
987 | +from autopilot.testcase import AutopilotTestCase |
988 | +from autopilot import logging as autopilot_logging |
989 | + |
990 | +import ubuntuuitoolkit |
991 | +from ubuntuuitoolkit import base |
992 | + |
993 | +logger = logging.getLogger(__name__) |
994 | + |
995 | + |
996 | +class BaseTestCase(AutopilotTestCase): |
997 | + |
998 | + """A common test case class |
999 | + |
1000 | + """ |
1001 | + |
1002 | + local_location = os.path.dirname(os.path.dirname(os.getcwd())) |
1003 | + local_location_qml = os.path.join(local_location, 'Main.qml') |
1004 | + click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%') |
1005 | + |
1006 | + def setUp(self): |
1007 | + super(BaseTestCase, self).setUp() |
1008 | + self.launcher, self.test_type = self.get_launcher_and_type() |
1009 | + self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type) |
1010 | + |
1011 | + def get_launcher_and_type(self): |
1012 | + if os.path.exists(self.local_location_qml): |
1013 | + launcher = self.launch_test_local |
1014 | + test_type = 'local' |
1015 | + else: |
1016 | + launcher = self.launch_test_click |
1017 | + test_type = 'click' |
1018 | + return launcher, test_type |
1019 | + |
1020 | + @autopilot_logging.log_action(logger.info) |
1021 | + def launch_test_local(self): |
1022 | + return self.launch_test_application( |
1023 | + base.get_qmlscene_launch_command(), |
1024 | + self.local_location_qml, |
1025 | + app_type='qt', |
1026 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
1027 | + |
1028 | + @autopilot_logging.log_action(logger.info) |
1029 | + def launch_test_click(self): |
1030 | + return self.launch_click_package( |
1031 | + self.click_package, |
1032 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
1033 | \ No newline at end of file |
1034 | |
1035 | === added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py' |
1036 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000 |
1037 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000 |
1038 | @@ -0,0 +1,21 @@ |
1039 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1040 | + |
1041 | +from autopilot.matchers import Eventually |
1042 | +from testtools.matchers import Equals |
1043 | +from %ProjectName% import tests |
1044 | + |
1045 | + |
1046 | +class MainViewTestCase(tests.BaseTestCase): |
1047 | + """Tests for the mainview""" |
1048 | + |
1049 | + def setUp(self): |
1050 | + super(MainViewTestCase, self).setUp() |
1051 | + |
1052 | + def test_click_button(self): |
1053 | + # Find and click the button |
1054 | + button = self.app.main_view.get_button() |
1055 | + self.app.pointing_device.click_object(button) |
1056 | + |
1057 | + # Make an assertion about what should happen |
1058 | + label = self.app.main_view.get_label() |
1059 | + self.assertThat(label.text, Eventually(Equals('..world!'))) |
1060 | \ No newline at end of file |
1061 | |
1062 | === added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/run' |
1063 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/run 1970-01-01 00:00:00 +0000 |
1064 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/run 2015-05-26 21:42:21 +0000 |
1065 | @@ -0,0 +1,11 @@ |
1066 | +#!/bin/bash |
1067 | + |
1068 | +if [[ -z `which autopilot3` ]]; then |
1069 | + echo "python3-autopilot is not installed. Skip" |
1070 | + exit |
1071 | +fi |
1072 | + |
1073 | +SCRIPTPATH=`dirname $0` |
1074 | +pushd ${SCRIPTPATH} |
1075 | +autopilot3 run %ProjectName% |
1076 | +popd |
1077 | \ No newline at end of file |
1078 | |
1079 | === added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit' |
1080 | === added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit/tst_main.qml' |
1081 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000 |
1082 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000 |
1083 | @@ -0,0 +1,41 @@ |
1084 | +import QtQuick 2.0 |
1085 | +import QtTest 1.0 |
1086 | +import Ubuntu.Test 1.0 |
1087 | +import "../../" |
1088 | +// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase |
1089 | + |
1090 | +// Execute these tests with: |
1091 | +// qmltestrunner |
1092 | + |
1093 | +Item { |
1094 | + |
1095 | + width: units.gu(100) |
1096 | + height: units.gu(75) |
1097 | + |
1098 | + // The objects |
1099 | + Main { |
1100 | + id: main |
1101 | + } |
1102 | + |
1103 | + UbuntuTestCase { |
1104 | + name: "MainTestCase" |
1105 | + |
1106 | + when: windowShown |
1107 | + |
1108 | + |
1109 | + function init() { |
1110 | + var label = findChild(main, "label"); |
1111 | + // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method |
1112 | + compare("Hello..", label.text); |
1113 | + } |
1114 | + |
1115 | + function test_clickButtonMustChangeLabel() { |
1116 | + var button = findChild(main, "button"); |
1117 | + var buttonCenter = centerOf(button) |
1118 | + mouseClick(button, buttonCenter.x, buttonCenter.y); |
1119 | + var label = findChild(main, "label"); |
1120 | + // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method |
1121 | + tryCompare(label, "text", "..world!", 1); |
1122 | + } |
1123 | + } |
1124 | +} |
1125 | |
1126 | === modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro' |
1127 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro 2015-01-12 09:34:07 +0000 |
1128 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro 2015-05-26 21:42:21 +0000 |
1129 | @@ -28,4 +28,13 @@ |
1130 | # compiled and installed into the right place in the click package |
1131 | UBUNTU_PO_FILES+=$$files(po/*.po) |
1132 | |
1133 | +aptest.target = autopilot |
1134 | +aptest.commands = bash $$PWD/app/tests/autopilot/run |
1135 | +aptest.depends = sub-app |
1136 | + |
1137 | +unittest.target = check |
1138 | +unittest.commands = /usr/bin/qmltestrunner -input $$PWD/app/tests/unit |
1139 | +unittest.depends = sub-app |
1140 | + |
1141 | +QMAKE_EXTRA_TARGETS += aptest unittest |
1142 | |
1143 | |
1144 | === modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml' |
1145 | --- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml 2015-02-04 17:42:14 +0000 |
1146 | +++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml 2015-05-26 21:42:21 +0000 |
1147 | @@ -1,60 +1,68 @@ |
1148 | <?xml version="1.0" encoding="UTF-8"?> |
1149 | <wizard version="1" kind="project" firstpage="10" id="B_UbuntuAppSimpleQmake" category="A.UbuntuProject" |
1150 | - platformIndependent="true" |
1151 | + platformIndependent="true" |
1152 | class="ubuntu-project-qmake" |
1153 | - featuresRequired="" |
1154 | + featuresRequired="" |
1155 | > |
1156 | <icon>../share/ubuntu.png</icon> |
1157 | <description>Creates a C++ Ubuntu application project with a sample UI containing a Label and a Button. |
1158 | |
1159 | +Also includes: |
1160 | + - unit and functional tests for QML |
1161 | + |
1162 | This templates requires a Kit using at least a 15.04 click chroot. |
1163 | </description> |
1164 | <displayname>QtQuick App with QML UI (qmake)</displayname> |
1165 | <displaycategory>Ubuntu</displaycategory> |
1166 | <files> |
1167 | - <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/> |
1168 | + <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/> |
1169 | <!-- MANIFEST PARTS --> |
1170 | - <file source="manifest.json.in" openeditor="true"/> |
1171 | + <file source="manifest.json.in" openeditor="true"/> |
1172 | <!-- APP PARTS --> |
1173 | - <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/> |
1174 | - <file source="appName/appName.qrc" target="%ClickHookName%/%ClickHookName%.qrc" openeditor="false"/> |
1175 | - <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/> |
1176 | - <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/> |
1177 | - <file source="appName/main.cpp" target="%ClickHookName%/main.cpp" openeditor="true"/> |
1178 | - <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/> |
1179 | - <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/> |
1180 | + <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/> |
1181 | + <file source="appName/appName.qrc" target="%ClickHookName%/%ClickHookName%.qrc" openeditor="false"/> |
1182 | + <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/> |
1183 | + <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/> |
1184 | + <file source="appName/main.cpp" target="%ClickHookName%/main.cpp" openeditor="true"/> |
1185 | + <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/> |
1186 | + <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/> |
1187 | + <file source="appName/tests/autopilot/run" target="%ClickHookName%/tests/autopilot/run" openeditor="false"/> |
1188 | + <file source="appName/tests/autopilot/displayName/tests/test_main.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/> |
1189 | + <file source="appName/tests/autopilot/displayName/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
1190 | + <file source="appName/tests/autopilot/displayName/tests/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/> |
1191 | + <file source="appName/tests/unit/tst_main.qml" target="%ClickHookName%/tests/unit/tst_main.qml" openeditor="false"/> |
1192 | </files> |
1193 | |
1194 | - <!-- Create a 2nd wizard page with click package parameters --> |
1195 | - <fieldpagetitle>Click package parameters</fieldpagetitle> |
1196 | - <fields> |
1197 | - <field mandatory="true" name="ClickDomain"> |
1198 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
1199 | - defaulttext="" placeholdertext="Nickname"/> |
1200 | - <fielddescription>Nickname:</fielddescription> |
1201 | - </field> |
1202 | - <field mandatory="true" name="ClickMaintainer"> |
1203 | - <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
1204 | - defaulttext="" placeholdertext="Maintainer"/> |
1205 | - <fielddescription>Maintainer:</fielddescription> |
1206 | - </field> |
1207 | - <field mandatory="true" name="ClickHookName"> |
1208 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
1209 | - defaulttext="app" placeholdertext="app hook name"/> |
1210 | - <fielddescription>App name:</fielddescription> |
1211 | - </field> |
1212 | - <field name="ClickFrameworkVersion"> |
1213 | - <fieldcontrol class="QComboBox" defaultindex="0"> |
1214 | - <comboentries> |
1215 | - <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
1216 | - <comboentry value="ubuntu-sdk-dummy-framework"> |
1217 | - <comboentrytext>Dummy Framework</comboentrytext> |
1218 | - </comboentry> |
1219 | - </comboentries> |
1220 | - </fieldcontrol> |
1221 | - <fielddescription>Framework:</fielddescription> |
1222 | - </field> |
1223 | - </fields> |
1224 | + <!-- Create a 2nd wizard page with click package parameters --> |
1225 | + <fieldpagetitle>Click package parameters</fieldpagetitle> |
1226 | + <fields> |
1227 | + <field mandatory="true" name="ClickDomain"> |
1228 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
1229 | + defaulttext="" placeholdertext="Nickname"/> |
1230 | + <fielddescription>Nickname:</fielddescription> |
1231 | + </field> |
1232 | + <field mandatory="true" name="ClickMaintainer"> |
1233 | + <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
1234 | + defaulttext="" placeholdertext="Maintainer"/> |
1235 | + <fielddescription>Maintainer:</fielddescription> |
1236 | + </field> |
1237 | + <field mandatory="true" name="ClickHookName"> |
1238 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
1239 | + defaulttext="app" placeholdertext="app hook name"/> |
1240 | + <fielddescription>App name:</fielddescription> |
1241 | + </field> |
1242 | + <field name="ClickFrameworkVersion"> |
1243 | + <fieldcontrol class="QComboBox" defaultindex="0"> |
1244 | + <comboentries> |
1245 | + <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
1246 | + <comboentry value="ubuntu-sdk-dummy-framework"> |
1247 | + <comboentrytext>Dummy Framework</comboentrytext> |
1248 | + </comboentry> |
1249 | + </comboentries> |
1250 | + </fieldcontrol> |
1251 | + <fielddescription>Framework:</fielddescription> |
1252 | + </field> |
1253 | + </fields> |
1254 | <validationrules> |
1255 | <validationrule condition='/^(.*)\s+<(.*@.*)>$/.test("%ClickMaintainer%")'> |
1256 | <message>Invalid format for maintainer (should be like "Joe Bloggs <joe.bloggs@isp.com>")</message> |
1257 | |
1258 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro' |
1259 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro 2015-01-15 12:51:26 +0000 |
1260 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro 2015-05-26 21:42:21 +0000 |
1261 | @@ -4,14 +4,18 @@ |
1262 | RESOURCES += %ClickHookName%.qrc |
1263 | |
1264 | QML_FILES += $$files(*.qml,true) \ |
1265 | - $$files(*.js,true) |
1266 | + $$files(*.js,true) |
1267 | |
1268 | CONF_FILES += %ClickHookName%.apparmor \ |
1269 | %ClickHookName%.desktop \ |
1270 | %ClickHookName%.png |
1271 | |
1272 | +AP_TEST_FILES += tests/autopilot/run \ |
1273 | + $$files(tests/*.py,true) |
1274 | + |
1275 | OTHER_FILES += $${CONF_FILES} \ |
1276 | - $${QML_FILES} |
1277 | + $${QML_FILES} \ |
1278 | + $${AP_TEST_FILES} |
1279 | |
1280 | #specify where the qml/js files are installed to |
1281 | qml_files.path = /%ClickHookName% |
1282 | |
1283 | === added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests' |
1284 | === added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot' |
1285 | === added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName' |
1286 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/__init__.py' |
1287 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/__init__.py 1970-01-01 00:00:00 +0000 |
1288 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000 |
1289 | @@ -0,0 +1,41 @@ |
1290 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1291 | +"""Application autopilot helpers.""" |
1292 | + |
1293 | +import logging |
1294 | +import ubuntuuitoolkit |
1295 | + |
1296 | +logger = logging.getLogger(__name__) |
1297 | + |
1298 | + |
1299 | +class AppException(ubuntuuitoolkit.ToolkitException): |
1300 | + |
1301 | + """Exception raised when there are problems with the Application.""" |
1302 | + |
1303 | + |
1304 | +class TouchApp(object): |
1305 | + |
1306 | + """Autopilot helper object for the application.""" |
1307 | + |
1308 | + def __init__(self, app_proxy, test_type): |
1309 | + self.app = app_proxy |
1310 | + self.test_type = test_type |
1311 | + self.main_view = self.app.select_single(MainView) |
1312 | + |
1313 | + @property |
1314 | + def pointing_device(self): |
1315 | + return self.app.pointing_device |
1316 | + |
1317 | + |
1318 | +class MainView(ubuntuuitoolkit.MainView): |
1319 | + |
1320 | + """A helper that makes it easy to interact with the mainview""" |
1321 | + |
1322 | + def __init__(self, *args): |
1323 | + super(MainView, self).__init__(*args) |
1324 | + self.visible.wait_for(True, 30) |
1325 | + |
1326 | + def get_button(self): |
1327 | + return self.select_single('Button', objectName="button") |
1328 | + |
1329 | + def get_label(self): |
1330 | + return self.select_single('Label', objectName="label") |
1331 | \ No newline at end of file |
1332 | |
1333 | === added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests' |
1334 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py' |
1335 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000 |
1336 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000 |
1337 | @@ -0,0 +1,54 @@ |
1338 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1339 | +"""Ubuntu Touch App Autopilot tests.""" |
1340 | + |
1341 | +import os |
1342 | +import logging |
1343 | + |
1344 | +import %ProjectName% |
1345 | + |
1346 | +from autopilot.testcase import AutopilotTestCase |
1347 | +from autopilot import logging as autopilot_logging |
1348 | + |
1349 | +import ubuntuuitoolkit |
1350 | +from ubuntuuitoolkit import base |
1351 | + |
1352 | +logger = logging.getLogger(__name__) |
1353 | + |
1354 | + |
1355 | +class BaseTestCase(AutopilotTestCase): |
1356 | + |
1357 | + """A common test case class |
1358 | + |
1359 | + """ |
1360 | + |
1361 | + local_location = os.path.dirname(os.path.dirname(os.getcwd())) |
1362 | + local_location_qml = os.path.join(local_location, 'Main.qml') |
1363 | + click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%') |
1364 | + |
1365 | + def setUp(self): |
1366 | + super(BaseTestCase, self).setUp() |
1367 | + self.launcher, self.test_type = self.get_launcher_and_type() |
1368 | + self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type) |
1369 | + |
1370 | + def get_launcher_and_type(self): |
1371 | + if os.path.exists(self.local_location_qml): |
1372 | + launcher = self.launch_test_local |
1373 | + test_type = 'local' |
1374 | + else: |
1375 | + launcher = self.launch_test_click |
1376 | + test_type = 'click' |
1377 | + return launcher, test_type |
1378 | + |
1379 | + @autopilot_logging.log_action(logger.info) |
1380 | + def launch_test_local(self): |
1381 | + return self.launch_test_application( |
1382 | + base.get_qmlscene_launch_command(), |
1383 | + self.local_location_qml, |
1384 | + app_type='qt', |
1385 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
1386 | + |
1387 | + @autopilot_logging.log_action(logger.info) |
1388 | + def launch_test_click(self): |
1389 | + return self.launch_click_package( |
1390 | + self.click_package, |
1391 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
1392 | \ No newline at end of file |
1393 | |
1394 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py' |
1395 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000 |
1396 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000 |
1397 | @@ -0,0 +1,21 @@ |
1398 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1399 | + |
1400 | +from autopilot.matchers import Eventually |
1401 | +from testtools.matchers import Equals |
1402 | +from %ProjectName% import tests |
1403 | + |
1404 | + |
1405 | +class MainViewTestCase(tests.BaseTestCase): |
1406 | + """Tests for the mainview""" |
1407 | + |
1408 | + def setUp(self): |
1409 | + super(MainViewTestCase, self).setUp() |
1410 | + |
1411 | + def test_click_button(self): |
1412 | + # Find and click the button |
1413 | + button = self.app.main_view.get_button() |
1414 | + self.app.pointing_device.click_object(button) |
1415 | + |
1416 | + # Make an assertion about what should happen |
1417 | + label = self.app.main_view.get_label() |
1418 | + self.assertThat(label.text, Eventually(Equals('..world!'))) |
1419 | \ No newline at end of file |
1420 | |
1421 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/run' |
1422 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/run 1970-01-01 00:00:00 +0000 |
1423 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/run 2015-05-26 21:42:21 +0000 |
1424 | @@ -0,0 +1,11 @@ |
1425 | +#!/bin/bash |
1426 | + |
1427 | +if [[ -z `which autopilot3` ]]; then |
1428 | + echo "python3-autopilot is not installed. Skip" |
1429 | + exit |
1430 | +fi |
1431 | + |
1432 | +SCRIPTPATH=`dirname $0` |
1433 | +pushd ${SCRIPTPATH} |
1434 | +autopilot3 run %ProjectName% |
1435 | +popd |
1436 | \ No newline at end of file |
1437 | |
1438 | === added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit' |
1439 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit/tst_main.qml' |
1440 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000 |
1441 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000 |
1442 | @@ -0,0 +1,41 @@ |
1443 | +import QtQuick 2.0 |
1444 | +import QtTest 1.0 |
1445 | +import Ubuntu.Test 1.0 |
1446 | +import "../../" |
1447 | +// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase |
1448 | + |
1449 | +// Execute these tests with: |
1450 | +// qmltestrunner |
1451 | + |
1452 | +Item { |
1453 | + |
1454 | + width: units.gu(100) |
1455 | + height: units.gu(75) |
1456 | + |
1457 | + // The objects |
1458 | + Main { |
1459 | + id: main |
1460 | + } |
1461 | + |
1462 | + UbuntuTestCase { |
1463 | + name: "MainTestCase" |
1464 | + |
1465 | + when: windowShown |
1466 | + |
1467 | + |
1468 | + function init() { |
1469 | + var label = findChild(main, "label"); |
1470 | + // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method |
1471 | + compare("Hello..", label.text); |
1472 | + } |
1473 | + |
1474 | + function test_clickButtonMustChangeLabel() { |
1475 | + var button = findChild(main, "button"); |
1476 | + var buttonCenter = centerOf(button) |
1477 | + mouseClick(button, buttonCenter.x, buttonCenter.y); |
1478 | + var label = findChild(main, "label"); |
1479 | + // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method |
1480 | + tryCompare(label, "text", "..world!", 1); |
1481 | + } |
1482 | + } |
1483 | +} |
1484 | |
1485 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro' |
1486 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro 2015-01-15 12:51:26 +0000 |
1487 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro 2015-05-26 21:42:21 +0000 |
1488 | @@ -28,4 +28,12 @@ |
1489 | # compiled and installed into the right place in the click package |
1490 | UBUNTU_PO_FILES+=$$files(po/*.po) |
1491 | |
1492 | - |
1493 | +aptest.target = autopilot |
1494 | +aptest.commands = bash $$PWD/app/tests/autopilot/run |
1495 | +aptest.depends = sub-app |
1496 | + |
1497 | +unittest.target = check |
1498 | +unittest.commands = /usr/bin/qmltestrunner -input $$PWD/app/tests/unit |
1499 | +unittest.depends = sub-app |
1500 | + |
1501 | +QMAKE_EXTRA_TARGETS += aptest unittest |
1502 | |
1503 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml' |
1504 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml 2015-02-04 17:42:14 +0000 |
1505 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml 2015-05-26 21:42:21 +0000 |
1506 | @@ -1,58 +1,63 @@ |
1507 | <?xml version="1.0" encoding="UTF-8"?> |
1508 | <wizard version="1" kind="project" firstpage="10" id="A3_UbuntuAppSimpleQmake'" category="A.UbuntuProject" |
1509 | - platformIndependent="true" |
1510 | + platformIndependent="true" |
1511 | class="ubuntu-project-qmake" |
1512 | - featuresRequired="" |
1513 | + featuresRequired="" |
1514 | > |
1515 | <icon>../share/ubuntu.png</icon> |
1516 | - <description>Creates a Qt Quick 2 application project with a sample UI containing a Label and a Button. This project contains QML code only. |
1517 | + <description>Creates a Qt Quick 2 application project with a sample UI containing a Label and a Button. Also includes unit and functional tests. This project contains QML code only. |
1518 | |
1519 | This templates requires a Kit using at least a 15.04 click chroot. |
1520 | </description> |
1521 | <displayname>QML App with Simple UI (qmake)</displayname> |
1522 | <displaycategory>Ubuntu</displaycategory> |
1523 | <files> |
1524 | - <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/> |
1525 | + <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/> |
1526 | <!-- MANIFEST PARTS --> |
1527 | - <file source="manifest.json.in" openeditor="true"/> |
1528 | + <file source="manifest.json.in" openeditor="true"/> |
1529 | <!-- APP PARTS --> |
1530 | - <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/> |
1531 | - <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/> |
1532 | - <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/> |
1533 | - <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/> |
1534 | - <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/> |
1535 | + <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/> |
1536 | + <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/> |
1537 | + <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/> |
1538 | + <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/> |
1539 | + <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/> |
1540 | + <file source="appName/tests/autopilot/run" target="%ClickHookName%/tests/autopilot/run" openeditor="false"/> |
1541 | + <file source="appName/tests/autopilot/displayName/tests/test_main.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/> |
1542 | + <file source="appName/tests/autopilot/displayName/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
1543 | + <file source="appName/tests/autopilot/displayName/tests/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/> |
1544 | + <file source="appName/tests/unit/tst_main.qml" target="%ClickHookName%/tests/unit/tst_main.qml" openeditor="false"/> |
1545 | </files> |
1546 | |
1547 | - <!-- Create a 2nd wizard page with click package parameters --> |
1548 | - <fieldpagetitle>Click package parameters</fieldpagetitle> |
1549 | - <fields> |
1550 | - <field mandatory="true" name="ClickDomain"> |
1551 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
1552 | - defaulttext="" placeholdertext="Nickname"/> |
1553 | - <fielddescription>Nickname:</fielddescription> |
1554 | - </field> |
1555 | - <field mandatory="true" name="ClickMaintainer"> |
1556 | - <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
1557 | - defaulttext="" placeholdertext="Maintainer"/> |
1558 | - <fielddescription>Maintainer:</fielddescription> |
1559 | - </field> |
1560 | - <field mandatory="true" name="ClickHookName"> |
1561 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
1562 | - defaulttext="app" placeholdertext="app hook name"/> |
1563 | - <fielddescription>App name:</fielddescription> |
1564 | - </field> |
1565 | - <field name="ClickFrameworkVersion"> |
1566 | - <fieldcontrol class="QComboBox" defaultindex="0"> |
1567 | - <comboentries> |
1568 | - <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
1569 | - <comboentry value="ubuntu-sdk-dummy-framework"> |
1570 | - <comboentrytext>Dummy Framework</comboentrytext> |
1571 | - </comboentry> |
1572 | - </comboentries> |
1573 | - </fieldcontrol> |
1574 | - <fielddescription>Framework:</fielddescription> |
1575 | - </field> |
1576 | - </fields> |
1577 | + <!-- Create a 2nd wizard page with click package parameters --> |
1578 | + <fieldpagetitle>Click package parameters</fieldpagetitle> |
1579 | + <fields> |
1580 | + <field mandatory="true" name="ClickDomain"> |
1581 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
1582 | + defaulttext="" placeholdertext="Nickname"/> |
1583 | + <fielddescription>Nickname:</fielddescription> |
1584 | + </field> |
1585 | + <field mandatory="true" name="ClickMaintainer"> |
1586 | + <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
1587 | + defaulttext="" placeholdertext="Maintainer"/> |
1588 | + <fielddescription>Maintainer:</fielddescription> |
1589 | + </field> |
1590 | + <field mandatory="true" name="ClickHookName"> |
1591 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
1592 | + defaulttext="app" placeholdertext="app hook name"/> |
1593 | + <fielddescription>App name:</fielddescription> |
1594 | + </field> |
1595 | + <field name="ClickFrameworkVersion"> |
1596 | + <fieldcontrol class="QComboBox" defaultindex="0"> |
1597 | + <comboentries> |
1598 | + <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
1599 | + <comboentry value="ubuntu-sdk-dummy-framework"> |
1600 | + <comboentrytext>Dummy Framework</comboentrytext> |
1601 | + </comboentry> |
1602 | + </comboentries> |
1603 | + </fieldcontrol> |
1604 | + <fielddescription>Framework:</fielddescription> |
1605 | + </field> |
1606 | + </fields> |
1607 | <validationrules> |
1608 | <validationrule condition='/^(.*)\s+<(.*@.*)>$/.test("%ClickMaintainer%")'> |
1609 | <message>Invalid format for maintainer (should be like "Joe Bloggs <joe.bloggs@isp.com>")</message> |
1610 | |
1611 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py' |
1612 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py 2015-02-04 17:44:30 +0000 |
1613 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000 |
1614 | @@ -1,76 +1,41 @@ |
1615 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1616 | - |
1617 | -"""Ubuntu Touch App Autopilot tests.""" |
1618 | - |
1619 | -import os |
1620 | - |
1621 | +"""Application autopilot helpers.""" |
1622 | + |
1623 | +import logging |
1624 | import ubuntuuitoolkit |
1625 | |
1626 | -from autopilot import introspection |
1627 | -from autopilot.matchers import Eventually |
1628 | -from testtools.matchers import Equals |
1629 | -from ubuntuuitoolkit import base |
1630 | - |
1631 | - |
1632 | -PACKAGE_ID = '%ProjectName:l%.%ClickDomain:l%' |
1633 | - |
1634 | - |
1635 | -def get_path_to_source_root(): |
1636 | - return os.path.abspath( |
1637 | - os.path.join( |
1638 | - os.path.dirname(__file__), '..', '..', '..', '..')) |
1639 | - |
1640 | - |
1641 | -class ApplicationCustomProxyObject( |
1642 | - ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase): |
1643 | - |
1644 | - """Autopilot custom proxy object for the app.""" |
1645 | - |
1646 | - @classmethod |
1647 | - def validate_dbus_object(cls, path, state): |
1648 | - application_name = PACKAGE_ID |
1649 | - name = introspection.get_classname_from_path(path) |
1650 | - if str(name) == application_name: |
1651 | - if state['applicationName'][1] == application_name: |
1652 | - return True |
1653 | - return False |
1654 | +logger = logging.getLogger(__name__) |
1655 | + |
1656 | + |
1657 | +class AppException(ubuntuuitoolkit.ToolkitException): |
1658 | + |
1659 | + """Exception raised when there are problems with the Application.""" |
1660 | + |
1661 | + |
1662 | +class TouchApp(object): |
1663 | + |
1664 | + """Autopilot helper object for the application.""" |
1665 | + |
1666 | + def __init__(self, app_proxy, test_type): |
1667 | + self.app = app_proxy |
1668 | + self.test_type = test_type |
1669 | + self.main_view = self.app.select_single(MainView) |
1670 | |
1671 | @property |
1672 | - def main_view(self): |
1673 | - return self.select_single(ubuntuuitoolkit.MainView) |
1674 | - |
1675 | - |
1676 | -class ClickAppTestCase(base.UbuntuUIToolkitAppTestCase): |
1677 | - |
1678 | - """Common test case that provides several useful methods for the tests.""" |
1679 | - |
1680 | - project_name = '%ProjectName%' |
1681 | - |
1682 | - def launch_application(self): |
1683 | - app_qml_source_location = self._get_app_qml_source_path() |
1684 | - if os.path.exists(app_qml_source_location): |
1685 | - app = self._launch_application_from_source( |
1686 | - app_qml_source_location) |
1687 | - else: |
1688 | - app = self._launch_installed_application() |
1689 | - |
1690 | - self.assertThat(app.main_view.visible, Eventually(Equals(True))) |
1691 | - return app |
1692 | - |
1693 | - def _get_app_qml_source_path(self): |
1694 | - qml_file_name = 'Main.qml' |
1695 | - return os.path.join(self._get_path_to_project_source(), qml_file_name) |
1696 | - |
1697 | - def _get_path_to_project_source(self): |
1698 | - return os.path.join(get_path_to_source_root(), self.project_name) |
1699 | - |
1700 | - def _launch_application_from_source(self, app_qml_source_location): |
1701 | - return self.launch_test_application( |
1702 | - base.get_qmlscene_launch_command(), |
1703 | - app_qml_source_location, |
1704 | - app_type='qt', |
1705 | - emulator_base=ApplicationCustomProxyObject) |
1706 | - |
1707 | - def _launch_installed_application(self): |
1708 | - return self.launch_click_package( |
1709 | - PACKAGE_ID, emulator_base=ApplicationCustomProxyObject) |
1710 | + def pointing_device(self): |
1711 | + return self.app.pointing_device |
1712 | + |
1713 | + |
1714 | +class MainView(ubuntuuitoolkit.MainView): |
1715 | + |
1716 | + """A helper that makes it easy to interact with the mainview""" |
1717 | + |
1718 | + def __init__(self, *args): |
1719 | + super(MainView, self).__init__(*args) |
1720 | + self.visible.wait_for(True, 30) |
1721 | + |
1722 | + def get_button(self): |
1723 | + return self.select_single('Button', objectName="button") |
1724 | + |
1725 | + def get_label(self): |
1726 | + return self.select_single('Label', objectName="label") |
1727 | \ No newline at end of file |
1728 | |
1729 | === removed file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/test_main.py' |
1730 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/test_main.py 2015-02-04 17:44:30 +0000 |
1731 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/test_main.py 1970-01-01 00:00:00 +0000 |
1732 | @@ -1,24 +0,0 @@ |
1733 | -# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1734 | - |
1735 | -"""Tests for the Hello World""" |
1736 | - |
1737 | -from autopilot.matchers import Eventually |
1738 | -from testtools.matchers import Equals |
1739 | - |
1740 | -import %ProjectName% |
1741 | - |
1742 | - |
1743 | -class MainViewTestCase(%ProjectName%.ClickAppTestCase): |
1744 | - """Generic tests for the Hello World""" |
1745 | - |
1746 | - def test_initial_label(self): |
1747 | - app = self.launch_application() |
1748 | - label = app.main_view.select_single(objectName='label') |
1749 | - self.assertThat(label.text, Equals('Hello..')) |
1750 | - |
1751 | - def test_click_button_should_update_label(self): |
1752 | - app = self.launch_application() |
1753 | - button = app.main_view.select_single(objectName='button') |
1754 | - app.pointing_device.click_object(button) |
1755 | - label = app.main_view.select_single(objectName='label') |
1756 | - self.assertThat(label.text, Eventually(Equals('..world!'))) |
1757 | |
1758 | === added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests' |
1759 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/__init__.py' |
1760 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000 |
1761 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000 |
1762 | @@ -0,0 +1,54 @@ |
1763 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1764 | +"""Ubuntu Touch App Autopilot tests.""" |
1765 | + |
1766 | +import os |
1767 | +import logging |
1768 | + |
1769 | +import %ProjectName% |
1770 | + |
1771 | +from autopilot.testcase import AutopilotTestCase |
1772 | +from autopilot import logging as autopilot_logging |
1773 | + |
1774 | +import ubuntuuitoolkit |
1775 | +from ubuntuuitoolkit import base |
1776 | + |
1777 | +logger = logging.getLogger(__name__) |
1778 | + |
1779 | + |
1780 | +class BaseTestCase(AutopilotTestCase): |
1781 | + |
1782 | + """A common test case class |
1783 | + |
1784 | + """ |
1785 | + |
1786 | + local_location = os.path.dirname(os.path.dirname(os.getcwd())) |
1787 | + local_location_qml = os.path.join(local_location, 'Main.qml') |
1788 | + click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%') |
1789 | + |
1790 | + def setUp(self): |
1791 | + super(BaseTestCase, self).setUp() |
1792 | + self.launcher, self.test_type = self.get_launcher_and_type() |
1793 | + self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type) |
1794 | + |
1795 | + def get_launcher_and_type(self): |
1796 | + if os.path.exists(self.local_location_qml): |
1797 | + launcher = self.launch_test_local |
1798 | + test_type = 'local' |
1799 | + else: |
1800 | + launcher = self.launch_test_click |
1801 | + test_type = 'click' |
1802 | + return launcher, test_type |
1803 | + |
1804 | + @autopilot_logging.log_action(logger.info) |
1805 | + def launch_test_local(self): |
1806 | + return self.launch_test_application( |
1807 | + base.get_qmlscene_launch_command(), |
1808 | + self.local_location_qml, |
1809 | + app_type='qt', |
1810 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
1811 | + |
1812 | + @autopilot_logging.log_action(logger.info) |
1813 | + def launch_test_click(self): |
1814 | + return self.launch_click_package( |
1815 | + self.click_package, |
1816 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
1817 | \ No newline at end of file |
1818 | |
1819 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/test_main.py' |
1820 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000 |
1821 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000 |
1822 | @@ -0,0 +1,21 @@ |
1823 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1824 | + |
1825 | +from autopilot.matchers import Eventually |
1826 | +from testtools.matchers import Equals |
1827 | +from %ProjectName% import tests |
1828 | + |
1829 | + |
1830 | +class MainViewTestCase(tests.BaseTestCase): |
1831 | + """Tests for the mainview""" |
1832 | + |
1833 | + def setUp(self): |
1834 | + super(MainViewTestCase, self).setUp() |
1835 | + |
1836 | + def test_click_button(self): |
1837 | + # Find and click the button |
1838 | + button = self.app.main_view.get_button() |
1839 | + self.app.pointing_device.click_object(button) |
1840 | + |
1841 | + # Make an assertion about what should happen |
1842 | + label = self.app.main_view.get_label() |
1843 | + self.assertThat(label.text, Eventually(Equals('..world!'))) |
1844 | \ No newline at end of file |
1845 | |
1846 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/run' |
1847 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/run 2015-02-04 17:44:30 +0000 |
1848 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/run 2015-05-26 21:42:21 +0000 |
1849 | @@ -1,11 +1,11 @@ |
1850 | #!/bin/bash |
1851 | |
1852 | -if [[ -z `which autopilot` ]]; then |
1853 | - echo "Autopilot is not installed. Skip" |
1854 | +if [[ -z `which autopilot3` ]]; then |
1855 | + echo "python3-autopilot is not installed. Skip" |
1856 | exit |
1857 | fi |
1858 | |
1859 | SCRIPTPATH=`dirname $0` |
1860 | pushd ${SCRIPTPATH} |
1861 | autopilot3 run %ProjectName% |
1862 | -popd |
1863 | +popd |
1864 | \ No newline at end of file |
1865 | |
1866 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml' |
1867 | --- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml 2015-02-04 17:42:14 +0000 |
1868 | +++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml 2015-05-26 21:42:21 +0000 |
1869 | @@ -1,61 +1,60 @@ |
1870 | <?xml version="1.0" encoding="UTF-8"?> |
1871 | <wizard version="1" kind="project" firstpage="10" id="A1_UbuntuAppSimple'" category="A.UbuntuProject" |
1872 | - platformIndependent="true" |
1873 | + platformIndependent="true" |
1874 | class="ubuntu-project-plain-qml" |
1875 | - featuresRequired="" |
1876 | + featuresRequired="" |
1877 | > |
1878 | <icon>../share/ubuntu.png</icon> |
1879 | - <description>Creates a Qt Quick 2 application project with a sample UI containing a Label and a Button. This project contains QML code only. |
1880 | - |
1881 | -Includes also unit and functional tests. |
1882 | + <description>Creates a Qt Quick 2 application project with a sample UI containing a Label and a Button. Also includes unit and functional tests. This project contains QML code only. |
1883 | </description> |
1884 | <displayname>QML App with Simple UI (qmlproject)</displayname> |
1885 | <displaycategory>Ubuntu</displaycategory> |
1886 | <files> |
1887 | - <file source="../share/manifest.json" target="manifest.json" openeditor="true"/> |
1888 | - <file source="../share/displayName.qmlproject" target="%ProjectName%.qmlproject" openproject="true"/> |
1889 | - <file source="Main.qml" target="Main.qml" openeditor="true"/> |
1890 | - <file source="displayName.png" target="%ProjectName%.png" openeditor="false" binary="true"/> |
1891 | - <file source="displayName.desktop" target="%ClickHookName%.desktop" openeditor="false"/> |
1892 | - <file source="tests/autopilot/displayName/test_main.py" target="tests/autopilot/%ProjectName%/test_main.py" openeditor="false"/> |
1893 | - <file source="tests/autopilot/displayName/__init__.py" target="tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
1894 | - <file source="tests/autopilot/run" target="tests/autopilot/run" openeditor="false"/> |
1895 | - <file source="tests/qml/tst_main.qml" target="tests/qml/tst_main.qml" openeditor="false"/> |
1896 | - <file source="Makefile" target="Makefile" openeditor="false"/> |
1897 | - <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/> |
1898 | - <file source="../share/.excludes" target=".excludes" openeditor="false"/> |
1899 | + <file source="../share/manifest.json" target="manifest.json" openeditor="true"/> |
1900 | + <file source="../share/displayName.qmlproject" target="%ProjectName%.qmlproject" openproject="true"/> |
1901 | + <file source="Main.qml" target="Main.qml" openeditor="true"/> |
1902 | + <file source="displayName.png" target="%ProjectName%.png" openeditor="false" binary="true"/> |
1903 | + <file source="displayName.desktop" target="%ClickHookName%.desktop" openeditor="false"/> |
1904 | + <file source="tests/autopilot/run" target="tests/autopilot/run" openeditor="false"/> |
1905 | + <file source="tests/autopilot/displayName/tests/test_main.py" target="tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/> |
1906 | + <file source="tests/autopilot/displayName/__init__.py" target="tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
1907 | + <file source="tests/autopilot/displayName/tests/__init__.py" target="tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/> |
1908 | + <file source="tests/qml/tst_main.qml" target="tests/qml/tst_main.qml" openeditor="false"/> |
1909 | + <file source="Makefile" target="Makefile" openeditor="false"/> |
1910 | + <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/> |
1911 | + <file source="../share/.excludes" target=".excludes" openeditor="false"/> |
1912 | </files> |
1913 | |
1914 | - <!-- Create a 2nd wizard page with click package parameters --> |
1915 | - <fieldpagetitle>Click package parameters</fieldpagetitle> |
1916 | - <fields> |
1917 | - <field mandatory="true" name="ClickDomain"> |
1918 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
1919 | - defaulttext="" placeholdertext="Nickname"/> |
1920 | - <fielddescription>Nickname:</fielddescription> |
1921 | - </field> |
1922 | - <field mandatory="true" name="ClickMaintainer"> |
1923 | - <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
1924 | - defaulttext="" placeholdertext="Maintainer"/> |
1925 | - <fielddescription>Maintainer:</fielddescription> |
1926 | - </field> |
1927 | - <field mandatory="true" name="ClickHookName"> |
1928 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
1929 | - defaulttext="app" placeholdertext="app hook name"/> |
1930 | - <fielddescription>App name:</fielddescription> |
1931 | - </field> |
1932 | - <field name="ClickFrameworkVersion"> |
1933 | - <fieldcontrol class="QComboBox" defaultindex="0"> |
1934 | - <comboentries> |
1935 | - <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
1936 | - <comboentry value="ubuntu-sdk-dummy-framework"> |
1937 | - <comboentrytext>Dummy Framework</comboentrytext> |
1938 | - </comboentry> |
1939 | - </comboentries> |
1940 | - </fieldcontrol> |
1941 | - <fielddescription>Framework:</fielddescription> |
1942 | - </field> |
1943 | - </fields> |
1944 | + <!-- Create a 2nd wizard page with click package parameters --> |
1945 | + <fieldpagetitle>Click package parameters</fieldpagetitle> |
1946 | + <fields> |
1947 | + <field mandatory="true" name="ClickDomain"> |
1948 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
1949 | + defaulttext="" placeholdertext="Nickname"/> |
1950 | + <fielddescription>Nickname:</fielddescription> |
1951 | + </field> |
1952 | + <field mandatory="true" name="ClickMaintainer"> |
1953 | + <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
1954 | + defaulttext="" placeholdertext="Maintainer"/> |
1955 | + <fielddescription>Maintainer:</fielddescription> |
1956 | + </field> |
1957 | + <field mandatory="true" name="ClickHookName"> |
1958 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
1959 | + defaulttext="app" placeholdertext="app hook name"/> |
1960 | + <fielddescription>App name:</fielddescription> |
1961 | + </field> |
1962 | + <field name="ClickFrameworkVersion"> |
1963 | + <fieldcontrol class="QComboBox" defaultindex="0"> |
1964 | + <comboentries> |
1965 | + <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
1966 | + <comboentry value="ubuntu-sdk-dummy-framework"> |
1967 | + <comboentrytext>Dummy Framework</comboentrytext> |
1968 | + </comboentry> |
1969 | + </comboentries> |
1970 | + </fieldcontrol> |
1971 | + <fielddescription>Framework:</fielddescription> |
1972 | + </field> |
1973 | + </fields> |
1974 | <validationrules> |
1975 | <validationrule condition='/^(.*)\s+<(.*@.*)>$/.test("%ClickMaintainer%")'> |
1976 | <message>Invalid format for maintainer (should be like "Joe Bloggs <joe.bloggs@isp.com>")</message> |
1977 | |
1978 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/CMakeLists.txt' |
1979 | --- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/CMakeLists.txt 2015-01-16 11:11:30 +0000 |
1980 | +++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/CMakeLists.txt 2015-05-26 21:42:21 +0000 |
1981 | @@ -15,3 +15,7 @@ |
1982 | # Make the autpilot files visible in qtcreator |
1983 | file(GLOB_RECURSE AUTOPILOT_TEST_FILES *.py) |
1984 | add_custom_target(%ProjectName:l%_AutopilotFiles ALL SOURCES ${AUTOPILOT_TEST_FILES}) |
1985 | + |
1986 | +# Make the qml test files visible in qtcreator |
1987 | +file(GLOB_RECURSE UNIT_TEST_FILES tests/unit/*.qml) |
1988 | +add_custom_target(%ProjectName:l%_UnitTestFiles ALL SOURCES ${UNIT_TEST_FILES}) |
1989 | |
1990 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/__init__.py' |
1991 | --- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/__init__.py 2014-10-14 08:33:49 +0000 |
1992 | +++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000 |
1993 | @@ -1,132 +1,41 @@ |
1994 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
1995 | - |
1996 | -"""Ubuntu Touch App autopilot tests.""" |
1997 | - |
1998 | -from os import remove |
1999 | -import os.path |
2000 | -from tempfile import mktemp |
2001 | -import subprocess |
2002 | - |
2003 | -from autopilot.input import Mouse, Touch, Pointer |
2004 | -from autopilot.matchers import Eventually |
2005 | -from autopilot.platform import model |
2006 | -from testtools.matchers import Is, Not, Equals |
2007 | -from autopilot.testcase import AutopilotTestCase |
2008 | - |
2009 | -def get_module_include_path(): |
2010 | - return os.path.abspath( |
2011 | - os.path.join( |
2012 | - os.path.dirname(__file__), |
2013 | - '..', |
2014 | - '..', |
2015 | - '..', |
2016 | - '..', |
2017 | - 'backend', |
2018 | - 'modules') |
2019 | - ) |
2020 | - |
2021 | - |
2022 | -class UbuntuTouchAppTestCase(AutopilotTestCase): |
2023 | - """A common test case class that provides several useful methods for the tests.""" |
2024 | - |
2025 | - if model() == 'Desktop': |
2026 | - scenarios = [ |
2027 | - ('with mouse', dict(input_device_class=Mouse)) |
2028 | - ] |
2029 | - else: |
2030 | - scenarios = [ |
2031 | - ('with touch', dict(input_device_class=Touch)) |
2032 | - ] |
2033 | +"""Application autopilot helpers.""" |
2034 | + |
2035 | +import logging |
2036 | +import ubuntuuitoolkit |
2037 | + |
2038 | +logger = logging.getLogger(__name__) |
2039 | + |
2040 | + |
2041 | +class AppException(ubuntuuitoolkit.ToolkitException): |
2042 | + |
2043 | + """Exception raised when there are problems with the Application.""" |
2044 | + |
2045 | + |
2046 | +class TouchApp(object): |
2047 | + |
2048 | + """Autopilot helper object for the application.""" |
2049 | + |
2050 | + def __init__(self, app_proxy, test_type): |
2051 | + self.app = app_proxy |
2052 | + self.test_type = test_type |
2053 | + self.main_view = self.app.select_single(MainView) |
2054 | |
2055 | @property |
2056 | - def main_window(self): |
2057 | - return MainWindow(self.app) |
2058 | - |
2059 | - |
2060 | - def setUp(self): |
2061 | - self.pointing_device = Pointer(self.input_device_class.create()) |
2062 | - super(UbuntuTouchAppTestCase, self).setUp() |
2063 | - self.launch_test_qml() |
2064 | - |
2065 | - |
2066 | - def launch_test_qml(self): |
2067 | - # If the test class has defined a 'test_qml' class attribute then we |
2068 | - # write it to disk and launch it inside the QML Scene. If not, then we |
2069 | - # silently do nothing (presumably the test has something else planned). |
2070 | - arch = subprocess.check_output(["dpkg-architecture", |
2071 | - "-qDEB_HOST_MULTIARCH"]).strip() |
2072 | - if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring): |
2073 | - qml_path = mktemp(suffix='.qml') |
2074 | - open(qml_path, 'w').write(self.test_qml) |
2075 | - self.addCleanup(remove, qml_path) |
2076 | - |
2077 | - self.app = self.launch_test_application( |
2078 | - "/usr/lib/" + arch + "/qt5/bin/qmlscene", |
2079 | - "-I", get_module_include_path(), |
2080 | - qml_path, |
2081 | - app_type='qt') |
2082 | - |
2083 | - if hasattr(self, 'test_qml_file') and isinstance(self.test_qml_file, basestring): |
2084 | - qml_path = self.test_qml_file |
2085 | - self.app = self.launch_test_application( |
2086 | - "/usr/lib/" + arch + "/qt5/bin/qmlscene", |
2087 | - "-I", get_module_include_path(), |
2088 | - qml_path, |
2089 | - app_type='qt') |
2090 | - |
2091 | - self.assertThat(self.get_qml_view().visible, Eventually(Equals(True))) |
2092 | - |
2093 | - |
2094 | - def get_qml_view(self): |
2095 | - """Get the main QML view""" |
2096 | - |
2097 | - return self.app.select_single("QQuickView") |
2098 | - |
2099 | - def get_mainview(self): |
2100 | - """Get the QML MainView""" |
2101 | - |
2102 | - mainView = self.app.select_single("MainView") |
2103 | - self.assertThat(mainView, Not(Is(None))) |
2104 | - return mainView |
2105 | - |
2106 | - |
2107 | - def get_object(self,objectName): |
2108 | - """Get a object based on the objectName""" |
2109 | - |
2110 | - obj = self.app.select_single(objectName=objectName) |
2111 | - self.assertThat(obj, Not(Is(None))) |
2112 | - return obj |
2113 | - |
2114 | - |
2115 | - def mouse_click(self,objectName): |
2116 | - """Move mouse on top of the object and click on it""" |
2117 | - |
2118 | - obj = self.get_object(objectName) |
2119 | - self.pointing_device.move_to_object(obj) |
2120 | - self.pointing_device.click() |
2121 | - |
2122 | - |
2123 | - def mouse_press(self,objectName): |
2124 | - """Move mouse on top of the object and press mouse button (without releasing it)""" |
2125 | - |
2126 | - obj = self.get_object(objectName) |
2127 | - self.pointing_device.move_to_object(obj) |
2128 | - self.pointing_device.press() |
2129 | - |
2130 | - |
2131 | - def mouse_release(self): |
2132 | - """Release mouse button""" |
2133 | - |
2134 | - self.pointing_device.release() |
2135 | - |
2136 | - |
2137 | - def type_string(self, string): |
2138 | - """Type a string with keyboard""" |
2139 | - |
2140 | - self.keyboard.type(string) |
2141 | - |
2142 | - |
2143 | - def type_key(self, key): |
2144 | - """Type a single key with keyboard""" |
2145 | - |
2146 | - self.keyboard.key(key) |
2147 | + def pointing_device(self): |
2148 | + return self.app.pointing_device |
2149 | + |
2150 | + |
2151 | +class MainView(ubuntuuitoolkit.MainView): |
2152 | + |
2153 | + """A helper that makes it easy to interact with the mainview""" |
2154 | + |
2155 | + def __init__(self, *args): |
2156 | + super(MainView, self).__init__(*args) |
2157 | + self.visible.wait_for(True, 30) |
2158 | + |
2159 | + def get_button(self): |
2160 | + return self.select_single('Button', objectName="button") |
2161 | + |
2162 | + def get_label(self): |
2163 | + return self.select_single('Label', objectName="label") |
2164 | \ No newline at end of file |
2165 | |
2166 | === renamed directory 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main' => 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests' |
2167 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/__init__.py' |
2168 | --- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/__init__.py 2015-01-17 04:53:32 +0000 |
2169 | +++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000 |
2170 | @@ -1,1 +1,54 @@ |
2171 | -""" A Main.qml test suite """ |
2172 | +# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
2173 | +"""Ubuntu Touch App Autopilot tests.""" |
2174 | + |
2175 | +import os |
2176 | +import logging |
2177 | + |
2178 | +import %ProjectName% |
2179 | + |
2180 | +from autopilot.testcase import AutopilotTestCase |
2181 | +from autopilot import logging as autopilot_logging |
2182 | + |
2183 | +import ubuntuuitoolkit |
2184 | +from ubuntuuitoolkit import base |
2185 | + |
2186 | +logger = logging.getLogger(__name__) |
2187 | + |
2188 | + |
2189 | +class BaseTestCase(AutopilotTestCase): |
2190 | + |
2191 | + """A common test case class |
2192 | + |
2193 | + """ |
2194 | + |
2195 | + local_location = os.path.dirname(os.path.dirname(os.getcwd())) |
2196 | + local_location_qml = os.path.join(local_location, 'Main.qml') |
2197 | + click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%') |
2198 | + |
2199 | + def setUp(self): |
2200 | + super(BaseTestCase, self).setUp() |
2201 | + self.launcher, self.test_type = self.get_launcher_and_type() |
2202 | + self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type) |
2203 | + |
2204 | + def get_launcher_and_type(self): |
2205 | + if os.path.exists(self.local_location_qml): |
2206 | + launcher = self.launch_test_local |
2207 | + test_type = 'local' |
2208 | + else: |
2209 | + launcher = self.launch_test_click |
2210 | + test_type = 'click' |
2211 | + return launcher, test_type |
2212 | + |
2213 | + @autopilot_logging.log_action(logger.info) |
2214 | + def launch_test_local(self): |
2215 | + return self.launch_test_application( |
2216 | + base.get_qmlscene_launch_command(), |
2217 | + self.local_location_qml, |
2218 | + app_type='qt', |
2219 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
2220 | + |
2221 | + @autopilot_logging.log_action(logger.info) |
2222 | + def launch_test_click(self): |
2223 | + return self.launch_click_package( |
2224 | + self.click_package, |
2225 | + emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
2226 | \ No newline at end of file |
2227 | |
2228 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/test_main.py' |
2229 | --- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/test_main.py 2015-05-06 08:49:21 +0000 |
2230 | +++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000 |
2231 | @@ -1,23 +1,21 @@ |
2232 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
2233 | |
2234 | -"""Tests for the Hello World""" |
2235 | - |
2236 | from autopilot.matchers import Eventually |
2237 | -from textwrap import dedent |
2238 | -from testtools.matchers import Is, Not, Equals |
2239 | -from testtools import skip |
2240 | -import os |
2241 | -from %ProjectName% import UbuntuTouchAppTestCase |
2242 | - |
2243 | - |
2244 | -class MainTests(UbuntuTouchAppTestCase): |
2245 | - """Generic tests for the Hello World""" |
2246 | - |
2247 | - test_qml_file = "%s/%s/Main.qml" % (os.path.dirname(os.path.realpath(__file__)),"../../../..") |
2248 | - |
2249 | - def test_0_can_select_mainView(self): |
2250 | - """Must be able to select the mainview.""" |
2251 | - |
2252 | - mainView = self.get_mainview() |
2253 | - self.assertThat(mainView.visible,Eventually(Equals(True))) |
2254 | - |
2255 | +from testtools.matchers import Equals |
2256 | +from %ProjectName% import tests |
2257 | + |
2258 | + |
2259 | +class MainViewTestCase(tests.BaseTestCase): |
2260 | + """Tests for the mainview""" |
2261 | + |
2262 | + def setUp(self): |
2263 | + super(MainViewTestCase, self).setUp() |
2264 | + |
2265 | + def test_click_button(self): |
2266 | + # Find and click the button |
2267 | + button = self.app.main_view.get_button() |
2268 | + self.app.pointing_device.click_object(button) |
2269 | + |
2270 | + # Make an assertion about what should happen |
2271 | + label = self.app.main_view.get_label() |
2272 | + self.assertThat(label.text, Eventually(Equals('..world!'))) |
2273 | \ No newline at end of file |
2274 | |
2275 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/run' |
2276 | --- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/run 2014-10-14 08:33:49 +0000 |
2277 | +++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/run 2015-05-26 21:42:21 +0000 |
2278 | @@ -1,11 +1,11 @@ |
2279 | #!/bin/bash |
2280 | |
2281 | -if [[ -z `which autopilot` ]]; then |
2282 | - echo "Autopilot is not installed. Skip" |
2283 | +if [[ -z `which autopilot3` ]]; then |
2284 | + echo "python3-autopilot is not installed. Skip" |
2285 | exit |
2286 | fi |
2287 | |
2288 | SCRIPTPATH=`dirname $0` |
2289 | pushd ${SCRIPTPATH} |
2290 | -autopilot run %ProjectName% |
2291 | -popd |
2292 | +autopilot3 run %ProjectName% |
2293 | +popd |
2294 | \ No newline at end of file |
2295 | |
2296 | === added directory 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit' |
2297 | === added file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit/tst_main.qml' |
2298 | --- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000 |
2299 | +++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000 |
2300 | @@ -0,0 +1,41 @@ |
2301 | +import QtQuick 2.0 |
2302 | +import QtTest 1.0 |
2303 | +import Ubuntu.Test 1.0 |
2304 | +import "../../" |
2305 | +// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase |
2306 | + |
2307 | +// Execute these tests with: |
2308 | +// qmltestrunner |
2309 | + |
2310 | +Item { |
2311 | + |
2312 | + width: units.gu(100) |
2313 | + height: units.gu(75) |
2314 | + |
2315 | + // The objects |
2316 | + Main { |
2317 | + id: main |
2318 | + } |
2319 | + |
2320 | + UbuntuTestCase { |
2321 | + name: "MainTestCase" |
2322 | + |
2323 | + when: windowShown |
2324 | + |
2325 | + |
2326 | + function init() { |
2327 | + var label = findChild(main, "label"); |
2328 | + // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method |
2329 | + compare("Hello..", label.text); |
2330 | + } |
2331 | + |
2332 | + function test_clickButtonMustChangeLabel() { |
2333 | + var button = findChild(main, "button"); |
2334 | + var buttonCenter = centerOf(button) |
2335 | + mouseClick(button, buttonCenter.x, buttonCenter.y); |
2336 | + var label = findChild(main, "label"); |
2337 | + // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method |
2338 | + tryCompare(label, "text", "..world!", 1); |
2339 | + } |
2340 | + } |
2341 | +} |
2342 | |
2343 | === modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/wizard.xml' |
2344 | --- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/wizard.xml 2015-05-06 08:49:21 +0000 |
2345 | +++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/wizard.xml 2015-05-26 21:42:21 +0000 |
2346 | @@ -1,63 +1,61 @@ |
2347 | <?xml version="1.0" encoding="UTF-8"?> |
2348 | <wizard version="1" kind="project" firstpage="10" id="A2_UbuntuSimpleI18nQmlProject'" category="A.UbuntuProject" |
2349 | - platformIndependent="true" |
2350 | + platformIndependent="true" |
2351 | class="ubuntu-project-cmake" |
2352 | - featuresRequired="" |
2353 | + featuresRequired="" |
2354 | > |
2355 | <icon>../share/ubuntu.png</icon> |
2356 | - <description>A simple QML app with localization support. |
2357 | - |
2358 | -Includes also |
2359 | - - unit and functional tests for QML |
2360 | + <description>A simple QML app with localization support. Also includes unit and functional tests. |
2361 | </description> |
2362 | <displayname>QML App with Simple UI (cmake)</displayname> |
2363 | <displaycategory>Ubuntu</displaycategory> |
2364 | <files> |
2365 | <file source="CMakeLists.txt" target="CMakeLists.txt" openproject="true"/> |
2366 | <file source="app/graphics/toolbarIcon@8.png" target="app/graphics/toolbarIcon@8.png" openeditor="false" binary="true"/> |
2367 | - <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/> |
2368 | + <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/> |
2369 | <file source="app/graphics/displayName.png" target="app/graphics/%ProjectName%.png" openeditor="false" binary="true"/> |
2370 | <file source="app/CMakeLists.txt" target="app/CMakeLists.txt" openeditor="false"/> |
2371 | - <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/> |
2372 | - <file source="app/tests/autopilot/displayName/main/test_main.py" target="app/tests/autopilot/%ProjectName%/main/test_main.py" openeditor="false"/> |
2373 | - <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
2374 | - <file source="app/tests/autopilot/displayName/main/__init__.py" target="app/tests/autopilot/%ProjectName%/main/__init__.py" openeditor="false"/> |
2375 | - <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/> |
2376 | - <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/> |
2377 | + <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/> |
2378 | + <file source="app/tests/autopilot/displayName/tests/test_main.py" target="app/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/> |
2379 | + <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/> |
2380 | + <file source="app/tests/autopilot/displayName/tests/__init__.py" target="app/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/> |
2381 | + <file source="app/tests/unit/tst_main.qml" target="app/tests/unit/tst_main.qml" openeditor="false"/> |
2382 | + <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/> |
2383 | + <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/> |
2384 | <file source="app/Main.qml" target="app/Main.qml" openeditor="true"/> |
2385 | <file source="po/CMakeLists.txt" target="po/CMakeLists.txt" openeditor="false"/> |
2386 | </files> |
2387 | |
2388 | - <!-- Create a 2nd wizard page with click package parameters --> |
2389 | - <fieldpagetitle>Click package parameters</fieldpagetitle> |
2390 | - <fields> |
2391 | - <field mandatory="true" name="ClickDomain"> |
2392 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
2393 | - defaulttext="" placeholdertext="Nickname"/> |
2394 | - <fielddescription>Nickname:</fielddescription> |
2395 | - </field> |
2396 | - <field mandatory="true" name="ClickMaintainer"> |
2397 | - <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
2398 | - defaulttext="" placeholdertext="Maintainer"/> |
2399 | - <fielddescription>Maintainer:</fielddescription> |
2400 | - </field> |
2401 | - <field mandatory="true" name="ClickHookName"> |
2402 | - <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
2403 | - defaulttext="myapp" placeholdertext="app hook name"/> |
2404 | - <fielddescription>App name:</fielddescription> |
2405 | - </field> |
2406 | - <field name="ClickFrameworkVersion"> |
2407 | - <fieldcontrol class="QComboBox" defaultindex="0"> |
2408 | - <comboentries> |
2409 | - <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
2410 | - <comboentry value="ubuntu-sdk-dummy-framework"> |
2411 | - <comboentrytext>Dummy Framework</comboentrytext> |
2412 | - </comboentry> |
2413 | - </comboentries> |
2414 | - </fieldcontrol> |
2415 | - <fielddescription>Framework:</fielddescription> |
2416 | - </field> |
2417 | - </fields> |
2418 | + <!-- Create a 2nd wizard page with click package parameters --> |
2419 | + <fieldpagetitle>Click package parameters</fieldpagetitle> |
2420 | + <fields> |
2421 | + <field mandatory="true" name="ClickDomain"> |
2422 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$' |
2423 | + defaulttext="" placeholdertext="Nickname"/> |
2424 | + <fielddescription>Nickname:</fielddescription> |
2425 | + </field> |
2426 | + <field mandatory="true" name="ClickMaintainer"> |
2427 | + <fieldcontrol class="QLineEdit" validator='^[^"]+$' |
2428 | + defaulttext="" placeholdertext="Maintainer"/> |
2429 | + <fielddescription>Maintainer:</fielddescription> |
2430 | + </field> |
2431 | + <field mandatory="true" name="ClickHookName"> |
2432 | + <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$' |
2433 | + defaulttext="myapp" placeholdertext="app hook name"/> |
2434 | + <fielddescription>App name:</fielddescription> |
2435 | + </field> |
2436 | + <field name="ClickFrameworkVersion"> |
2437 | + <fieldcontrol class="QComboBox" defaultindex="0"> |
2438 | + <comboentries> |
2439 | + <!-- Do not add any other frameworks here, they are populated at runtime, this is just a dummy framework to make sure we can find the combobox --> |
2440 | + <comboentry value="ubuntu-sdk-dummy-framework"> |
2441 | + <comboentrytext>Dummy Framework</comboentrytext> |
2442 | + </comboentry> |
2443 | + </comboentries> |
2444 | + </fieldcontrol> |
2445 | + <fielddescription>Framework:</fielddescription> |
2446 | + </field> |
2447 | + </fields> |
2448 | <validationrules> |
2449 | <validationrule condition='/^(.*)\s+<(.*@.*)>$/.test("%ClickMaintainer%")'> |
2450 | <message>Invalid format for maintainer (should be like "Joe Bloggs <joe.bloggs@isp.com>")</message> |
PASSED: Continuous integration, rev:393 jenkins. qa.ubuntu. com/job/ qtcreator- plugin- ubuntu- ci/539/ jenkins. qa.ubuntu. com/job/ qtcreator- plugin- ubuntu- vivid-amd64- ci/73 jenkins. qa.ubuntu. com/job/ qtcreator- plugin- ubuntu- vivid-armhf- ci/73
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/qtcreator- plugin- ubuntu- ci/539/ rebuild
http://