Merge lp:~saviq/unity/phablet.unity-test-module into lp:unity/phablet

Proposed by Michał Sawicz
Status: Merged
Approved by: Albert Astals Cid
Approved revision: no longer in the source branch.
Merged at revision: 614
Proposed branch: lp:~saviq/unity/phablet.unity-test-module
Merge into: lp:unity/phablet
Diff against target: 884 lines (+293/-36)
37 files modified
cmake/modules/QmlTest.cmake (+6/-0)
tests/CMakeLists.txt (+1/-0)
tests/qmltests/CMakeLists.txt (+15/-9)
tests/qmltests/Components/tst_ListViewWithPageHeader.qml (+2/-1)
tests/qmltests/Components/tst_PageHeader.qml (+2/-1)
tests/qmltests/Components/tst_ResponsiveFlowView.qml (+2/-1)
tests/qmltests/Components/tst_ResponsiveGridView.qml (+2/-1)
tests/qmltests/Components/tst_Revealer.qml (+2/-1)
tests/qmltests/Components/tst_Showable.qml (+2/-1)
tests/qmltests/Components/tst_Stage.qml (+2/-1)
tests/qmltests/Components/tst_Tile.qml (+2/-1)
tests/qmltests/Dash/tst_DashPreview.qml (+2/-1)
tests/qmltests/Dash/tst_FilterGrids.qml (+2/-1)
tests/qmltests/Dash/tst_PeoplePreview.qml (+2/-1)
tests/qmltests/Greeter/tst_Clock.qml (+2/-1)
tests/qmltests/Greeter/tst_Greeter.qml (+2/-1)
tests/qmltests/Hud/tst_Hud.qml (+2/-1)
tests/qmltests/Launcher/tst_Launcher.qml (+2/-1)
tests/qmltests/Panel/tst_IndicatorItem.qml (+2/-1)
tests/qmltests/Panel/tst_IndicatorRow.qml (+5/-4)
tests/qmltests/Panel/tst_Indicators.qml (+2/-1)
tests/qmltests/Panel/tst_MenuContent.qml (+2/-1)
tests/qmltests/Panel/tst_Overview.qml (+2/-1)
tests/qmltests/Panel/tst_Panel.qml (+2/-1)
tests/qmltests/Panel/tst_SearchIndicator.qml (+2/-1)
tests/qmltests/SideStage/tst_SideStage.qml (+2/-1)
tests/qmltests/utils/Unity/Test/tst_UnityTest.qml (+51/-0)
tests/utils/CMakeLists.txt (+1/-0)
tests/utils/modules/CMakeLists.txt (+1/-0)
tests/utils/modules/Unity/CMakeLists.txt (+1/-0)
tests/utils/modules/Unity/Test/CMakeLists.txt (+21/-0)
tests/utils/modules/Unity/Test/plugin.cpp (+33/-0)
tests/utils/modules/Unity/Test/plugin.h (+32/-0)
tests/utils/modules/Unity/Test/qmldir (+3/-0)
tests/utils/modules/Unity/Test/testutil.cpp (+36/-0)
tests/utils/modules/Unity/Test/testutil.h (+38/-0)
unity.qmlproject (+5/-1)
To merge this branch: bzr merge lp:~saviq/unity/phablet.unity-test-module
Reviewer Review Type Date Requested Status
Albert Astals Cid (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+159410@code.launchpad.net

Commit message

add TestUtil class with isInstanceOf utility method

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

I'd prefer if you use the expectFailContinue() function instead of just commenting out the tests that don't work.

This way when they start to work we'll know :-)

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

CI triggered

Revision history for this message
Albert Astals Cid (aacid) wrote :

qmluitests doesn't pass here

Scanning dependencies of target testFilterGrids
file:///home/tsdgeos_work/phablet/lalala/tests/qmltests/Dash/tst_FilterGrids.qml:102:5: UnityTestCase is not a type
         UnityTestCase {
         ^
********* Start testing of qmltestrunner *********
Config: Using QTest library 5.0.1, Qt 5.0.1
QWARN : qmltestrunner::tst_FilterGrids::compile()
  /home/tsdgeos_work/phablet/lalala/tests/qmltests/Dash/tst_FilterGrids.qml produced 1 error(s):
    /home/tsdgeos_work/phablet/lalala/tests/qmltests/Dash/tst_FilterGrids.qml:102,5: UnityTestCase is not a type
  Working directory: /home/tsdgeos_work/phablet/lalala/builddir/tests/qmltests
  View: QQuickView, import paths:
    '/home/tsdgeos_work/phablet/lalala/builddir/plugins'
    '/usr/lib/x86_64-linux-gnu/qt5/bin'
    '/usr/lib/x86_64-linux-gnu/qt5/qml'
  Plugin paths:
    '.'

FAIL! : qmltestrunner::tst_FilterGrids::compile() UnityTestCase is not a type
   Loc: [/home/tsdgeos_work/phablet/lalala/tests/qmltests/Dash/tst_FilterGrids.qml(102)]
Totals: 0 passed, 1 failed, 0 skipped
********* Finished testing of qmltestrunner *********

review: Needs Fixing
Revision history for this message
Michał Sawicz (saviq) wrote :

Indeed, fixed.

Revision history for this message
Albert Astals Cid (aacid) wrote :

Works for me, let's wait to see what CI says

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Needs remerging

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

qmluitests got stuck again, retriggering CI

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Michał Sawicz (saviq) wrote :

Triggered CI again :/

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Retriggered CI

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

Good to go

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cmake/modules/QmlTest.cmake'
2--- cmake/modules/QmlTest.cmake 2013-04-17 10:14:28 +0000
3+++ cmake/modules/QmlTest.cmake 2013-04-19 21:00:36 +0000
4@@ -12,6 +12,7 @@
5 # To change/set a default value for the whole test suite, prior to calling add_qml_test, set:
6 # qmltest_DEFAULT_NO_ADD_TEST (default: FALSE)
7 # qmltest_DEFAULT_TARGETS
8+# qmltest_DEFAULT_IMPORT_PATHS
9 # qmltest_DEFAULT_PROPERTIES
10
11 find_program(qmltestrunner_exe qmltestrunner)
12@@ -35,6 +36,11 @@
13 list(APPEND qmltestrunner_imports "-import")
14 list(APPEND qmltestrunner_imports ${IMPORT_PATH})
15 endforeach(IMPORT_PATH)
16+ elseif(NOT "${qmltest_DEFAULT_IMPORT_PATHS}" STREQUAL "")
17+ foreach(IMPORT_PATH ${qmltest_DEFAULT_IMPORT_PATHS})
18+ list(APPEND qmltestrunner_imports "-import")
19+ list(APPEND qmltestrunner_imports ${IMPORT_PATH})
20+ endforeach(IMPORT_PATH)
21 endif()
22
23 set(qmltest_command
24
25=== modified file 'tests/CMakeLists.txt'
26--- tests/CMakeLists.txt 2013-04-18 17:20:37 +0000
27+++ tests/CMakeLists.txt 2013-04-19 21:00:36 +0000
28@@ -7,3 +7,4 @@
29 add_subdirectory(whitespace)
30 add_subdirectory(cleanincludes)
31 add_subdirectory(plugins)
32+add_subdirectory(utils)
33
34=== modified file 'tests/qmltests/CMakeLists.txt'
35--- tests/qmltests/CMakeLists.txt 2013-04-19 14:51:08 +0000
36+++ tests/qmltests/CMakeLists.txt 2013-04-19 21:00:36 +0000
37@@ -9,6 +9,11 @@
38
39 add_subdirectory(plugins)
40
41+set(qmltest_DEFAULT_IMPORT_PATHS
42+ ${CMAKE_CURRENT_BINARY_DIR}/plugins
43+ ${CMAKE_BINARY_DIR}/tests/utils/modules
44+)
45+
46 set(qmltest_DEFAULT_TARGETS qmlunittests qmltests)
47 set(qmltest_DEFAULT_NO_ADD_TEST FALSE)
48 set(qmltest_DEFAULT_PROPERTIES ENVIRONMENT "QT_QPA_PLATFORM=minimal")
49@@ -21,30 +26,31 @@
50 add_qml_test(Components TimeLocal)
51 add_qml_test(Greeter Clock)
52 add_qml_test(Panel IndicatorItem)
53+add_qml_test(utils/Unity/Test UnityTest)
54
55 set(qmltest_DEFAULT_TARGETS qmluitests qmltests)
56 set(qmltest_DEFAULT_NO_ADD_TEST TRUE)
57 set(qmltest_DEFAULT_PROPERTIES "")
58 add_qml_test(Components DraggingArea)
59-add_qml_test(Components FilterGrid IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins)
60+add_qml_test(Components FilterGrid IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins)
61 add_qml_test(Components ListViewWithPageHeader)
62 add_qml_test(Components ResponsiveFlowView)
63 add_qml_test(Components ResponsiveGridView)
64 add_qml_test(Components Revealer)
65 add_qml_test(Components Showable)
66-add_qml_test(Components Stage IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks)
67+add_qml_test(Components Stage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
68 add_qml_test(Components Tile)
69 add_qml_test(Components PageHeader)
70 add_qml_test(Dash DashPreview)
71 add_qml_test(Dash PeoplePreview)
72-add_qml_test(Dash FilterGrids IMPORT_PATHS ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
73+add_qml_test(Dash FilterGrids IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/plugins ${CMAKE_CURRENT_SOURCE_DIR}/plugins)
74 add_qml_test(Greeter Greeter)
75-add_qml_test(Hud Hud IMPORT_PATHS ${CMAKE_CURRENT_BINARY_DIR}/plugins)
76+add_qml_test(Hud Hud)
77 add_qml_test(Launcher Launcher)
78-add_qml_test(Panel IndicatorRow IMPORT_PATHS ${CMAKE_CURRENT_BINARY_DIR}/plugins)
79-add_qml_test(Panel Indicators IMPORT_PATHS ${CMAKE_CURRENT_BINARY_DIR}/plugins)
80-add_qml_test(Panel MenuContent IMPORT_PATHS ${CMAKE_CURRENT_BINARY_DIR}/plugins)
81+add_qml_test(Panel IndicatorRow)
82+add_qml_test(Panel Indicators)
83+add_qml_test(Panel MenuContent)
84 add_qml_test(Panel Overview)
85-add_qml_test(Panel Panel IMPORT_PATHS ${CMAKE_CURRENT_BINARY_DIR}/plugins)
86+add_qml_test(Panel Panel)
87 add_qml_test(Panel SearchIndicator)
88-add_qml_test(SideStage SideStage IMPORT_PATHS ${CMAKE_BINARY_DIR}/tests/mocks)
89+add_qml_test(SideStage SideStage IMPORT_PATHS ${qmltest_DEFAULT_IMPORT_PATHS} ${CMAKE_BINARY_DIR}/tests/mocks)
90
91=== modified file 'tests/qmltests/Components/tst_ListViewWithPageHeader.qml'
92--- tests/qmltests/Components/tst_ListViewWithPageHeader.qml 2013-04-11 15:16:45 +0000
93+++ tests/qmltests/Components/tst_ListViewWithPageHeader.qml 2013-04-19 21:00:36 +0000
94@@ -20,6 +20,7 @@
95 import "../../../Components"
96 import Ubuntu.Components.ListItems 0.1 as ListItem
97 import Ubuntu.Components 0.1
98+import Unity.Test 0.1 as UT
99
100 Item {
101 id: root
102@@ -136,7 +137,7 @@
103
104
105
106- UnityTestCase {
107+ UT.UnityTestCase {
108 name: "ListViewWithPageHeader"
109 when: windowShown
110
111
112=== modified file 'tests/qmltests/Components/tst_PageHeader.qml'
113--- tests/qmltests/Components/tst_PageHeader.qml 2013-04-09 12:25:07 +0000
114+++ tests/qmltests/Components/tst_PageHeader.qml 2013-04-19 21:00:36 +0000
115@@ -19,12 +19,13 @@
116 import ".."
117 import "../../../Components"
118 import Ubuntu.Components 0.1
119+import Unity.Test 0.1 as UT
120
121 Item {
122 width: units.gu(110)
123 height: units.gu(30)
124
125- UnityTestCase {
126+ UT.UnityTestCase {
127 name: "PageHeaderTest"
128 when: windowShown
129
130
131=== modified file 'tests/qmltests/Components/tst_ResponsiveFlowView.qml'
132--- tests/qmltests/Components/tst_ResponsiveFlowView.qml 2013-04-09 09:51:32 +0000
133+++ tests/qmltests/Components/tst_ResponsiveFlowView.qml 2013-04-19 21:00:36 +0000
134@@ -20,6 +20,7 @@
135 import "../../../Components"
136 import Ubuntu.Components.ListItems 0.1 as ListItem
137 import Ubuntu.Components 0.1
138+import Unity.Test 0.1 as UT
139
140 Item {
141 width: flowRect.width + controls.width
142@@ -118,7 +119,7 @@
143 }
144 }
145
146- UnityTestCase {
147+ UT.UnityTestCase {
148 name: "ResponsiveFlowView"
149 when: windowShown
150
151
152=== modified file 'tests/qmltests/Components/tst_ResponsiveGridView.qml'
153--- tests/qmltests/Components/tst_ResponsiveGridView.qml 2013-04-09 15:52:21 +0000
154+++ tests/qmltests/Components/tst_ResponsiveGridView.qml 2013-04-19 21:00:36 +0000
155@@ -20,6 +20,7 @@
156 import "../../../Components"
157 import Ubuntu.Components.ListItems 0.1 as ListItem
158 import Ubuntu.Components 0.1
159+import Unity.Test 0.1 as UT
160
161 Item {
162 width: gridRect.width + controls.width
163@@ -118,7 +119,7 @@
164 }
165 }
166
167- UnityTestCase {
168+ UT.UnityTestCase {
169 name: "ResponsiveGridView"
170 when: windowShown
171
172
173=== modified file 'tests/qmltests/Components/tst_Revealer.qml'
174--- tests/qmltests/Components/tst_Revealer.qml 2013-04-09 14:49:00 +0000
175+++ tests/qmltests/Components/tst_Revealer.qml 2013-04-19 21:00:36 +0000
176@@ -16,6 +16,7 @@
177
178 import QtQuick 2.0
179 import QtTest 1.0
180+import Unity.Test 0.1 as UT
181 import ".."
182
183 /*
184@@ -59,7 +60,7 @@
185 direction: Qt.RightToLeft
186 }
187
188- UnityTestCase {
189+ UT.UnityTestCase {
190 name: "Revealer"
191 when: windowShown
192
193
194=== modified file 'tests/qmltests/Components/tst_Showable.qml'
195--- tests/qmltests/Components/tst_Showable.qml 2013-04-09 14:49:00 +0000
196+++ tests/qmltests/Components/tst_Showable.qml 2013-04-19 21:00:36 +0000
197@@ -17,6 +17,7 @@
198 import QtQuick 2.0
199 import QtTest 1.0
200 import Ubuntu.Components 0.1
201+import Unity.Test 0.1 as UT
202 import ".."
203 import "../../../Components"
204
205@@ -100,7 +101,7 @@
206 }
207 }
208
209- UnityTestCase {
210+ UT.UnityTestCase {
211 name: "Showable"
212 when: windowShown
213
214
215=== modified file 'tests/qmltests/Components/tst_Stage.qml'
216--- tests/qmltests/Components/tst_Stage.qml 2013-04-09 14:49:00 +0000
217+++ tests/qmltests/Components/tst_Stage.qml 2013-04-19 21:00:36 +0000
218@@ -19,6 +19,7 @@
219 import ".."
220 import "../../../Components"
221 import Ubuntu.Components 0.1
222+import Unity.Test 0.1 as UT
223 import "../../../Applications/applications.js" as ApplicationsModel
224 import "tst_Stage"
225
226@@ -190,7 +191,7 @@
227 }
228 }
229
230- UnityTestCase {
231+ UT.UnityTestCase {
232 name: "Stage"
233 when: windowShown
234
235
236=== modified file 'tests/qmltests/Components/tst_Tile.qml'
237--- tests/qmltests/Components/tst_Tile.qml 2013-04-10 09:19:27 +0000
238+++ tests/qmltests/Components/tst_Tile.qml 2013-04-19 21:00:36 +0000
239@@ -19,6 +19,7 @@
240 import ".."
241 import "../../../Components"
242 import Ubuntu.Components 0.1
243+import Unity.Test 0.1 as UT
244
245 Item {
246 id: root
247@@ -36,7 +37,7 @@
248 imageHeight: width
249 }
250
251- UnityTestCase {
252+ UT.UnityTestCase {
253 name: "Tile"
254 when: windowShown
255
256
257=== modified file 'tests/qmltests/Dash/tst_DashPreview.qml'
258--- tests/qmltests/Dash/tst_DashPreview.qml 2013-04-10 09:19:27 +0000
259+++ tests/qmltests/Dash/tst_DashPreview.qml 2013-04-19 21:00:36 +0000
260@@ -19,6 +19,7 @@
261 import ".."
262 import "../../../Dash"
263 import Ubuntu.Components 0.1
264+import Unity.Test 0.1 as UT
265
266 Item {
267 id: root
268@@ -91,7 +92,7 @@
269 signalName: "previewImageClicked"
270 }
271
272- UnityTestCase {
273+ UT.UnityTestCase {
274 name: "DashPreview"
275 when: windowShown
276
277
278=== modified file 'tests/qmltests/Dash/tst_FilterGrids.qml'
279--- tests/qmltests/Dash/tst_FilterGrids.qml 2013-04-18 11:29:52 +0000
280+++ tests/qmltests/Dash/tst_FilterGrids.qml 2013-04-19 21:00:36 +0000
281@@ -19,6 +19,7 @@
282 import "../../../Dash/Video"
283 import Ubuntu.Components.ListItems 0.1 as ListItem
284 import Ubuntu.Components 0.1
285+import Unity.Test 0.1 as UT
286 import "../"
287
288 Rectangle {
289@@ -99,7 +100,7 @@
290 }
291 }
292
293- UnityTestCase {
294+ UT.UnityTestCase {
295 id: testCase
296 name: "FilterGrids"
297 when: windowShown
298
299=== modified file 'tests/qmltests/Dash/tst_PeoplePreview.qml'
300--- tests/qmltests/Dash/tst_PeoplePreview.qml 2013-04-11 11:04:15 +0000
301+++ tests/qmltests/Dash/tst_PeoplePreview.qml 2013-04-19 21:00:36 +0000
302@@ -19,6 +19,7 @@
303 import ".."
304 import "../../../Dash/People"
305 import Ubuntu.Components 0.1
306+import Unity.Test 0.1 as UT
307
308 Item {
309 id: root
310@@ -67,7 +68,7 @@
311 signalName: "clicked"
312 }
313
314- UnityTestCase {
315+ UT.UnityTestCase {
316 id: testCase
317 name: "PeoplePreview"
318 when: windowShown
319
320=== modified file 'tests/qmltests/Greeter/tst_Clock.qml'
321--- tests/qmltests/Greeter/tst_Clock.qml 2013-04-16 13:31:55 +0000
322+++ tests/qmltests/Greeter/tst_Clock.qml 2013-04-19 21:00:36 +0000
323@@ -19,6 +19,7 @@
324 import ".."
325 import "../../../Greeter"
326 import Ubuntu.Components 0.1
327+import Unity.Test 0.1 as UT
328
329 Rectangle {
330 width: units.gu(60)
331@@ -34,7 +35,7 @@
332 }
333 }
334
335- UnityTestCase {
336+ UT.UnityTestCase {
337 name: "Clock"
338
339 function test_customDate() {
340
341=== modified file 'tests/qmltests/Greeter/tst_Greeter.qml'
342--- tests/qmltests/Greeter/tst_Greeter.qml 2013-04-10 09:19:27 +0000
343+++ tests/qmltests/Greeter/tst_Greeter.qml 2013-04-19 21:00:36 +0000
344@@ -19,6 +19,7 @@
345 import ".."
346 import "../../../Greeter"
347 import Ubuntu.Components 0.1
348+import Unity.Test 0.1 as UT
349
350 Item {
351 width: units.gu(120)
352@@ -41,7 +42,7 @@
353 signalName: "selected"
354 }
355
356- UnityTestCase {
357+ UT.UnityTestCase {
358 name: "Greeter"
359 when: windowShown
360
361
362=== modified file 'tests/qmltests/Hud/tst_Hud.qml'
363--- tests/qmltests/Hud/tst_Hud.qml 2013-04-09 14:49:00 +0000
364+++ tests/qmltests/Hud/tst_Hud.qml 2013-04-19 21:00:36 +0000
365@@ -19,6 +19,7 @@
366 import ".."
367 import "../../../Hud"
368 import HudClient 0.1
369+import Unity.Test 0.1 as UT
370
371 Hud {
372 id: hud
373@@ -37,7 +38,7 @@
374 id: hudClientStub
375 }
376
377- UnityTestCase {
378+ UT.UnityTestCase {
379 name: "Hud"
380 when: windowShown
381
382
383=== modified file 'tests/qmltests/Launcher/tst_Launcher.qml'
384--- tests/qmltests/Launcher/tst_Launcher.qml 2013-04-09 14:49:00 +0000
385+++ tests/qmltests/Launcher/tst_Launcher.qml 2013-04-19 21:00:36 +0000
386@@ -16,6 +16,7 @@
387
388 import QtQuick 2.0
389 import QtTest 1.0
390+import Unity.Test 0.1 as UT
391 import ".."
392 import "../../../Launcher"
393 import "../../../Applications/applications.js" as ApplicationsModel
394@@ -54,7 +55,7 @@
395 }
396 }
397
398- UnityTestCase {
399+ UT.UnityTestCase {
400 id: testCase
401 name: "Launcher"
402 when: windowShown
403
404=== modified file 'tests/qmltests/Panel/tst_IndicatorItem.qml'
405--- tests/qmltests/Panel/tst_IndicatorItem.qml 2013-04-16 13:31:55 +0000
406+++ tests/qmltests/Panel/tst_IndicatorItem.qml 2013-04-19 21:00:36 +0000
407@@ -19,6 +19,7 @@
408 import ".."
409 import "../../../Panel"
410 import Ubuntu.Components 0.1
411+import Unity.Test 0.1 as UT
412
413 Rectangle {
414 width: units.gu(10)
415@@ -32,7 +33,7 @@
416 label: "Clock"
417 }
418
419- UnityTestCase {
420+ UT.UnityTestCase {
421 name: "IndicatorItem"
422
423 function init_test() {
424
425=== modified file 'tests/qmltests/Panel/tst_IndicatorRow.qml'
426--- tests/qmltests/Panel/tst_IndicatorRow.qml 2013-04-12 10:51:20 +0000
427+++ tests/qmltests/Panel/tst_IndicatorRow.qml 2013-04-19 21:00:36 +0000
428@@ -16,6 +16,7 @@
429
430 import QtQuick 2.0
431 import QtTest 1.0
432+import Unity.Test 0.1 as UT
433 import ".."
434 import "../../../Panel"
435 import Ubuntu.ChewieUI 0.1 as ChewieUI
436@@ -54,7 +55,7 @@
437 id: indicatorModel
438 }
439
440- UnityTestCase {
441+ UT.UnityTestCase {
442 name: "IndicatorRow"
443 when: windowShown
444
445@@ -71,7 +72,7 @@
446 }
447 }
448
449- UnityTestCase {
450+ UT.UnityTestCase {
451 name: "IndicatorRow_IconPosition"
452 when: windowShown
453
454@@ -93,7 +94,7 @@
455 }
456 }
457
458- UnityTestCase {
459+ UT.UnityTestCase {
460 name: "IndicatorRow_Highlight"
461 when: windowShown
462
463@@ -167,7 +168,7 @@
464 }
465 }
466
467- UnityTestCase {
468+ UT.UnityTestCase {
469 name: "IndicatorRow_Dimmed"
470 when: windowShown
471
472
473=== modified file 'tests/qmltests/Panel/tst_Indicators.qml'
474--- tests/qmltests/Panel/tst_Indicators.qml 2013-04-10 09:45:49 +0000
475+++ tests/qmltests/Panel/tst_Indicators.qml 2013-04-19 21:00:36 +0000
476@@ -16,6 +16,7 @@
477
478 import QtQuick 2.0
479 import QtTest 1.0
480+import Unity.Test 0.1 as UT
481 import ".."
482 import "../../../Panel"
483 import "../../../Components"
484@@ -93,7 +94,7 @@
485 }
486 }
487
488- UnityTestCase {
489+ UT.UnityTestCase {
490 name: "Indicators"
491 when: windowShown
492
493
494=== modified file 'tests/qmltests/Panel/tst_MenuContent.qml'
495--- tests/qmltests/Panel/tst_MenuContent.qml 2013-04-12 10:51:20 +0000
496+++ tests/qmltests/Panel/tst_MenuContent.qml 2013-04-19 21:00:36 +0000
497@@ -16,6 +16,7 @@
498
499 import QtQuick 2.0
500 import QtTest 1.0
501+import Unity.Test 0.1 as UT
502 import ".."
503 import "../../../Panel"
504 import Ubuntu.ChewieUI 0.1 as ChewieUI
505@@ -143,7 +144,7 @@
506 return menu.parent == current_loader;
507 }
508
509- UnityTestCase {
510+ UT.UnityTestCase {
511 id: menu_content_test
512 name: "MenuContentTest"
513 when: windowShown
514
515=== modified file 'tests/qmltests/Panel/tst_Overview.qml'
516--- tests/qmltests/Panel/tst_Overview.qml 2013-04-12 20:16:47 +0000
517+++ tests/qmltests/Panel/tst_Overview.qml 2013-04-19 21:00:36 +0000
518@@ -19,6 +19,7 @@
519 import ".."
520 import "../../../Panel/Menus"
521 import "../../../Components"
522+import Unity.Test 0.1 as UT
523
524 Rectangle {
525 id: shell
526@@ -61,7 +62,7 @@
527 signalName: "menuSelected"
528 }
529
530- UnityTestCase {
531+ UT.UnityTestCase {
532 name: "Overview"
533 when: windowShown
534
535
536=== modified file 'tests/qmltests/Panel/tst_Panel.qml'
537--- tests/qmltests/Panel/tst_Panel.qml 2013-04-09 18:02:40 +0000
538+++ tests/qmltests/Panel/tst_Panel.qml 2013-04-19 21:00:36 +0000
539@@ -16,6 +16,7 @@
540
541 import QtQuick 2.0
542 import QtTest 1.0
543+import Unity.Test 0.1 as UT
544 import ".."
545 import "../../../Panel"
546 import Ubuntu.ChewieUI 0.1 as ChewieUI
547@@ -42,7 +43,7 @@
548 anchors.fill: parent
549 }
550
551- UnityTestCase {
552+ UT.UnityTestCase {
553 name: "Panel"
554 when: windowShown
555
556
557=== modified file 'tests/qmltests/Panel/tst_SearchIndicator.qml'
558--- tests/qmltests/Panel/tst_SearchIndicator.qml 2013-04-09 14:49:00 +0000
559+++ tests/qmltests/Panel/tst_SearchIndicator.qml 2013-04-19 21:00:36 +0000
560@@ -19,6 +19,7 @@
561 import ".."
562 import "../../../Panel"
563 import Ubuntu.Components 0.1
564+import Unity.Test 0.1 as UT
565
566 Item {
567 width: units.gu(9)
568@@ -35,7 +36,7 @@
569 anchors.fill: parent
570 }
571
572- UnityTestCase {
573+ UT.UnityTestCase {
574 name: "SearchIndicator"
575 when: windowShown
576
577
578=== modified file 'tests/qmltests/SideStage/tst_SideStage.qml'
579--- tests/qmltests/SideStage/tst_SideStage.qml 2013-04-16 13:31:55 +0000
580+++ tests/qmltests/SideStage/tst_SideStage.qml 2013-04-19 21:00:36 +0000
581@@ -16,11 +16,12 @@
582
583 import QtQuick 2.0
584 import QtTest 1.0
585+import Unity.Test 0.1 as UT
586 import ".."
587 import "../../../SideStage"
588 import Ubuntu.Components 0.1
589
590-UnityTestCase {
591+UT.UnityTestCase {
592 name: "SideStage"
593
594 SideStage {
595
596=== added directory 'tests/qmltests/utils'
597=== added directory 'tests/qmltests/utils/Unity'
598=== added directory 'tests/qmltests/utils/Unity/Test'
599=== added file 'tests/qmltests/utils/Unity/Test/tst_UnityTest.qml'
600--- tests/qmltests/utils/Unity/Test/tst_UnityTest.qml 1970-01-01 00:00:00 +0000
601+++ tests/qmltests/utils/Unity/Test/tst_UnityTest.qml 2013-04-19 21:00:36 +0000
602@@ -0,0 +1,51 @@
603+/*
604+ * Copyright (C) 2012, 2013 Canonical, Ltd.
605+ *
606+ * This program is free software; you can redistribute it and/or modify
607+ * it under the terms of the GNU General Public License as published by
608+ * the Free Software Foundation; version 3.
609+ *
610+ * This program is distributed in the hope that it will be useful,
611+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
612+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
613+ * GNU General Public License for more details.
614+ *
615+ * You should have received a copy of the GNU General Public License
616+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
617+ */
618+
619+
620+import QtQuick 2.0
621+import QtTest 1.0
622+import Unity.Test 0.1
623+
624+TestCase {
625+ Rectangle {
626+ id: rect
627+ }
628+
629+ // Singletons need to be bound to a property and not-named-imported
630+ // for them to be able to be properly passed back to C++.
631+ // See https://bugreports.qt-project.org/browse/QTBUG-30730
632+ property var util: Util
633+
634+ function test_direct() {
635+ compare(Util.isInstanceOf(rect, "QQuickRectangle"), true, "rect should be an instance of QQuickRectangle");
636+ compare(Util.isInstanceOf(util, "TestUtil"), true, "Util should be an instance of TestUtil");
637+ }
638+
639+ function test_inherited() {
640+ compare(Util.isInstanceOf(rect, "QQuickItem"), true, "rect should be an instance of QQuickItem");
641+ compare(Util.isInstanceOf(rect, "QObject"), true, "rect should be an instance of QObject");
642+ compare(Util.isInstanceOf(util, "QObject"), true, "Util should be an instance of QObject");
643+ }
644+
645+ function test_negative() {
646+ compare(Util.isInstanceOf(rect, "QQuickMouseArea"), false, "rect should not be an instance of MouseArea");
647+ compare(Util.isInstanceOf(util, "QQuickItem"), false, "Util should not be an instance of QQuickItem");
648+ }
649+
650+ function test_undefined() {
651+ compare(Util.isInstanceOf(undefined, "QObject"), false, "passing undefined should fail");
652+ }
653+}
654
655=== added directory 'tests/utils'
656=== added file 'tests/utils/CMakeLists.txt'
657--- tests/utils/CMakeLists.txt 1970-01-01 00:00:00 +0000
658+++ tests/utils/CMakeLists.txt 2013-04-19 21:00:36 +0000
659@@ -0,0 +1,1 @@
660+add_subdirectory(modules)
661
662=== added directory 'tests/utils/modules'
663=== added file 'tests/utils/modules/CMakeLists.txt'
664--- tests/utils/modules/CMakeLists.txt 1970-01-01 00:00:00 +0000
665+++ tests/utils/modules/CMakeLists.txt 2013-04-19 21:00:36 +0000
666@@ -0,0 +1,1 @@
667+add_subdirectory(Unity)
668
669=== added directory 'tests/utils/modules/Unity'
670=== added file 'tests/utils/modules/Unity/CMakeLists.txt'
671--- tests/utils/modules/Unity/CMakeLists.txt 1970-01-01 00:00:00 +0000
672+++ tests/utils/modules/Unity/CMakeLists.txt 2013-04-19 21:00:36 +0000
673@@ -0,0 +1,1 @@
674+add_subdirectory(Test)
675
676=== added directory 'tests/utils/modules/Unity/Test'
677=== added file 'tests/utils/modules/Unity/Test/CMakeLists.txt'
678--- tests/utils/modules/Unity/Test/CMakeLists.txt 1970-01-01 00:00:00 +0000
679+++ tests/utils/modules/Unity/Test/CMakeLists.txt 2013-04-19 21:00:36 +0000
680@@ -0,0 +1,21 @@
681+find_package(Qt5Core REQUIRED)
682+find_package(Qt5Quick REQUIRED)
683+
684+set(CMAKE_AUTOMOC ON)
685+add_definitions(-DQT_NO_KEYWORDS)
686+
687+set(UnityTestQML_SOURCES
688+ testutil.cpp
689+ plugin.cpp
690+)
691+
692+add_library(UnityTestQml MODULE ${UnityTestQML_SOURCES})
693+
694+qt5_use_modules(UnityTestQml Core Quick)
695+
696+# copy qmldir file into build directory for shadow builds
697+file(GLOB QML_JS_FILES *.js *.qml)
698+
699+file(COPY qmldir ${QML_JS_FILES}
700+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
701+ )
702
703=== renamed file 'tests/qmltests/UnityTestCase.qml' => 'tests/utils/modules/Unity/Test/UnityTestCase.qml'
704=== added file 'tests/utils/modules/Unity/Test/plugin.cpp'
705--- tests/utils/modules/Unity/Test/plugin.cpp 1970-01-01 00:00:00 +0000
706+++ tests/utils/modules/Unity/Test/plugin.cpp 2013-04-19 21:00:36 +0000
707@@ -0,0 +1,33 @@
708+/*
709+ * Copyright (C) 2012, 2013 Canonical, Ltd.
710+ *
711+ * This program is free software; you can redistribute it and/or modify
712+ * it under the terms of the GNU General Public License as published by
713+ * the Free Software Foundation; version 3.
714+ *
715+ * This program is distributed in the hope that it will be useful,
716+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
717+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
718+ * GNU General Public License for more details.
719+ *
720+ * You should have received a copy of the GNU General Public License
721+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
722+ */
723+
724+
725+#include "plugin.h"
726+#include "testutil.h"
727+
728+#include <qqml.h>
729+
730+static QObject *testutil_provider(QQmlEngine* /* engine */, QJSEngine* /* scriptEngine */)
731+{
732+ return new TestUtil();
733+}
734+
735+void UnityTestPlugin::registerTypes(const char *uri)
736+{
737+ Q_ASSERT(QLatin1String(uri) == QLatin1String("Unity.Test"));
738+ // @uri Unity.Test
739+ qmlRegisterSingletonType<TestUtil>(uri, 0, 1, "Util", testutil_provider);
740+}
741
742=== added file 'tests/utils/modules/Unity/Test/plugin.h'
743--- tests/utils/modules/Unity/Test/plugin.h 1970-01-01 00:00:00 +0000
744+++ tests/utils/modules/Unity/Test/plugin.h 2013-04-19 21:00:36 +0000
745@@ -0,0 +1,32 @@
746+/*
747+ * Copyright (C) 2012, 2013 Canonical, Ltd.
748+ *
749+ * This program is free software; you can redistribute it and/or modify
750+ * it under the terms of the GNU General Public License as published by
751+ * the Free Software Foundation; version 3.
752+ *
753+ * This program is distributed in the hope that it will be useful,
754+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
755+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
756+ * GNU General Public License for more details.
757+ *
758+ * You should have received a copy of the GNU General Public License
759+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
760+ */
761+
762+
763+#ifndef UNITY_TEST_PLUGIN_H
764+#define UNITY_TEST_PLUGIN_H
765+
766+#include <QQmlExtensionPlugin>
767+
768+class UnityTestPlugin : public QQmlExtensionPlugin
769+{
770+ Q_OBJECT
771+ Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
772+
773+public:
774+ void registerTypes(const char *uri);
775+};
776+
777+#endif // UNITY_TEST_PLUGIN_H
778
779=== added file 'tests/utils/modules/Unity/Test/qmldir'
780--- tests/utils/modules/Unity/Test/qmldir 1970-01-01 00:00:00 +0000
781+++ tests/utils/modules/Unity/Test/qmldir 2013-04-19 21:00:36 +0000
782@@ -0,0 +1,3 @@
783+module Unity.Test
784+plugin UnityTestQml
785+UnityTestCase 0.1 UnityTestCase.qml
786
787=== added file 'tests/utils/modules/Unity/Test/testutil.cpp'
788--- tests/utils/modules/Unity/Test/testutil.cpp 1970-01-01 00:00:00 +0000
789+++ tests/utils/modules/Unity/Test/testutil.cpp 2013-04-19 21:00:36 +0000
790@@ -0,0 +1,36 @@
791+/*
792+ * Copyright (C) 2012, 2013 Canonical, Ltd.
793+ *
794+ * This program is free software; you can redistribute it and/or modify
795+ * it under the terms of the GNU General Public License as published by
796+ * the Free Software Foundation; version 3.
797+ *
798+ * This program is distributed in the hope that it will be useful,
799+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
800+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
801+ * GNU General Public License for more details.
802+ *
803+ * You should have received a copy of the GNU General Public License
804+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
805+ */
806+
807+
808+#include "testutil.h"
809+
810+#include <QDebug>
811+
812+TestUtil::TestUtil(QObject *parent)
813+: QObject(parent)
814+{
815+}
816+
817+TestUtil::~TestUtil()
818+{
819+}
820+
821+bool
822+TestUtil::isInstanceOf(QObject *obj, QString name)
823+{
824+ if (!obj) return false;
825+ return obj->metaObject()->className() == name || obj->inherits(name.toUtf8());
826+}
827
828=== added file 'tests/utils/modules/Unity/Test/testutil.h'
829--- tests/utils/modules/Unity/Test/testutil.h 1970-01-01 00:00:00 +0000
830+++ tests/utils/modules/Unity/Test/testutil.h 2013-04-19 21:00:36 +0000
831@@ -0,0 +1,38 @@
832+/*
833+ * Copyright (C) 2012, 2013 Canonical, Ltd.
834+ *
835+ * This program is free software; you can redistribute it and/or modify
836+ * it under the terms of the GNU General Public License as published by
837+ * the Free Software Foundation; version 3.
838+ *
839+ * This program is distributed in the hope that it will be useful,
840+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
841+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
842+ * GNU General Public License for more details.
843+ *
844+ * You should have received a copy of the GNU General Public License
845+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
846+ */
847+
848+
849+#ifndef TESTUTIL_H
850+#define TESTUTIL_H
851+
852+#include <QtQuick/QQuickItem>
853+
854+class TestUtil : public QObject
855+{
856+ Q_OBJECT
857+ Q_DISABLE_COPY(TestUtil)
858+
859+public:
860+ TestUtil(QObject *parent = 0);
861+ ~TestUtil();
862+
863+ Q_INVOKABLE bool isInstanceOf(QObject*, QString);
864+};
865+
866+QML_DECLARE_TYPE(TestUtil)
867+
868+#endif // TESTUTIL_H
869+
870
871=== modified file 'unity.qmlproject'
872--- unity.qmlproject 2013-03-22 12:01:20 +0000
873+++ unity.qmlproject 2013-04-19 21:00:36 +0000
874@@ -16,5 +16,9 @@
875 directory: "."
876 }
877 /* List of plugin directories passed to QML runtime */
878- importPaths: [ "plugins" ]
879+ importPaths: [
880+ "builddir/plugins",
881+ "builddir/tests/plugins",
882+ "builddir/tests/utils/modules"
883+ ]
884 }

Subscribers

People subscribed via source and target branches