Merge lp:~nskaggs/qtcreator-plugin-ubuntu/update-qml-autopilot into lp:qtcreator-plugin-ubuntu

Proposed by Nicholas Skaggs
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
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.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
403. By Nicholas Skaggs

update wizard descriptions

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Max Brustkern (nuclearbob) wrote :

LGTM

review: Approve
Revision history for this message
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zoltan Balogh (bzoltan) wrote :

OK

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/CMakeLists.txt'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/CMakeLists.txt 2015-05-06 08:49:21 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/CMakeLists.txt 2015-05-26 21:42:21 +0000
@@ -58,15 +58,17 @@
5858
59add_custom_target("autopilot" chmod +x ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run59add_custom_target("autopilot" chmod +x ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run
60 COMMAND ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run60 COMMAND ${CMAKE_SOURCE_DIR}/app/tests/autopilot/run
61 DEPENDS %ProjectName%backend %ProjectName%backend-qmldir61 DEPENDS %ClickHookName:s%backend %ClickHookName:s%backend-qmldir
62 WORKING_DIRECTORY ./app)62 WORKING_DIRECTORY ./app)
6363
64add_custom_target("check" /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/app/tests/unit -import ${CMAKE_BINARY_DIR}/backend64add_custom_target("check"
65 DEPENDS %ProjectName%backend %ProjectName%backend-qmldir65 COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/backend/tests/unit -import ${CMAKE_BINARY_DIR}/backend
66 WORKING_DIRECTORY ./app)66 COMMAND /usr/bin/qmltestrunner -input ${CMAKE_SOURCE_DIR}/app/tests/unit -import ${CMAKE_BINARY_DIR}/backend
6767 DEPENDS %ClickHookName:s%backend %ClickHookName:s%backend-qmldir
68add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/%ProjectName%.qml68 WORKING_DIRECTORY ./app)
69 DEPENDS %ProjectName%backend %ProjectName%backend-qmldir69
70add_custom_target("run" /usr/bin/qmlscene -I ${CMAKE_BINARY_DIR}/backend ${CMAKE_SOURCE_DIR}/app/Main.qml
71 DEPENDS %ClickHookName:s%backend %ClickHookName:s%backend-qmldir
70 WORKING_DIRECTORY ./app)72 WORKING_DIRECTORY ./app)
7173
72# No op custom target for all not compiled files, so they show up in the QtCreator project tree74# No op custom target for all not compiled files, so they show up in the QtCreator project tree
7375
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/CMakeLists.txt'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/CMakeLists.txt 2015-01-15 09:48:38 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/CMakeLists.txt 2015-05-26 21:42:21 +0000
@@ -9,3 +9,10 @@
9install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DESKTOP_DIR})9install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE_NAME} DESTINATION ${DESKTOP_DIR})
10install(FILES ${QML_JS_FILES} DESTINATION ${%ProjectName:u%_DIR})10install(FILES ${QML_JS_FILES} DESTINATION ${%ProjectName:u%_DIR})
1111
12# Make the autpilot files visible in qtcreator
13file(GLOB_RECURSE AUTOPILOT_TEST_FILES *.py)
14add_custom_target(%ProjectName:l%_AutopilotFiles ALL SOURCES ${AUTOPILOT_TEST_FILES})
15
16# Make the unit test files visible in qtcreator
17file(GLOB_RECURSE UNIT_TEST_FILES tests/unit/*.qml)
18add_custom_target(%ProjectName:l%_UnitTestFiles ALL SOURCES ${UNIT_TEST_FILES})
1219
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/__init__.py 2014-02-05 22:28:56 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000
@@ -1,132 +1,41 @@
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 -*-
22"""Application autopilot helpers."""
3"""Ubuntu Touch App autopilot tests."""3
44import logging
5from os import remove5import ubuntuuitoolkit
6import os.path6
7from tempfile import mktemp7logger = logging.getLogger(__name__)
8import subprocess8
99
10from autopilot.input import Mouse, Touch, Pointer10class AppException(ubuntuuitoolkit.ToolkitException):
11from autopilot.matchers import Eventually11
12from autopilot.platform import model12 """Exception raised when there are problems with the Application."""
13from testtools.matchers import Is, Not, Equals13
14from autopilot.testcase import AutopilotTestCase14
1515class TouchApp(object):
16def get_module_include_path():16
17 return os.path.abspath(17 """Autopilot helper object for the application."""
18 os.path.join(18
19 os.path.dirname(__file__),19 def __init__(self, app_proxy, test_type):
20 '..',20 self.app = app_proxy
21 '..',21 self.test_type = test_type
22 '..',22 self.main_view = self.app.select_single(MainView)
23 '..',
24 'backend',
25 'modules')
26 )
27
28
29class UbuntuTouchAppTestCase(AutopilotTestCase):
30 """A common test case class that provides several useful methods for the tests."""
31
32 if model() == 'Desktop':
33 scenarios = [
34 ('with mouse', dict(input_device_class=Mouse))
35 ]
36 else:
37 scenarios = [
38 ('with touch', dict(input_device_class=Touch))
39 ]
4023
41 @property24 @property
42 def main_window(self):25 def pointing_device(self):
43 return MainWindow(self.app)26 return self.app.pointing_device
4427
4528
46 def setUp(self):29class MainView(ubuntuuitoolkit.MainView):
47 self.pointing_device = Pointer(self.input_device_class.create())30
48 super(UbuntuTouchAppTestCase, self).setUp()31 """A helper that makes it easy to interact with the mainview"""
49 self.launch_test_qml()32
5033 def __init__(self, *args):
5134 super(MainView, self).__init__(*args)
52 def launch_test_qml(self):35 self.visible.wait_for(True, 30)
53 # If the test class has defined a 'test_qml' class attribute then we36
54 # write it to disk and launch it inside the QML Scene. If not, then we37 def get_button(self):
55 # silently do nothing (presumably the test has something else planned).38 return self.select_single('Button', objectName="button")
56 arch = subprocess.check_output(["dpkg-architecture",39
57 "-qDEB_HOST_MULTIARCH"]).strip()40 def get_label(self):
58 if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring):41 return self.select_single('Label', objectName="label")
59 qml_path = mktemp(suffix='.qml')
60 open(qml_path, 'w').write(self.test_qml)
61 self.addCleanup(remove, qml_path)
62
63 self.app = self.launch_test_application(
64 "/usr/lib/" + arch + "/qt5/bin/qmlscene",
65 "-I", get_module_include_path(),
66 qml_path,
67 app_type='qt')
68
69 if hasattr(self, 'test_qml_file') and isinstance(self.test_qml_file, basestring):
70 qml_path = self.test_qml_file
71 self.app = self.launch_test_application(
72 "/usr/lib/" + arch + "/qt5/bin/qmlscene",
73 "-I", get_module_include_path(),
74 qml_path,
75 app_type='qt')
76
77 self.assertThat(self.get_qml_view().visible, Eventually(Equals(True)))
78
79
80 def get_qml_view(self):
81 """Get the main QML view"""
82
83 return self.app.select_single("QQuickView")
84
85 def get_mainview(self):
86 """Get the QML MainView"""
87
88 mainView = self.app.select_single("MainView")
89 self.assertThat(mainView, Not(Is(None)))
90 return mainView
91
92
93 def get_object(self,objectName):
94 """Get a object based on the objectName"""
95
96 obj = self.app.select_single(objectName=objectName)
97 self.assertThat(obj, Not(Is(None)))
98 return obj
99
100
101 def mouse_click(self,objectName):
102 """Move mouse on top of the object and click on it"""
103
104 obj = self.get_object(objectName)
105 self.pointing_device.move_to_object(obj)
106 self.pointing_device.click()
107
108
109 def mouse_press(self,objectName):
110 """Move mouse on top of the object and press mouse button (without releasing it)"""
111
112 obj = self.get_object(objectName)
113 self.pointing_device.move_to_object(obj)
114 self.pointing_device.press()
115
116
117 def mouse_release(self):
118 """Release mouse button"""
119
120 self.pointing_device.release()
121
122
123 def type_string(self, string):
124 """Type a string with keyboard"""
125
126 self.keyboard.type(string)
127
128
129 def type_key(self, key):
130 """Type a single key with keyboard"""
131
132 self.keyboard.key(key)
133\ No newline at end of file42\ No newline at end of file
13443
=== 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'
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/__init__.py 2015-01-17 04:53:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000
@@ -1,1 +1,54 @@
1""" A Main.qml test suite """1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Ubuntu Touch App Autopilot tests."""
3
4import os
5import logging
6
7import %ProjectName%
8
9from autopilot.testcase import AutopilotTestCase
10from autopilot import logging as autopilot_logging
11
12import ubuntuuitoolkit
13from ubuntuuitoolkit import base
14
15logger = logging.getLogger(__name__)
16
17
18class BaseTestCase(AutopilotTestCase):
19
20 """A common test case class
21
22 """
23
24 local_location = os.path.dirname(os.path.dirname(os.getcwd()))
25 local_location_qml = os.path.join(local_location, 'Main.qml')
26 click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%')
27
28 def setUp(self):
29 super(BaseTestCase, self).setUp()
30 self.launcher, self.test_type = self.get_launcher_and_type()
31 self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type)
32
33 def get_launcher_and_type(self):
34 if os.path.exists(self.local_location_qml):
35 launcher = self.launch_test_local
36 test_type = 'local'
37 else:
38 launcher = self.launch_test_click
39 test_type = 'click'
40 return launcher, test_type
41
42 @autopilot_logging.log_action(logger.info)
43 def launch_test_local(self):
44 return self.launch_test_application(
45 base.get_qmlscene_launch_command(),
46 self.local_location_qml,
47 app_type='qt',
48 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
49
50 @autopilot_logging.log_action(logger.info)
51 def launch_test_click(self):
52 return self.launch_click_package(
53 self.click_package,
54 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
2\ No newline at end of file55\ No newline at end of file
356
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/test_main.py'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/test_main.py 2015-05-06 08:49:21 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000
@@ -1,23 +1,21 @@
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 -*-
22
3"""Tests for the Hello World"""
4
5from autopilot.matchers import Eventually3from autopilot.matchers import Eventually
6from textwrap import dedent4from testtools.matchers import Equals
7from testtools.matchers import Is, Not, Equals5from %ProjectName% import tests
8from testtools import skip6
9import os7
10from %ProjectName% import UbuntuTouchAppTestCase8class MainViewTestCase(tests.BaseTestCase):
119 """Tests for the mainview"""
1210
13class MainTests(UbuntuTouchAppTestCase):11 def setUp(self):
14 """Generic tests for the Hello World"""12 super(MainViewTestCase, self).setUp()
1513
16 test_qml_file = "%s/%s/Main.qml" % (os.path.dirname(os.path.realpath(__file__)),"../../../..")14 def test_click_button(self):
1715 # Find and click the button
18 def test_0_can_select_mainView(self):16 button = self.app.main_view.get_button()
19 """Must be able to select the mainview."""17 self.app.pointing_device.click_object(button)
2018
21 mainView = self.get_mainview()19 # Make an assertion about what should happen
22 self.assertThat(mainView.visible,Eventually(Equals(True)))20 label = self.app.main_view.get_label()
2321 self.assertThat(label.text, Eventually(Equals('..world!')))
24\ No newline at end of file22\ No newline at end of file
2523
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/run'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/run 2014-06-30 15:20:18 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/run 2015-05-26 21:42:21 +0000
@@ -1,11 +1,11 @@
1#!/bin/bash1#!/bin/bash
22
3if [[ -z `which autopilot` ]]; then3if [[ -z `which autopilot3` ]]; then
4 echo "Autopilot is not installed. Skip"4 echo "python3-autopilot is not installed. Skip"
5 exit5 exit
6fi6fi
77
8SCRIPTPATH=`dirname $0`8SCRIPTPATH=`dirname $0`
9pushd ${SCRIPTPATH}9pushd ${SCRIPTPATH}
10autopilot run %ProjectName%10autopilot3 run %ProjectName%
11popd11popd
12\ No newline at end of file12\ No newline at end of file
1313
=== added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit'
=== added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit/tst_main.qml'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1import QtQuick 2.0
2import QtTest 1.0
3import Ubuntu.Test 1.0
4import "../../"
5// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase
6
7// Execute these tests with:
8// qmltestrunner
9
10Item {
11
12 width: units.gu(100)
13 height: units.gu(75)
14
15 // The objects
16 Main {
17 id: main
18 }
19
20 UbuntuTestCase {
21 name: "MainTestCase"
22
23 when: windowShown
24
25
26 function init() {
27 var label = findChild(main, "label");
28 // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method
29 compare("Hello world..", label.text);
30 }
31
32 function test_clickButtonMustChangeLabel() {
33 var button = findChild(main, "button");
34 var buttonCenter = centerOf(button)
35 mouseClick(button, buttonCenter.x, buttonCenter.y);
36 var label = findChild(main, "label");
37 // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method
38 tryCompare(label, "text", "..from Cpp Backend", 1);
39 }
40 }
41}
042
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/backend/CMakeLists.txt'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/backend/CMakeLists.txt 2014-07-10 15:35:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/backend/CMakeLists.txt 2015-05-26 21:42:21 +0000
@@ -8,6 +8,9 @@
8 modules/%ClickHookName:s%/mytype.cpp8 modules/%ClickHookName:s%/mytype.cpp
9)9)
1010
11# Make the unit test files visible on qtcreator
12add_custom_target(%ClickHookName:s%backend_UNITTEST_QML_FILES ALL SOURCES "tests/unit/tst_mytype.qml")
13
11add_library(%ClickHookName:s%backend MODULE14add_library(%ClickHookName:s%backend MODULE
12 ${%ClickHookName:s%backend_SRCS}15 ${%ClickHookName:s%backend_SRCS}
13)16)
1417
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/wizard.xml 2015-05-06 08:49:21 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/wizard.xml 2015-05-26 21:42:21 +0000
@@ -1,73 +1,74 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="A4_UbuntuAppWBackendPlusTabsCMake'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="A4_UbuntuAppWBackendPlusTabsCMake'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-cmake"4 class="ubuntu-project-cmake"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
8 <description>A simple C++ based QtQuick2 Extension Library with8 <description>A simple C++ based QtQuick2 Extension Library with
9simple UI written in QML.9simple UI written in QML.
1010
11Includes also11Also includes:
12 - a unit test for C++12 - a unit test for C++
13 - unit and functional tests for QML13 - unit and functional tests for QML
14</description>14</description>
15 <displayname>QML App with C++ plugin (cmake)</displayname>15 <displayname>QML App with C++ plugin (cmake)</displayname>
16 <displaycategory>Ubuntu</displaycategory>16 <displaycategory>Ubuntu</displaycategory>
17 <files>17 <files>
18 <file source="CMakeLists.txt" target="CMakeLists.txt" openproject="true"/>18 <file source="CMakeLists.txt" target="CMakeLists.txt" openproject="true"/>
19 <file source="backend/CMakeLists.txt" target="backend/CMakeLists.txt" openeditor="false"/>19 <file source="backend/CMakeLists.txt" target="backend/CMakeLists.txt" openeditor="false"/>
20 <file source="backend/modules/displayName/backend.h" target="backend/modules/%ClickHookName:s%/backend.h" openeditor="false"/>20 <file source="backend/modules/displayName/backend.h" target="backend/modules/%ClickHookName:s%/backend.h" openeditor="false"/>
21 <file source="backend/modules/displayName/backend.cpp" target="backend/modules/%ClickHookName:s%/backend.cpp" openeditor="false"/>21 <file source="backend/modules/displayName/backend.cpp" target="backend/modules/%ClickHookName:s%/backend.cpp" openeditor="false"/>
22 <file source="backend/modules/displayName/mytype.h" target="backend/modules/%ClickHookName:s%/mytype.h" openeditor="false"/>22 <file source="backend/modules/displayName/mytype.h" target="backend/modules/%ClickHookName:s%/mytype.h" openeditor="false"/>
23 <file source="backend/modules/displayName/mytype.cpp" target="backend/modules/%ClickHookName:s%/mytype.cpp" openeditor="false"/>23 <file source="backend/modules/displayName/mytype.cpp" target="backend/modules/%ClickHookName:s%/mytype.cpp" openeditor="false"/>
24 <file source="backend/modules/displayName/qmldir" target="backend/modules/%ClickHookName:s%/qmldir" openeditor="false"/>24 <file source="backend/modules/displayName/qmldir" target="backend/modules/%ClickHookName:s%/qmldir" openeditor="false"/>
25 <file source="backend/tests/unit/tst_mytype.qml" target="backend/tests/unit/tst_mytype.qml" openeditor="false"/>25 <file source="backend/tests/unit/tst_mytype.qml" target="backend/tests/unit/tst_mytype.qml" openeditor="false"/>
26 <file source="app/graphics/toolbarIcon@8.png" target="app/graphics/toolbarIcon@8.png" openeditor="false" binary="true"/>26 <file source="app/graphics/toolbarIcon@8.png" target="app/graphics/toolbarIcon@8.png" openeditor="false" binary="true"/>
27 <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/>27 <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/>
28 <file source="app/graphics/displayName.png" target="app/graphics/%ProjectName%.png" openeditor="false" binary="true"/>28 <file source="app/graphics/displayName.png" target="app/graphics/%ProjectName%.png" openeditor="false" binary="true"/>
29 <file source="app/CMakeLists.txt" target="app/CMakeLists.txt" openeditor="false"/>29 <file source="app/CMakeLists.txt" target="app/CMakeLists.txt" openeditor="false"/>
30 <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/>30 <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/>
31 <file source="app/tests/autopilot/displayName/main/test_main.py" target="app/tests/autopilot/%ProjectName%/main/test_main.py" openeditor="false"/>31 <file source="app/tests/autopilot/displayName/tests/test_main.py" target="app/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/>
32 <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>32 <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>
33 <file source="app/tests/autopilot/displayName/main/__init__.py" target="app/tests/autopilot/%ProjectName%/main/__init__.py" openeditor="false"/>33 <file source="app/tests/autopilot/displayName/tests/__init__.py" target="app/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/>
34 <file source="cmake/Click.cmake" target="cmake/Click.cmake" openeditor="false"/>34 <file source="app/tests/unit/tst_main.qml" target="app/tests/unit/tst_main.qml" openeditor="false"/>
35 <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/>35 <file source="cmake/Click.cmake" target="cmake/Click.cmake" openeditor="false"/>
36 <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/>36 <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/>
37 <file source="app/Main.qml" target="app/Main.qml" openeditor="true"/>37 <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/>
38 <file source="po/CMakeLists.txt" target="po/CMakeLists.txt" openeditor="false"/>38 <file source="app/Main.qml" target="app/Main.qml" openeditor="true"/>
39 <file source="po/CMakeLists.txt" target="po/CMakeLists.txt" openeditor="false"/>
39 </files>40 </files>
4041
41 <!-- Create a 2nd wizard page with click package parameters -->42 <!-- Create a 2nd wizard page with click package parameters -->
42 <fieldpagetitle>Click package parameters</fieldpagetitle>43 <fieldpagetitle>Click package parameters</fieldpagetitle>
43 <fields>44 <fields>
44 <field mandatory="true" name="ClickDomain">45 <field mandatory="true" name="ClickDomain">
45 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'46 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
46 defaulttext="" placeholdertext="Nickname"/>47 defaulttext="" placeholdertext="Nickname"/>
47 <fielddescription>Nickname:</fielddescription>48 <fielddescription>Nickname:</fielddescription>
48 </field>49 </field>
49 <field mandatory="true" name="ClickMaintainer">50 <field mandatory="true" name="ClickMaintainer">
50 <fieldcontrol class="QLineEdit" validator='^[^"]+$'51 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
51 defaulttext="" placeholdertext="Maintainer"/>52 defaulttext="" placeholdertext="Maintainer"/>
52 <fielddescription>Maintainer:</fielddescription>53 <fielddescription>Maintainer:</fielddescription>
53 </field>54 </field>
54 <field mandatory="true" name="ClickHookName">55 <field mandatory="true" name="ClickHookName">
55 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'56 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
56 defaulttext="myapp" placeholdertext="app hook name"/>57 defaulttext="myapp" placeholdertext="app hook name"/>
57 <fielddescription>App name:</fielddescription>58 <fielddescription>App name:</fielddescription>
58 </field>59 </field>
59 <field name="ClickFrameworkVersion">60 <field name="ClickFrameworkVersion">
60 <fieldcontrol class="QComboBox" defaultindex="0">61 <fieldcontrol class="QComboBox" defaultindex="0">
61 <comboentries>62 <comboentries>
62 <!-- 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 -->63 <!-- 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 -->
63 <comboentry value="ubuntu-sdk-dummy-framework">64 <comboentry value="ubuntu-sdk-dummy-framework">
64 <comboentrytext>Dummy Framework</comboentrytext>65 <comboentrytext>Dummy Framework</comboentrytext>
65 </comboentry>66 </comboentry>
66 </comboentries>67 </comboentries>
67 </fieldcontrol>68 </fieldcontrol>
68 <fielddescription>Framework:</fielddescription>69 <fielddescription>Framework:</fielddescription>
69 </field>70 </field>
70 </fields>71 </fields>
71 <validationrules>72 <validationrules>
72 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>73 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>
73 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>74 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>
7475
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro 2015-01-16 10:50:52 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.pro 2015-05-26 21:42:21 +0000
@@ -4,14 +4,18 @@
4RESOURCES += %ClickHookName%.qrc4RESOURCES += %ClickHookName%.qrc
55
6QML_FILES += $$files(*.qml,true) \6QML_FILES += $$files(*.qml,true) \
7 $$files(*.js,true)7 $$files(*.js,true)
88
9CONF_FILES += %ClickHookName%.apparmor \9CONF_FILES += %ClickHookName%.apparmor \
10 %ClickHookName%.desktop \10 %ClickHookName%.desktop \
11 %ClickHookName%.png11 %ClickHookName%.png
1212
13AP_TEST_FILES += tests/autopilot/run \
14 $$files(tests/*.py,true)
15
13OTHER_FILES += $${CONF_FILES} \16OTHER_FILES += $${CONF_FILES} \
14 $${QML_FILES}17 $${QML_FILES} \
18 $${AP_TEST_FILES}
1519
16#specify where the qml/js files are installed to20#specify where the qml/js files are installed to
17qml_files.path = /%ClickHookName%21qml_files.path = /%ClickHookName%
1822
=== added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests'
=== added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot'
=== added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName'
=== added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/__init__.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Application autopilot helpers."""
3
4import logging
5import ubuntuuitoolkit
6
7logger = logging.getLogger(__name__)
8
9
10class AppException(ubuntuuitoolkit.ToolkitException):
11
12 """Exception raised when there are problems with the Application."""
13
14
15class TouchApp(object):
16
17 """Autopilot helper object for the application."""
18
19 def __init__(self, app_proxy, test_type):
20 self.app = app_proxy
21 self.test_type = test_type
22 self.main_view = self.app.select_single(MainView)
23
24 @property
25 def pointing_device(self):
26 return self.app.pointing_device
27
28
29class MainView(ubuntuuitoolkit.MainView):
30
31 """A helper that makes it easy to interact with the mainview"""
32
33 def __init__(self, *args):
34 super(MainView, self).__init__(*args)
35 self.visible.wait_for(True, 30)
36
37 def get_button(self):
38 return self.select_single('Button', objectName="button")
39
40 def get_label(self):
41 return self.select_single('Label', objectName="label")
0\ No newline at end of file42\ No newline at end of file
143
=== added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests'
=== added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,54 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Ubuntu Touch App Autopilot tests."""
3
4import os
5import logging
6
7import %ProjectName%
8
9from autopilot.testcase import AutopilotTestCase
10from autopilot import logging as autopilot_logging
11
12import ubuntuuitoolkit
13from ubuntuuitoolkit import base
14
15logger = logging.getLogger(__name__)
16
17
18class BaseTestCase(AutopilotTestCase):
19
20 """A common test case class
21
22 """
23
24 local_location = os.path.dirname(os.path.dirname(os.getcwd()))
25 local_location_qml = os.path.join(local_location, 'Main.qml')
26 click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%')
27
28 def setUp(self):
29 super(BaseTestCase, self).setUp()
30 self.launcher, self.test_type = self.get_launcher_and_type()
31 self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type)
32
33 def get_launcher_and_type(self):
34 if os.path.exists(self.local_location_qml):
35 launcher = self.launch_test_local
36 test_type = 'local'
37 else:
38 launcher = self.launch_test_click
39 test_type = 'click'
40 return launcher, test_type
41
42 @autopilot_logging.log_action(logger.info)
43 def launch_test_local(self):
44 return self.launch_test_application(
45 base.get_qmlscene_launch_command(),
46 self.local_location_qml,
47 app_type='qt',
48 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
49
50 @autopilot_logging.log_action(logger.info)
51 def launch_test_click(self):
52 return self.launch_click_package(
53 self.click_package,
54 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
0\ No newline at end of file55\ No newline at end of file
156
=== added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,21 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3from autopilot.matchers import Eventually
4from testtools.matchers import Equals
5from %ProjectName% import tests
6
7
8class MainViewTestCase(tests.BaseTestCase):
9 """Tests for the mainview"""
10
11 def setUp(self):
12 super(MainViewTestCase, self).setUp()
13
14 def test_click_button(self):
15 # Find and click the button
16 button = self.app.main_view.get_button()
17 self.app.pointing_device.click_object(button)
18
19 # Make an assertion about what should happen
20 label = self.app.main_view.get_label()
21 self.assertThat(label.text, Eventually(Equals('..world!')))
0\ No newline at end of file22\ No newline at end of file
123
=== added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/run'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/run 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/autopilot/run 2015-05-26 21:42:21 +0000
@@ -0,0 +1,11 @@
1#!/bin/bash
2
3if [[ -z `which autopilot3` ]]; then
4 echo "python3-autopilot is not installed. Skip"
5 exit
6fi
7
8SCRIPTPATH=`dirname $0`
9pushd ${SCRIPTPATH}
10autopilot3 run %ProjectName%
11popd
0\ No newline at end of file12\ No newline at end of file
113
=== added directory 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit'
=== added file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit/tst_main.qml'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1import QtQuick 2.0
2import QtTest 1.0
3import Ubuntu.Test 1.0
4import "../../"
5// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase
6
7// Execute these tests with:
8// qmltestrunner
9
10Item {
11
12 width: units.gu(100)
13 height: units.gu(75)
14
15 // The objects
16 Main {
17 id: main
18 }
19
20 UbuntuTestCase {
21 name: "MainTestCase"
22
23 when: windowShown
24
25
26 function init() {
27 var label = findChild(main, "label");
28 // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method
29 compare("Hello world..", label.text);
30 }
31
32 function test_clickButtonMustChangeLabel() {
33 var button = findChild(main, "button");
34 var buttonCenter = centerOf(button)
35 mouseClick(button, buttonCenter.x, buttonCenter.y);
36 var label = findChild(main, "label");
37 // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method
38 tryCompare(label, "text", "..from Cpp Backend", 1);
39 }
40 }
41}
042
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro 2015-01-16 10:50:52 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/projectName.pro 2015-05-26 21:42:21 +0000
@@ -31,4 +31,14 @@
31# compiled and installed into the right place in the click package31# compiled and installed into the right place in the click package
32UBUNTU_PO_FILES+=$$files(po/*.po)32UBUNTU_PO_FILES+=$$files(po/*.po)
3333
34aptest.target = autopilot
35aptest.commands = QML2_IMPORT_PATH=$$OUT_PWD/backend bash $$PWD/app/tests/autopilot/run
36aptest.depends = sub-app sub-backend-App
37
38unittest.target = check
39unittest.commands = /usr/bin/qmltestrunner -input $$PWD/backend/tests/unit -import $$OUT_PWD/backend
40unittest.commands += && /usr/bin/qmltestrunner -input $$PWD/app/tests/unit -import $$OUT_PWD/backend
41unittest.depends = sub-app sub-backend-App
42
43QMAKE_EXTRA_TARGETS += aptest unittest
3444
3545
=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml 2015-02-04 17:42:14 +0000
+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml 2015-05-26 21:42:21 +0000
@@ -1,14 +1,14 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="A4_UbuntuAppBackendQmake'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="A4_UbuntuAppBackendQmake'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-qmake"4 class="ubuntu-project-qmake"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
8 <description>A simple C++ based QtQuick2 Extension Library with8 <description>A simple C++ based QtQuick2 Extension Library with
9simple UI written in QML.9simple UI written in QML.
1010
11Includes also11Also includes:
12 - a unit test for C++12 - a unit test for C++
13 - unit and functional tests for QML13 - unit and functional tests for QML
1414
@@ -21,11 +21,16 @@
21<!-- MANIFEST PARTS -->21<!-- MANIFEST PARTS -->
22 <file source="manifest.json.in" openeditor="true"/>22 <file source="manifest.json.in" openeditor="true"/>
23<!-- APP PARTS -->23<!-- APP PARTS -->
24 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>24 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>
25 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>25 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>
26 <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>26 <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>
27 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>27 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>
28 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>28 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>
29 <file source="appName/tests/autopilot/run" target="%ClickHookName%/tests/autopilot/run" openeditor="false"/>
30 <file source="appName/tests/autopilot/displayName/tests/test_main.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/>
31 <file source="appName/tests/autopilot/displayName/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>
32 <file source="appName/tests/autopilot/displayName/tests/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/>
33 <file source="appName/tests/unit/tst_main.qml" target="%ClickHookName%/tests/unit/tst_main.qml" openeditor="false"/>
29 <file source="backend/displayName/backend.h" target="backend/%ClickHookName:s%/backend.h" openeditor="false"/>34 <file source="backend/displayName/backend.h" target="backend/%ClickHookName:s%/backend.h" openeditor="false"/>
30 <file source="backend/displayName/backend.cpp" target="backend/%ClickHookName:s%/backend.cpp" openeditor="false"/>35 <file source="backend/displayName/backend.cpp" target="backend/%ClickHookName:s%/backend.cpp" openeditor="false"/>
31 <file source="backend/displayName/mytype.h" target="backend/%ClickHookName:s%/mytype.h" openeditor="false"/>36 <file source="backend/displayName/mytype.h" target="backend/%ClickHookName:s%/mytype.h" openeditor="false"/>
@@ -35,36 +40,36 @@
35 <file source="backend/tests/unit/tst_mytype.qml" target="backend/tests/unit/tst_mytype.qml" openeditor="false"/>40 <file source="backend/tests/unit/tst_mytype.qml" target="backend/tests/unit/tst_mytype.qml" openeditor="false"/>
36 </files>41 </files>
3742
38 <!-- Create a 2nd wizard page with click package parameters -->43 <!-- Create a 2nd wizard page with click package parameters -->
39 <fieldpagetitle>Click package parameters</fieldpagetitle>44 <fieldpagetitle>Click package parameters</fieldpagetitle>
40 <fields>45 <fields>
41 <field mandatory="true" name="ClickDomain">46 <field mandatory="true" name="ClickDomain">
42 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'47 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
43 defaulttext="" placeholdertext="Nickname"/>48 defaulttext="" placeholdertext="Nickname"/>
44 <fielddescription>Nickname:</fielddescription>49 <fielddescription>Nickname:</fielddescription>
45 </field>50 </field>
46 <field mandatory="true" name="ClickMaintainer">51 <field mandatory="true" name="ClickMaintainer">
47 <fieldcontrol class="QLineEdit" validator='^[^"]+$'52 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
48 defaulttext="" placeholdertext="Maintainer"/>53 defaulttext="" placeholdertext="Maintainer"/>
49 <fielddescription>Maintainer:</fielddescription>54 <fielddescription>Maintainer:</fielddescription>
50 </field>55 </field>
51 <field mandatory="true" name="ClickHookName">56 <field mandatory="true" name="ClickHookName">
52 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'57 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
53 defaulttext="app" placeholdertext="app hook name"/>58 defaulttext="app" placeholdertext="app hook name"/>
54 <fielddescription>App name:</fielddescription>59 <fielddescription>App name:</fielddescription>
55 </field>60 </field>
56 <field name="ClickFrameworkVersion">61 <field name="ClickFrameworkVersion">
57 <fieldcontrol class="QComboBox" defaultindex="0">62 <fieldcontrol class="QComboBox" defaultindex="0">
58 <comboentries>63 <comboentries>
59 <!-- 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 -->64 <!-- 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 -->
60 <comboentry value="ubuntu-sdk-dummy-framework">65 <comboentry value="ubuntu-sdk-dummy-framework">
61 <comboentrytext>Dummy Framework</comboentrytext>66 <comboentrytext>Dummy Framework</comboentrytext>
62 </comboentry>67 </comboentry>
63 </comboentries>68 </comboentries>
64 </fieldcontrol>69 </fieldcontrol>
65 <fielddescription>Framework:</fielddescription>70 <fielddescription>Framework:</fielddescription>
66 </field>71 </field>
67 </fields>72 </fields>
68 <validationrules>73 <validationrules>
69 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>74 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>
70 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>75 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>
7176
=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro 2015-01-12 09:34:07 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.pro 2015-05-26 21:42:21 +0000
@@ -9,14 +9,24 @@
99
10RESOURCES += %ClickHookName%.qrc10RESOURCES += %ClickHookName%.qrc
1111
12OTHER_FILES += %ClickHookName%.apparmor \12QML_FILES += $$files(*.qml,true) \
13 $$files(*.js,true)
14
15CONF_FILES += %ClickHookName%.apparmor \
13 %ClickHookName%.desktop \16 %ClickHookName%.desktop \
14 %ClickHookName%.png17 %ClickHookName%.png
1518
19AP_TEST_FILES += tests/autopilot/run \
20 $$files(tests/*.py,true)
21
22#show all the files in QtCreator
23OTHER_FILES += $${CONF_FILES} \
24 $${QML_FILES} \
25 $${AP_TEST_FILES}
26
16#specify where the config files are installed to27#specify where the config files are installed to
17config_files.path = /%ClickHookName%28config_files.path = /%ClickHookName%
18config_files.files += $${OTHER_FILES}29config_files.files += $${CONF_FILES}
19message($$config_files.files)
20INSTALLS+=config_files30INSTALLS+=config_files
2131
22# Default rules for deployment.32# Default rules for deployment.
2333
=== added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests'
=== added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot'
=== added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName'
=== added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/__init__.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Application autopilot helpers."""
3
4import logging
5import ubuntuuitoolkit
6
7logger = logging.getLogger(__name__)
8
9
10class AppException(ubuntuuitoolkit.ToolkitException):
11
12 """Exception raised when there are problems with the Application."""
13
14
15class TouchApp(object):
16
17 """Autopilot helper object for the application."""
18
19 def __init__(self, app_proxy, test_type):
20 self.app = app_proxy
21 self.test_type = test_type
22 self.main_view = self.app.select_single(MainView)
23
24 @property
25 def pointing_device(self):
26 return self.app.pointing_device
27
28
29class MainView(ubuntuuitoolkit.MainView):
30
31 """A helper that makes it easy to interact with the mainview"""
32
33 def __init__(self, *args):
34 super(MainView, self).__init__(*args)
35 self.visible.wait_for(True, 30)
36
37 def get_button(self):
38 return self.select_single('Button', objectName="button")
39
40 def get_label(self):
41 return self.select_single('Label', objectName="label")
0\ No newline at end of file42\ No newline at end of file
143
=== added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests'
=== added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,54 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Ubuntu Touch App Autopilot tests."""
3
4import os
5import logging
6
7import %ProjectName%
8
9from autopilot.testcase import AutopilotTestCase
10from autopilot import logging as autopilot_logging
11
12import ubuntuuitoolkit
13from ubuntuuitoolkit import base
14
15logger = logging.getLogger(__name__)
16
17
18class BaseTestCase(AutopilotTestCase):
19
20 """A common test case class
21
22 """
23
24 local_location = os.path.dirname(os.path.dirname(os.getcwd()))
25 local_location_qml = os.path.join(local_location, 'Main.qml')
26 click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%')
27
28 def setUp(self):
29 super(BaseTestCase, self).setUp()
30 self.launcher, self.test_type = self.get_launcher_and_type()
31 self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type)
32
33 def get_launcher_and_type(self):
34 if os.path.exists(self.local_location_qml):
35 launcher = self.launch_test_local
36 test_type = 'local'
37 else:
38 launcher = self.launch_test_click
39 test_type = 'click'
40 return launcher, test_type
41
42 @autopilot_logging.log_action(logger.info)
43 def launch_test_local(self):
44 return self.launch_test_application(
45 base.get_qmlscene_launch_command(),
46 self.local_location_qml,
47 app_type='qt',
48 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
49
50 @autopilot_logging.log_action(logger.info)
51 def launch_test_click(self):
52 return self.launch_click_package(
53 self.click_package,
54 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
0\ No newline at end of file55\ No newline at end of file
156
=== added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,21 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3from autopilot.matchers import Eventually
4from testtools.matchers import Equals
5from %ProjectName% import tests
6
7
8class MainViewTestCase(tests.BaseTestCase):
9 """Tests for the mainview"""
10
11 def setUp(self):
12 super(MainViewTestCase, self).setUp()
13
14 def test_click_button(self):
15 # Find and click the button
16 button = self.app.main_view.get_button()
17 self.app.pointing_device.click_object(button)
18
19 # Make an assertion about what should happen
20 label = self.app.main_view.get_label()
21 self.assertThat(label.text, Eventually(Equals('..world!')))
0\ No newline at end of file22\ No newline at end of file
123
=== added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/run'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/run 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/autopilot/run 2015-05-26 21:42:21 +0000
@@ -0,0 +1,11 @@
1#!/bin/bash
2
3if [[ -z `which autopilot3` ]]; then
4 echo "python3-autopilot is not installed. Skip"
5 exit
6fi
7
8SCRIPTPATH=`dirname $0`
9pushd ${SCRIPTPATH}
10autopilot3 run %ProjectName%
11popd
0\ No newline at end of file12\ No newline at end of file
113
=== added directory 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit'
=== added file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit/tst_main.qml'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1import QtQuick 2.0
2import QtTest 1.0
3import Ubuntu.Test 1.0
4import "../../"
5// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase
6
7// Execute these tests with:
8// qmltestrunner
9
10Item {
11
12 width: units.gu(100)
13 height: units.gu(75)
14
15 // The objects
16 Main {
17 id: main
18 }
19
20 UbuntuTestCase {
21 name: "MainTestCase"
22
23 when: windowShown
24
25
26 function init() {
27 var label = findChild(main, "label");
28 // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method
29 compare("Hello..", label.text);
30 }
31
32 function test_clickButtonMustChangeLabel() {
33 var button = findChild(main, "button");
34 var buttonCenter = centerOf(button)
35 mouseClick(button, buttonCenter.x, buttonCenter.y);
36 var label = findChild(main, "label");
37 // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method
38 tryCompare(label, "text", "..world!", 1);
39 }
40 }
41}
042
=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro 2015-01-12 09:34:07 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/projectName.pro 2015-05-26 21:42:21 +0000
@@ -28,4 +28,13 @@
28# compiled and installed into the right place in the click package28# compiled and installed into the right place in the click package
29UBUNTU_PO_FILES+=$$files(po/*.po)29UBUNTU_PO_FILES+=$$files(po/*.po)
3030
31aptest.target = autopilot
32aptest.commands = bash $$PWD/app/tests/autopilot/run
33aptest.depends = sub-app
34
35unittest.target = check
36unittest.commands = /usr/bin/qmltestrunner -input $$PWD/app/tests/unit
37unittest.depends = sub-app
38
39QMAKE_EXTRA_TARGETS += aptest unittest
3140
3241
=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml 2015-02-04 17:42:14 +0000
+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml 2015-05-26 21:42:21 +0000
@@ -1,60 +1,68 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="B_UbuntuAppSimpleQmake" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="B_UbuntuAppSimpleQmake" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-qmake"4 class="ubuntu-project-qmake"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
8 <description>Creates a C++ Ubuntu application project with a sample UI containing a Label and a Button.8 <description>Creates a C++ Ubuntu application project with a sample UI containing a Label and a Button.
99
10Also includes:
11 - unit and functional tests for QML
12
10This templates requires a Kit using at least a 15.04 click chroot.13This templates requires a Kit using at least a 15.04 click chroot.
11</description>14</description>
12 <displayname>QtQuick App with QML UI (qmake)</displayname>15 <displayname>QtQuick App with QML UI (qmake)</displayname>
13 <displaycategory>Ubuntu</displaycategory>16 <displaycategory>Ubuntu</displaycategory>
14 <files>17 <files>
15 <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/>18 <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/>
16<!-- MANIFEST PARTS -->19<!-- MANIFEST PARTS -->
17 <file source="manifest.json.in" openeditor="true"/>20 <file source="manifest.json.in" openeditor="true"/>
18<!-- APP PARTS -->21<!-- APP PARTS -->
19 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>22 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>
20 <file source="appName/appName.qrc" target="%ClickHookName%/%ClickHookName%.qrc" openeditor="false"/>23 <file source="appName/appName.qrc" target="%ClickHookName%/%ClickHookName%.qrc" openeditor="false"/>
21 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>24 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>
22 <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>25 <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>
23 <file source="appName/main.cpp" target="%ClickHookName%/main.cpp" openeditor="true"/>26 <file source="appName/main.cpp" target="%ClickHookName%/main.cpp" openeditor="true"/>
24 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>27 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>
25 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>28 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>
29 <file source="appName/tests/autopilot/run" target="%ClickHookName%/tests/autopilot/run" openeditor="false"/>
30 <file source="appName/tests/autopilot/displayName/tests/test_main.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/>
31 <file source="appName/tests/autopilot/displayName/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>
32 <file source="appName/tests/autopilot/displayName/tests/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/>
33 <file source="appName/tests/unit/tst_main.qml" target="%ClickHookName%/tests/unit/tst_main.qml" openeditor="false"/>
26 </files>34 </files>
2735
28 <!-- Create a 2nd wizard page with click package parameters -->36 <!-- Create a 2nd wizard page with click package parameters -->
29 <fieldpagetitle>Click package parameters</fieldpagetitle>37 <fieldpagetitle>Click package parameters</fieldpagetitle>
30 <fields>38 <fields>
31 <field mandatory="true" name="ClickDomain">39 <field mandatory="true" name="ClickDomain">
32 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'40 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
33 defaulttext="" placeholdertext="Nickname"/>41 defaulttext="" placeholdertext="Nickname"/>
34 <fielddescription>Nickname:</fielddescription>42 <fielddescription>Nickname:</fielddescription>
35 </field>43 </field>
36 <field mandatory="true" name="ClickMaintainer">44 <field mandatory="true" name="ClickMaintainer">
37 <fieldcontrol class="QLineEdit" validator='^[^"]+$'45 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
38 defaulttext="" placeholdertext="Maintainer"/>46 defaulttext="" placeholdertext="Maintainer"/>
39 <fielddescription>Maintainer:</fielddescription>47 <fielddescription>Maintainer:</fielddescription>
40 </field>48 </field>
41 <field mandatory="true" name="ClickHookName">49 <field mandatory="true" name="ClickHookName">
42 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'50 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
43 defaulttext="app" placeholdertext="app hook name"/>51 defaulttext="app" placeholdertext="app hook name"/>
44 <fielddescription>App name:</fielddescription>52 <fielddescription>App name:</fielddescription>
45 </field>53 </field>
46 <field name="ClickFrameworkVersion">54 <field name="ClickFrameworkVersion">
47 <fieldcontrol class="QComboBox" defaultindex="0">55 <fieldcontrol class="QComboBox" defaultindex="0">
48 <comboentries>56 <comboentries>
49 <!-- 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 -->57 <!-- 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 -->
50 <comboentry value="ubuntu-sdk-dummy-framework">58 <comboentry value="ubuntu-sdk-dummy-framework">
51 <comboentrytext>Dummy Framework</comboentrytext>59 <comboentrytext>Dummy Framework</comboentrytext>
52 </comboentry>60 </comboentry>
53 </comboentries>61 </comboentries>
54 </fieldcontrol>62 </fieldcontrol>
55 <fielddescription>Framework:</fielddescription>63 <fielddescription>Framework:</fielddescription>
56 </field>64 </field>
57 </fields>65 </fields>
58 <validationrules>66 <validationrules>
59 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>67 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>
60 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>68 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>
6169
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro 2015-01-15 12:51:26 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.pro 2015-05-26 21:42:21 +0000
@@ -4,14 +4,18 @@
4RESOURCES += %ClickHookName%.qrc4RESOURCES += %ClickHookName%.qrc
55
6QML_FILES += $$files(*.qml,true) \6QML_FILES += $$files(*.qml,true) \
7 $$files(*.js,true)7 $$files(*.js,true)
88
9CONF_FILES += %ClickHookName%.apparmor \9CONF_FILES += %ClickHookName%.apparmor \
10 %ClickHookName%.desktop \10 %ClickHookName%.desktop \
11 %ClickHookName%.png11 %ClickHookName%.png
1212
13AP_TEST_FILES += tests/autopilot/run \
14 $$files(tests/*.py,true)
15
13OTHER_FILES += $${CONF_FILES} \16OTHER_FILES += $${CONF_FILES} \
14 $${QML_FILES}17 $${QML_FILES} \
18 $${AP_TEST_FILES}
1519
16#specify where the qml/js files are installed to20#specify where the qml/js files are installed to
17qml_files.path = /%ClickHookName%21qml_files.path = /%ClickHookName%
1822
=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests'
=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot'
=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName'
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/__init__.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Application autopilot helpers."""
3
4import logging
5import ubuntuuitoolkit
6
7logger = logging.getLogger(__name__)
8
9
10class AppException(ubuntuuitoolkit.ToolkitException):
11
12 """Exception raised when there are problems with the Application."""
13
14
15class TouchApp(object):
16
17 """Autopilot helper object for the application."""
18
19 def __init__(self, app_proxy, test_type):
20 self.app = app_proxy
21 self.test_type = test_type
22 self.main_view = self.app.select_single(MainView)
23
24 @property
25 def pointing_device(self):
26 return self.app.pointing_device
27
28
29class MainView(ubuntuuitoolkit.MainView):
30
31 """A helper that makes it easy to interact with the mainview"""
32
33 def __init__(self, *args):
34 super(MainView, self).__init__(*args)
35 self.visible.wait_for(True, 30)
36
37 def get_button(self):
38 return self.select_single('Button', objectName="button")
39
40 def get_label(self):
41 return self.select_single('Label', objectName="label")
0\ No newline at end of file42\ No newline at end of file
143
=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests'
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,54 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Ubuntu Touch App Autopilot tests."""
3
4import os
5import logging
6
7import %ProjectName%
8
9from autopilot.testcase import AutopilotTestCase
10from autopilot import logging as autopilot_logging
11
12import ubuntuuitoolkit
13from ubuntuuitoolkit import base
14
15logger = logging.getLogger(__name__)
16
17
18class BaseTestCase(AutopilotTestCase):
19
20 """A common test case class
21
22 """
23
24 local_location = os.path.dirname(os.path.dirname(os.getcwd()))
25 local_location_qml = os.path.join(local_location, 'Main.qml')
26 click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%')
27
28 def setUp(self):
29 super(BaseTestCase, self).setUp()
30 self.launcher, self.test_type = self.get_launcher_and_type()
31 self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type)
32
33 def get_launcher_and_type(self):
34 if os.path.exists(self.local_location_qml):
35 launcher = self.launch_test_local
36 test_type = 'local'
37 else:
38 launcher = self.launch_test_click
39 test_type = 'click'
40 return launcher, test_type
41
42 @autopilot_logging.log_action(logger.info)
43 def launch_test_local(self):
44 return self.launch_test_application(
45 base.get_qmlscene_launch_command(),
46 self.local_location_qml,
47 app_type='qt',
48 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
49
50 @autopilot_logging.log_action(logger.info)
51 def launch_test_click(self):
52 return self.launch_click_package(
53 self.click_package,
54 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
0\ No newline at end of file55\ No newline at end of file
156
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,21 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3from autopilot.matchers import Eventually
4from testtools.matchers import Equals
5from %ProjectName% import tests
6
7
8class MainViewTestCase(tests.BaseTestCase):
9 """Tests for the mainview"""
10
11 def setUp(self):
12 super(MainViewTestCase, self).setUp()
13
14 def test_click_button(self):
15 # Find and click the button
16 button = self.app.main_view.get_button()
17 self.app.pointing_device.click_object(button)
18
19 # Make an assertion about what should happen
20 label = self.app.main_view.get_label()
21 self.assertThat(label.text, Eventually(Equals('..world!')))
0\ No newline at end of file22\ No newline at end of file
123
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/run'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/run 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/autopilot/run 2015-05-26 21:42:21 +0000
@@ -0,0 +1,11 @@
1#!/bin/bash
2
3if [[ -z `which autopilot3` ]]; then
4 echo "python3-autopilot is not installed. Skip"
5 exit
6fi
7
8SCRIPTPATH=`dirname $0`
9pushd ${SCRIPTPATH}
10autopilot3 run %ProjectName%
11popd
0\ No newline at end of file12\ No newline at end of file
113
=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit'
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit/tst_main.qml'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1import QtQuick 2.0
2import QtTest 1.0
3import Ubuntu.Test 1.0
4import "../../"
5// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase
6
7// Execute these tests with:
8// qmltestrunner
9
10Item {
11
12 width: units.gu(100)
13 height: units.gu(75)
14
15 // The objects
16 Main {
17 id: main
18 }
19
20 UbuntuTestCase {
21 name: "MainTestCase"
22
23 when: windowShown
24
25
26 function init() {
27 var label = findChild(main, "label");
28 // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method
29 compare("Hello..", label.text);
30 }
31
32 function test_clickButtonMustChangeLabel() {
33 var button = findChild(main, "button");
34 var buttonCenter = centerOf(button)
35 mouseClick(button, buttonCenter.x, buttonCenter.y);
36 var label = findChild(main, "label");
37 // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method
38 tryCompare(label, "text", "..world!", 1);
39 }
40 }
41}
042
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro 2015-01-15 12:51:26 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/projectName.pro 2015-05-26 21:42:21 +0000
@@ -28,4 +28,12 @@
28# compiled and installed into the right place in the click package28# compiled and installed into the right place in the click package
29UBUNTU_PO_FILES+=$$files(po/*.po)29UBUNTU_PO_FILES+=$$files(po/*.po)
3030
3131aptest.target = autopilot
32aptest.commands = bash $$PWD/app/tests/autopilot/run
33aptest.depends = sub-app
34
35unittest.target = check
36unittest.commands = /usr/bin/qmltestrunner -input $$PWD/app/tests/unit
37unittest.depends = sub-app
38
39QMAKE_EXTRA_TARGETS += aptest unittest
3240
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml 2015-02-04 17:42:14 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml 2015-05-26 21:42:21 +0000
@@ -1,58 +1,63 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="A3_UbuntuAppSimpleQmake'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="A3_UbuntuAppSimpleQmake'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-qmake"4 class="ubuntu-project-qmake"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
8 <description>Creates a Qt Quick 2 application project with a sample UI containing a Label and a Button. This project contains QML code only.8 <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.
99
10This templates requires a Kit using at least a 15.04 click chroot.10This templates requires a Kit using at least a 15.04 click chroot.
11</description>11</description>
12 <displayname>QML App with Simple UI (qmake)</displayname>12 <displayname>QML App with Simple UI (qmake)</displayname>
13 <displaycategory>Ubuntu</displaycategory>13 <displaycategory>Ubuntu</displaycategory>
14 <files>14 <files>
15 <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/>15 <file source="projectName.pro" target="%ProjectName%.pro" openproject="true"/>
16<!-- MANIFEST PARTS -->16<!-- MANIFEST PARTS -->
17 <file source="manifest.json.in" openeditor="true"/>17 <file source="manifest.json.in" openeditor="true"/>
18<!-- APP PARTS -->18<!-- APP PARTS -->
19 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>19 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>
20 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>20 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>
21 <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>21 <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>
22 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>22 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>
23 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>23 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>
24 <file source="appName/tests/autopilot/run" target="%ClickHookName%/tests/autopilot/run" openeditor="false"/>
25 <file source="appName/tests/autopilot/displayName/tests/test_main.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/>
26 <file source="appName/tests/autopilot/displayName/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>
27 <file source="appName/tests/autopilot/displayName/tests/__init__.py" target="%ClickHookName%/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/>
28 <file source="appName/tests/unit/tst_main.qml" target="%ClickHookName%/tests/unit/tst_main.qml" openeditor="false"/>
24 </files>29 </files>
2530
26 <!-- Create a 2nd wizard page with click package parameters -->31 <!-- Create a 2nd wizard page with click package parameters -->
27 <fieldpagetitle>Click package parameters</fieldpagetitle>32 <fieldpagetitle>Click package parameters</fieldpagetitle>
28 <fields>33 <fields>
29 <field mandatory="true" name="ClickDomain">34 <field mandatory="true" name="ClickDomain">
30 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'35 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
31 defaulttext="" placeholdertext="Nickname"/>36 defaulttext="" placeholdertext="Nickname"/>
32 <fielddescription>Nickname:</fielddescription>37 <fielddescription>Nickname:</fielddescription>
33 </field>38 </field>
34 <field mandatory="true" name="ClickMaintainer">39 <field mandatory="true" name="ClickMaintainer">
35 <fieldcontrol class="QLineEdit" validator='^[^"]+$'40 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
36 defaulttext="" placeholdertext="Maintainer"/>41 defaulttext="" placeholdertext="Maintainer"/>
37 <fielddescription>Maintainer:</fielddescription>42 <fielddescription>Maintainer:</fielddescription>
38 </field>43 </field>
39 <field mandatory="true" name="ClickHookName">44 <field mandatory="true" name="ClickHookName">
40 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'45 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
41 defaulttext="app" placeholdertext="app hook name"/>46 defaulttext="app" placeholdertext="app hook name"/>
42 <fielddescription>App name:</fielddescription>47 <fielddescription>App name:</fielddescription>
43 </field>48 </field>
44 <field name="ClickFrameworkVersion">49 <field name="ClickFrameworkVersion">
45 <fieldcontrol class="QComboBox" defaultindex="0">50 <fieldcontrol class="QComboBox" defaultindex="0">
46 <comboentries>51 <comboentries>
47 <!-- 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 -->52 <!-- 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 -->
48 <comboentry value="ubuntu-sdk-dummy-framework">53 <comboentry value="ubuntu-sdk-dummy-framework">
49 <comboentrytext>Dummy Framework</comboentrytext>54 <comboentrytext>Dummy Framework</comboentrytext>
50 </comboentry>55 </comboentry>
51 </comboentries>56 </comboentries>
52 </fieldcontrol>57 </fieldcontrol>
53 <fielddescription>Framework:</fielddescription>58 <fielddescription>Framework:</fielddescription>
54 </field>59 </field>
55 </fields>60 </fields>
56 <validationrules>61 <validationrules>
57 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>62 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>
58 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>63 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>
5964
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py 2015-02-04 17:44:30 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000
@@ -1,76 +1,41 @@
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 -*-
22"""Application autopilot helpers."""
3"""Ubuntu Touch App Autopilot tests."""3
44import logging
5import os
6
7import ubuntuuitoolkit5import ubuntuuitoolkit
86
9from autopilot import introspection7logger = logging.getLogger(__name__)
10from autopilot.matchers import Eventually8
11from testtools.matchers import Equals9
12from ubuntuuitoolkit import base10class AppException(ubuntuuitoolkit.ToolkitException):
1311
1412 """Exception raised when there are problems with the Application."""
15PACKAGE_ID = '%ProjectName:l%.%ClickDomain:l%'13
1614
1715class TouchApp(object):
18def get_path_to_source_root():16
19 return os.path.abspath(17 """Autopilot helper object for the application."""
20 os.path.join(18
21 os.path.dirname(__file__), '..', '..', '..', '..'))19 def __init__(self, app_proxy, test_type):
2220 self.app = app_proxy
2321 self.test_type = test_type
24class ApplicationCustomProxyObject(22 self.main_view = self.app.select_single(MainView)
25 ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase):
26
27 """Autopilot custom proxy object for the app."""
28
29 @classmethod
30 def validate_dbus_object(cls, path, state):
31 application_name = PACKAGE_ID
32 name = introspection.get_classname_from_path(path)
33 if str(name) == application_name:
34 if state['applicationName'][1] == application_name:
35 return True
36 return False
3723
38 @property24 @property
39 def main_view(self):25 def pointing_device(self):
40 return self.select_single(ubuntuuitoolkit.MainView)26 return self.app.pointing_device
4127
4228
43class ClickAppTestCase(base.UbuntuUIToolkitAppTestCase):29class MainView(ubuntuuitoolkit.MainView):
4430
45 """Common test case that provides several useful methods for the tests."""31 """A helper that makes it easy to interact with the mainview"""
4632
47 project_name = '%ProjectName%'33 def __init__(self, *args):
4834 super(MainView, self).__init__(*args)
49 def launch_application(self):35 self.visible.wait_for(True, 30)
50 app_qml_source_location = self._get_app_qml_source_path()36
51 if os.path.exists(app_qml_source_location):37 def get_button(self):
52 app = self._launch_application_from_source(38 return self.select_single('Button', objectName="button")
53 app_qml_source_location)39
54 else:40 def get_label(self):
55 app = self._launch_installed_application()41 return self.select_single('Label', objectName="label")
56
57 self.assertThat(app.main_view.visible, Eventually(Equals(True)))
58 return app
59
60 def _get_app_qml_source_path(self):
61 qml_file_name = 'Main.qml'
62 return os.path.join(self._get_path_to_project_source(), qml_file_name)
63
64 def _get_path_to_project_source(self):
65 return os.path.join(get_path_to_source_root(), self.project_name)
66
67 def _launch_application_from_source(self, app_qml_source_location):
68 return self.launch_test_application(
69 base.get_qmlscene_launch_command(),
70 app_qml_source_location,
71 app_type='qt',
72 emulator_base=ApplicationCustomProxyObject)
73
74 def _launch_installed_application(self):
75 return self.launch_click_package(
76 PACKAGE_ID, emulator_base=ApplicationCustomProxyObject)
77\ No newline at end of file42\ No newline at end of file
7843
=== removed file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/test_main.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/test_main.py 2015-02-04 17:44:30 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/test_main.py 1970-01-01 00:00:00 +0000
@@ -1,24 +0,0 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3"""Tests for the Hello World"""
4
5from autopilot.matchers import Eventually
6from testtools.matchers import Equals
7
8import %ProjectName%
9
10
11class MainViewTestCase(%ProjectName%.ClickAppTestCase):
12 """Generic tests for the Hello World"""
13
14 def test_initial_label(self):
15 app = self.launch_application()
16 label = app.main_view.select_single(objectName='label')
17 self.assertThat(label.text, Equals('Hello..'))
18
19 def test_click_button_should_update_label(self):
20 app = self.launch_application()
21 button = app.main_view.select_single(objectName='button')
22 app.pointing_device.click_object(button)
23 label = app.main_view.select_single(objectName='label')
24 self.assertThat(label.text, Eventually(Equals('..world!')))
250
=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests'
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/__init__.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,54 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Ubuntu Touch App Autopilot tests."""
3
4import os
5import logging
6
7import %ProjectName%
8
9from autopilot.testcase import AutopilotTestCase
10from autopilot import logging as autopilot_logging
11
12import ubuntuuitoolkit
13from ubuntuuitoolkit import base
14
15logger = logging.getLogger(__name__)
16
17
18class BaseTestCase(AutopilotTestCase):
19
20 """A common test case class
21
22 """
23
24 local_location = os.path.dirname(os.path.dirname(os.getcwd()))
25 local_location_qml = os.path.join(local_location, 'Main.qml')
26 click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%')
27
28 def setUp(self):
29 super(BaseTestCase, self).setUp()
30 self.launcher, self.test_type = self.get_launcher_and_type()
31 self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type)
32
33 def get_launcher_and_type(self):
34 if os.path.exists(self.local_location_qml):
35 launcher = self.launch_test_local
36 test_type = 'local'
37 else:
38 launcher = self.launch_test_click
39 test_type = 'click'
40 return launcher, test_type
41
42 @autopilot_logging.log_action(logger.info)
43 def launch_test_local(self):
44 return self.launch_test_application(
45 base.get_qmlscene_launch_command(),
46 self.local_location_qml,
47 app_type='qt',
48 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
49
50 @autopilot_logging.log_action(logger.info)
51 def launch_test_click(self):
52 return self.launch_click_package(
53 self.click_package,
54 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
0\ No newline at end of file55\ No newline at end of file
156
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/test_main.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/test_main.py 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000
@@ -0,0 +1,21 @@
1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2
3from autopilot.matchers import Eventually
4from testtools.matchers import Equals
5from %ProjectName% import tests
6
7
8class MainViewTestCase(tests.BaseTestCase):
9 """Tests for the mainview"""
10
11 def setUp(self):
12 super(MainViewTestCase, self).setUp()
13
14 def test_click_button(self):
15 # Find and click the button
16 button = self.app.main_view.get_button()
17 self.app.pointing_device.click_object(button)
18
19 # Make an assertion about what should happen
20 label = self.app.main_view.get_label()
21 self.assertThat(label.text, Eventually(Equals('..world!')))
0\ No newline at end of file22\ No newline at end of file
123
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/run'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/run 2015-02-04 17:44:30 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/run 2015-05-26 21:42:21 +0000
@@ -1,11 +1,11 @@
1#!/bin/bash1#!/bin/bash
22
3if [[ -z `which autopilot` ]]; then3if [[ -z `which autopilot3` ]]; then
4 echo "Autopilot is not installed. Skip"4 echo "python3-autopilot is not installed. Skip"
5 exit5 exit
6fi6fi
77
8SCRIPTPATH=`dirname $0`8SCRIPTPATH=`dirname $0`
9pushd ${SCRIPTPATH}9pushd ${SCRIPTPATH}
10autopilot3 run %ProjectName%10autopilot3 run %ProjectName%
11popd11popd
12\ No newline at end of file12\ No newline at end of file
1313
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml 2015-02-04 17:42:14 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml 2015-05-26 21:42:21 +0000
@@ -1,61 +1,60 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="A1_UbuntuAppSimple'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="A1_UbuntuAppSimple'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-plain-qml"4 class="ubuntu-project-plain-qml"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
8 <description>Creates a Qt Quick 2 application project with a sample UI containing a Label and a Button. This project contains QML code only.8 <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.
9
10Includes also unit and functional tests.
11</description>9</description>
12 <displayname>QML App with Simple UI (qmlproject)</displayname>10 <displayname>QML App with Simple UI (qmlproject)</displayname>
13 <displaycategory>Ubuntu</displaycategory>11 <displaycategory>Ubuntu</displaycategory>
14 <files>12 <files>
15 <file source="../share/manifest.json" target="manifest.json" openeditor="true"/>13 <file source="../share/manifest.json" target="manifest.json" openeditor="true"/>
16 <file source="../share/displayName.qmlproject" target="%ProjectName%.qmlproject" openproject="true"/>14 <file source="../share/displayName.qmlproject" target="%ProjectName%.qmlproject" openproject="true"/>
17 <file source="Main.qml" target="Main.qml" openeditor="true"/>15 <file source="Main.qml" target="Main.qml" openeditor="true"/>
18 <file source="displayName.png" target="%ProjectName%.png" openeditor="false" binary="true"/>16 <file source="displayName.png" target="%ProjectName%.png" openeditor="false" binary="true"/>
19 <file source="displayName.desktop" target="%ClickHookName%.desktop" openeditor="false"/>17 <file source="displayName.desktop" target="%ClickHookName%.desktop" openeditor="false"/>
20 <file source="tests/autopilot/displayName/test_main.py" target="tests/autopilot/%ProjectName%/test_main.py" openeditor="false"/>18 <file source="tests/autopilot/run" target="tests/autopilot/run" openeditor="false"/>
21 <file source="tests/autopilot/displayName/__init__.py" target="tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>19 <file source="tests/autopilot/displayName/tests/test_main.py" target="tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/>
22 <file source="tests/autopilot/run" target="tests/autopilot/run" openeditor="false"/>20 <file source="tests/autopilot/displayName/__init__.py" target="tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>
23 <file source="tests/qml/tst_main.qml" target="tests/qml/tst_main.qml" openeditor="false"/>21 <file source="tests/autopilot/displayName/tests/__init__.py" target="tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/>
24 <file source="Makefile" target="Makefile" openeditor="false"/>22 <file source="tests/qml/tst_main.qml" target="tests/qml/tst_main.qml" openeditor="false"/>
25 <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/>23 <file source="Makefile" target="Makefile" openeditor="false"/>
26 <file source="../share/.excludes" target=".excludes" openeditor="false"/>24 <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/>
25 <file source="../share/.excludes" target=".excludes" openeditor="false"/>
27 </files>26 </files>
2827
29 <!-- Create a 2nd wizard page with click package parameters -->28 <!-- Create a 2nd wizard page with click package parameters -->
30 <fieldpagetitle>Click package parameters</fieldpagetitle>29 <fieldpagetitle>Click package parameters</fieldpagetitle>
31 <fields>30 <fields>
32 <field mandatory="true" name="ClickDomain">31 <field mandatory="true" name="ClickDomain">
33 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'32 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
34 defaulttext="" placeholdertext="Nickname"/>33 defaulttext="" placeholdertext="Nickname"/>
35 <fielddescription>Nickname:</fielddescription>34 <fielddescription>Nickname:</fielddescription>
36 </field>35 </field>
37 <field mandatory="true" name="ClickMaintainer">36 <field mandatory="true" name="ClickMaintainer">
38 <fieldcontrol class="QLineEdit" validator='^[^"]+$'37 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
39 defaulttext="" placeholdertext="Maintainer"/>38 defaulttext="" placeholdertext="Maintainer"/>
40 <fielddescription>Maintainer:</fielddescription>39 <fielddescription>Maintainer:</fielddescription>
41 </field>40 </field>
42 <field mandatory="true" name="ClickHookName">41 <field mandatory="true" name="ClickHookName">
43 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'42 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
44 defaulttext="app" placeholdertext="app hook name"/>43 defaulttext="app" placeholdertext="app hook name"/>
45 <fielddescription>App name:</fielddescription>44 <fielddescription>App name:</fielddescription>
46 </field>45 </field>
47 <field name="ClickFrameworkVersion">46 <field name="ClickFrameworkVersion">
48 <fieldcontrol class="QComboBox" defaultindex="0">47 <fieldcontrol class="QComboBox" defaultindex="0">
49 <comboentries>48 <comboentries>
50 <!-- 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 -->49 <!-- 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 -->
51 <comboentry value="ubuntu-sdk-dummy-framework">50 <comboentry value="ubuntu-sdk-dummy-framework">
52 <comboentrytext>Dummy Framework</comboentrytext>51 <comboentrytext>Dummy Framework</comboentrytext>
53 </comboentry>52 </comboentry>
54 </comboentries>53 </comboentries>
55 </fieldcontrol>54 </fieldcontrol>
56 <fielddescription>Framework:</fielddescription>55 <fielddescription>Framework:</fielddescription>
57 </field>56 </field>
58 </fields>57 </fields>
59 <validationrules>58 <validationrules>
60 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>59 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>
61 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>60 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>
6261
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/CMakeLists.txt'
--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/CMakeLists.txt 2015-01-16 11:11:30 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/CMakeLists.txt 2015-05-26 21:42:21 +0000
@@ -15,3 +15,7 @@
15# Make the autpilot files visible in qtcreator15# Make the autpilot files visible in qtcreator
16file(GLOB_RECURSE AUTOPILOT_TEST_FILES *.py)16file(GLOB_RECURSE AUTOPILOT_TEST_FILES *.py)
17add_custom_target(%ProjectName:l%_AutopilotFiles ALL SOURCES ${AUTOPILOT_TEST_FILES})17add_custom_target(%ProjectName:l%_AutopilotFiles ALL SOURCES ${AUTOPILOT_TEST_FILES})
18
19# Make the qml test files visible in qtcreator
20file(GLOB_RECURSE UNIT_TEST_FILES tests/unit/*.qml)
21add_custom_target(%ProjectName:l%_UnitTestFiles ALL SOURCES ${UNIT_TEST_FILES})
1822
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/__init__.py 2014-10-14 08:33:49 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/__init__.py 2015-05-26 21:42:21 +0000
@@ -1,132 +1,41 @@
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 -*-
22"""Application autopilot helpers."""
3"""Ubuntu Touch App autopilot tests."""3
44import logging
5from os import remove5import ubuntuuitoolkit
6import os.path6
7from tempfile import mktemp7logger = logging.getLogger(__name__)
8import subprocess8
99
10from autopilot.input import Mouse, Touch, Pointer10class AppException(ubuntuuitoolkit.ToolkitException):
11from autopilot.matchers import Eventually11
12from autopilot.platform import model12 """Exception raised when there are problems with the Application."""
13from testtools.matchers import Is, Not, Equals13
14from autopilot.testcase import AutopilotTestCase14
1515class TouchApp(object):
16def get_module_include_path():16
17 return os.path.abspath(17 """Autopilot helper object for the application."""
18 os.path.join(18
19 os.path.dirname(__file__),19 def __init__(self, app_proxy, test_type):
20 '..',20 self.app = app_proxy
21 '..',21 self.test_type = test_type
22 '..',22 self.main_view = self.app.select_single(MainView)
23 '..',
24 'backend',
25 'modules')
26 )
27
28
29class UbuntuTouchAppTestCase(AutopilotTestCase):
30 """A common test case class that provides several useful methods for the tests."""
31
32 if model() == 'Desktop':
33 scenarios = [
34 ('with mouse', dict(input_device_class=Mouse))
35 ]
36 else:
37 scenarios = [
38 ('with touch', dict(input_device_class=Touch))
39 ]
4023
41 @property24 @property
42 def main_window(self):25 def pointing_device(self):
43 return MainWindow(self.app)26 return self.app.pointing_device
4427
4528
46 def setUp(self):29class MainView(ubuntuuitoolkit.MainView):
47 self.pointing_device = Pointer(self.input_device_class.create())30
48 super(UbuntuTouchAppTestCase, self).setUp()31 """A helper that makes it easy to interact with the mainview"""
49 self.launch_test_qml()32
5033 def __init__(self, *args):
5134 super(MainView, self).__init__(*args)
52 def launch_test_qml(self):35 self.visible.wait_for(True, 30)
53 # If the test class has defined a 'test_qml' class attribute then we36
54 # write it to disk and launch it inside the QML Scene. If not, then we37 def get_button(self):
55 # silently do nothing (presumably the test has something else planned).38 return self.select_single('Button', objectName="button")
56 arch = subprocess.check_output(["dpkg-architecture",39
57 "-qDEB_HOST_MULTIARCH"]).strip()40 def get_label(self):
58 if hasattr(self, 'test_qml') and isinstance(self.test_qml, basestring):41 return self.select_single('Label', objectName="label")
59 qml_path = mktemp(suffix='.qml')
60 open(qml_path, 'w').write(self.test_qml)
61 self.addCleanup(remove, qml_path)
62
63 self.app = self.launch_test_application(
64 "/usr/lib/" + arch + "/qt5/bin/qmlscene",
65 "-I", get_module_include_path(),
66 qml_path,
67 app_type='qt')
68
69 if hasattr(self, 'test_qml_file') and isinstance(self.test_qml_file, basestring):
70 qml_path = self.test_qml_file
71 self.app = self.launch_test_application(
72 "/usr/lib/" + arch + "/qt5/bin/qmlscene",
73 "-I", get_module_include_path(),
74 qml_path,
75 app_type='qt')
76
77 self.assertThat(self.get_qml_view().visible, Eventually(Equals(True)))
78
79
80 def get_qml_view(self):
81 """Get the main QML view"""
82
83 return self.app.select_single("QQuickView")
84
85 def get_mainview(self):
86 """Get the QML MainView"""
87
88 mainView = self.app.select_single("MainView")
89 self.assertThat(mainView, Not(Is(None)))
90 return mainView
91
92
93 def get_object(self,objectName):
94 """Get a object based on the objectName"""
95
96 obj = self.app.select_single(objectName=objectName)
97 self.assertThat(obj, Not(Is(None)))
98 return obj
99
100
101 def mouse_click(self,objectName):
102 """Move mouse on top of the object and click on it"""
103
104 obj = self.get_object(objectName)
105 self.pointing_device.move_to_object(obj)
106 self.pointing_device.click()
107
108
109 def mouse_press(self,objectName):
110 """Move mouse on top of the object and press mouse button (without releasing it)"""
111
112 obj = self.get_object(objectName)
113 self.pointing_device.move_to_object(obj)
114 self.pointing_device.press()
115
116
117 def mouse_release(self):
118 """Release mouse button"""
119
120 self.pointing_device.release()
121
122
123 def type_string(self, string):
124 """Type a string with keyboard"""
125
126 self.keyboard.type(string)
127
128
129 def type_key(self, key):
130 """Type a single key with keyboard"""
131
132 self.keyboard.key(key)
133\ No newline at end of file42\ No newline at end of file
13443
=== 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'
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/__init__.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/__init__.py 2015-01-17 04:53:32 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/__init__.py 2015-05-26 21:42:21 +0000
@@ -1,1 +1,54 @@
1""" A Main.qml test suite """1# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
2"""Ubuntu Touch App Autopilot tests."""
3
4import os
5import logging
6
7import %ProjectName%
8
9from autopilot.testcase import AutopilotTestCase
10from autopilot import logging as autopilot_logging
11
12import ubuntuuitoolkit
13from ubuntuuitoolkit import base
14
15logger = logging.getLogger(__name__)
16
17
18class BaseTestCase(AutopilotTestCase):
19
20 """A common test case class
21
22 """
23
24 local_location = os.path.dirname(os.path.dirname(os.getcwd()))
25 local_location_qml = os.path.join(local_location, 'Main.qml')
26 click_package = '{0}.{1}'.format('%ProjectName%', '%ClickDomain%')
27
28 def setUp(self):
29 super(BaseTestCase, self).setUp()
30 self.launcher, self.test_type = self.get_launcher_and_type()
31 self.app = %ProjectName%.TouchApp(self.launcher(), self.test_type)
32
33 def get_launcher_and_type(self):
34 if os.path.exists(self.local_location_qml):
35 launcher = self.launch_test_local
36 test_type = 'local'
37 else:
38 launcher = self.launch_test_click
39 test_type = 'click'
40 return launcher, test_type
41
42 @autopilot_logging.log_action(logger.info)
43 def launch_test_local(self):
44 return self.launch_test_application(
45 base.get_qmlscene_launch_command(),
46 self.local_location_qml,
47 app_type='qt',
48 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
49
50 @autopilot_logging.log_action(logger.info)
51 def launch_test_click(self):
52 return self.launch_click_package(
53 self.click_package,
54 emulator_base=ubuntuuitoolkit.UbuntuUIToolkitCustomProxyObjectBase)
2\ No newline at end of file55\ No newline at end of file
356
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/test_main.py'
--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/test_main.py 2015-05-06 08:49:21 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/tests/test_main.py 2015-05-26 21:42:21 +0000
@@ -1,23 +1,21 @@
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 -*-
22
3"""Tests for the Hello World"""
4
5from autopilot.matchers import Eventually3from autopilot.matchers import Eventually
6from textwrap import dedent4from testtools.matchers import Equals
7from testtools.matchers import Is, Not, Equals5from %ProjectName% import tests
8from testtools import skip6
9import os7
10from %ProjectName% import UbuntuTouchAppTestCase8class MainViewTestCase(tests.BaseTestCase):
119 """Tests for the mainview"""
1210
13class MainTests(UbuntuTouchAppTestCase):11 def setUp(self):
14 """Generic tests for the Hello World"""12 super(MainViewTestCase, self).setUp()
1513
16 test_qml_file = "%s/%s/Main.qml" % (os.path.dirname(os.path.realpath(__file__)),"../../../..")14 def test_click_button(self):
1715 # Find and click the button
18 def test_0_can_select_mainView(self):16 button = self.app.main_view.get_button()
19 """Must be able to select the mainview."""17 self.app.pointing_device.click_object(button)
2018
21 mainView = self.get_mainview()19 # Make an assertion about what should happen
22 self.assertThat(mainView.visible,Eventually(Equals(True)))20 label = self.app.main_view.get_label()
2321 self.assertThat(label.text, Eventually(Equals('..world!')))
24\ No newline at end of file22\ No newline at end of file
2523
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/run'
--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/run 2014-10-14 08:33:49 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/run 2015-05-26 21:42:21 +0000
@@ -1,11 +1,11 @@
1#!/bin/bash1#!/bin/bash
22
3if [[ -z `which autopilot` ]]; then3if [[ -z `which autopilot3` ]]; then
4 echo "Autopilot is not installed. Skip"4 echo "python3-autopilot is not installed. Skip"
5 exit5 exit
6fi6fi
77
8SCRIPTPATH=`dirname $0`8SCRIPTPATH=`dirname $0`
9pushd ${SCRIPTPATH}9pushd ${SCRIPTPATH}
10autopilot run %ProjectName%10autopilot3 run %ProjectName%
11popd11popd
12\ No newline at end of file12\ No newline at end of file
1313
=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit'
=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit/tst_main.qml'
--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit/tst_main.qml 1970-01-01 00:00:00 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/unit/tst_main.qml 2015-05-26 21:42:21 +0000
@@ -0,0 +1,41 @@
1import QtQuick 2.0
2import QtTest 1.0
3import Ubuntu.Test 1.0
4import "../../"
5// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase
6
7// Execute these tests with:
8// qmltestrunner
9
10Item {
11
12 width: units.gu(100)
13 height: units.gu(75)
14
15 // The objects
16 Main {
17 id: main
18 }
19
20 UbuntuTestCase {
21 name: "MainTestCase"
22
23 when: windowShown
24
25
26 function init() {
27 var label = findChild(main, "label");
28 // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method
29 compare("Hello..", label.text);
30 }
31
32 function test_clickButtonMustChangeLabel() {
33 var button = findChild(main, "button");
34 var buttonCenter = centerOf(button)
35 mouseClick(button, buttonCenter.x, buttonCenter.y);
36 var label = findChild(main, "label");
37 // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method
38 tryCompare(label, "text", "..world!", 1);
39 }
40 }
41}
042
=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/wizard.xml'
--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/wizard.xml 2015-05-06 08:49:21 +0000
+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/wizard.xml 2015-05-26 21:42:21 +0000
@@ -1,63 +1,61 @@
1<?xml version="1.0" encoding="UTF-8"?>1<?xml version="1.0" encoding="UTF-8"?>
2<wizard version="1" kind="project" firstpage="10" id="A2_UbuntuSimpleI18nQmlProject'" category="A.UbuntuProject"2<wizard version="1" kind="project" firstpage="10" id="A2_UbuntuSimpleI18nQmlProject'" category="A.UbuntuProject"
3 platformIndependent="true" 3 platformIndependent="true"
4 class="ubuntu-project-cmake"4 class="ubuntu-project-cmake"
5 featuresRequired=""5 featuresRequired=""
6 >6 >
7 <icon>../share/ubuntu.png</icon>7 <icon>../share/ubuntu.png</icon>
8 <description>A simple QML app with localization support.8 <description>A simple QML app with localization support. Also includes unit and functional tests.
9
10Includes also
11 - unit and functional tests for QML
12</description>9</description>
13 <displayname>QML App with Simple UI (cmake)</displayname>10 <displayname>QML App with Simple UI (cmake)</displayname>
14 <displaycategory>Ubuntu</displaycategory>11 <displaycategory>Ubuntu</displaycategory>
15 <files>12 <files>
16 <file source="CMakeLists.txt" target="CMakeLists.txt" openproject="true"/>13 <file source="CMakeLists.txt" target="CMakeLists.txt" openproject="true"/>
17 <file source="app/graphics/toolbarIcon@8.png" target="app/graphics/toolbarIcon@8.png" openeditor="false" binary="true"/>14 <file source="app/graphics/toolbarIcon@8.png" target="app/graphics/toolbarIcon@8.png" openeditor="false" binary="true"/>
18 <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/>15 <file source="app/displayName.desktop.in" target="app/%ClickHookName%.desktop.in" openeditor="false"/>
19 <file source="app/graphics/displayName.png" target="app/graphics/%ProjectName%.png" openeditor="false" binary="true"/>16 <file source="app/graphics/displayName.png" target="app/graphics/%ProjectName%.png" openeditor="false" binary="true"/>
20 <file source="app/CMakeLists.txt" target="app/CMakeLists.txt" openeditor="false"/>17 <file source="app/CMakeLists.txt" target="app/CMakeLists.txt" openeditor="false"/>
21 <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/>18 <file source="app/tests/autopilot/run" target="app/tests/autopilot/run" openeditor="false"/>
22 <file source="app/tests/autopilot/displayName/main/test_main.py" target="app/tests/autopilot/%ProjectName%/main/test_main.py" openeditor="false"/>19 <file source="app/tests/autopilot/displayName/tests/test_main.py" target="app/tests/autopilot/%ProjectName%/tests/test_main.py" openeditor="false"/>
23 <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>20 <file source="app/tests/autopilot/displayName/__init__.py" target="app/tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>
24 <file source="app/tests/autopilot/displayName/main/__init__.py" target="app/tests/autopilot/%ProjectName%/main/__init__.py" openeditor="false"/>21 <file source="app/tests/autopilot/displayName/tests/__init__.py" target="app/tests/autopilot/%ProjectName%/tests/__init__.py" openeditor="false"/>
25 <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/>22 <file source="app/tests/unit/tst_main.qml" target="app/tests/unit/tst_main.qml" openeditor="false"/>
26 <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/>23 <file source="manifest.json.in" target="manifest.json.in" openeditor="true"/>
24 <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/>
27 <file source="app/Main.qml" target="app/Main.qml" openeditor="true"/>25 <file source="app/Main.qml" target="app/Main.qml" openeditor="true"/>
28 <file source="po/CMakeLists.txt" target="po/CMakeLists.txt" openeditor="false"/>26 <file source="po/CMakeLists.txt" target="po/CMakeLists.txt" openeditor="false"/>
29 </files>27 </files>
3028
31 <!-- Create a 2nd wizard page with click package parameters -->29 <!-- Create a 2nd wizard page with click package parameters -->
32 <fieldpagetitle>Click package parameters</fieldpagetitle>30 <fieldpagetitle>Click package parameters</fieldpagetitle>
33 <fields>31 <fields>
34 <field mandatory="true" name="ClickDomain">32 <field mandatory="true" name="ClickDomain">
35 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'33 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9-]+$'
36 defaulttext="" placeholdertext="Nickname"/>34 defaulttext="" placeholdertext="Nickname"/>
37 <fielddescription>Nickname:</fielddescription>35 <fielddescription>Nickname:</fielddescription>
38 </field>36 </field>
39 <field mandatory="true" name="ClickMaintainer">37 <field mandatory="true" name="ClickMaintainer">
40 <fieldcontrol class="QLineEdit" validator='^[^"]+$'38 <fieldcontrol class="QLineEdit" validator='^[^"]+$'
41 defaulttext="" placeholdertext="Maintainer"/>39 defaulttext="" placeholdertext="Maintainer"/>
42 <fielddescription>Maintainer:</fielddescription>40 <fielddescription>Maintainer:</fielddescription>
43 </field>41 </field>
44 <field mandatory="true" name="ClickHookName">42 <field mandatory="true" name="ClickHookName">
45 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'43 <fieldcontrol class="QLineEdit" validator='^[A-Za-z0-9.-]+$'
46 defaulttext="myapp" placeholdertext="app hook name"/>44 defaulttext="myapp" placeholdertext="app hook name"/>
47 <fielddescription>App name:</fielddescription>45 <fielddescription>App name:</fielddescription>
48 </field>46 </field>
49 <field name="ClickFrameworkVersion">47 <field name="ClickFrameworkVersion">
50 <fieldcontrol class="QComboBox" defaultindex="0">48 <fieldcontrol class="QComboBox" defaultindex="0">
51 <comboentries>49 <comboentries>
52 <!-- 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 -->50 <!-- 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 -->
53 <comboentry value="ubuntu-sdk-dummy-framework">51 <comboentry value="ubuntu-sdk-dummy-framework">
54 <comboentrytext>Dummy Framework</comboentrytext>52 <comboentrytext>Dummy Framework</comboentrytext>
55 </comboentry>53 </comboentry>
56 </comboentries>54 </comboentries>
57 </fieldcontrol>55 </fieldcontrol>
58 <fielddescription>Framework:</fielddescription>56 <fielddescription>Framework:</fielddescription>
59 </field>57 </field>
60 </fields>58 </fields>
61 <validationrules>59 <validationrules>
62 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>60 <validationrule condition='/^(.*)\s+&lt;(.*@.*)&gt;$/.test("%ClickMaintainer%")'>
63 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>61 <message>Invalid format for maintainer (should be like "Joe Bloggs &lt;joe.bloggs@isp.com&gt;")</message>

Subscribers

People subscribed via source and target branches