Merge lp:~nick-dedekind/ubuntu-settings-components/uqmlscene into lp:~registry/ubuntu-settings-components/trunk

Proposed by Nick Dedekind on 2014-07-31
Status: Merged
Approved by: Michał Sawicz on 2014-08-08
Approved revision: 81
Merged at revision: 76
Proposed branch: lp:~nick-dedekind/ubuntu-settings-components/uqmlscene
Merge into: lp:~registry/ubuntu-settings-components/trunk
Diff against target: 1096 lines (+145/-138)
26 files modified
CMakeLists.txt (+23/-0)
cmake/modules/QmlTest.cmake (+1/-1)
tests/qmltests/Components/tst_Calendar.qml (+4/-6)
tests/qmltests/Components/tst_StatusIcon.qml (+7/-8)
tests/qmltests/Menus/tst_AccessPointMenu.qml (+6/-7)
tests/qmltests/Menus/tst_ButtonMenu.qml (+4/-5)
tests/qmltests/Menus/tst_CalendarMenu.qml (+3/-4)
tests/qmltests/Menus/tst_CheckableMenu.qml (+4/-5)
tests/qmltests/Menus/tst_EventMenu.qml (+1/-1)
tests/qmltests/Menus/tst_GroupedMessageMenu.qml (+1/-3)
tests/qmltests/Menus/tst_MediaPlayerMenu.qml (+4/-5)
tests/qmltests/Menus/tst_PlaybackItemMenu.qml (+3/-4)
tests/qmltests/Menus/tst_ProgressBarMenu.qml (+1/-1)
tests/qmltests/Menus/tst_ProgressValueMenu.qml (+3/-4)
tests/qmltests/Menus/tst_SectionMenu.qml (+3/-4)
tests/qmltests/Menus/tst_SimpleTextMessageMenu.qml (+5/-7)
tests/qmltests/Menus/tst_SliderMenu.qml (+7/-8)
tests/qmltests/Menus/tst_SnapDecisionMenu.qml (+17/-19)
tests/qmltests/Menus/tst_SwitchMenu.qml (+4/-5)
tests/qmltests/Menus/tst_TextMessageMenu.qml (+10/-12)
tests/qmltests/Menus/tst_TimeZoneMenu.qml (+3/-4)
tests/qmltests/Menus/tst_TransferMenu.qml (+8/-9)
tests/qmltests/Menus/tst_UserSessionMenu.qml (+4/-5)
tests/qmltests/utils.js (+0/-11)
tests/utils/modules/Ubuntu/Test/plugin.cpp (+18/-0)
tests/utils/modules/Ubuntu/Test/plugin.h (+1/-0)
To merge this branch: bzr merge lp:~nick-dedekind/ubuntu-settings-components/uqmlscene
Reviewer Review Type Date Requested Status
Michał Sawicz (community) Approve on 2014-08-08
PS Jenkins bot (community) continuous-integration Needs Fixing on 2014-08-08
Ubuntu Unity PS integration team packaging 2014-07-31 Pending
Andrea Cimitan 2014-07-31 Pending
Review via email: mp+229081@code.launchpad.net

Commit message

Added ability to use try*. Added target for test files in qcreator.

Description of the change

Added ability to use try*. Added target for test files in qcreator.

To post a comment you must log in.
Nick Dedekind (nick-dedekind) wrote :

jenkins failing due to lacking xvfb-run

77. By Nick Dedekind on 2014-08-04

reverted changes to use xvfb

78. By Nick Dedekind on 2014-08-05

removed uqmlscene. Use UbuntuTestCase.

79. By Nick Dedekind on 2014-08-07

removed utils.js

80. By Nick Dedekind on 2014-08-07

removed whitespace

81. By Nick Dedekind on 2014-08-07

removed unnecessary change

Michał Sawicz (saviq) wrote :

 * Did you perform an exploratory manual test run of the code change and any related functionality?
Yes.

 * Did CI run pass? If not, please explain why.
Yes, the failure is due to CI weirdness, Test Result says all fine, and passes locally.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2014-06-26 13:01:19 +0000
3+++ CMakeLists.txt 2014-08-07 15:18:10 +0000
4@@ -69,6 +69,29 @@
5 endif()
6 endif()
7
8+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
9+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-permissive -pedantic -Wall -Wextra")
10+
11+if ("${CMAKE_BUILD_TYPE}" STREQUAL "release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "relwithdebinfo")
12+ option(Werror "Treat warnings as errors" ON)
13+else()
14+ option(Werror "Treat warnings as errors" OFF)
15+endif()
16+
17+if (Werror)
18+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
19+endif()
20+
21+file(GLOB_RECURSE QML_EXTRA_FILES
22+ ${CMAKE_SOURCE_DIR}/tests/*.qml
23+ ${CMAKE_SOURCE_DIR}/tests/*.js
24+ ${CMAKE_SOURCE_DIR}/tests/*.jpg
25+ ${CMAKE_SOURCE_DIR}/tests/*.png
26+ ${CMAKE_SOURCE_DIR}/tests/*.sci
27+ ${CMAKE_SOURCE_DIR}/tests/*.svg
28+)
29+add_custom_target(qml_fake_target SOURCES ${QML_EXTRA_FILES})
30+
31 # Tests
32 enable_testing()
33
34
35=== modified file 'cmake/modules/QmlTest.cmake'
36--- cmake/modules/QmlTest.cmake 2013-09-24 10:04:36 +0000
37+++ cmake/modules/QmlTest.cmake 2014-08-07 15:18:10 +0000
38@@ -50,7 +50,7 @@
39
40 set(qmlscene_command
41 env ${qmltest_ENVIRONMENT}
42- ${qmlscene_exe} ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
43+ ${qmlscene_exe} ${CMAKE_CURRENT_SOURCE_DIR}/${qmltest_FILE}.qml
44 ${qmlscene_imports}
45 )
46 add_custom_target(${qmlscene_TARGET} ${qmlscene_command})
47
48=== modified file 'tests/qmltests/Components/tst_Calendar.qml'
49--- tests/qmltests/Components/tst_Calendar.qml 2013-10-04 10:04:18 +0000
50+++ tests/qmltests/Components/tst_Calendar.qml 2014-08-07 15:18:10 +0000
51@@ -18,15 +18,14 @@
52
53 import QtQuick 2.0
54 import QtTest 1.0
55-import Ubuntu.Components 0.1
56+import Ubuntu.Test 0.1
57 import Ubuntu.Settings.Components 0.1
58-import "../utils.js" as UtilsJS
59
60 Item {
61 width: units.gu(42)
62 height: units.gu(75)
63
64- Label {
65+ Text {
66 id: label
67 anchors {
68 left: parent.left
69@@ -35,7 +34,6 @@
70 margins: units.gu(2)
71 }
72 height: units.gu(5)
73- fontSize: "large"
74 text: Qt.formatDate(calendar.currentDate, "MMMM") + " " + calendar.currentDate.getFullYear()
75 }
76
77@@ -50,7 +48,7 @@
78 selectedDate: new Date()
79 }
80
81- TestCase {
82+ UbuntuTestCase {
83 name: "Calendar"
84 when: windowShown
85
86@@ -94,7 +92,7 @@
87 calendar.firstDayOfWeek = data.firstDayOfWeek;
88
89 for (var i = 0; i < (6*7); i++) {
90- var dayColumn = UtilsJS.findChild(calendar, "dayItem" + i);
91+ var dayColumn = findChild(calendar, "dayItem" + i);
92 verify(dayColumn);
93
94 compare(dayColumn.dayStart.getDay(), (data.firstDayOfWeek + i)%7, "Day column does not match expected for firstDayOfWeek");
95
96=== modified file 'tests/qmltests/Components/tst_StatusIcon.qml'
97--- tests/qmltests/Components/tst_StatusIcon.qml 2014-07-01 10:41:39 +0000
98+++ tests/qmltests/Components/tst_StatusIcon.qml 2014-08-07 15:18:10 +0000
99@@ -16,9 +16,8 @@
100
101 import QtQuick 2.0
102 import QtTest 1.0
103-import Ubuntu.Components 0.1
104+import Ubuntu.Test 0.1
105 import Ubuntu.Settings.Components 0.1
106-import "../utils.js" as UtilsJS
107
108 Item {
109 width: units.gu(40)
110@@ -30,7 +29,7 @@
111 height: units.gu(3)
112 }
113
114- TestCase {
115+ UbuntuTestCase {
116 name: "StatusIcon"
117 when: windowShown
118
119@@ -43,14 +42,14 @@
120 function test_icon() {
121 icon.source = "image://theme/bar,gps,baz";
122
123- var image = UtilsJS.findChild(icon, "image");
124+ var image = findChild(icon, "image");
125 tryCompare(image, "source", "file://" + image.iconPath.arg("status").arg("gps"));
126 }
127
128 function test_iconFallback() {
129 icon.source = "image://theme/foo,bar,baz";
130
131- var image = UtilsJS.findChild(icon, "image");
132+ var image = findChild(icon, "image");
133 tryCompare(image, "source", "file://" + image.iconPath.arg("status").arg("baz"));
134 }
135
136@@ -58,7 +57,7 @@
137 icon.source = "image://theme/bar,add,baz";
138 icon.sets = [ "foo", "actions", "bar" ]
139
140- var image = UtilsJS.findChild(icon, "image");
141+ var image = findChild(icon, "image");
142 tryCompare(image, "source", "file://" + image.iconPath.arg("actions").arg("add"));
143 }
144
145@@ -66,12 +65,12 @@
146 icon.source = "image://theme/add,bar,baz";
147 icon.sets = [ "foo", "bar", "baz" ]
148
149- var image = UtilsJS.findChild(icon, "image");
150+ var image = findChild(icon, "image");
151 tryCompare(image, "source", "file://" + image.iconPath.arg("baz").arg("baz"));
152 }
153
154 function test_iconSource() {
155- var image = UtilsJS.findChild(icon, "image");
156+ var image = findChild(icon, "image");
157 icon.source = image.iconPath.arg("status").arg("gps");
158
159 tryCompare(image, "source", "file://" + image.iconPath.arg("status").arg("gps"));
160
161=== modified file 'tests/qmltests/Menus/tst_AccessPointMenu.qml'
162--- tests/qmltests/Menus/tst_AccessPointMenu.qml 2014-03-26 17:50:59 +0000
163+++ tests/qmltests/Menus/tst_AccessPointMenu.qml 2014-08-07 15:18:10 +0000
164@@ -18,9 +18,8 @@
165
166 import QtQuick 2.0
167 import QtTest 1.0
168-import Ubuntu.Components 0.1
169+import Ubuntu.Test 0.1
170 import Ubuntu.Settings.Menus 0.1
171-import "../utils.js" as UtilsJS
172
173 Item {
174 width: units.gu(42)
175@@ -62,7 +61,7 @@
176 target: accessPoint
177 }
178
179- TestCase {
180+ UbuntuTestCase {
181 name: "AccessPointMenu"
182 when: windowShown
183
184@@ -108,14 +107,14 @@
185 accessPoint.signalStrength = data.signal;
186 accessPoint.adHoc = data.adHoc;
187
188- var icon = UtilsJS.findChild(accessPoint, "iconSignal");
189+ var icon = findChild(accessPoint, "iconSignal");
190 verify(icon !== undefined);
191
192 compare(icon.name, data.icon, "Incorret icon for strength");
193 }
194
195 function test_secure(data) {
196- var icon = UtilsJS.findChild(accessPoint, "iconSecure");
197+ var icon = findChild(accessPoint, "iconSecure");
198 verify(icon !== undefined);
199
200 accessPoint.secure = true;
201@@ -126,7 +125,7 @@
202 }
203
204 function test_checkBox(data) {
205- var checkBox = UtilsJS.findChild(accessPoint, "checkBox");
206+ var checkBox = findChild(accessPoint, "checkBox");
207 verify(checkBox !== undefined);
208
209 accessPoint.checked = true;
210@@ -137,7 +136,7 @@
211 }
212
213 function test_checkBox_on_default_checked() {
214- var checkBox = UtilsJS.findChild(accessPoint2, "checkBox");
215+ var checkBox = findChild(accessPoint2, "checkBox");
216 verify(checkBox !== undefined);
217
218 compare(checkBox.checked, true, "Check box should be checked if default to checked")
219
220=== modified file 'tests/qmltests/Menus/tst_ButtonMenu.qml'
221--- tests/qmltests/Menus/tst_ButtonMenu.qml 2013-12-13 15:56:57 +0000
222+++ tests/qmltests/Menus/tst_ButtonMenu.qml 2014-08-07 15:18:10 +0000
223@@ -18,9 +18,8 @@
224
225 import QtQuick 2.0
226 import QtTest 1.0
227-import Ubuntu.Components 0.1
228+import Ubuntu.Test 0.1
229 import Ubuntu.Settings.Menus 0.1
230-import "../utils.js" as UtilsJS
231
232 Item {
233 width: units.gu(42)
234@@ -59,15 +58,15 @@
235 target: buttonMenu
236 }
237
238- TestCase {
239+ UbuntuTestCase {
240 name: "ButtonMenu"
241 when: windowShown
242
243 function test_click() {
244 signalSpy.clear();
245
246- var button = UtilsJS.findChild(buttonMenu, "button");
247- var button2 = UtilsJS.findChild(buttonMenu2, "button");
248+ var button = findChild(buttonMenu, "button");
249+ var button2 = findChild(buttonMenu2, "button");
250 verify(button !== undefined);
251
252 mouseClick(button, button.width / 2, button.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
253
254=== modified file 'tests/qmltests/Menus/tst_CalendarMenu.qml'
255--- tests/qmltests/Menus/tst_CalendarMenu.qml 2013-10-04 10:04:18 +0000
256+++ tests/qmltests/Menus/tst_CalendarMenu.qml 2014-08-07 15:18:10 +0000
257@@ -18,9 +18,8 @@
258
259 import QtQuick 2.0
260 import QtTest 1.0
261-import Ubuntu.Components 0.1
262+import Ubuntu.Test 0.1
263 import Ubuntu.Settings.Menus 0.1
264-import "../utils.js" as UtilsJS
265
266 Item {
267 width: units.gu(42)
268@@ -49,11 +48,11 @@
269 }
270 }
271
272- TestCase {
273+ UbuntuTestCase {
274 name: "CalendarMenu"
275 when: windowShown
276
277- property var calendar: UtilsJS.findChild(calendarMenu, "calendar")
278+ property var calendar: findChild(calendarMenu, "calendar")
279
280 function test_collapsed() {
281 calendarMenu.collapsed = true
282
283=== modified file 'tests/qmltests/Menus/tst_CheckableMenu.qml'
284--- tests/qmltests/Menus/tst_CheckableMenu.qml 2013-12-13 15:56:57 +0000
285+++ tests/qmltests/Menus/tst_CheckableMenu.qml 2014-08-07 15:18:10 +0000
286@@ -18,9 +18,8 @@
287
288 import QtQuick 2.0
289 import QtTest 1.0
290-import Ubuntu.Components 0.1
291+import Ubuntu.Test 0.1
292 import Ubuntu.Settings.Menus 0.1
293-import "../utils.js" as UtilsJS
294
295 Item {
296 width: units.gu(42)
297@@ -52,7 +51,7 @@
298 target: checkMenu
299 }
300
301- TestCase {
302+ UbuntuTestCase {
303 name: "CheckableMenu"
304 when: windowShown
305
306@@ -62,7 +61,7 @@
307 }
308
309 function test_checkChanged() {
310- var checkbox = UtilsJS.findChild(checkMenu, "checkbox");
311+ var checkbox = findChild(checkMenu, "checkbox");
312 verify(checkbox !== undefined);
313
314 compare(checkbox.checked, false, "Checkbox should initially be unchecked");
315@@ -71,7 +70,7 @@
316 }
317
318 function test_clickCheckBox() {
319- var checkbox = UtilsJS.findChild(checkMenu, "checkbox");
320+ var checkbox = findChild(checkMenu, "checkbox");
321 verify(checkbox !== undefined);
322
323 mouseClick(checkMenu, checkbox.width / 2, checkbox.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
324
325=== modified file 'tests/qmltests/Menus/tst_EventMenu.qml'
326--- tests/qmltests/Menus/tst_EventMenu.qml 2013-10-30 17:40:31 +0000
327+++ tests/qmltests/Menus/tst_EventMenu.qml 2014-08-07 15:18:10 +0000
328@@ -18,7 +18,7 @@
329
330 import QtQuick 2.0
331 import QtTest 1.0
332-import Ubuntu.Components 0.1
333+import Ubuntu.Test 0.1
334 import Ubuntu.Settings.Menus 0.1
335
336 Item {
337
338=== modified file 'tests/qmltests/Menus/tst_GroupedMessageMenu.qml'
339--- tests/qmltests/Menus/tst_GroupedMessageMenu.qml 2013-12-16 12:15:43 +0000
340+++ tests/qmltests/Menus/tst_GroupedMessageMenu.qml 2014-08-07 15:18:10 +0000
341@@ -19,9 +19,7 @@
342 import QtQuick 2.0
343 import QtTest 1.0
344 import Ubuntu.Test 0.1
345-import Ubuntu.Components 0.1
346 import Ubuntu.Settings.Menus 0.1
347-import "../utils.js" as UtilsJS
348
349 Item {
350 width: units.gu(42)
351@@ -71,7 +69,7 @@
352 target: messageMenu2
353 }
354
355- UbuntuTestCase {
356+ TestCase {
357 name: "GropedMessageMenu"
358 when: windowShown
359
360
361=== modified file 'tests/qmltests/Menus/tst_MediaPlayerMenu.qml'
362--- tests/qmltests/Menus/tst_MediaPlayerMenu.qml 2013-10-04 10:04:18 +0000
363+++ tests/qmltests/Menus/tst_MediaPlayerMenu.qml 2014-08-07 15:18:10 +0000
364@@ -18,9 +18,8 @@
365
366 import QtQuick 2.0
367 import QtTest 1.0
368-import Ubuntu.Components 0.1
369+import Ubuntu.Test 0.1
370 import Ubuntu.Settings.Menus 0.1
371-import "../utils.js" as UtilsJS
372
373 Item {
374 width: units.gu(42)
375@@ -45,13 +44,13 @@
376 }
377 }
378
379- TestCase {
380+ UbuntuTestCase {
381 name: "MediaPlayerMenu"
382 when: windowShown
383
384 function test_running() {
385- var player = UtilsJS.findChild(mediaPlayerMenu, "player");
386- var albumArt = UtilsJS.findChild(mediaPlayerMenu, "albumArt");
387+ var player = findChild(mediaPlayerMenu, "player");
388+ var albumArt = findChild(mediaPlayerMenu, "albumArt");
389
390 var running = mediaPlayerMenu.running
391
392
393=== modified file 'tests/qmltests/Menus/tst_PlaybackItemMenu.qml'
394--- tests/qmltests/Menus/tst_PlaybackItemMenu.qml 2013-10-04 10:10:47 +0000
395+++ tests/qmltests/Menus/tst_PlaybackItemMenu.qml 2014-08-07 15:18:10 +0000
396@@ -18,9 +18,8 @@
397
398 import QtQuick 2.0
399 import QtTest 1.0
400-import Ubuntu.Components 0.1
401+import Ubuntu.Test 0.1
402 import Ubuntu.Settings.Menus 0.1
403-import "../utils.js" as UtilsJS
404
405 Item {
406 width: units.gu(42)
407@@ -63,7 +62,7 @@
408 target: playbackItem
409 }
410
411- TestCase {
412+ UbuntuTestCase {
413 name: "PlaybackItemMenu"
414 when: windowShown
415
416@@ -94,7 +93,7 @@
417 function test_buttons(data) {
418 playbackItem[data.enableProp] = data.enableValue;
419
420- var button = UtilsJS.findChild(playbackItem, data.objectName);
421+ var button = findChild(playbackItem, data.objectName);
422 mouseClick(button, button.width / 2, button.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
423
424 compare(data.signalSpy.count > 0, data.enableValue, data.enableValue ? "signal should be triggered" : "signal should not be triggered");
425
426=== modified file 'tests/qmltests/Menus/tst_ProgressBarMenu.qml'
427--- tests/qmltests/Menus/tst_ProgressBarMenu.qml 2013-10-04 10:04:18 +0000
428+++ tests/qmltests/Menus/tst_ProgressBarMenu.qml 2014-08-07 15:18:10 +0000
429@@ -18,7 +18,7 @@
430
431 import QtQuick 2.0
432 import QtTest 1.0
433-import Ubuntu.Components 0.1
434+import Ubuntu.Test 0.1
435 import Ubuntu.Settings.Menus 0.1
436
437 Item {
438
439=== modified file 'tests/qmltests/Menus/tst_ProgressValueMenu.qml'
440--- tests/qmltests/Menus/tst_ProgressValueMenu.qml 2013-12-13 15:56:57 +0000
441+++ tests/qmltests/Menus/tst_ProgressValueMenu.qml 2014-08-07 15:18:10 +0000
442@@ -18,9 +18,8 @@
443
444 import QtQuick 2.0
445 import QtTest 1.0
446-import Ubuntu.Components 0.1
447+import Ubuntu.Test 0.1
448 import Ubuntu.Settings.Menus 0.1
449-import "../utils.js" as UtilsJS
450
451 Item {
452 width: units.gu(42)
453@@ -48,12 +47,12 @@
454 }
455 }
456
457- TestCase {
458+ UbuntuTestCase {
459 name: "ProgressValueMenu"
460 when: windowShown
461
462 function test_label() {
463- var progress = UtilsJS.findChild(progressMenu, "progress");
464+ var progress = findChild(progressMenu, "progress");
465 verify(progress !== undefined);
466
467 progressMenu.value = 20;
468
469=== modified file 'tests/qmltests/Menus/tst_SectionMenu.qml'
470--- tests/qmltests/Menus/tst_SectionMenu.qml 2013-10-07 16:35:13 +0000
471+++ tests/qmltests/Menus/tst_SectionMenu.qml 2014-08-07 15:18:10 +0000
472@@ -18,9 +18,8 @@
473
474 import QtQuick 2.0
475 import QtTest 1.0
476-import Ubuntu.Components 0.1
477+import Ubuntu.Test 0.1
478 import Ubuntu.Settings.Menus 0.1
479-import "../utils.js" as UtilsJS
480
481 Item {
482 width: units.gu(42)
483@@ -52,7 +51,7 @@
484 }
485 }
486
487- TestCase {
488+ UbuntuTestCase {
489 name: "SectionMenu"
490 when: windowShown
491
492@@ -61,7 +60,7 @@
493 }
494
495 function test_busy() {
496- var indicator = UtilsJS.findChild(section1, "indicator");
497+ var indicator = findChild(section1, "indicator");
498 verify(indicator.running === false);
499
500 section1.busy = true
501
502=== modified file 'tests/qmltests/Menus/tst_SimpleTextMessageMenu.qml'
503--- tests/qmltests/Menus/tst_SimpleTextMessageMenu.qml 2013-12-13 17:51:57 +0000
504+++ tests/qmltests/Menus/tst_SimpleTextMessageMenu.qml 2014-08-07 15:18:10 +0000
505@@ -19,9 +19,7 @@
506 import QtQuick 2.0
507 import QtTest 1.0
508 import Ubuntu.Test 0.1
509-import Ubuntu.Components 0.1
510 import Ubuntu.Settings.Menus 0.1
511-import "../utils.js" as UtilsJS
512
513 Item {
514 width: units.gu(42)
515@@ -95,7 +93,7 @@
516 function test_title(data) {
517 messageMenu.title = data.title;
518
519- var title = UtilsJS.findChild(messageMenu, "title");
520+ var title = findChild(messageMenu, "title");
521 verify(title, "No title");
522 compare(title.text, data.title, "Title does not match set title.");
523 }
524@@ -110,7 +108,7 @@
525 function test_time(data) {
526 messageMenu.time = data.time;
527
528- var subtitle = UtilsJS.findChild(messageMenu, "subtitle");
529+ var subtitle = findChild(messageMenu, "subtitle");
530 verify(subtitle !== undefined, "No subtitle");
531 compare(subtitle.text, data.time, "Time does not match set time.");
532 }
533@@ -125,7 +123,7 @@
534 function test_appIcon(data) {
535 messageMenu.appIcon = data.appIcon;
536
537- var appIcon = UtilsJS.findChild(messageMenu, "appIcon");
538+ var appIcon = findChild(messageMenu, "appIcon");
539 verify(appIcon !== undefined, "No app icon");
540 compare(appIcon.source, data.appIcon, "App Icon does not match set icon.");
541 }
542@@ -140,13 +138,13 @@
543 function test_message(data) {
544 messageMenu.message = data.message;
545
546- var body = UtilsJS.findChild(messageMenu, "body");
547+ var body = findChild(messageMenu, "body");
548 verify(body !== undefined, "No body");
549 compare(body.text, data.message, "Message does not match set message.");
550 }
551
552 function test_activateApp() {
553- var appIcon = UtilsJS.findChild(messageMenuSelected, "appIcon");
554+ var appIcon = findChild(messageMenuSelected, "appIcon");
555
556 mouseClick(appIcon, appIcon.width * 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
557 compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered");
558
559=== modified file 'tests/qmltests/Menus/tst_SliderMenu.qml'
560--- tests/qmltests/Menus/tst_SliderMenu.qml 2014-07-01 12:49:56 +0000
561+++ tests/qmltests/Menus/tst_SliderMenu.qml 2014-08-07 15:18:10 +0000
562@@ -18,9 +18,8 @@
563
564 import QtQuick 2.0
565 import QtTest 1.0
566-import Ubuntu.Components 0.1
567+import Ubuntu.Test 0.1
568 import Ubuntu.Settings.Menus 0.1
569-import "../utils.js" as UtilsJS
570
571 Item {
572 width: units.gu(42)
573@@ -56,7 +55,7 @@
574 }
575 }
576
577- TestCase {
578+ UbuntuTestCase {
579 name: "SliderMenu"
580 when: windowShown
581
582@@ -96,7 +95,7 @@
583
584 // simulates dragging the slider to a value
585 function test_setSliderValue() {
586- var slider = UtilsJS.findChild(sliderMenu, "slider");
587+ var slider = findChild(sliderMenu, "slider");
588 verify(slider !== undefined);
589
590 slider.value = 20;
591@@ -105,7 +104,7 @@
592
593 // simulates dragging the slider to a value
594 function test_setMenuValue() {
595- var slider = UtilsJS.findChild(sliderMenu, "slider");
596+ var slider = findChild(sliderMenu, "slider");
597 verify(slider !== undefined);
598
599 sliderMenu.value = 20;
600@@ -148,13 +147,13 @@
601
602 // simulates clicking the min/max buttons
603 function test_minmaxButtons() {
604- var slider = UtilsJS.findChild(sliderMenu2, "slider");
605+ var slider = findChild(sliderMenu2, "slider");
606 verify(slider !== undefined);
607
608- var leftButton = UtilsJS.findChild(sliderMenu2, "leftButton");
609+ var leftButton = findChild(sliderMenu2, "leftButton");
610 verify(leftButton !== undefined);
611
612- var rightButton = UtilsJS.findChild(sliderMenu2, "rightButton");
613+ var rightButton = findChild(sliderMenu2, "rightButton");
614 verify(rightButton !== undefined);
615
616 mouseClick(leftButton, leftButton.width / 2, leftButton.height / 2);
617
618=== modified file 'tests/qmltests/Menus/tst_SnapDecisionMenu.qml'
619--- tests/qmltests/Menus/tst_SnapDecisionMenu.qml 2013-12-16 12:14:25 +0000
620+++ tests/qmltests/Menus/tst_SnapDecisionMenu.qml 2014-08-07 15:18:10 +0000
621@@ -19,9 +19,7 @@
622 import QtQuick 2.0
623 import QtTest 1.0
624 import Ubuntu.Test 0.1
625-import Ubuntu.Components 0.1
626 import Ubuntu.Settings.Menus 0.1
627-import "../utils.js" as UtilsJS
628
629 Item {
630 width: units.gu(42)
631@@ -119,7 +117,7 @@
632 function test_title(data) {
633 messageMenu.title = data.title;
634
635- var title = UtilsJS.findChild(messageMenu, "title");
636+ var title = findChild(messageMenu, "title");
637 verify(title, "No title");
638 compare(title.text, data.title, "Title does not match set title.");
639 }
640@@ -134,7 +132,7 @@
641 function test_time(data) {
642 messageMenu.time = data.time;
643
644- var body = UtilsJS.findChild(messageMenu, "body");
645+ var body = findChild(messageMenu, "body");
646 verify(body !== undefined, "No body");
647 compare(body.text, data.time, "Time does not match set time.");
648 }
649@@ -149,7 +147,7 @@
650 function test_appIcon(data) {
651 messageMenu.appIcon = data.appIcon;
652
653- var appIcon = UtilsJS.findChild(messageMenu, "appIcon");
654+ var appIcon = findChild(messageMenu, "appIcon");
655 verify(appIcon !== undefined, "No app icon");
656 compare(appIcon.source, data.appIcon, "App Icon does not match set icon.");
657 }
658@@ -164,7 +162,7 @@
659 function test_message(data) {
660 messageMenu.message = data.message;
661
662- var subtitle = UtilsJS.findChild(messageMenu, "subtitle");
663+ var subtitle = findChild(messageMenu, "subtitle");
664 verify(subtitle !== undefined, "No subtitle");
665 compare(subtitle.text, data.message, "Message does not match set message.");
666 }
667@@ -179,13 +177,13 @@
668 function test_replyButtonText(data) {
669 messageMenu.replyButtonText = data.buttonText;
670
671- var button = UtilsJS.findChild(messageMenu, "sendButton");
672+ var button = findChild(messageMenu, "sendButton");
673 verify(button !== undefined, "No send button");
674 compare(button.text, data.buttonText, "Button text does not match set text.");
675 }
676
677 function test_activateApp() {
678- var appIcon = UtilsJS.findChild(messageMenuSelected, "appIcon");
679+ var appIcon = findChild(messageMenuSelected, "appIcon");
680
681 mouseClick(appIcon, appIcon.width * 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
682 compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered");
683@@ -213,7 +211,7 @@
684 messageMenuSelected.selected = true;
685 messageMenuSelected.activateEnabled = false;
686
687- var actionButton = UtilsJS.findChild(messageMenuSelected, "actionButton");
688+ var actionButton = findChild(messageMenuSelected, "actionButton");
689 verify(actionButton !== undefined, "Action button not found");
690
691 compare(actionButton.enabled, false, "Action button should not be enabled when activateEnabled=false");
692@@ -225,7 +223,7 @@
693 messageMenuSelected.selected = true;
694 messageMenuSelected.activateEnabled = true;
695
696- var actionButton = UtilsJS.findChild(messageMenuSelected, "actionButton");
697+ var actionButton = findChild(messageMenuSelected, "actionButton");
698 verify(actionButton !== undefined, "Action button not found");
699
700 mouseClick(actionButton, actionButton.width / 2, actionButton.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
701@@ -245,15 +243,15 @@
702 messageMenuSelected.selected = true;
703 messageMenuSelected.replyEnabled = data.enabled
704
705- var replyText = UtilsJS.findChild(messageMenuSelected, "replyText");
706+ var replyText = findChild(messageMenuSelected, "replyText");
707 verify(replyText !== undefined, "Reply text not found");
708 replyText.text = data.reply;
709
710- var messageButton = UtilsJS.findChild(messageMenuSelected, "messageButton");
711+ var messageButton = findChild(messageMenuSelected, "messageButton");
712 verify(messageButton !== undefined, "Message button not found");
713 mouseClick(messageButton, messageButton.width / 2, messageButton.height / 2, Qt.LeftButton, Qt.NoModifier, 300);
714
715- var sendButton = UtilsJS.findChild(messageMenuSelected, "sendButton");
716+ var sendButton = findChild(messageMenuSelected, "sendButton");
717 verify(sendButton !== undefined, "Send button not found");
718
719 compare(sendButton.enabled, data.expected, "Reply button is not in correct state");
720@@ -263,15 +261,15 @@
721 messageMenuSelected.selected = true;
722 messageMenuSelected.replyEnabled = true;
723
724- var replyText = UtilsJS.findChild(messageMenuSelected, "replyText");
725+ var replyText = findChild(messageMenuSelected, "replyText");
726 verify(replyText !== undefined, "Reply text not found");
727 replyText.text = "reply1";
728
729- var messageButton = UtilsJS.findChild(messageMenuSelected, "messageButton");
730+ var messageButton = findChild(messageMenuSelected, "messageButton");
731 verify(messageButton !== undefined, "Message button not found");
732 mouseClick(messageButton, messageButton.width / 2, messageButton.height / 2, Qt.LeftButton, Qt.NoModifier, 300);
733
734- var sendButton = UtilsJS.findChild(messageMenuSelected, "sendButton");
735+ var sendButton = findChild(messageMenuSelected, "sendButton");
736 verify(sendButton !== undefined, "Send button not found");
737
738 mouseClick(sendButton, sendButton.width / 2, sendButton.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
739@@ -292,17 +290,17 @@
740 messageMenu.replyEnabled = true;
741 messageMenuSelected.replyMessages = [ "reply1", "reply2", "reply3", "reply4" ];
742
743- var messageButton = UtilsJS.findChild(messageMenuSelected, "messageButton");
744+ var messageButton = findChild(messageMenuSelected, "messageButton");
745 verify(messageButton !== undefined, "Message button not found");
746 mouseClick(messageButton, messageButton.width / 2, messageButton.height / 2, Qt.LeftButton, Qt.NoModifier, 300);
747
748 tryCompareFunction(function() { return messageMenuSelected.implicitHeight == messageMenuSelected.expandedHeight; }, true);
749
750- var replyMessage = UtilsJS.findChild(messageMenuSelected, "replyMessage"+data.index);
751+ var replyMessage = findChild(messageMenuSelected, "replyMessage"+data.index);
752 verify(replyMessage !== undefined, "Reply message not found");
753 mouseClick(replyMessage, replyMessage.width / 2, replyMessage.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
754
755- var sendButton = UtilsJS.findChild(messageMenuSelected, "sendButton");
756+ var sendButton = findChild(messageMenuSelected, "sendButton");
757 verify(sendButton !== undefined, "Send button not found");
758
759 mouseClick(sendButton, sendButton.width / 2, sendButton.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
760
761=== modified file 'tests/qmltests/Menus/tst_SwitchMenu.qml'
762--- tests/qmltests/Menus/tst_SwitchMenu.qml 2013-10-04 13:57:24 +0000
763+++ tests/qmltests/Menus/tst_SwitchMenu.qml 2014-08-07 15:18:10 +0000
764@@ -18,9 +18,8 @@
765
766 import QtQuick 2.0
767 import QtTest 1.0
768-import Ubuntu.Components 0.1
769+import Ubuntu.Test 0.1
770 import Ubuntu.Settings.Menus 0.1
771-import "../utils.js" as UtilsJS
772
773 Item {
774 width: units.gu(42)
775@@ -58,7 +57,7 @@
776 target: switchMenu
777 }
778
779- TestCase {
780+ UbuntuTestCase {
781 name: "SwitchMenu"
782 when: windowShown
783
784@@ -68,7 +67,7 @@
785 }
786
787 function test_checkChanged() {
788- var switcher = UtilsJS.findChild(switchMenu, "switcher");
789+ var switcher = findChild(switchMenu, "switcher");
790 verify(switcher !== undefined);
791
792 compare(switcher.checked, false, "Checkbox should initially be unchecked");
793@@ -77,7 +76,7 @@
794 }
795
796 function test_clickSwitchBox() {
797- var switcher = UtilsJS.findChild(switchMenu, "switcher");
798+ var switcher = findChild(switchMenu, "switcher");
799 mouseClick(switchMenu, switcher.width / 2, switcher.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
800 compare(signalSpyTriggered.count > 0, true, "signal checked not triggered on switcher click");
801 }
802
803=== modified file 'tests/qmltests/Menus/tst_TextMessageMenu.qml'
804--- tests/qmltests/Menus/tst_TextMessageMenu.qml 2013-12-13 17:51:57 +0000
805+++ tests/qmltests/Menus/tst_TextMessageMenu.qml 2014-08-07 15:18:10 +0000
806@@ -19,9 +19,7 @@
807 import QtQuick 2.0
808 import QtTest 1.0
809 import Ubuntu.Test 0.1
810-import Ubuntu.Components 0.1
811 import Ubuntu.Settings.Menus 0.1
812-import "../utils.js" as UtilsJS
813
814 Item {
815 width: units.gu(42)
816@@ -111,7 +109,7 @@
817 function test_title(data) {
818 messageMenu.title = data.title;
819
820- var title = UtilsJS.findChild(messageMenu, "title");
821+ var title = findChild(messageMenu, "title");
822 verify(title, "No title");
823 compare(title.text, data.title, "Title does not match set title.");
824 }
825@@ -126,7 +124,7 @@
826 function test_time(data) {
827 messageMenu.time = data.time;
828
829- var subtitle = UtilsJS.findChild(messageMenu, "subtitle");
830+ var subtitle = findChild(messageMenu, "subtitle");
831 verify(subtitle !== undefined, "No subtitle");
832 compare(subtitle.text, data.time, "Time does not match set time.");
833 }
834@@ -141,7 +139,7 @@
835 function test_appIcon(data) {
836 messageMenu.appIcon = data.appIcon;
837
838- var appIcon = UtilsJS.findChild(messageMenu, "appIcon");
839+ var appIcon = findChild(messageMenu, "appIcon");
840 verify(appIcon !== undefined, "No app icon");
841 compare(appIcon.source, data.appIcon, "App Icon does not match set icon.");
842 }
843@@ -156,7 +154,7 @@
844 function test_message(data) {
845 messageMenu.message = data.message;
846
847- var body = UtilsJS.findChild(messageMenu, "body");
848+ var body = findChild(messageMenu, "body");
849 verify(body !== undefined, "No body");
850 compare(body.text, data.message, "Message does not match set message.");
851 }
852@@ -171,13 +169,13 @@
853 function test_replyButtonText(data) {
854 messageMenu.replyButtonText = data.buttonText;
855
856- var button = UtilsJS.findChild(messageMenu, "sendButton");
857+ var button = findChild(messageMenu, "sendButton");
858 verify(button !== undefined, "No send button");
859 compare(button.text, data.buttonText, "Button text does not match set text.");
860 }
861
862 function test_activateApp() {
863- var appIcon = UtilsJS.findChild(messageMenuSelected, "appIcon");
864+ var appIcon = findChild(messageMenuSelected, "appIcon");
865
866 mouseClick(appIcon, appIcon.width * 2, appIcon.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
867 compare(signalSpyActivateApp.count, 0, "activate app should not have been triggered");
868@@ -214,10 +212,10 @@
869 messageMenuSelected.selected = true;
870 messageMenuSelected.replyEnabled = data.enabled
871
872- var replyText = UtilsJS.findChild(messageMenuSelected, "replyText");
873+ var replyText = findChild(messageMenuSelected, "replyText");
874 verify(replyText !== undefined, "Reply text not found");
875
876- var sendButton = UtilsJS.findChild(messageMenuSelected, "sendButton");
877+ var sendButton = findChild(messageMenuSelected, "sendButton");
878 verify(sendButton !== undefined, "Send button not found");
879
880 replyText.text = data.reply;
881@@ -229,11 +227,11 @@
882 messageMenuSelected.selected = true;
883 messageMenuSelected.replyEnabled = true;
884
885- var replyText = UtilsJS.findChild(messageMenuSelected, "replyText");
886+ var replyText = findChild(messageMenuSelected, "replyText");
887 verify(replyText !== undefined, "Reply text not found");
888 replyText.text = "reply1";
889
890- var sendButton = UtilsJS.findChild(messageMenuSelected, "sendButton");
891+ var sendButton = findChild(messageMenuSelected, "sendButton");
892 verify(sendButton !== undefined, "Send button not found");
893
894 mouseClick(sendButton, sendButton.width / 2, sendButton.height / 2, Qt.LeftButton, Qt.NoModifier, 0);
895
896=== modified file 'tests/qmltests/Menus/tst_TimeZoneMenu.qml'
897--- tests/qmltests/Menus/tst_TimeZoneMenu.qml 2013-10-04 10:04:18 +0000
898+++ tests/qmltests/Menus/tst_TimeZoneMenu.qml 2014-08-07 15:18:10 +0000
899@@ -18,9 +18,8 @@
900
901 import QtQuick 2.0
902 import QtTest 1.0
903-import Ubuntu.Components 0.1
904+import Ubuntu.Test 0.1
905 import Ubuntu.Settings.Menus 0.1
906-import "../utils.js" as UtilsJS
907
908 Item {
909 width: units.gu(42)
910@@ -53,7 +52,7 @@
911 }
912 }
913
914- TestCase {
915+ UbuntuTestCase {
916 name: "TimeZoneMenu"
917 when: windowShown
918
919@@ -64,7 +63,7 @@
920
921 function test_time() {
922 timeZoneMenu.time = "12:00am"
923- var timeLabel = UtilsJS.findChild(timeZoneMenu, "timeLabel")
924+ var timeLabel = findChild(timeZoneMenu, "timeLabel")
925 compare(timeLabel.text, "12:00am", "Cannot set time")
926 }
927 }
928
929=== modified file 'tests/qmltests/Menus/tst_TransferMenu.qml'
930--- tests/qmltests/Menus/tst_TransferMenu.qml 2014-07-04 14:32:47 +0000
931+++ tests/qmltests/Menus/tst_TransferMenu.qml 2014-08-07 15:18:10 +0000
932@@ -16,9 +16,8 @@
933
934 import QtQuick 2.0
935 import QtTest 1.0
936-import Ubuntu.Components 0.1
937+import Ubuntu.Test 0.1
938 import Ubuntu.Settings.Menus 0.1
939-import "../utils.js" as UtilsJS
940
941 Item {
942 width: units.gu(42)
943@@ -57,7 +56,7 @@
944 }
945 }
946
947- TestCase {
948+ UbuntuTestCase {
949 name: "TransferMenu"
950 when: windowShown
951
952@@ -77,7 +76,7 @@
953 function test_iconSource(data) {
954 transferMenu.iconSource = data.icon;
955
956- var icon = UtilsJS.findChild(transferMenu, "icon");
957+ var icon = findChild(transferMenu, "icon");
958 compare(icon.source, data.icon, "Icon does not match data");
959 }
960
961@@ -90,7 +89,7 @@
962 function test_text(data) {
963 transferMenu.text = data.text;
964
965- var text = UtilsJS.findChild(transferMenu, "text");
966+ var text = findChild(transferMenu, "text");
967 compare(text.text, data.text, "Text does not match data");
968 }
969
970@@ -103,7 +102,7 @@
971 function test_stateText(data) {
972 transferMenu.stateText = data.stateText;
973
974- var stateText = UtilsJS.findChild(transferMenu, "stateText");
975+ var stateText = findChild(transferMenu, "stateText");
976 compare(stateText.text, data.stateText, "State text does not match data");
977 }
978
979@@ -116,13 +115,13 @@
980 function test_progress(data) {
981 transferMenu.progress = data.progress;
982
983- var progress = UtilsJS.findChild(transferMenu, "progress");
984+ var progress = findChild(transferMenu, "progress");
985 compare(progress.value, data.progress, "Progress does not match expected value");
986 }
987
988 function test_active() {
989- var progress = UtilsJS.findChild(transferMenu, "progress");
990- var stateText = UtilsJS.findChild(transferMenu, "stateText");
991+ var progress = findChild(transferMenu, "progress");
992+ var stateText = findChild(transferMenu, "stateText");
993
994 transferMenu.active = true;
995 compare(progress.visible, true, "Progress should be visible when active");
996
997=== modified file 'tests/qmltests/Menus/tst_UserSessionMenu.qml'
998--- tests/qmltests/Menus/tst_UserSessionMenu.qml 2013-12-13 15:56:57 +0000
999+++ tests/qmltests/Menus/tst_UserSessionMenu.qml 2014-08-07 15:18:10 +0000
1000@@ -18,9 +18,8 @@
1001
1002 import QtQuick 2.0
1003 import QtTest 1.0
1004-import Ubuntu.Components 0.1
1005+import Ubuntu.Test 0.1
1006 import Ubuntu.Settings.Menus 0.1
1007-import "../utils.js" as UtilsJS
1008
1009 Item {
1010 width: units.gu(42)
1011@@ -55,7 +54,7 @@
1012 }
1013 }
1014
1015- TestCase {
1016+ UbuntuTestCase {
1017 name: "UserSessionMenu"
1018 when: windowShown
1019
1020@@ -65,12 +64,12 @@
1021 }
1022
1023 function test_active() {
1024- var activeIcon = UtilsJS.findChild(userSessionMenu, "activeIcon")
1025+ var activeIcon = findChild(userSessionMenu, "activeIcon")
1026 compare(activeIcon.visible, true, "Active icon should be visible when active")
1027 }
1028
1029 function test_inactive() {
1030- var activeIcon = UtilsJS.findChild(userSessionMenu2, "activeIcon")
1031+ var activeIcon = findChild(userSessionMenu2, "activeIcon")
1032 compare(activeIcon.visible, false, "Active icon should not be visible when inactive")
1033 }
1034 }
1035
1036=== removed file 'tests/qmltests/utils.js'
1037--- tests/qmltests/utils.js 2013-05-17 11:35:07 +0000
1038+++ tests/qmltests/utils.js 1970-01-01 00:00:00 +0000
1039@@ -1,11 +0,0 @@
1040-.pragma library
1041-
1042-function findChild(obj,objectName) {
1043- for (var i in obj.children) {
1044- var child = obj.children[i];
1045- if (child.objectName === objectName) return child;
1046- var subChild = findChild(child,objectName);
1047- if (subChild !== undefined) return subChild;
1048- }
1049- return undefined;
1050-}
1051
1052=== modified file 'tests/utils/modules/Ubuntu/Test/plugin.cpp'
1053--- tests/utils/modules/Ubuntu/Test/plugin.cpp 2013-10-04 10:10:47 +0000
1054+++ tests/utils/modules/Ubuntu/Test/plugin.cpp 2014-08-07 15:18:10 +0000
1055@@ -20,6 +20,17 @@
1056 #include "TouchEventSequenceWrapper.h"
1057
1058 #include <qqml.h>
1059+#include <QQmlEngine>
1060+
1061+static QObject *s_testRootObject = nullptr;
1062+static QObject *testRootObject(QQmlEngine *engine, QJSEngine *jsEngine)
1063+{
1064+ Q_UNUSED(jsEngine);
1065+ if (!s_testRootObject) {
1066+ s_testRootObject = new QObject(engine);
1067+ }
1068+ return s_testRootObject;
1069+}
1070
1071 static QObject *testutil_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
1072 {
1073@@ -34,3 +45,10 @@
1074 qmlRegisterUncreatableType<TouchEventSequenceWrapper>(uri, 0, 1, "TouchEventSequence",
1075 "You cannot directly create a TouchEventSequence object.");
1076 }
1077+
1078+void UbuntuTestPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
1079+{
1080+ Q_UNUSED(uri);
1081+ Q_UNUSED(engine);
1082+ qmlRegisterSingletonType<QObject>("Qt.test.qtestroot", 1, 0, "QTestRootObject", testRootObject);
1083+}
1084\ No newline at end of file
1085
1086=== modified file 'tests/utils/modules/Ubuntu/Test/plugin.h'
1087--- tests/utils/modules/Ubuntu/Test/plugin.h 2013-10-04 10:10:47 +0000
1088+++ tests/utils/modules/Ubuntu/Test/plugin.h 2014-08-07 15:18:10 +0000
1089@@ -27,6 +27,7 @@
1090
1091 public:
1092 void registerTypes(const char *uri);
1093+ void initializeEngine(QQmlEngine *engine, const char *uri);
1094 };
1095
1096 #endif // UBUNTU_TEST_PLUGIN_H

Subscribers

People subscribed via source and target branches

to all changes: