Merge lp:~canonical-platform-qa/qtcreator-plugin-ubuntu/update_simpleui_qttest-2 into lp:qtcreator-plugin-ubuntu

Proposed by Leo Arias on 2015-01-17
Status: Superseded
Proposed branch: lp:~canonical-platform-qa/qtcreator-plugin-ubuntu/update_simpleui_qttest-2
Merge into: lp:qtcreator-plugin-ubuntu
Prerequisite: lp:~canonical-platform-qa/qtcreator-plugin-ubuntu/qmake-template-makeover-fix_install
Diff against target: 248 lines (+58/-16)
17 files modified
share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/__init__.py (+1/-1)
share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop (+1/-1)
share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/goproject/src/displayName/main.go (+1/-1)
share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.qrc (+1/-1)
share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/main.cpp (+1/-1)
share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/share/displayName.qmlproject (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/Makefile (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/displayName.desktop (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py (+1/-1)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/qml/tst_main.qml (+41/-0)
share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml (+2/-1)
share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/__init__.py (+1/-1)
To merge this branch: bzr merge lp:~canonical-platform-qa/qtcreator-plugin-ubuntu/update_simpleui_qttest-2
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2015-02-04
Benjamin Zeller (community) 2015-01-17 Approve on 2015-01-21
Thomi Richards (community) Approve on 2015-01-20
Christopher Lee (community) Needs Fixing on 2015-01-20
Allan LeSage 2015-01-17 Pending
Richard Huddie 2015-01-17 Pending
Ubuntu SDK team 2015-01-17 Pending
Review via email: mp+246806@code.launchpad.net

This proposal has been superseded by a proposal from 2015-02-04.

Commit Message

Added a qttest to simpel-app-qmlproject template.

Description of the Change

Renamed the directory tests/unit to tests/qml, because generally we will have qml tests that are not unit tests.
Made the test actually pass. For that, I had to rename the main.qml to Main.qml because "main" is parsed as a property, not as a component. As the instructions to run the qml are shared by all the templates, I had to rename every main.qml to Main.qml.
Use UbuntuTestCase.

To post a comment you must log in.
353. By Leo Arias on 2015-01-17

Added a qttest to simpel-app-qmlproject template.

Christopher Lee (veebers) wrote :

Looking good. Just a couple of minor nit-picks though.

review: Needs Fixing
Leo Arias (elopio) wrote :

Thanks for the review veebers. I replied and will push a new version now.

354. By Leo Arias on 2015-01-19

Change @ to at.

Christopher Lee (veebers) wrote :

Hey elopio, it looks like your editor or something has introduced a bunch of whitespace changes to the changelog. Can you revert these please as it adds a bunch of noise to the MP (unless this isn't an issue to the owning team).

review: Needs Fixing
355. By Leo Arias on 2015-01-20

Reverted the changelog change.

Leo Arias (elopio) wrote :

veebers, I intentionally have my emacs configured to remove the extra white spaces. I do this to follow the boyscout rule [1] of leaving everything you touch a little cleaner than before, and because with our painful release process, it's not likely that branches to only fix small details like this are going to be released.
The downside is that the diff gets larger. When it's already too big, I try not to do it. But I think this one is not too big. I found that the main place where the spaces were removed was on the changelog, which I checked in by mistake. I reverted that one.

[1] http://programmer.97things.oreilly.com/wiki/index.php/The_Boy_Scout_Rule

Thomi Richards (thomir) wrote :

> veebers, I intentionally have my emacs configured to remove the extra white
> spaces. I do this to follow the boyscout rule [1] of leaving everything you
> touch a little cleaner than before, and because with our painful release
> process, it's not likely that branches to only fix small details like this are
> going to be released.

Leo, the boy scout rule doesn't say you need to land all those changes together.

I agree with veebers - please land separate fixes in separate branches. The bzr 'pipelines' plugin can help you if you want to make all these changes in one working directory.

Why? It introduces noise to the diff. The more noise there is, the harder it is to determine what needs to be scrutinised in a review. This MP already has several changes that are hard to follow ('main.qml' -> 'Main.qml' for example, which is easy to miss).

> The downside is that the diff gets larger. When it's already too big, I try
> not to do it. But I think this one is not too big. I found that the main place
> where the spaces were removed was on the changelog, which I checked in by
> mistake. I reverted that one.

It's not about diff size, it's about reviewer fatigue.

Cheers,

Thomi Richards (thomir) wrote :

A few things need fixing, plus please remove whitespace-only changes.

review: Needs Fixing
356. By Leo Arias on 2015-01-20

Reverted whitespaces.

357. By Leo Arias on 2015-01-20

Fixed a little the alignment.

Leo Arias (elopio) wrote :

> It's not about diff size, it's about reviewer fatigue.
>
> Cheers,

I don't agree, but two against one.
Pushed with the white spaces reverted.

358. By Leo Arias on 2015-01-20

Get rid of unnecessary parts.

Leo Arias (elopio) wrote :

> A few things need fixing, plus please remove whitespace-only changes.

Thanks for the comments. I've pushed a new rev, please rereview.

Thomi Richards (thomir) wrote :

LGTM - thanks!

review: Approve
Benjamin Zeller (zeller-benjamin) wrote :

OK

review: Approve
359. By Leo Arias on 2015-02-04

Merged with trunk.

360. By Leo Arias on 2015-02-05

Change the compiler optimization to avoid gcc bug.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/__init__.py'
2--- share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/__init__.py 2014-02-05 22:28:56 +0000
3+++ share/qtcreator/templates/wizards/ubuntu/backend-app-cmake/app/tests/autopilot/displayName/main/__init__.py 2015-02-04 17:43:11 +0000
4@@ -1,1 +1,1 @@
5-""" A main.qml test suite """
6+""" A Main.qml test suite """
7
8=== renamed file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/main.qml' => 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/Main.qml'
9=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop'
10--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop 2015-01-16 10:50:52 +0000
11+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/appName/appName.desktop 2015-02-04 17:43:11 +0000
12@@ -1,6 +1,6 @@
13 [Desktop Entry]
14 Name=%ClickHookName%
15-Exec=qmlscene $@ %ClickHookName%/main.qml
16+Exec=qmlscene $@ %ClickHookName%/Main.qml
17 Icon=%ClickHookName%/%ClickHookName%.png
18 Terminal=false
19 Type=Application
20
21=== modified file 'share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml'
22--- share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml 2015-01-28 10:41:30 +0000
23+++ share/qtcreator/templates/wizards/ubuntu/backend-app-qmake/wizard.xml 2015-02-04 17:43:11 +0000
24@@ -23,7 +23,7 @@
25 <!-- APP PARTS -->
26 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>
27 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>
28- <file source="appName/main.qml" target="%ClickHookName%/main.qml" openeditor="true"/>
29+ <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>
30 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>
31 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>
32 <file source="backend/displayName/backend.h" target="backend/%ClickHookName:s%/backend.h" openeditor="false"/>
33
34=== renamed file 'share/qtcreator/templates/wizards/ubuntu/goproject/share/displayName/main.qml' => 'share/qtcreator/templates/wizards/ubuntu/goproject/share/displayName/Main.qml'
35=== modified file 'share/qtcreator/templates/wizards/ubuntu/goproject/src/displayName/main.go'
36--- share/qtcreator/templates/wizards/ubuntu/goproject/src/displayName/main.go 2014-06-30 15:20:18 +0000
37+++ share/qtcreator/templates/wizards/ubuntu/goproject/src/displayName/main.go 2015-02-04 17:43:11 +0000
38@@ -9,7 +9,7 @@
39 func main() {
40 qml.Init(nil)
41 engine := qml.NewEngine()
42- component, err := engine.LoadFile("share/%ProjectName%/main.qml")
43+ component, err := engine.LoadFile("share/%ProjectName%/Main.qml")
44 if err != nil {
45 panic(err)
46 }
47
48=== modified file 'share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml'
49--- share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml 2015-01-07 10:50:28 +0000
50+++ share/qtcreator/templates/wizards/ubuntu/goproject/wizard.xml 2015-02-04 17:43:11 +0000
51@@ -9,7 +9,7 @@
52 <displayname>Go app with QML UI</displayname>
53 <displaycategory>Ubuntu</displaycategory>
54 <files>
55- <file source="share/displayName/main.qml" target="share/%ProjectName%/main.qml" openeditor="false"/>
56+ <file source="share/displayName/Main.qml" target="share/%ProjectName%/Main.qml" openeditor="false"/>
57 <file source="displayName.goproject" target="%ProjectName%.goproject" openeditor="false" openproject="true"/>
58 <file source="displayName.png" target="%ProjectName%.png" openeditor="false" binary="true"/>
59 <file source="displayName.desktop" target="%ClickHookName%.desktop" openeditor="false"/>
60
61=== renamed file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/main.qml' => 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/Main.qml'
62=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.qrc'
63--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.qrc 2014-11-13 15:45:24 +0000
64+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/appName.qrc 2015-02-04 17:43:11 +0000
65@@ -1,5 +1,5 @@
66 <RCC>
67 <qresource prefix="/">
68- <file>main.qml</file>
69+ <file>Main.qml</file>
70 </qresource>
71 </RCC>
72
73=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/main.cpp'
74--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/main.cpp 2014-11-13 15:45:24 +0000
75+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/appName/main.cpp 2015-02-04 17:43:11 +0000
76@@ -7,7 +7,7 @@
77 QGuiApplication app(argc, argv);
78
79 QQuickView view;
80- view.setSource(QUrl(QStringLiteral("qrc:///main.qml")));
81+ view.setSource(QUrl(QStringLiteral("qrc:///Main.qml")));
82 view.setResizeMode(QQuickView::SizeRootObjectToView);
83 view.show();
84 return app.exec();
85
86=== modified file 'share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml'
87--- share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml 2015-01-28 10:41:30 +0000
88+++ share/qtcreator/templates/wizards/ubuntu/qtquick-app-qmake/wizard.xml 2015-02-04 17:43:11 +0000
89@@ -19,7 +19,7 @@
90 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>
91 <file source="appName/appName.qrc" target="%ClickHookName%/%ClickHookName%.qrc" openeditor="false"/>
92 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>
93- <file source="appName/main.qml" target="%ClickHookName%/main.qml" openeditor="true"/>
94+ <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>
95 <file source="appName/main.cpp" target="%ClickHookName%/main.cpp" openeditor="true"/>
96 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>
97 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>
98
99=== modified file 'share/qtcreator/templates/wizards/ubuntu/share/displayName.qmlproject'
100--- share/qtcreator/templates/wizards/ubuntu/share/displayName.qmlproject 2014-08-19 06:39:27 +0000
101+++ share/qtcreator/templates/wizards/ubuntu/share/displayName.qmlproject 2015-02-04 17:43:11 +0000
102@@ -1,7 +1,7 @@
103 import QmlProject 1.1
104
105 Project {
106- mainFile: "main.qml"
107+ mainFile: "Main.qml"
108
109 /* Include .qml, .js, and image files from current directory and subdirectories */
110 QmlFiles {
111
112=== renamed file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/main.qml' => 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/Main.qml'
113=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop'
114--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop 2015-01-15 12:51:26 +0000
115+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/appName/appName.desktop 2015-02-04 17:43:11 +0000
116@@ -1,6 +1,6 @@
117 [Desktop Entry]
118 Name=%ClickHookName%
119-Exec=qmlscene $@ %ClickHookName%/main.qml
120+Exec=qmlscene $@ %ClickHookName%/Main.qml
121 Icon=%ClickHookName%/%ClickHookName%.png
122 Terminal=false
123 Type=Application
124
125=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml'
126--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml 2015-01-28 10:41:30 +0000
127+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmake/wizard.xml 2015-02-04 17:43:11 +0000
128@@ -18,7 +18,7 @@
129 <!-- APP PARTS -->
130 <file source="appName/appName.pro" target="%ClickHookName%/%ClickHookName%.pro" openeditor="false"/>
131 <file source="appName/appName.png" target="%ClickHookName%/%ClickHookName%.png" openeditor="false" binary="true"/>
132- <file source="appName/main.qml" target="%ClickHookName%/main.qml" openeditor="true"/>
133+ <file source="appName/Main.qml" target="%ClickHookName%/Main.qml" openeditor="true"/>
134 <file source="appName/appName.desktop" target="%ClickHookName%/%ClickHookName%.desktop" openeditor="false"/>
135 <file source="appName/appName.apparmor" target="%ClickHookName%/%ClickHookName%.apparmor" openeditor="false"/>
136 </files>
137
138=== renamed file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/main.qml' => 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/Main.qml'
139=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/Makefile'
140--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/Makefile 2015-01-28 09:59:55 +0000
141+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/Makefile 2015-02-04 17:43:11 +0000
142@@ -35,7 +35,7 @@
143 tests/autopilot/run
144
145 check:
146- qmltestrunner -input tests/unit
147+ qmltestrunner -input tests/qml
148
149 #translation targets
150
151
152=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/displayName.desktop'
153--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/displayName.desktop 2015-01-28 09:59:55 +0000
154+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/displayName.desktop 2015-02-04 17:43:11 +0000
155@@ -1,6 +1,6 @@
156 [Desktop Entry]
157 Name=%ClickHookName%
158-Exec=qmlscene $@ main.qml
159+Exec=qmlscene $@ Main.qml
160 Icon=%ProjectName%.png
161 Terminal=false
162 Type=Application
163
164=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py'
165--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py 2015-01-28 09:59:55 +0000
166+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/autopilot/displayName/__init__.py 2015-02-04 17:43:11 +0000
167@@ -55,7 +55,7 @@
168 "only run from source.")
169
170 def _get_app_qml_source_path(self):
171- qml_file_name = 'main.qml'
172+ qml_file_name = 'Main.qml'
173 return os.path.join(self._get_path_to_app_source(), qml_file_name)
174
175 def _get_path_to_app_source(self):
176
177=== added directory 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/qml'
178=== added file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/qml/tst_main.qml'
179--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/qml/tst_main.qml 1970-01-01 00:00:00 +0000
180+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/tests/qml/tst_main.qml 2015-02-04 17:43:11 +0000
181@@ -0,0 +1,41 @@
182+import QtQuick 2.0
183+import QtTest 1.0
184+import Ubuntu.Test 1.0
185+import "../../"
186+// See more details at https://developer.ubuntu.com/api/qml/sdk-14.10/Ubuntu.Test.UbuntuTestCase
187+
188+// Execute these tests with:
189+// qmltestrunner
190+
191+Item {
192+
193+ width: units.gu(100)
194+ height: units.gu(75)
195+
196+ // The objects
197+ Main {
198+ id: main
199+ }
200+
201+ UbuntuTestCase {
202+ name: "MainTestCase"
203+
204+ when: windowShown
205+
206+
207+ function init() {
208+ var label = findChild(main, "label");
209+ // See the compare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#compare-method
210+ compare("Hello..", label.text);
211+ }
212+
213+ function test_clickButtonMustChangeLabel() {
214+ var button = findChild(main, "button");
215+ var buttonCenter = centerOf(button)
216+ mouseClick(button, buttonCenter.x, buttonCenter.y);
217+ var label = findChild(main, "label");
218+ // See the tryCompare method documentation at https://developer.ubuntu.com/api/qml/sdk-14.10/QtTest.TestCase/#tryCompare-method
219+ tryCompare(label, "text", "..world!", 1);
220+ }
221+ }
222+}
223
224=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml'
225--- share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml 2015-01-28 09:59:55 +0000
226+++ share/qtcreator/templates/wizards/ubuntu/simple-app-qmlproject/wizard.xml 2015-02-04 17:43:11 +0000
227@@ -14,12 +14,13 @@
228 <files>
229 <file source="../share/manifest.json" target="manifest.json" openeditor="true"/>
230 <file source="../share/displayName.qmlproject" target="%ProjectName%.qmlproject" openproject="true"/>
231- <file source="main.qml" target="main.qml" openeditor="true"/>
232+ <file source="Main.qml" target="Main.qml" openeditor="true"/>
233 <file source="displayName.png" target="%ProjectName%.png" openeditor="false" binary="true"/>
234 <file source="displayName.desktop" target="%ClickHookName%.desktop" openeditor="false"/>
235 <file source="tests/autopilot/displayName/test_main.py" target="tests/autopilot/%ProjectName%/test_main.py" openeditor="false"/>
236 <file source="tests/autopilot/displayName/__init__.py" target="tests/autopilot/%ProjectName%/__init__.py" openeditor="false"/>
237 <file source="tests/autopilot/run" target="tests/autopilot/run" openeditor="false"/>
238+ <file source="tests/qml/tst_main.qml" target="tests/qml/tst_main.qml" openeditor="false"/>
239 <file source="Makefile" target="Makefile" openeditor="false"/>
240 <file source="../share/displayName.apparmor" target="%ClickHookName%.apparmor" openeditor="false"/>
241 <file source="../share/.excludes" target=".excludes" openeditor="false"/>
242
243=== modified file 'share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/__init__.py'
244--- share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/__init__.py 2014-10-14 08:33:49 +0000
245+++ share/qtcreator/templates/wizards/ubuntu/simple-i18n-cmake/app/tests/autopilot/displayName/main/__init__.py 2015-02-04 17:43:11 +0000
246@@ -1,1 +1,1 @@
247-""" A main.qml test suite """
248+""" A Main.qml test suite """

Subscribers

People subscribed via source and target branches