Merge lp:~nskaggs/ubuntu-sdk-tutorials/update-currency-tests into lp:ubuntu-sdk-tutorials
- update-currency-tests
- Merge into trunk
Proposed by
Nicholas Skaggs
Status: | Merged |
---|---|
Merged at revision: | 137 |
Proposed branch: | lp:~nskaggs/ubuntu-sdk-tutorials/update-currency-tests |
Merge into: | lp:ubuntu-sdk-tutorials |
Diff against target: |
781 lines (+167/-447) 14 files modified
getting-started/CurrencyConverter/Main.qml (+0/-2) getting-started/CurrencyConverter/Makefile (+6/-6) getting-started/CurrencyConverter/tests/acceptance/currencyconverter/__init__.py (+76/-2) getting-started/CurrencyConverter/tests/acceptance/currencyconverter/tests/__init__.py (+37/-43) getting-started/CurrencyConverter/tests/acceptance/currencyconverter/tests/test_currencyconverter.py (+29/-74) getting-started/CurrencyConverter/tests/acceptance/run (+12/-0) getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/__init__.py (+0/-17) getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/main_window.py (+0/-44) getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/ubuntusdk.py (+0/-165) getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/test_main.py (+0/-25) getting-started/CurrencyConverter/tests/autopilot/run (+0/-12) getting-started/CurrencyConverter/tests/integration/tst_currencyconverter.qml (+6/-6) getting-started/CurrencyConverter/tests/unit/tst_convert.qml (+1/-1) getting-started/CurrencyConverter/tests/unit/tst_hellocomponent.qml (+0/-50) |
To merge this branch: | bzr merge lp:~nskaggs/ubuntu-sdk-tutorials/update-currency-tests |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Daniel Holbach (community) | Needs Fixing | ||
Review via email: mp+252776@code.launchpad.net |
Commit message
Description of the change
update tests for currency converter
To post a comment you must log in.
Revision history for this message
Nicholas Skaggs (nskaggs) wrote : | # |
make test works now. Merging with dholbach's blessing.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === renamed file 'getting-started/CurrencyConverter/main.qml' => 'getting-started/CurrencyConverter/Main.qml' | |||
2 | --- getting-started/CurrencyConverter/main.qml 2015-01-08 17:45:23 +0000 | |||
3 | +++ getting-started/CurrencyConverter/Main.qml 2015-03-12 17:38:35 +0000 | |||
4 | @@ -10,8 +10,6 @@ | |||
5 | 10 | 10 | ||
6 | 11 | MainView { | 11 | MainView { |
7 | 12 | id: root | 12 | id: root |
8 | 13 | // objectName for functional testing purposes (autopilot-qt5) | ||
9 | 14 | objectName: "mainView" | ||
10 | 15 | 13 | ||
11 | 16 | // Note! applicationName needs to match the "name" field of the click manifest | 14 | // Note! applicationName needs to match the "name" field of the click manifest |
12 | 17 | applicationName: "currencyconverter.yourname" | 15 | applicationName: "currencyconverter.yourname" |
13 | 18 | 16 | ||
14 | === modified file 'getting-started/CurrencyConverter/Makefile' | |||
15 | --- getting-started/CurrencyConverter/Makefile 2015-01-08 17:45:23 +0000 | |||
16 | +++ getting-started/CurrencyConverter/Makefile 2015-03-12 17:38:35 +0000 | |||
17 | @@ -3,9 +3,7 @@ | |||
18 | 3 | # Notes for autopilot tests: | 3 | # Notes for autopilot tests: |
19 | 4 | # --------------------------------------------------------------- | 4 | # --------------------------------------------------------------- |
20 | 5 | # In order to run autopilot tests: | 5 | # In order to run autopilot tests: |
24 | 6 | # sudo apt-add-repository ppa:autopilot/ppa | 6 | # sudo apt-get install python3-autopilot autopilot-desktop |
22 | 7 | # sudo apt-get update | ||
23 | 8 | # sudo apt-get install python-autopilot autopilot-qt | ||
25 | 9 | # | 7 | # |
26 | 10 | # Notes for translations: | 8 | # Notes for translations: |
27 | 11 | # --------------------------------------------------------------- | 9 | # --------------------------------------------------------------- |
28 | @@ -30,9 +28,11 @@ | |||
29 | 30 | 28 | ||
30 | 31 | all: po/template.pot | 29 | all: po/template.pot |
31 | 32 | 30 | ||
35 | 33 | autopilot: | 31 | test: |
36 | 34 | chmod +x tests/autopilot/run | 32 | qmltestrunner -input tests/unit |
37 | 35 | tests/autopilot/run | 33 | qmltestrunner -input tests/integration |
38 | 34 | chmod +x tests/acceptance/run | ||
39 | 35 | tests/acceptance/run | ||
40 | 36 | 36 | ||
41 | 37 | check: | 37 | check: |
42 | 38 | qmltestrunner -input tests/unit | 38 | qmltestrunner -input tests/unit |
43 | 39 | 39 | ||
44 | === renamed directory 'getting-started/CurrencyConverter/tests/autopilot' => 'getting-started/CurrencyConverter/tests/acceptance' | |||
45 | === renamed directory 'getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter' => 'getting-started/CurrencyConverter/tests/acceptance/currencyconverter' | |||
46 | === modified file 'getting-started/CurrencyConverter/tests/acceptance/currencyconverter/__init__.py' | |||
47 | --- getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/__init__.py 2013-06-05 16:58:12 +0000 | |||
48 | +++ getting-started/CurrencyConverter/tests/acceptance/currencyconverter/__init__.py 2015-03-12 17:38:35 +0000 | |||
49 | @@ -1,6 +1,6 @@ | |||
50 | 1 | # -#- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -#- | 1 | # -#- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -#- |
51 | 2 | # | 2 | # |
53 | 3 | # Copyright (C) 2013 Canonical Ltd | 3 | # Copyright (C) 2013-2015 Canonical Ltd |
54 | 4 | # | 4 | # |
55 | 5 | # This program is free software: you can redistribute it and/or modify | 5 | # This program is free software: you can redistribute it and/or modify |
56 | 6 | # it under the terms of the GNU General Public License version 3 as | 6 | # it under the terms of the GNU General Public License version 3 as |
57 | @@ -16,4 +16,78 @@ | |||
58 | 16 | # | 16 | # |
59 | 17 | # Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> | 17 | # Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> |
60 | 18 | 18 | ||
62 | 19 | """CurrencyConverter autopilot tests and emulators - top level package.""" | 19 | import ubuntuuitoolkit |
63 | 20 | import logging | ||
64 | 21 | import random | ||
65 | 22 | |||
66 | 23 | logger = logging.getLogger(__name__) | ||
67 | 24 | |||
68 | 25 | |||
69 | 26 | class CurrencyConverter(object): | ||
70 | 27 | |||
71 | 28 | """Autopilot helper object for the currencyconverter application.""" | ||
72 | 29 | |||
73 | 30 | def __init__(self, app_proxy, test_type): | ||
74 | 31 | self.app = app_proxy | ||
75 | 32 | self.test_type = test_type | ||
76 | 33 | self.main_view = self.app.select_single(Main) | ||
77 | 34 | |||
78 | 35 | @property | ||
79 | 36 | def pointing_device(self): | ||
80 | 37 | return self.app.pointing_device | ||
81 | 38 | |||
82 | 39 | |||
83 | 40 | class Main(ubuntuuitoolkit.MainView): | ||
84 | 41 | |||
85 | 42 | """Autopilot helper for the MainView.""" | ||
86 | 43 | |||
87 | 44 | def __init__(self, *args): | ||
88 | 45 | super(Main, self).__init__(*args) | ||
89 | 46 | self.visible.wait_for(True) | ||
90 | 47 | self.wait_for_network() | ||
91 | 48 | |||
92 | 49 | def wait_for_network(self): | ||
93 | 50 | self.select_single("ActivityIndicator").running.wait_for(False) | ||
94 | 51 | |||
95 | 52 | def set_random_to_value(self): | ||
96 | 53 | """Sets a random value in the to currency field""" | ||
97 | 54 | self.get_to_currency_field()._set_field_to_random_value() | ||
98 | 55 | |||
99 | 56 | def set_random_from_value(self): | ||
100 | 57 | """Sets a random value in the from currency field""" | ||
101 | 58 | self.get_from_currency_field()._set_field_to_random_value() | ||
102 | 59 | |||
103 | 60 | def get_clear_button(self): | ||
104 | 61 | """Returns the clear button object""" | ||
105 | 62 | return self.select_single("Button", objectName="clearBtn") | ||
106 | 63 | |||
107 | 64 | def use_clear_button(self): | ||
108 | 65 | """Clicks the clear button""" | ||
109 | 66 | self.pointing_device.click_object(self.get_clear_button()) | ||
110 | 67 | |||
111 | 68 | def get_from_currency_field(self): | ||
112 | 69 | """Returns the from currency field""" | ||
113 | 70 | return self.select_single(TextField, objectName="inputFrom") | ||
114 | 71 | |||
115 | 72 | def get_to_currency_field(self): | ||
116 | 73 | """Returns the to currency field""" | ||
117 | 74 | return self.select_single(TextField, objectName="inputTo") | ||
118 | 75 | |||
119 | 76 | def get_from_currency_button(self): | ||
120 | 77 | """Returns the select for the from currency field""" | ||
121 | 78 | return self.select_single("Button", objectName="selectorFrom") | ||
122 | 79 | |||
123 | 80 | def get_to_currency_button(self): | ||
124 | 81 | """Returns the select for the to currency field""" | ||
125 | 82 | return self.select_single("Button", objectName="selectorTo") | ||
126 | 83 | |||
127 | 84 | |||
128 | 85 | class TextField(ubuntuuitoolkit.TextField): | ||
129 | 86 | """Autopilot helper for the Textfield.""" | ||
130 | 87 | |||
131 | 88 | def _set_field_to_random_value(self): | ||
132 | 89 | value = str(random.random()) | ||
133 | 90 | self.write(value) | ||
134 | 91 | |||
135 | 92 | def get_value(self): | ||
136 | 93 | return float(self.text) | ||
137 | 20 | 94 | ||
138 | === modified file 'getting-started/CurrencyConverter/tests/acceptance/currencyconverter/tests/__init__.py' | |||
139 | --- getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/tests/__init__.py 2013-06-11 20:36:45 +0000 | |||
140 | +++ getting-started/CurrencyConverter/tests/acceptance/currencyconverter/tests/__init__.py 2015-03-12 17:38:35 +0000 | |||
141 | @@ -1,6 +1,6 @@ | |||
142 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
143 | 2 | # | 2 | # |
145 | 3 | # Copyright (C) 2013 Canonical Ltd | 3 | # Copyright (C) 2013-2015 Canonical Ltd |
146 | 4 | # | 4 | # |
147 | 5 | # This program is free software: you can redistribute it and/or modify | 5 | # This program is free software: you can redistribute it and/or modify |
148 | 6 | # it under the terms of the GNU General Public License version 3 as | 6 | # it under the terms of the GNU General Public License version 3 as |
149 | @@ -20,54 +20,48 @@ | |||
150 | 20 | """CurrencyConverter autopilot tests.""" | 20 | """CurrencyConverter autopilot tests.""" |
151 | 21 | 21 | ||
152 | 22 | import os.path | 22 | import os.path |
153 | 23 | import os | ||
154 | 24 | |||
155 | 25 | from autopilot.input import Mouse, Touch, Pointer | ||
156 | 26 | from autopilot.platform import model | ||
157 | 27 | from autopilot.testcase import AutopilotTestCase | 23 | from autopilot.testcase import AutopilotTestCase |
161 | 28 | 24 | from autopilot import logging as autopilot_logging | |
162 | 29 | from CurrencyConverter.emulators.main_window import MainWindow | 25 | import logging |
163 | 30 | from CurrencyConverter.emulators.ubuntusdk import ubuntusdk | 26 | import currencyconverter |
164 | 27 | import ubuntuuitoolkit | ||
165 | 28 | from ubuntuuitoolkit import base | ||
166 | 29 | |||
167 | 30 | logger = logging.getLogger(__name__) | ||
168 | 31 | |||
169 | 31 | 32 | ||
170 | 32 | class CurrencyConverterTestCase(AutopilotTestCase): | 33 | class CurrencyConverterTestCase(AutopilotTestCase): |
171 | 33 | |||
172 | 34 | """A common test case class that provides several useful methods for | 34 | """A common test case class that provides several useful methods for |
183 | 35 | CurrencyConverter tests. | 35 | CurrencyConverter tests.""" |
184 | 36 | 36 | ||
185 | 37 | """ | 37 | local_location = os.path.dirname(os.path.dirname(os.getcwd())) |
186 | 38 | 38 | local_location_qml = os.path.join(local_location, 'Main.qml') | |
187 | 39 | if model() == 'Desktop': | 39 | |
188 | 40 | scenarios = [('with mouse', dict(input_device_class=Mouse))] | 40 | def get_launcher_and_type(self): |
189 | 41 | else: | 41 | if os.path.exists(self.local_location_qml): |
190 | 42 | scenarios = [('with touch', dict(input_device_class=Touch))] | 42 | launcher = self.launch_test_local |
191 | 43 | 43 | test_type = 'local' | |
192 | 44 | local_location = "../../CurrencyConverter.qml" | 44 | else: |
193 | 45 | launcher = self.launch_test_click | ||
194 | 46 | test_type = 'click' | ||
195 | 47 | return launcher, test_type | ||
196 | 45 | 48 | ||
197 | 46 | def setUp(self): | 49 | def setUp(self): |
198 | 47 | self.pointing_device = Pointer(self.input_device_class.create()) | ||
199 | 48 | super(CurrencyConverterTestCase, self).setUp() | 50 | super(CurrencyConverterTestCase, self).setUp() |
204 | 49 | if os.path.exists(self.local_location): | 51 | self.launcher, self.test_type = self.get_launcher_and_type() |
205 | 50 | self.launch_test_local() | 52 | self.app = currencyconverter.CurrencyConverter(self.launcher(), |
206 | 51 | else: | 53 | self.test_type) |
203 | 52 | self.launch_test_installed() | ||
207 | 53 | 54 | ||
208 | 55 | @autopilot_logging.log_action(logger.info) | ||
209 | 54 | def launch_test_local(self): | 56 | def launch_test_local(self): |
229 | 55 | self.app = self.launch_test_application( | 57 | return self.launch_test_application( |
230 | 56 | "qmlscene", | 58 | base.get_qmlscene_launch_command(), |
231 | 57 | self.local_location, | 59 | self.local_location_qml, |
232 | 58 | app_type='qt') | 60 | app_type='qt', |
233 | 59 | 61 | emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) | |
234 | 60 | def launch_test_installed(self): | 62 | |
235 | 61 | self.app = self.launch_test_application( | 63 | @autopilot_logging.log_action(logger.info) |
236 | 62 | "qmlscene", | 64 | def launch_test_click(self): |
237 | 63 | "/usr/share/CurrencyConverter/CurrencyConverter.qml", | 65 | return self.launch_click_package( |
238 | 64 | "--desktop_file_hint=/usr/share/applications/CurrencyConverter.desktop", | 66 | "com.ubuntu.developer.yourname.currencyconverter", |
239 | 65 | app_type='qt') | 67 | emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase) |
221 | 66 | |||
222 | 67 | @property | ||
223 | 68 | def main_window(self): | ||
224 | 69 | return MainWindow(self.app) | ||
225 | 70 | |||
226 | 71 | @property | ||
227 | 72 | def ubuntusdk(self): | ||
228 | 73 | return ubuntusdk(self, self.app) | ||
240 | 74 | 68 | ||
241 | === renamed file 'getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/tests/test_CurrencyConverter.py' => 'getting-started/CurrencyConverter/tests/acceptance/currencyconverter/tests/test_currencyconverter.py' | |||
242 | --- getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/tests/test_CurrencyConverter.py 2013-06-11 20:36:45 +0000 | |||
243 | +++ getting-started/CurrencyConverter/tests/acceptance/currencyconverter/tests/test_currencyconverter.py 2015-03-12 17:38:35 +0000 | |||
244 | @@ -1,6 +1,6 @@ | |||
245 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- |
246 | 2 | # | 2 | # |
248 | 3 | # Copyright (C) 2013 Canonical Ltd | 3 | # Copyright (C) 2013-2015 Canonical Ltd |
249 | 4 | # | 4 | # |
250 | 5 | # This program is free software: you can redistribute it and/or modify | 5 | # This program is free software: you can redistribute it and/or modify |
251 | 6 | # it under the terms of the GNU General Public License version 3 as | 6 | # it under the terms of the GNU General Public License version 3 as |
252 | @@ -19,77 +19,32 @@ | |||
253 | 19 | 19 | ||
254 | 20 | """ Tests for CurrencyConverter """ | 20 | """ Tests for CurrencyConverter """ |
255 | 21 | 21 | ||
319 | 22 | from __future__ import absolute_import | 22 | from currencyconverter.tests import CurrencyConverterTestCase |
320 | 23 | 23 | ||
321 | 24 | from testtools.matchers import Equals, NotEquals, Not, Is | 24 | |
322 | 25 | from autopilot.matchers import Eventually | 25 | class TestMainWindow(CurrencyConverterTestCase): |
323 | 26 | 26 | ||
324 | 27 | from CurrencyConverter.tests import CurrencyConverterTestCase | 27 | def test_from_currency_convert(self): |
325 | 28 | 28 | """ Setting from currency value should update to currency """ | |
326 | 29 | 29 | ||
327 | 30 | class TestCurrencyConverter(CurrencyConverterTestCase): | 30 | self.app.main_view.set_random_from_value() |
328 | 31 | """ Tests the CurrencyConverter page features """ | 31 | to_value = self.app.main_view.get_to_currency_field().get_value() |
329 | 32 | 32 | self.assertGreater(to_value, 0) | |
330 | 33 | def setUp(self): | 33 | |
331 | 34 | super(TestCurrencyConverter, self).setUp() | 34 | def test_to_currency_convert(self): |
332 | 35 | self.assertThat( | 35 | """ Setting to currency value should update from currency """ |
333 | 36 | self.ubuntusdk.get_qml_view().visible, Eventually(Equals(True))) | 36 | |
334 | 37 | 37 | self.app.main_view.set_random_to_value() | |
335 | 38 | def tearDown(self): | 38 | from_value = self.app.main_view.get_from_currency_field().get_value() |
336 | 39 | super(TestCurrencyConverter, self).tearDown() | 39 | self.assertGreater(from_value, 0) |
337 | 40 | 40 | ||
275 | 41 | """ Test if the currency rate is converted """ | ||
276 | 42 | def test_convert_currency(self): | ||
277 | 43 | fromField = self.main_window.get_from_currency_field() | ||
278 | 44 | toField = self.main_window.get_to_currency_field() | ||
279 | 45 | fromCurrencyButton = self.main_window.get_from_currency_button() | ||
280 | 46 | toCurrencyButton = self.main_window.get_to_currency_button() | ||
281 | 47 | |||
282 | 48 | #store current values | ||
283 | 49 | oldToValue = toField.text | ||
284 | 50 | |||
285 | 51 | #input value to convert from | ||
286 | 52 | self.pointing_device.click_object(fromField) | ||
287 | 53 | self.keyboard.type('1') | ||
288 | 54 | |||
289 | 55 | #store current values | ||
290 | 56 | oldFromValue = fromField.text | ||
291 | 57 | |||
292 | 58 | #verify fromField was updated and toField is still the same | ||
293 | 59 | self.assertThat(toField.text, Eventually(NotEquals(oldToValue))) | ||
294 | 60 | self.assertThat(fromField.text, Eventually(Equals(oldFromValue))) | ||
295 | 61 | |||
296 | 62 | #store current values | ||
297 | 63 | oldFromValue = fromField.text | ||
298 | 64 | oldToValue = toField.text | ||
299 | 65 | |||
300 | 66 | #change the from currency | ||
301 | 67 | self.ubuntusdk.set_popup_value("popoverCurrencySelector", fromCurrencyButton, 'HUF') | ||
302 | 68 | |||
303 | 69 | #verify fromField was updated and toField is still the same | ||
304 | 70 | self.assertThat(fromField.text, Eventually(NotEquals(oldFromValue))) | ||
305 | 71 | self.assertThat(toField.text, Eventually(Equals(oldToValue))) | ||
306 | 72 | |||
307 | 73 | #store current values | ||
308 | 74 | oldFromValue = fromField.text | ||
309 | 75 | oldToValue = toField.text | ||
310 | 76 | |||
311 | 77 | #change the to currency | ||
312 | 78 | self.ubuntusdk.set_popup_value("popoverCurrencySelector", toCurrencyButton, 'BGN') | ||
313 | 79 | |||
314 | 80 | #verify fromField is the same and toField is updated | ||
315 | 81 | self.assertThat(fromField.text, Eventually(Equals(oldFromValue))) | ||
316 | 82 | self.assertThat(toField.text, Eventually(NotEquals(oldToValue))) | ||
317 | 83 | |||
318 | 84 | """ Test if the clear button clears the screen """ | ||
338 | 85 | def test_clear_button(self): | 41 | def test_clear_button(self): |
349 | 86 | clearButton = self.main_window.get_clear_button() | 42 | """ Test if the clear button clears the screen """ |
350 | 87 | fromField = self.main_window.get_from_currency_field() | 43 | |
351 | 88 | toField = self.main_window.get_to_currency_field() | 44 | self.app.main_view.set_random_from_value() |
352 | 89 | 45 | self.app.main_view.use_clear_button() | |
353 | 90 | #click the clear button | 46 | |
354 | 91 | self.pointing_device.click_object(clearButton) | 47 | self.assertEquals(self.app.main_view.get_from_currency_field().text, |
355 | 92 | 48 | '0.0') | |
356 | 93 | #confirm fields have been wiped | 49 | self.assertEquals(self.app.main_view.get_to_currency_field().text, |
357 | 94 | self.assertThat(fromField.text, Eventually(Equals('0.0'))) | 50 | '0.0') |
348 | 95 | self.assertThat(toField.text, Eventually(Equals('0.0'))) | ||
358 | 96 | 51 | ||
359 | === added file 'getting-started/CurrencyConverter/tests/acceptance/run' | |||
360 | --- getting-started/CurrencyConverter/tests/acceptance/run 1970-01-01 00:00:00 +0000 | |||
361 | +++ getting-started/CurrencyConverter/tests/acceptance/run 2015-03-12 17:38:35 +0000 | |||
362 | @@ -0,0 +1,12 @@ | |||
363 | 1 | #!/bin/bash | ||
364 | 2 | |||
365 | 3 | if [[ -z `which autopilot3` ]]; then | ||
366 | 4 | echo "Autopilot3 is not installed. Skip" | ||
367 | 5 | exit | ||
368 | 6 | fi | ||
369 | 7 | |||
370 | 8 | SCRIPTPATH=`dirname $0` | ||
371 | 9 | pushd ${SCRIPTPATH} | ||
372 | 10 | autopilot3 run -v currencyconverter | ||
373 | 11 | popd | ||
374 | 12 | |||
375 | 0 | 13 | ||
376 | === removed directory 'getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators' | |||
377 | === removed file 'getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/__init__.py' | |||
378 | --- getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/__init__.py 2013-06-05 16:58:12 +0000 | |||
379 | +++ getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/__init__.py 1970-01-01 00:00:00 +0000 | |||
380 | @@ -1,17 +0,0 @@ | |||
381 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
382 | 2 | # | ||
383 | 3 | # Copyright (C) 2013 Canonical Ltd | ||
384 | 4 | # | ||
385 | 5 | # This program is free software: you can redistribute it and/or modify | ||
386 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
387 | 7 | # published by the Free Software Foundation. | ||
388 | 8 | # | ||
389 | 9 | # This program is distributed in the hope that it will be useful, | ||
390 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
391 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
392 | 12 | # GNU General Public License for more details. | ||
393 | 13 | # | ||
394 | 14 | # You should have received a copy of the GNU General Public License | ||
395 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
396 | 16 | # | ||
397 | 17 | # Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> | ||
398 | 18 | 0 | ||
399 | === removed file 'getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/main_window.py' | |||
400 | --- getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/main_window.py 2013-06-11 20:36:45 +0000 | |||
401 | +++ getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/main_window.py 1970-01-01 00:00:00 +0000 | |||
402 | @@ -1,44 +0,0 @@ | |||
403 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
404 | 2 | # | ||
405 | 3 | # Copyright (C) 2013 Canonical Ltd | ||
406 | 4 | # | ||
407 | 5 | # This program is free software: you can redistribute it and/or modify | ||
408 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
409 | 7 | # published by the Free Software Foundation. | ||
410 | 8 | # | ||
411 | 9 | # This program is distributed in the hope that it will be useful, | ||
412 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
413 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
414 | 12 | # GNU General Public License for more details. | ||
415 | 13 | # | ||
416 | 14 | # You should have received a copy of the GNU General Public License | ||
417 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
418 | 16 | # | ||
419 | 17 | # Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> | ||
420 | 18 | |||
421 | 19 | |||
422 | 20 | class MainWindow(object): | ||
423 | 21 | """An emulator class that makes it easy to interact with the CurrencyConverter.""" | ||
424 | 22 | |||
425 | 23 | def __init__(self, app): | ||
426 | 24 | self.app = app | ||
427 | 25 | |||
428 | 26 | def get_clear_button(self): | ||
429 | 27 | """Returns the clear button object""" | ||
430 | 28 | return self.app.select_single("Button", objectName="clearBtn") | ||
431 | 29 | |||
432 | 30 | def get_from_currency_field(self): | ||
433 | 31 | """Returns the from currency field""" | ||
434 | 32 | return self.app.select_single("TextField", objectName="inputFrom") | ||
435 | 33 | |||
436 | 34 | def get_to_currency_field(self): | ||
437 | 35 | """Returns the to currency field""" | ||
438 | 36 | return self.app.select_single("TextField", objectName="inputTo") | ||
439 | 37 | |||
440 | 38 | def get_from_currency_button(self): | ||
441 | 39 | """Returns the select for the from currency field""" | ||
442 | 40 | return self.app.select_single("Button", objectName="selectorFrom") | ||
443 | 41 | |||
444 | 42 | def get_to_currency_button(self): | ||
445 | 43 | """Returns the select for the to currency field""" | ||
446 | 44 | return self.app.select_single("Button", objectName="selectorTo") | ||
447 | 45 | 0 | ||
448 | === removed file 'getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/ubuntusdk.py' | |||
449 | --- getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/ubuntusdk.py 2013-06-11 22:58:27 +0000 | |||
450 | +++ getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/emulators/ubuntusdk.py 1970-01-01 00:00:00 +0000 | |||
451 | @@ -1,165 +0,0 @@ | |||
452 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
453 | 2 | # | ||
454 | 3 | # Copyright (C) 2013 Canonical Ltd | ||
455 | 4 | # | ||
456 | 5 | # This program is free software: you can redistribute it and/or modify | ||
457 | 6 | # it under the terms of the GNU General Public License version 3 as | ||
458 | 7 | # published by the Free Software Foundation. | ||
459 | 8 | # | ||
460 | 9 | # This program is distributed in the hope that it will be useful, | ||
461 | 10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
462 | 11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
463 | 12 | # GNU General Public License for more details. | ||
464 | 13 | # | ||
465 | 14 | # You should have received a copy of the GNU General Public License | ||
466 | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
467 | 16 | # | ||
468 | 17 | # Authored by: Nicholas Skaggs <nicholas.skaggs@canonical.com> | ||
469 | 18 | |||
470 | 19 | from testtools.matchers import Equals, NotEquals, Not, Is | ||
471 | 20 | from autopilot.matchers import Eventually | ||
472 | 21 | |||
473 | 22 | class ubuntusdk(object): | ||
474 | 23 | """An emulator class that makes it easy to interact with the ubuntu sdk applications.""" | ||
475 | 24 | |||
476 | 25 | def __init__(self, autopilot, app): | ||
477 | 26 | self.app = app | ||
478 | 27 | self.autopilot = autopilot | ||
479 | 28 | |||
480 | 29 | def get_qml_view(self): | ||
481 | 30 | """Get the main QML view""" | ||
482 | 31 | return self.app.select_single("QQuickView") | ||
483 | 32 | |||
484 | 33 | def get_object(self, typeName, name): | ||
485 | 34 | """Get a specific object""" | ||
486 | 35 | return self.app.select_single(typeName, objectName=name) | ||
487 | 36 | |||
488 | 37 | def get_objects(self, typeName, name): | ||
489 | 38 | """Get more than one object""" | ||
490 | 39 | return self.app.select_many(typeName, objectName=name) | ||
491 | 40 | |||
492 | 41 | def switch_to_tab(self, tab): | ||
493 | 42 | """Switch to the specified tab number""" | ||
494 | 43 | tabs = self.get_tabs() | ||
495 | 44 | currentTab = tabs.selectedTabIndex | ||
496 | 45 | |||
497 | 46 | #perform operations until tab == currentTab | ||
498 | 47 | while tab != currentTab: | ||
499 | 48 | if tab > currentTab: | ||
500 | 49 | self._previous_tab() | ||
501 | 50 | if tab < currentTab: | ||
502 | 51 | self._next_tab() | ||
503 | 52 | currentTab = tabs.selectedTabIndex | ||
504 | 53 | |||
505 | 54 | def toggle_toolbar(self): | ||
506 | 55 | """Toggle the toolbar between revealed and hidden""" | ||
507 | 56 | #check and see if the toolbar is open or not | ||
508 | 57 | if self.get_toolbar().opened: | ||
509 | 58 | self.hide_toolbar() | ||
510 | 59 | else: | ||
511 | 60 | self.open_toolbar() | ||
512 | 61 | |||
513 | 62 | def get_toolbar(self): | ||
514 | 63 | """Returns the toolbar in the main events view.""" | ||
515 | 64 | return self.app.select_single("Toolbar") | ||
516 | 65 | |||
517 | 66 | def get_toolbar_button(self, button): | ||
518 | 67 | """Returns the toolbar button at position index""" | ||
519 | 68 | toolbar = self.get_toolbar() | ||
520 | 69 | item = toolbar.get_children_by_type("QQuickItem")[0] | ||
521 | 70 | row = item.get_children_by_type("QQuickRow")[0] | ||
522 | 71 | buttonLoaders = row.get_children_by_type("QQuickLoader") | ||
523 | 72 | buttonLoader = buttonLoaders[button] | ||
524 | 73 | return buttonLoader | ||
525 | 74 | |||
526 | 75 | def click_toolbar_button(self, value): | ||
527 | 76 | """Clicks the toolbar button with value""" | ||
528 | 77 | #The toolbar button is assumed to be the following format | ||
529 | 78 | #ToolbarActions { | ||
530 | 79 | # Action { | ||
531 | 80 | # objectName: "name" | ||
532 | 81 | # text: value | ||
533 | 82 | toolbar = self.get_toolbar() | ||
534 | 83 | if not toolbar.opened: | ||
535 | 84 | self.open_toolbar() | ||
536 | 85 | item = toolbar.get_children_by_type("QQuickItem")[0] | ||
537 | 86 | row = item.get_children_by_type("QQuickRow")[0] | ||
538 | 87 | buttonList = row.get_children_by_type("QQuickLoader") | ||
539 | 88 | for button in buttonList: | ||
540 | 89 | itemList = lambda: self.get_objects("Action", button) | ||
541 | 90 | |||
542 | 91 | for item in itemList(): | ||
543 | 92 | if item.get_properties()['text'] == value: | ||
544 | 93 | self.autopilot.pointing_device.click_object(item) | ||
545 | 94 | |||
546 | 95 | def open_toolbar(self): | ||
547 | 96 | """Open the toolbar""" | ||
548 | 97 | qmlView = self.get_qml_view() | ||
549 | 98 | |||
550 | 99 | lineX = qmlView.x + qmlView.width * 0.50 | ||
551 | 100 | startY = qmlView.y + qmlView.height - 1 | ||
552 | 101 | stopY = qmlView.y + qmlView.height - 200 | ||
553 | 102 | |||
554 | 103 | self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) | ||
555 | 104 | self.autopilot.pointing_device.click() | ||
556 | 105 | self.autopilot.pointing_device.click() | ||
557 | 106 | |||
558 | 107 | def hide_toolbar(self): | ||
559 | 108 | """Hide the toolbar""" | ||
560 | 109 | qmlView = self.get_qml_view() | ||
561 | 110 | |||
562 | 111 | lineX = qmlView.x + qmlView.width * 0.50 | ||
563 | 112 | startY = qmlView.y + qmlView.height - 200 | ||
564 | 113 | stopY = qmlView.y + qmlView.height - 1 | ||
565 | 114 | |||
566 | 115 | self.autopilot.pointing_device.drag(lineX, startY, lineX, stopY) | ||
567 | 116 | self.autopilot.pointing_device.click() | ||
568 | 117 | self.autopilot.pointing_device.click() | ||
569 | 118 | |||
570 | 119 | def set_popup_value(self, popover, button, value): | ||
571 | 120 | """Changes the given popover selector to the request value | ||
572 | 121 | At the moment this only works for values that are currently visible. To | ||
573 | 122 | access the remaining items, a help method to drag and recheck is needed.""" | ||
574 | 123 | #The popover is assumed to be the following format | ||
575 | 124 | # Popover { | ||
576 | 125 | # Column { | ||
577 | 126 | # ListView { | ||
578 | 127 | # delegate: Standard { | ||
579 | 128 | # objectName: "name" | ||
580 | 129 | # text: value | ||
581 | 130 | |||
582 | 131 | self.autopilot.pointing_device.click_object(button) | ||
583 | 132 | #we'll get all matching objects, incase the popover is reused between buttons | ||
584 | 133 | itemList = lambda: self.get_objects("Standard", popover) | ||
585 | 134 | |||
586 | 135 | for item in itemList(): | ||
587 | 136 | if item.get_properties()['text'] == value: | ||
588 | 137 | self.autopilot.pointing_device.click_object(item) | ||
589 | 138 | |||
590 | 139 | def get_tabs(self): | ||
591 | 140 | """Return all tabs""" | ||
592 | 141 | return self.get_object("Tabs", "rootTabs") | ||
593 | 142 | |||
594 | 143 | def _previous_tab(self): | ||
595 | 144 | """Switch to the previous tab""" | ||
596 | 145 | qmlView = self.get_qml_view() | ||
597 | 146 | |||
598 | 147 | startX = qmlView.x + qmlView.width * 0.20 | ||
599 | 148 | stopX = qmlView.x + qmlView.width * 0.50 | ||
600 | 149 | lineY = qmlView.y + qmlView.height * 0.05 | ||
601 | 150 | |||
602 | 151 | self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) | ||
603 | 152 | self.autopilot.pointing_device.click() | ||
604 | 153 | self.autopilot.pointing_device.click() | ||
605 | 154 | |||
606 | 155 | def _next_tab(self): | ||
607 | 156 | """Switch to the next tab""" | ||
608 | 157 | qmlView = self.get_qml_view() | ||
609 | 158 | |||
610 | 159 | startX = qmlView.x + qmlView.width * 0.50 | ||
611 | 160 | stopX = qmlView.x + qmlView.width * 0.20 | ||
612 | 161 | lineY = qmlView.y + qmlView.height * 0.05 | ||
613 | 162 | |||
614 | 163 | self.autopilot.pointing_device.drag(startX, lineY, stopX, lineY) | ||
615 | 164 | self.autopilot.pointing_device.click() | ||
616 | 165 | self.autopilot.pointing_device.click() | ||
617 | 166 | 0 | ||
618 | === removed file 'getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/test_main.py' | |||
619 | --- getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/test_main.py 2015-01-08 17:45:23 +0000 | |||
620 | +++ getting-started/CurrencyConverter/tests/autopilot/CurrencyConverter/test_main.py 1970-01-01 00:00:00 +0000 | |||
621 | @@ -1,25 +0,0 @@ | |||
622 | 1 | # -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*- | ||
623 | 2 | |||
624 | 3 | """Tests for the Hello World""" | ||
625 | 4 | |||
626 | 5 | import os | ||
627 | 6 | |||
628 | 7 | from autopilot.matchers import Eventually | ||
629 | 8 | from testtools.matchers import Equals | ||
630 | 9 | |||
631 | 10 | import CurrencyConverter | ||
632 | 11 | |||
633 | 12 | |||
634 | 13 | class MainViewTestCase(CurrencyConverter.ClickAppTestCase): | ||
635 | 14 | """Generic tests for the Hello World""" | ||
636 | 15 | |||
637 | 16 | def test_initial_label(self): | ||
638 | 17 | label = self.main_view.select_single(objectName='label') | ||
639 | 18 | self.assertThat(label.text, Equals('Hello..')) | ||
640 | 19 | |||
641 | 20 | def test_click_button_should_update_label(self): | ||
642 | 21 | button = self.main_view.select_single(objectName='button') | ||
643 | 22 | self.pointing_device.click_object(button) | ||
644 | 23 | label = self.main_view.select_single(objectName='label') | ||
645 | 24 | self.assertThat(label.text, Eventually(Equals('..world!'))) | ||
646 | 25 | |||
647 | 26 | 0 | ||
648 | === removed file 'getting-started/CurrencyConverter/tests/autopilot/run' | |||
649 | --- getting-started/CurrencyConverter/tests/autopilot/run 2015-01-08 17:45:23 +0000 | |||
650 | +++ getting-started/CurrencyConverter/tests/autopilot/run 1970-01-01 00:00:00 +0000 | |||
651 | @@ -1,12 +0,0 @@ | |||
652 | 1 | #!/bin/bash | ||
653 | 2 | |||
654 | 3 | if [[ -z `which autopilot` ]]; then | ||
655 | 4 | echo "Autopilot is not installed. Skip" | ||
656 | 5 | exit | ||
657 | 6 | fi | ||
658 | 7 | |||
659 | 8 | SCRIPTPATH=`dirname $0` | ||
660 | 9 | pushd ${SCRIPTPATH} | ||
661 | 10 | autopilot run CurrencyConverter | ||
662 | 11 | popd | ||
663 | 12 | |||
664 | 13 | 0 | ||
665 | === renamed directory 'getting-started/CurrencyConverter/tests/qmltests' => 'getting-started/CurrencyConverter/tests/integration' | |||
666 | === renamed file 'getting-started/CurrencyConverter/tests/qmltests/tst_CurrencyConverter.qml' => 'getting-started/CurrencyConverter/tests/integration/tst_currencyconverter.qml' | |||
667 | --- getting-started/CurrencyConverter/tests/qmltests/tst_CurrencyConverter.qml 2014-03-05 13:39:26 +0000 | |||
668 | +++ getting-started/CurrencyConverter/tests/integration/tst_currencyconverter.qml 2015-03-12 17:38:35 +0000 | |||
669 | @@ -2,7 +2,7 @@ | |||
670 | 2 | import Ubuntu.Components 0.1 // we need units.gu() here | 2 | import Ubuntu.Components 0.1 // we need units.gu() here |
671 | 3 | import QtTest 1.0 // for TestCase, compare() etc | 3 | import QtTest 1.0 // for TestCase, compare() etc |
672 | 4 | import Ubuntu.Test 0.1 // for UbuntuTestCase, findChild() etc | 4 | import Ubuntu.Test 0.1 // for UbuntuTestCase, findChild() etc |
674 | 5 | import "../../" | 5 | import "../.." |
675 | 6 | 6 | ||
676 | 7 | // Part 2 (read tst_currency.qml first if you haven't) | 7 | // Part 2 (read tst_currency.qml first if you haven't) |
677 | 8 | 8 | ||
678 | @@ -10,16 +10,16 @@ | |||
679 | 10 | // This time we wrap the TestCase into an Item because we need to display | 10 | // This time we wrap the TestCase into an Item because we need to display |
680 | 11 | // the CurrencyConverter. | 11 | // the CurrencyConverter. |
681 | 12 | // Just like before, you can run it with | 12 | // Just like before, you can run it with |
683 | 13 | // qmltestrunner -input tst_CurrencyConverter.qml | 13 | // qmltestrunner -input tst_currencyconverter.qml |
684 | 14 | // Additionally you can open it in qmlscene: | 14 | // Additionally you can open it in qmlscene: |
686 | 15 | // qmlscene tst_CurrencyConverter.qml | 15 | // qmlscene tst_currencyconverter.qml |
687 | 16 | 16 | ||
688 | 17 | Item { | 17 | Item { |
689 | 18 | width: units.gu(40) | 18 | width: units.gu(40) |
690 | 19 | height: units.gu(30) | 19 | height: units.gu(30) |
691 | 20 | 20 | ||
692 | 21 | // Create an instance of the QML element we want to test | 21 | // Create an instance of the QML element we want to test |
694 | 22 | CurrencyConverter { | 22 | Main { |
695 | 23 | id: currencyConverter | 23 | id: currencyConverter |
696 | 24 | anchors.fill: parent | 24 | anchors.fill: parent |
697 | 25 | } | 25 | } |
698 | @@ -58,13 +58,13 @@ | |||
699 | 58 | keyClick(Qt.Key_5) | 58 | keyClick(Qt.Key_5) |
700 | 59 | 59 | ||
701 | 60 | // Now the field should contain the value 0.05 because 0.0 is already in there in the beginning | 60 | // Now the field should contain the value 0.05 because 0.0 is already in there in the beginning |
703 | 61 | tryCompare(inputFrom, "text", "0.05", "Input field \"From:\" does does not contain the value 0.05") | 61 | tryCompare(inputFrom, "text", "0.05") |
704 | 62 | 62 | ||
705 | 63 | var clearBtn = findChild(currencyConverter, "clearBtn") | 63 | var clearBtn = findChild(currencyConverter, "clearBtn") |
706 | 64 | mouseClick(clearBtn, clearBtn.width / 2, clearBtn.height / 2) | 64 | mouseClick(clearBtn, clearBtn.width / 2, clearBtn.height / 2) |
707 | 65 | 65 | ||
708 | 66 | // Now the field should be set back to "0.0" | 66 | // Now the field should be set back to "0.0" |
710 | 67 | tryCompare(inputFrom, "text", "0.0", "Input field \"From:\" is not reset to 0.00") | 67 | tryCompare(inputFrom, "text", "0.0") |
711 | 68 | } | 68 | } |
712 | 69 | 69 | ||
713 | 70 | 70 | ||
714 | 71 | 71 | ||
715 | === renamed file 'getting-started/CurrencyConverter/tests/qmltests/tst_convert.qml' => 'getting-started/CurrencyConverter/tests/unit/tst_convert.qml' | |||
716 | --- getting-started/CurrencyConverter/tests/qmltests/tst_convert.qml 2014-03-05 13:39:26 +0000 | |||
717 | +++ getting-started/CurrencyConverter/tests/unit/tst_convert.qml 2015-03-12 17:38:35 +0000 | |||
718 | @@ -16,7 +16,7 @@ | |||
719 | 16 | 16 | ||
720 | 17 | // The element we want to test. As we are not painting | 17 | // The element we want to test. As we are not painting |
721 | 18 | // anything, don't bother with the size. | 18 | // anything, don't bother with the size. |
723 | 19 | CurrencyConverter { | 19 | Main { |
724 | 20 | id: currencyConverter | 20 | id: currencyConverter |
725 | 21 | } | 21 | } |
726 | 22 | 22 | ||
727 | 23 | 23 | ||
728 | === removed file 'getting-started/CurrencyConverter/tests/unit/tst_hellocomponent.qml' | |||
729 | --- getting-started/CurrencyConverter/tests/unit/tst_hellocomponent.qml 2015-01-08 17:45:23 +0000 | |||
730 | +++ getting-started/CurrencyConverter/tests/unit/tst_hellocomponent.qml 1970-01-01 00:00:00 +0000 | |||
731 | @@ -1,50 +0,0 @@ | |||
732 | 1 | import QtQuick 2.0 | ||
733 | 2 | import QtTest 1.0 | ||
734 | 3 | import Ubuntu.Components 1.1 | ||
735 | 4 | import "../../components" | ||
736 | 5 | |||
737 | 6 | // See more details @ http://qt-project.org/doc/qt-5.0/qtquick/qml-testcase.html | ||
738 | 7 | |||
739 | 8 | // Execute tests with: | ||
740 | 9 | // qmltestrunner | ||
741 | 10 | |||
742 | 11 | Item { | ||
743 | 12 | // The objects | ||
744 | 13 | HelloComponent { | ||
745 | 14 | id: objectUnderTest | ||
746 | 15 | } | ||
747 | 16 | |||
748 | 17 | TestCase { | ||
749 | 18 | name: "HelloComponent" | ||
750 | 19 | |||
751 | 20 | function init() { | ||
752 | 21 | console.debug(">> init"); | ||
753 | 22 | compare("",objectUnderTest.text,"text was not empty on init"); | ||
754 | 23 | console.debug("<< init"); | ||
755 | 24 | } | ||
756 | 25 | |||
757 | 26 | function cleanup() { | ||
758 | 27 | console.debug(">> cleanup"); | ||
759 | 28 | console.debug("<< cleanup"); | ||
760 | 29 | } | ||
761 | 30 | |||
762 | 31 | function initTestCase() { | ||
763 | 32 | console.debug(">> initTestCase"); | ||
764 | 33 | console.debug("<< initTestCase"); | ||
765 | 34 | } | ||
766 | 35 | |||
767 | 36 | function cleanupTestCase() { | ||
768 | 37 | console.debug(">> cleanupTestCase"); | ||
769 | 38 | console.debug("<< cleanupTestCase"); | ||
770 | 39 | } | ||
771 | 40 | |||
772 | 41 | function test_canReadAndWriteText() { | ||
773 | 42 | var expected = "Hello World"; | ||
774 | 43 | |||
775 | 44 | objectUnderTest.text = expected; | ||
776 | 45 | |||
777 | 46 | compare(expected,objectUnderTest.text,"expected did not equal result"); | ||
778 | 47 | } | ||
779 | 48 | } | ||
780 | 49 | } | ||
781 | 50 |
daniel@ daydream: /tmp/ubuntu- sdk-tutorials/ getting- started/ CurrencyConvert er$ sudo apt-get install python3-autopilot autopilot- desktop[ sudo] password for daniel: daydream: /tmp/ubuntu- sdk-tutorials/ getting- started/ CurrencyConvert er$ make test /tmp/ubuntu- sdk-tutorials/ getting- started/ CurrencyConvert er/tests/ unit/tst_ convert. qml:19: 5: CurrencyConverter is not a type
CurrencyConve rter { little_ endian- lp64 shared (dynamic) release build; by GCC 4.9.2) :tst_convert: :compile( ) ubuntu- sdk-tutorials/ getting- started/ CurrencyConvert er/tests/ unit/tst_ convert. qml produced 1 error(s): ubuntu- sdk-tutorials/ getting- started/ CurrencyConvert er/tests/ unit/tst_ convert. qml:19, 5: CurrencyConverter is not a type sdk-tutorials/ getting- started/ CurrencyConvert er daniel/ .local/ share' local/share' share/gnome' share/ubuntu' ubuntu- sdk-tutorials/ getting- started/ CurrencyConvert er' lib/x86_ 64-linux- gnu/qt5/ bin' lib/x86_ 64-linux- gnu/qt5/ qml'
Reading package lists... Done
Building dependency tree
Reading state information... Done
autopilot-desktop is already the newest version.
python3-autopilot is already the newest version.
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.
daniel@
qmltestrunner -input tests/unit
file://
^
********* Start testing of qmltestrunner *********
Config: Using QtTest library 5.4.0, Qt 5.4.0 (x86_64-
QWARN : qmltestrunner:
/tmp/
/tmp/
Working directory: /tmp/ubuntu-
View: QQuickView, import paths:
'/home/
'/usr/share'
'/usr/
'/usr/
'/usr/
'/tmp/
'/usr/
'/usr/
Plugin paths:
'.'
FAIL! : qmltestrunner: :tst_convert: :compile( ) CurrencyConverter is not a type sdk-tutorials/ getting- started/ CurrencyConvert er/tests/ unit/tst_ convert. qml(19) ] daydream: /tmp/ubuntu- sdk-tutorials/ getting- started/ CurrencyConvert er$
Loc: [/tmp/ubuntu-
Totals: 0 passed, 1 failed, 0 skipped, 0 blacklisted
********* Finished testing of qmltestrunner *********
Makefile:32: recipe for target 'test' failed
make: *** [test] Error 1
daniel@