Merge lp:~tpeeters/ubuntu-ui-toolkit/qt56fixes2sections into lp:ubuntu-ui-toolkit/staging
- qt56fixes2sections
- Merge into staging
Status: | Superseded | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Proposed branch: | lp:~tpeeters/ubuntu-ui-toolkit/qt56fixes2sections | ||||||||||||
Merge into: | lp:ubuntu-ui-toolkit/staging | ||||||||||||
Diff against target: |
702 lines (+477/-34) 19 files modified
src/UbuntuToolkit/ubuntutoolkitmodule.cpp (+5/-0) src/imports/Components/1.2/MainView.qml (+9/-9) src/imports/Components/1.2/OrientationHelper.qml (+6/-4) src/imports/Components/1.3/MainView.qml (+9/-9) src/imports/Components/1.3/OrientationHelper.qml (+6/-4) tests/unit/components/tst_window_context_property_init_bug1621509.13.qml (+56/-0) tests/unit/mainview11/Settings.qml (+1/-1) tests/unit/mainview13/AppName.qml (+23/-0) tests/unit/mainview13/LocalStorage.qml (+32/-0) tests/unit/mainview13/PageStack.qml (+38/-0) tests/unit/mainview13/PageTitle.qml (+32/-0) tests/unit/mainview13/Settings.qml (+34/-0) tests/unit/mainview13/mainview13.pro (+4/-0) tests/unit/mainview13/tst_mainview.cpp (+216/-0) tests/unit/orientation/tst_orientation.cpp (+2/-2) tests/unit/runtest.sh (+2/-2) tests/unit/unit.pro (+2/-1) tests/unit/visual/tst_pagehead_sections_bug1511839.13.qml (+0/-1) tests/unit/visual/tst_sections.13.qml (+0/-1) |
||||||||||||
To merge this branch: | bzr merge lp:~tpeeters/ubuntu-ui-toolkit/qt56fixes2sections | ||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
ubuntu-sdk-build-bot | continuous-integration | Needs Fixing | |
Ubuntu SDK team | Pending | ||
Review via email:
|
Commit message
void.
Description of the change
Do not approve yet! Testing on CI.
- 2111. By Tim Peeters
-
link bug
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2111
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2111
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2111
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2111
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2111
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 2112. By Tim Peeters
-
clean
- 2113. By Tim Peeters
-
sync staging
- 2114. By Tim Peeters
-
update MainView 1.2
- 2115. By Tim Peeters
-
add mainview13 unit tests
- 2116. By Tim Peeters
-
update mainview 1.3 tests
- 2117. By Tim Peeters
-
clean Settings.qml versions
- 2118. By Tim Peeters
-
update OrientationHelpers, revert orientation tests and add FIXME.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2118
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
- 2119. By Tim Peeters
-
clean. Link a bug
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2118
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2118
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2118
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2118
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild:
https:/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote : | # |
FAILED: Continuous integration, rev:2118
https:/
Executed test runs:
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
FAILURE: https:/
None: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
SUCCESS: https:/
Click here to trigger a rebuild:
https:/
- 2120. By Tim Peeters
-
move new test to visual/
- 2121. By Tim Peeters
-
update MainView12
- 2122. By Tim Peeters
-
don't test Settings with MainView 1.1
- 2123. By Tim Peeters
-
no settings test for 1.1
- 2124. By Tim Peeters
-
update versions in Settings.qml
- 2125. By Tim Peeters
-
change test name
- 2126. By Tim Peeters
-
kick
- 2127. By Tim Peeters
-
sync staging
- 2128. By Tim Peeters
-
kick CI again. Failed on device not found.
- 2129. By Tim Peeters
-
don't check if window is undefined in OrientationHelper
- 2130. By Tim Peeters
-
kick
Unmerged revisions
Preview Diff
1 | === modified file 'src/UbuntuToolkit/ubuntutoolkitmodule.cpp' |
2 | --- src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-09-12 14:07:38 +0000 |
3 | +++ src/UbuntuToolkit/ubuntutoolkitmodule.cpp 2016-09-21 12:26:15 +0000 |
4 | @@ -190,6 +190,11 @@ |
5 | new ContextPropertyChangeListener(context, QStringLiteral("FontUtils")); |
6 | QObject::connect(UCUnits::instance(), SIGNAL(gridUnitChanged()), |
7 | fontUtilsListener, SLOT(updateContextProperty())); |
8 | + |
9 | + // Make the context property 'window' available even before there is a window, |
10 | + // so that in QML we do not have to check whether 'window' is defined, and no new |
11 | + // context property will be added after all components are completed (bug #1621509). |
12 | + context->setContextProperty("window", Q_NULLPTR); |
13 | } |
14 | |
15 | void UbuntuToolkitModule::registerTypesToVersion(const char *uri, int major, int minor) |
16 | |
17 | === modified file 'src/imports/Components/1.2/MainView.qml' |
18 | --- src/imports/Components/1.2/MainView.qml 2015-12-17 09:13:29 +0000 |
19 | +++ src/imports/Components/1.2/MainView.qml 2016-09-21 12:26:15 +0000 |
20 | @@ -204,17 +204,17 @@ |
21 | |
22 | // 'window' is defined by QML between startup and showing on the screen. |
23 | // There is no signal for when it becomes available and re-declaring it is not safe. |
24 | - property bool windowActive: typeof window != 'undefined' |
25 | + property bool windowActive: window !== null |
26 | + function updateWindowTitle() { |
27 | + if (window) { |
28 | + window.title = headerItem.title; |
29 | + } |
30 | + } |
31 | onWindowActiveChanged: { |
32 | - window.title = headerItem.title |
33 | + updateWindowTitle(); |
34 | } |
35 | - |
36 | - Connections { |
37 | - target: headerItem |
38 | - onTitleChanged: { |
39 | - if (headerItem.windowActive) |
40 | - window.title = headerItem.title |
41 | - } |
42 | + onTitleChanged: { |
43 | + updateWindowTitle(); |
44 | } |
45 | |
46 | useDeprecatedToolbar: mainView.useDeprecatedToolbar |
47 | |
48 | === modified file 'src/imports/Components/1.2/OrientationHelper.qml' |
49 | --- src/imports/Components/1.2/OrientationHelper.qml 2016-05-25 12:48:10 +0000 |
50 | +++ src/imports/Components/1.2/OrientationHelper.qml 2016-09-21 12:26:15 +0000 |
51 | @@ -129,20 +129,22 @@ |
52 | http://qt-project.org/doc/qt-5.1/qtqml/qml-qtqml2-qt.html |
53 | http://qt-project.org/doc/qt-5.1/qtquick/qmlmodule-qtquick-window2-qtquick-window-2.html |
54 | */ |
55 | - property bool windowActive: typeof window != 'undefined' |
56 | + property bool windowActive: typeof window != 'undefined' && window !== null |
57 | |
58 | /*! |
59 | Report the current orientation of the application via QWindow::contentOrientation. |
60 | http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop |
61 | */ |
62 | function applyOrientation() { |
63 | - if (windowActive && window) |
64 | - window.contentOrientation = Screen.orientation |
65 | + if (windowActive && window) { |
66 | + window.contentOrientation = Screen.orientation; |
67 | + } |
68 | } |
69 | |
70 | onWindowActiveChanged: { |
71 | - if (automaticOrientation) |
72 | + if (automaticOrientation) { |
73 | applyOrientation(); |
74 | + } |
75 | } |
76 | |
77 | Timer { |
78 | |
79 | === modified file 'src/imports/Components/1.3/MainView.qml' |
80 | --- src/imports/Components/1.3/MainView.qml 2016-07-27 15:40:52 +0000 |
81 | +++ src/imports/Components/1.3/MainView.qml 2016-09-21 12:26:15 +0000 |
82 | @@ -167,17 +167,17 @@ |
83 | |
84 | // 'window' is defined by QML between startup and showing on the screen. |
85 | // There is no signal for when it becomes available and re-declaring it is not safe. |
86 | - property bool windowActive: typeof window != 'undefined' |
87 | + property bool windowActive: window !== null |
88 | + function updateWindowTitle() { |
89 | + if (window) { |
90 | + window.title = headerItem.title; |
91 | + } |
92 | + } |
93 | onWindowActiveChanged: { |
94 | - window.title = headerItem.title |
95 | + updateWindowTitle(); |
96 | } |
97 | - |
98 | - Connections { |
99 | - target: headerItem |
100 | - onTitleChanged: { |
101 | - if (headerItem.windowActive) |
102 | - window.title = headerItem.title |
103 | - } |
104 | + onTitleChanged: { |
105 | + updateWindowTitle(); |
106 | } |
107 | } |
108 | |
109 | |
110 | === modified file 'src/imports/Components/1.3/OrientationHelper.qml' |
111 | --- src/imports/Components/1.3/OrientationHelper.qml 2016-05-25 12:48:10 +0000 |
112 | +++ src/imports/Components/1.3/OrientationHelper.qml 2016-09-21 12:26:15 +0000 |
113 | @@ -129,20 +129,22 @@ |
114 | http://qt-project.org/doc/qt-5.1/qtqml/qml-qtqml2-qt.html |
115 | http://qt-project.org/doc/qt-5.1/qtquick/qmlmodule-qtquick-window2-qtquick-window-2.html |
116 | */ |
117 | - property bool windowActive: typeof window != 'undefined' |
118 | + property bool windowActive: typeof window != 'undefined' && window !== null |
119 | |
120 | /*! |
121 | Report the current orientation of the application via QWindow::contentOrientation. |
122 | http://qt-project.org/doc/qt-5.0/qtgui/qwindow.html#contentOrientation-prop |
123 | */ |
124 | function applyOrientation() { |
125 | - if (windowActive && window) |
126 | - window.contentOrientation = Screen.orientation |
127 | + if (windowActive && window) { |
128 | + window.contentOrientation = Screen.orientation; |
129 | + } |
130 | } |
131 | |
132 | onWindowActiveChanged: { |
133 | - if (automaticOrientation) |
134 | + if (automaticOrientation) { |
135 | applyOrientation(); |
136 | + } |
137 | } |
138 | |
139 | Timer { |
140 | |
141 | === added file 'tests/unit/components/tst_window_context_property_init_bug1621509.13.qml' |
142 | --- tests/unit/components/tst_window_context_property_init_bug1621509.13.qml 1970-01-01 00:00:00 +0000 |
143 | +++ tests/unit/components/tst_window_context_property_init_bug1621509.13.qml 2016-09-21 12:26:15 +0000 |
144 | @@ -0,0 +1,56 @@ |
145 | +/* |
146 | + * Copyright 2016 Canonical Ltd. |
147 | + * |
148 | + * This program is free software; you can redistribute it and/or modify |
149 | + * it under the terms of the GNU Lesser General Public License as published by |
150 | + * the Free Software Foundation; version 3. |
151 | + * |
152 | + * This program is distributed in the hope that it will be useful, |
153 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
154 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
155 | + * GNU Lesser General Public License for more details. |
156 | + * |
157 | + * You should have received a copy of the GNU Lesser General Public License |
158 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
159 | + */ |
160 | + |
161 | +import QtQuick 2.4 |
162 | +import QtTest 1.0 |
163 | + |
164 | +// Ubuntu.Components is not explicitly used below, but its import causes bug #1621509. |
165 | +import Ubuntu.Components 1.3 |
166 | + |
167 | +TestCase { |
168 | + id: testCase |
169 | + name: "EmbeddedListView" |
170 | + width: 100 |
171 | + height: 100 |
172 | + |
173 | + // Bug #1621509 only occurs when we wait for the window to be visible. |
174 | + // Forces the components to be completed before the test functions are executed. |
175 | + when: windowShown |
176 | + |
177 | + Item { |
178 | + id: testItem |
179 | + |
180 | + // This property changes its value when a new context property is added. |
181 | + property var myObject: objectOne |
182 | + property int count: 0 |
183 | + onMyObjectChanged: { |
184 | + count++; |
185 | + } |
186 | + Component.onCompleted: { |
187 | + count = 0; |
188 | + print("Component completed."); // must print something to reproduce the bug. |
189 | + } |
190 | + QtObject { |
191 | + objectName: "one" |
192 | + id: objectOne |
193 | + } |
194 | + } |
195 | + |
196 | + function test_no_property_change_after_completed_bug1621509_bug1610231() { |
197 | + compare(testItem.count, 0, |
198 | + "The property was changed after the component was completed."); |
199 | + } |
200 | +} |
201 | |
202 | === renamed directory 'tests/unit/mainview' => 'tests/unit/mainview11' |
203 | === modified file 'tests/unit/mainview11/Settings.qml' |
204 | --- tests/unit/mainview/Settings.qml 2016-01-20 16:42:29 +0000 |
205 | +++ tests/unit/mainview11/Settings.qml 2016-09-21 12:26:15 +0000 |
206 | @@ -15,7 +15,7 @@ |
207 | */ |
208 | |
209 | import QtQuick 2.0 |
210 | -import Ubuntu.Components 1.3 |
211 | +import Ubuntu.Components 1.1 |
212 | import Qt.labs.settings 1.0 |
213 | |
214 | MainView { |
215 | |
216 | === renamed file 'tests/unit/mainview/mainview.pro' => 'tests/unit/mainview11/mainview11.pro' |
217 | === added directory 'tests/unit/mainview13' |
218 | === added file 'tests/unit/mainview13/AppName.qml' |
219 | --- tests/unit/mainview13/AppName.qml 1970-01-01 00:00:00 +0000 |
220 | +++ tests/unit/mainview13/AppName.qml 2016-09-21 12:26:15 +0000 |
221 | @@ -0,0 +1,23 @@ |
222 | +/* |
223 | + * Copyright 2016 Canonical Ltd. |
224 | + * |
225 | + * This program is free software; you can redistribute it and/or modify |
226 | + * it under the terms of the GNU Lesser General Public License as published by |
227 | + * the Free Software Foundation; version 3. |
228 | + * |
229 | + * This program is distributed in the hope that it will be useful, |
230 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
231 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
232 | + * GNU Lesser General Public License for more details. |
233 | + * |
234 | + * You should have received a copy of the GNU Lesser General Public License |
235 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
236 | + */ |
237 | + |
238 | +import QtQuick 2.4 |
239 | +import Ubuntu.Components 1.3 |
240 | + |
241 | +MainView { |
242 | + objectName: "appName" |
243 | + applicationName: "org.gnu.wildebeest" |
244 | +} |
245 | |
246 | === added file 'tests/unit/mainview13/LocalStorage.qml' |
247 | --- tests/unit/mainview13/LocalStorage.qml 1970-01-01 00:00:00 +0000 |
248 | +++ tests/unit/mainview13/LocalStorage.qml 2016-09-21 12:26:15 +0000 |
249 | @@ -0,0 +1,32 @@ |
250 | +/* |
251 | + * Copyright 2016 Canonical Ltd. |
252 | + * |
253 | + * This program is free software; you can redistribute it and/or modify |
254 | + * it under the terms of the GNU Lesser General Public License as published by |
255 | + * the Free Software Foundation; version 3. |
256 | + * |
257 | + * This program is distributed in the hope that it will be useful, |
258 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
259 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
260 | + * GNU Lesser General Public License for more details. |
261 | + * |
262 | + * You should have received a copy of the GNU Lesser General Public License |
263 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
264 | + */ |
265 | + |
266 | +import QtQuick 2.4 |
267 | +import Ubuntu.Components 1.3 |
268 | +import QtQuick.LocalStorage 2.0 |
269 | + |
270 | +MainView { |
271 | + objectName: "localStorage" |
272 | + applicationName: "tv.island.pacific" |
273 | + |
274 | + Component.onCompleted: { |
275 | + var db = LocalStorage.openDatabaseSync("pacific.island.tv", "1.0", "lorem ipsum", 1000) |
276 | + db.transaction(function(tx){ |
277 | + tx.executeSql('CREATE TABLE IF NOT EXISTS Island(name TEXT)') |
278 | + tx.executeSql('INSERT INTO Island VALUES(?)', ['Tuvalu']) |
279 | + }) |
280 | + } |
281 | +} |
282 | |
283 | === added file 'tests/unit/mainview13/PageStack.qml' |
284 | --- tests/unit/mainview13/PageStack.qml 1970-01-01 00:00:00 +0000 |
285 | +++ tests/unit/mainview13/PageStack.qml 2016-09-21 12:26:15 +0000 |
286 | @@ -0,0 +1,38 @@ |
287 | +/* |
288 | + * Copyright 2016 Canonical Ltd. |
289 | + * |
290 | + * This program is free software; you can redistribute it and/or modify |
291 | + * it under the terms of the GNU Lesser General Public License as published by |
292 | + * the Free Software Foundation; version 3. |
293 | + * |
294 | + * This program is distributed in the hope that it will be useful, |
295 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
296 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
297 | + * GNU Lesser General Public License for more details. |
298 | + * |
299 | + * You should have received a copy of the GNU Lesser General Public License |
300 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
301 | + */ |
302 | + |
303 | +import QtQuick 2.4 |
304 | +import Ubuntu.Components 1.3 |
305 | + |
306 | +MainView { |
307 | + objectName: "pageStack" |
308 | + applicationName: "once.upon.a.time" |
309 | + |
310 | + PageStack { |
311 | + id: stack |
312 | + objectName: "stack" |
313 | + Component.onCompleted: stack.push(pageOnStack) |
314 | + |
315 | + Page { |
316 | + id: pageOnStack |
317 | + objectName: "page" |
318 | + title: 'Far far away' // sets the window title. |
319 | + header: PageHeader { |
320 | + title: pageOnStack.title |
321 | + } |
322 | + } |
323 | + } |
324 | +} |
325 | |
326 | === added file 'tests/unit/mainview13/PageTitle.qml' |
327 | --- tests/unit/mainview13/PageTitle.qml 1970-01-01 00:00:00 +0000 |
328 | +++ tests/unit/mainview13/PageTitle.qml 2016-09-21 12:26:15 +0000 |
329 | @@ -0,0 +1,32 @@ |
330 | +/* |
331 | + * Copyright 2016 Canonical Ltd. |
332 | + * |
333 | + * This program is free software; you can redistribute it and/or modify |
334 | + * it under the terms of the GNU Lesser General Public License as published by |
335 | + * the Free Software Foundation; version 3. |
336 | + * |
337 | + * This program is distributed in the hope that it will be useful, |
338 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
339 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
340 | + * GNU Lesser General Public License for more details. |
341 | + * |
342 | + * You should have received a copy of the GNU Lesser General Public License |
343 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
344 | + */ |
345 | + |
346 | +import QtQuick 2.4 |
347 | +import Ubuntu.Components 1.3 |
348 | + |
349 | +MainView { |
350 | + objectName: "pageTitle" |
351 | + applicationName: "once.upon.a.time" |
352 | + |
353 | + Page { |
354 | + id: page |
355 | + objectName: "page" |
356 | + title: 'Once upon a time' // sets the window title |
357 | + header: PageHeader { |
358 | + title: page.title |
359 | + } |
360 | + } |
361 | +} |
362 | |
363 | === added file 'tests/unit/mainview13/Settings.qml' |
364 | --- tests/unit/mainview13/Settings.qml 1970-01-01 00:00:00 +0000 |
365 | +++ tests/unit/mainview13/Settings.qml 2016-09-21 12:26:15 +0000 |
366 | @@ -0,0 +1,34 @@ |
367 | +/* |
368 | + * Copyright 2014 Canonical Ltd. |
369 | + * |
370 | + * This program is free software; you can redistribute it and/or modify |
371 | + * it under the terms of the GNU Lesser General Public License as published by |
372 | + * the Free Software Foundation; version 3. |
373 | + * |
374 | + * This program is distributed in the hope that it will be useful, |
375 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
376 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
377 | + * GNU Lesser General Public License for more details. |
378 | + * |
379 | + * You should have received a copy of the GNU Lesser General Public License |
380 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
381 | + */ |
382 | + |
383 | +import QtQuick 2.4 |
384 | +import Ubuntu.Components 1.3 |
385 | +import Qt.labs.settings 1.0 |
386 | + |
387 | +MainView { |
388 | + objectName: "settings" |
389 | + applicationName: "red.riding.hood" |
390 | + |
391 | + Settings { |
392 | + property alias nickname: textField.text |
393 | + } |
394 | + |
395 | + TextField { |
396 | + id: textField |
397 | + objectName: "textfield" |
398 | + text: "Red" |
399 | + } |
400 | +} |
401 | |
402 | === added file 'tests/unit/mainview13/mainview13.pro' |
403 | --- tests/unit/mainview13/mainview13.pro 1970-01-01 00:00:00 +0000 |
404 | +++ tests/unit/mainview13/mainview13.pro 2016-09-21 12:26:15 +0000 |
405 | @@ -0,0 +1,4 @@ |
406 | +include(../test-include.pri) |
407 | + |
408 | +QT += gui |
409 | +SOURCES += tst_mainview.cpp |
410 | |
411 | === added file 'tests/unit/mainview13/tst_mainview.cpp' |
412 | --- tests/unit/mainview13/tst_mainview.cpp 1970-01-01 00:00:00 +0000 |
413 | +++ tests/unit/mainview13/tst_mainview.cpp 2016-09-21 12:26:15 +0000 |
414 | @@ -0,0 +1,216 @@ |
415 | +/* |
416 | + * Copyright 2012-2013 Canonical Ltd. |
417 | + * |
418 | + * This program is free software; you can redistribute it and/or modify |
419 | + * it under the terms of the GNU Lesser General Public License as published by |
420 | + * the Free Software Foundation; version 3. |
421 | + * |
422 | + * This program is distributed in the hope that it will be useful, |
423 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
424 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
425 | + * GNU Lesser General Public License for more details. |
426 | + * |
427 | + * You should have received a copy of the GNU Lesser General Public License |
428 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
429 | + * |
430 | + * Author: Christian Dywan <christian.dywan@canonical.com> |
431 | + */ |
432 | + |
433 | +#include <QtCore/QCoreApplication> |
434 | +#include <QtCore/QCryptographicHash> |
435 | +#include <QtCore/QDebug> |
436 | +#include <QtCore/QDir> |
437 | +#include <QtCore/QFileInfo> |
438 | +#include <QtCore/QProcessEnvironment> |
439 | +#include <QtCore/QSettings> |
440 | +#include <QtCore/QStandardPaths> |
441 | +#include <QtCore/QString> |
442 | +#include <QtCore/QTextCodec> |
443 | +#include <QtCore/QThread> |
444 | +#include <QtQml/QQmlEngine> |
445 | +#include <QtQuick/QQuickItem> |
446 | +#include <QtQuick/QQuickView> |
447 | +#include <QtTest/QSignalSpy> |
448 | +#include <QtTest/QTest> |
449 | +#include <UbuntuToolkit/ubuntutoolkitmodule.h> |
450 | +#include <UbuntuToolkit/private/ucapplication_p.h> |
451 | +#include <UbuntuToolkit/private/ucunits_p.h> |
452 | + |
453 | +#include "uctestcase.h" |
454 | + |
455 | +UT_USE_NAMESPACE |
456 | + |
457 | +class tst_MainView : public QObject |
458 | +{ |
459 | + Q_OBJECT |
460 | + |
461 | +private: |
462 | + QQuickView *view; |
463 | + |
464 | +public: |
465 | + tst_MainView() : |
466 | + view(0) |
467 | + { |
468 | + } |
469 | + |
470 | + QQuickItem *loadTest(const QString &document) |
471 | + { |
472 | + // load the document |
473 | + view->setSource(QUrl::fromLocalFile(document)); |
474 | + QTest::waitForEvents(); |
475 | + |
476 | + return view->rootObject(); |
477 | + } |
478 | + |
479 | + QQuickItem *testItem(QQuickItem *that, const QString &identifier) |
480 | + { |
481 | + if (that->property(identifier.toLocal8Bit()).isValid()) |
482 | + return that->property(identifier.toLocal8Bit()).value<QQuickItem*>(); |
483 | + |
484 | + QList<QQuickItem*> children = that->findChildren<QQuickItem*>(identifier); |
485 | + return (children.count() > 0) ? children[0] : 0; |
486 | + } |
487 | + |
488 | +private Q_SLOTS: |
489 | + |
490 | + void initTestCase() |
491 | + { |
492 | + QString modules(UBUNTU_QML_IMPORT_PATH); |
493 | + QVERIFY(QDir(modules).exists()); |
494 | + |
495 | + view = new QQuickView; |
496 | + QQmlEngine *quickEngine = view->engine(); |
497 | + UbuntuToolkitModule::initializeContextProperties(quickEngine); |
498 | + |
499 | + view->setGeometry(0,0, UCUnits::instance()->gu(40), UCUnits::instance()->gu(30)); |
500 | + //add modules folder so we have access to the plugin from QML |
501 | + QStringList imports = quickEngine->importPathList(); |
502 | + imports.prepend(QDir(modules).absolutePath()); |
503 | + quickEngine->setImportPathList(imports); |
504 | + } |
505 | + |
506 | + void cleanupTestCase() |
507 | + { |
508 | + delete view; |
509 | + } |
510 | + |
511 | + void testCase_AppName() |
512 | + { |
513 | + QQuickItem *root = loadTest("AppName.qml"); |
514 | + QVERIFY(root); |
515 | + QQuickItem *mainView = root; |
516 | + QString applicationName(mainView->property("applicationName").toString()); |
517 | + QCOMPARE(applicationName, QString("org.gnu.wildebeest")); |
518 | + QCOMPARE(applicationName, QCoreApplication::applicationName()); |
519 | + QCOMPARE(QString(""), QCoreApplication::organizationName()); |
520 | + } |
521 | + |
522 | + void testSetApplicationName() { |
523 | + QString appName("com.ubuntu.foo"); |
524 | + UCApplication::instance()->setApplicationName(appName); |
525 | + QCOMPARE(UCApplication::instance()->applicationName(), appName); |
526 | + QCOMPARE(QCoreApplication::applicationName(), appName); |
527 | + QCOMPARE(QString(""), QCoreApplication::organizationName()); |
528 | + } |
529 | + |
530 | + void testExpectedDataFolder() { |
531 | + QString appName("net.weight.gain"); |
532 | + UCApplication::instance()->setApplicationName(appName); |
533 | + QString dataFolder(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); |
534 | + QString xdgDataHome(QProcessEnvironment::systemEnvironment().value("XDG_DATA_HOME", |
535 | + QProcessEnvironment::systemEnvironment().value("HOME") + "/.local/share")); |
536 | + QString expectedDataFolder(xdgDataHome + "/" + appName); |
537 | + QCOMPARE(dataFolder, expectedDataFolder); |
538 | + } |
539 | + |
540 | + void testExpectedCacheFolder() { |
541 | + QString appName("cat.long.very"); |
542 | + UCApplication::instance()->setApplicationName(appName); |
543 | + QString cacheFolder(QStandardPaths::writableLocation(QStandardPaths::CacheLocation)); |
544 | + QString xdgCacheHome(QProcessEnvironment::systemEnvironment().value("XDG_CACHE_HOME", |
545 | + QProcessEnvironment::systemEnvironment().value("HOME") + "/.cache")); |
546 | + QString expectedCacheFolder(xdgCacheHome + "/" + appName); |
547 | + QCOMPARE(cacheFolder, expectedCacheFolder); |
548 | + } |
549 | + |
550 | + void testLocalStorage() { |
551 | + QQuickItem *root = loadTest("LocalStorage.qml"); |
552 | + QVERIFY(root); |
553 | + QQuickItem *mainView = root; |
554 | + QString applicationName(mainView->property("applicationName").toString()); |
555 | + QCOMPARE(applicationName, QString("tv.island.pacific")); |
556 | + QCOMPARE(applicationName, QCoreApplication::applicationName()); |
557 | + QCOMPARE(QString(""), QCoreApplication::organizationName()); |
558 | + QString dataFolder(QStandardPaths::writableLocation(QStandardPaths::DataLocation)); |
559 | + QString databaseFolder(dataFolder + "/Databases"); |
560 | + QVERIFY(QFile::exists(databaseFolder)); |
561 | + QString hash(QCryptographicHash::hash("pacific.island.tv", QCryptographicHash::Md5).toHex()); |
562 | + QString database(databaseFolder + "/" + hash + ".sqlite"); |
563 | + QVERIFY(QFile::exists(database)); |
564 | + } |
565 | + |
566 | + QString getConfFile(QString applicationName) { |
567 | + QString configFolder(QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)); |
568 | + QString subFolder(configFolder + "/" + applicationName); |
569 | + QString filename(subFolder + "/" + applicationName + ".conf"); |
570 | + return filename; |
571 | + } |
572 | + |
573 | + void testLabsSettings() { |
574 | + QString applicationName("red.riding.hood"); |
575 | + // Delete file if it exists to avoid false positives |
576 | + QString filename(getConfFile(applicationName)); |
577 | + QFile::remove(filename); |
578 | + |
579 | + QQuickItem *root = loadTest("Settings.qml"); |
580 | + QVERIFY(root); |
581 | + QQuickItem *mainView = root; |
582 | + QCOMPARE(applicationName, mainView->property("applicationName").toString()); |
583 | + QCOMPARE(QString(applicationName), QCoreApplication::organizationDomain()); |
584 | + QQuickItem *textField(testItem(mainView, "textfield")); |
585 | + textField->setProperty("text", "Blue"); |
586 | + delete root; |
587 | + QVERIFY(QFile::exists(filename)); |
588 | + } |
589 | + |
590 | + void testQSettings() { |
591 | + QString applicationName("i.prefer.pi"); |
592 | + // Delete file if it exists to avoid false positives |
593 | + QString filename(getConfFile(applicationName)); |
594 | + QFile::remove(filename); |
595 | + |
596 | + UCApplication::instance()->setApplicationName(applicationName); |
597 | + // QSettings with defaults |
598 | + QSettings mySettings; |
599 | + mySettings.setValue("spam", "eggs"); |
600 | + // Force writing to disk |
601 | + mySettings.sync(); |
602 | + QVERIFY(QFile::exists(filename)); |
603 | + } |
604 | + |
605 | + void testNoWarnings_bug186065() { |
606 | + // An empty MainView would suffice |
607 | + QScopedPointer<UbuntuTestCase>testCase (new UbuntuTestCase("AppName.qml")); |
608 | + |
609 | + // No warnings from QML |
610 | + QCOMPARE(testCase->warnings(), 0); |
611 | + } |
612 | + |
613 | + void testWindowTitleFromPage() { |
614 | + QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("PageTitle.qml")); |
615 | + QQuickItem *page = testCase->findItem<QQuickItem*>("page"); |
616 | + QCOMPARE(QString("Once upon a time"), page->property("title").toString()); |
617 | + QCOMPARE(testCase->title(), page->property("title").toString()); |
618 | + } |
619 | + |
620 | + void testWindowTitleFromStack() { |
621 | + QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("PageStack.qml")); |
622 | + QQuickItem *page = testCase->findItem<QQuickItem*>("page"); |
623 | + QCOMPARE(QString("Far far away"), page->property("title").toString()); |
624 | + QCOMPARE(testCase->title(), page->property("title").toString()); |
625 | + } |
626 | +}; |
627 | + |
628 | +QTEST_MAIN(tst_MainView) |
629 | + |
630 | +#include "tst_mainview.moc" |
631 | |
632 | === modified file 'tests/unit/orientation/tst_orientation.cpp' |
633 | --- tests/unit/orientation/tst_orientation.cpp 2016-09-09 17:49:07 +0000 |
634 | +++ tests/unit/orientation/tst_orientation.cpp 2016-09-21 12:26:15 +0000 |
635 | @@ -52,12 +52,12 @@ |
636 | QScopedPointer<UbuntuTestCase> testCase(new UbuntuTestCase("ManualAngle.qml")); |
637 | QQuickItem *helper = testCase->findItem<QQuickItem*>("helper"); |
638 | // No warning about "window" being undefined must appear |
639 | - QSKIP("TypeError: Cannot set property 'contentOrientation' of null"); |
640 | + QSKIP("FIXME: We have no valid effectiveness tests for OrientationHelper. See bug #1626063."); |
641 | QCOMPARE(testCase->warnings(), 0); |
642 | QCOMPARE(helper->property("orientationAngle").toInt(), 90); |
643 | // Verify expected values |
644 | QQuickItem *checkpoint = testCase->findItem<QQuickItem*>("checkpoint"); |
645 | - // window.contentOrientation |
646 | + // window.contentOrientation |
647 | QCOMPARE(checkpoint->property("contentOrientation").toInt(), helper->property("orientationAngle").toInt()); |
648 | } |
649 | }; |
650 | |
651 | === modified file 'tests/unit/runtest.sh' |
652 | --- tests/unit/runtest.sh 2016-06-07 12:53:59 +0000 |
653 | +++ tests/unit/runtest.sh 2016-09-21 12:26:15 +0000 |
654 | @@ -45,8 +45,8 @@ |
655 | echo 'Examples:' |
656 | echo " $0 $(relpath ${BUILD_DIR}/tests/unit/components/components) $(relpath ${SRC_DIR}/tests/unit/components/tst_label13.qml) minimal" |
657 | echo '' |
658 | - echo " cd $(relpath ${BUILD_DIR}/tests/unit/mainview)" |
659 | - echo " ../$(basename $0) mainview minimal" |
660 | + echo " cd $(relpath ${BUILD_DIR}/tests/unit/mainview13)" |
661 | + echo " ../$(basename $0) mainview13 minimal" |
662 | echo " cd ../../.." |
663 | echo '' |
664 | echo " cd $(relpath ${BUILD_DIR}/tests/unit/visual)" |
665 | |
666 | === modified file 'tests/unit/unit.pro' |
667 | --- tests/unit/unit.pro 2016-09-19 15:16:44 +0000 |
668 | +++ tests/unit/unit.pro 2016-09-21 12:26:15 +0000 |
669 | @@ -39,7 +39,8 @@ |
670 | scaling_image_provider \ |
671 | qquick_image_extension \ |
672 | performance \ |
673 | - mainview \ |
674 | + mainview11 \ |
675 | + mainview13 \ |
676 | i18n \ |
677 | arguments \ |
678 | argument \ |
679 | |
680 | === renamed file 'tests/unit/visual/FIXME-QT56_pagehead_sections_bug1511839.13.qml' => 'tests/unit/visual/tst_pagehead_sections_bug1511839.13.qml' |
681 | --- tests/unit/visual/FIXME-QT56_pagehead_sections_bug1511839.13.qml 2016-09-16 11:13:32 +0000 |
682 | +++ tests/unit/visual/tst_pagehead_sections_bug1511839.13.qml 2016-09-21 12:26:15 +0000 |
683 | @@ -40,7 +40,6 @@ |
684 | stack.push(pageComponent) |
685 | } |
686 | |
687 | - // FIXME: Tests failing with Qt 5.6. See bug #1624337. |
688 | UbuntuTestCase { |
689 | id: testCase |
690 | name: "Page.head.sections" |
691 | |
692 | === renamed file 'tests/unit/visual/FIXME-QT56_sections.13.qml' => 'tests/unit/visual/tst_sections.13.qml' |
693 | --- tests/unit/visual/FIXME-QT56_sections.13.qml 2016-09-16 11:13:32 +0000 |
694 | +++ tests/unit/visual/tst_sections.13.qml 2016-09-21 12:26:15 +0000 |
695 | @@ -142,7 +142,6 @@ |
696 | name: "SectionsApi" |
697 | when: windowShown |
698 | |
699 | - // FIXME: Fails with Qt 5.6. See bug #1610231. |
700 | function initTestCase() { |
701 | // The initially selected actions must be triggered. |
702 | compare(label.text, "First action triggered.", |
FAILED: Continuous integration, rev:2111 /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-i386- gles-stable/ 1198/ /jenkins. ubuntu. com/ubuntu- sdk/job/ generic- update- mp/6519/ console
https:/
Executed test runs:
None: https:/
Click here to trigger a rebuild: /jenkins. ubuntu. com/ubuntu- sdk/job/ ubuntu- ui-toolkit- ci-i386- gles-stable/ 1198/rebuild
https:/