on xenial help sign in
merged with lp:~unity-team/unity8/installed-qmltests
9b6323cNick Dedekind
CMakeLists.txt−2
@@ -138,8 +138,6 @@ include_directories(
138 ${APPLICATION_API_INCLUDE_DIRS}
138 ${APPLICATION_API_INCLUDE_DIRS}
139)
139)
140
140
141−set(ARTIFACTS_DIR "" CACHE PATH "Store test artifacts in this directory.")
142−
143# Quiet logger
141# Quiet logger
144set(QUIET_LOGGER OFF CACHE BOOL "Disable test output on stdout.")
142set(QUIET_LOGGER OFF CACHE BOOL "Disable test output on stdout.")
145if(NOT QUIET_LOGGER)
143if(NOT QUIET_LOGGER)
cmake/modules/QmlTest.cmake+182−11
@@ -55,6 +55,55 @@ function(add_qml_test PATH COMPONENT_NAME)
55endfunction()
55endfunction()
56
56
57
57
58+# add_qml_test_data(path component_name
59+# [...]
60+# )
61+#
62+# Install file called ${component_name} (or ${component_name}.qml) under
63+# ${path}.
64+
65+function(add_qml_test_data PATH COMPONENT_NAME)
66+ cmake_parse_arguments(TEST "" "DESTINATION" "" ${ARGN})
67+
68+ set(filename "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/${COMPONENT_NAME}")
69+
70+ if (IS_DIRECTORY "${filename}")
71+ # As a convenience, allow specifying a directory and we will install
72+ # all files in the dir. We do it this way rather than passing
73+ # DIRECTORY to install() because we want to process any qml files.
74+ file(GLOB subfiles RELATIVE "${filename}" "${filename}/*")
75+ foreach(subfile ${subfiles})
76+ add_qml_test_data("${PATH}/${COMPONENT_NAME}" "${subfile}")
77+ endforeach()
78+ return()
79+ endif()
80+
81+ if (NOT EXISTS "${filename}")
82+ set(filename "${filename}.qml")
83+ set(COMPONENT_NAME "${COMPONENT_NAME}.qml")
84+ endif()
85+
86+ if ("${filename}" MATCHES "\\.qml$")
87+ file(READ "${filename}" contents)
88+ string(REGEX REPLACE "(\"[./]*)/qml(/|\")" "\\1\\2" contents "${contents}")
89+ # this is for (at least) cardcreatortest which pulls in an architecture-specific
90+ # import into the plugins directory (which is a 'qml' once installed).
91+ string(REGEX REPLACE "(import \"[./]*)/plugins(/|\")" "\\1/qml\\2" contents "${contents}")
92+ set(filename "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/${COMPONENT_NAME}")
93+ file(WRITE "${filename}" "${contents}")
94+ endif()
95+
96+ if (TEST_DESTINATION)
97+ set(DESTINATION "${TEST_DESTINATION}")
98+ else()
99+ file(RELATIVE_PATH relcurpath "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}")
100+ set(DESTINATION "${SHELL_APP_DIR}/${relcurpath}/${PATH}")
101+ endif()
102+
103+ install(FILES "${filename}" DESTINATION "${DESTINATION}")
104+endfunction()
105+
106+
58# add_qml_unittest(path component_name
107# add_qml_unittest(path component_name
59# [...]
108# [...]
60# )
109# )
@@ -71,6 +120,10 @@ function(add_qml_unittest PATH COMPONENT_NAME)
71 ${ARGN}
120 ${ARGN}
72 ARGS -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
121 ARGS -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
73 )
122 )
123+
124+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml")
125+ add_qml_test_data("${PATH}" "tst_${COMPONENT_NAME}.qml")
126+ endif()
74endfunction()
127endfunction()
75
128
76
129
@@ -91,6 +144,10 @@ function(add_manual_qml_test PATH COMPONENT_NAME)
91 ${ARGN}
144 ${ARGN}
92 ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
145 ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
93 )
146 )
147+
148+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml")
149+ add_qml_test_data("${PATH}" "tst_${COMPONENT_NAME}.qml")
150+ endif()
94endfunction()
151endfunction()
95
152
96
153
@@ -108,8 +165,7 @@ endfunction()
108#
165#
109# Logging options in the standard form of "-o filename,format"
166# Logging options in the standard form of "-o filename,format"
110# will be appended to the arguments list, prefixed with ARG_PREFIX.
167# will be appended to the arguments list, prefixed with ARG_PREFIX.
111−# XUnitXML files will be stored in current binary dir or under
168+# XUnitXML files will be stored in current binary dir.
112−# ARTIFACTS_DIR, if set.
113#
169#
114# Three targets will be created:
170# Three targets will be created:
115# - test${component_name} - Runs the test
171# - test${component_name} - Runs the test
@@ -122,14 +178,8 @@ function(add_executable_test COMPONENT_NAME TARGET)
122 cmake_parse_arguments(QMLTEST "${QMLTEST_OPTIONS}" "${QMLTEST_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
178 cmake_parse_arguments(QMLTEST "${QMLTEST_OPTIONS}" "${QMLTEST_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
123 mangle_arguments()
179 mangle_arguments()
124
180
125− if(ARTIFACTS_DIR)
181+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
126− file(RELATIVE_PATH path ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
127− file(MAKE_DIRECTORY ${ARTIFACTS_DIR}/${path})
128− set(file_logger -o ${ARTIFACTS_DIR}/${path}/test${COMPONENT_NAME}.xml,xunitxml)
129− else()
130− file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
131− set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
182+ set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
132− endif()
133
183
134 bake_arguments("${QMLTEST_ARG_PREFIX}" args ${iterations} ${file_logger} ${STDOUT_LOGGER})
184 bake_arguments("${QMLTEST_ARG_PREFIX}" args ${iterations} ${file_logger} ${STDOUT_LOGGER})
135
185
@@ -207,8 +257,124 @@ function(add_manual_test COMPONENT_NAME TARGET)
207endfunction()
257endfunction()
208
258
209
259
260+# add_meta_test(target)
261+#
262+# Adds a test target that will run one of our "meta" test targets, like
263+# xvfbuitests. This script will run the specified suite of tests on an
264+# installed system.
265+
266+function(add_meta_test TARGET_NAME)
267+ cmake_parse_arguments(TEST "" "" "DEPENDS" ${ARGN})
268+
269+ add_custom_target(${TARGET_NAME})
270+
271+ set(filename "${CMAKE_BINARY_DIR}/tests/scripts/${TARGET_NAME}.sh")
272+ file(WRITE "${filename}" "#!/usr/bin/parallel --shebang --no-notice\n\n")
273+
274+ add_meta_dependencies(${TARGET_NAME} DEPENDS ${TEST_DEPENDS})
275+ # else we will write the rest of the script as we add cmake targets
276+
277+ install(FILES "${filename}"
278+ PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
279+ GROUP_EXECUTE GROUP_READ
280+ WORLD_EXECUTE WORLD_READ
281+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/scripts"
282+ )
283+endfunction()
284+
285+
210################### INTERNAL ####################
286################### INTERNAL ####################
211
287
288+function(install_test_script TARGET_NAME)
289+ cmake_parse_arguments(TEST "" "" "COMMAND;ENVIRONMENT" ${ARGN})
290+
291+ # Now write the above test into a shell script that we can run on an
292+ # installed system.
293+ set(script "#!/bin/sh\n\nset -x\n\n")
294+ foreach(ONE_ENV ${TEST_ENVIRONMENT})
295+ set(script "${script}export ${ONE_ENV}\n")
296+ endforeach()
297+ set(script "${script}export UNITY_TESTING_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}\"\n")
298+ set(script "${script}export UNITY_TESTING_LIBDIR=\"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}\"\n")
299+ set(script "${script}\n")
300+ set(script "${script}XML_ARGS=\n")
301+ set(script "${script}if [ -n \"\$ARTIFACTS_DIR\" ]; then\n")
302+ set(script "${script} XML_ARGS=\"@XML_ARGS@\"\n")
303+ set(script "${script} mkdir -p \"@XML_DIR@\"\n")
304+ set(script "${script} touch \"@XML_FILE@\"\n")
305+ set(script "${script}fi\n")
306+ set(script "${script}\n")
307+ foreach(ONE_CMD ${TEST_COMMAND})
308+ set(script "${script}'${ONE_CMD}' ")
309+ endforeach()
310+
311+ set(filename "${CMAKE_BINARY_DIR}/tests/scripts/${TARGET_NAME}.sh")
312+
313+ # Generate script to file then read it back to resolve any generator
314+ # expressions before we try to replace paths.
315+ file(GENERATE
316+ OUTPUT "${filename}"
317+ CONTENT "${script}"
318+ )
319+
320+ # Do replacement at install time to save needless work and to make sure
321+ # we are modifying file after generate step above (which doesn't happen
322+ # immediately). We can't use a custom-defined function or macro here...
323+ # So instead we use a giant ugly code block.
324+
325+ # START OF CODE BLOCK --------------------------------------------------
326+ install(CODE "
327+ file(READ \"${filename}\" replacestr)
328+
329+ # Now some replacements...
330+ # tests like to write xml output to our builddir; we don't need that, but we do want them in ARTIFACTS_DIR
331+ string(REGEX MATCH \"( '--parameter')? '-o'( '--parameter')? '[^']*,xunitxml' \" xmlargs \"\${replacestr}\")
332+ string(REGEX REPLACE \"( '--parameter')? '-o'( '--parameter')? '[^']*,xunitxml' \" \" \\\$XML_ARGS \" replacestr \"\${replacestr}\")
333+ string(REGEX REPLACE \"'[^']*/tests/\" \"'\\\$ARTIFACTS_DIR/tests/\" xmlargs \"\${xmlargs}\")
334+ string(REGEX REPLACE \".*'([^']*),xunitxml'.*\" \"\\\\1\" xmlfile \"\${xmlargs}\")
335+ string(REGEX REPLACE \"(.*)/[^/]*\" \"\\\\1\" xmldir \"\${xmlfile}\")
336+ string(REGEX REPLACE \"'\" \"\" xmlargs \"\${xmlargs}\") # strip single quotes
337+ string(REGEX REPLACE \"@XML_ARGS@\" \"\${xmlargs}\" replacestr \"\${replacestr}\")
338+ string(REGEX REPLACE \"@XML_DIR@\" \"\${xmldir}\" replacestr \"\${replacestr}\")
339+ string(REGEX REPLACE \"@XML_FILE@\" \"\${xmlfile}\" replacestr \"\${replacestr}\")
340+ # replace build/source roots with their install paths
341+ string(REPLACE \"${CMAKE_BINARY_DIR}/libs\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}\" replacestr \"\${replacestr}\")
342+ string(REPLACE \"${CMAKE_BINARY_DIR}/plugins\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}\" replacestr \"\${replacestr}\")
343+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/libs\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/tests/libs\" replacestr \"\${replacestr}\")
344+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/mocks\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks\" replacestr \"\${replacestr}\")
345+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/plugins\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/tests/plugins\" replacestr \"\${replacestr}\")
346+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/qmltests\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/tests/qmltests\" replacestr \"\${replacestr}\")
347+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/uqmlscene\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}\" replacestr \"\${replacestr}\")
348+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/utils/modules\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/utils\" replacestr \"\${replacestr}\")
349+ string(REPLACE \"${CMAKE_SOURCE_DIR}/tests/plugins\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}/tests/plugins\" replacestr \"\${replacestr}\")
350+ string(REPLACE \"${CMAKE_SOURCE_DIR}/tests/qmltests\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}/tests/qmltests\" replacestr \"\${replacestr}\")
351+
352+ file(WRITE \"${filename}\" \"\${replacestr}\")
353+ ")
354+ # END OF CODE BLOCK --------------------------------------------------
355+
356+ install(FILES "${filename}"
357+ PERMISSIONS OWNER_EXECUTE OWNER_READ OWNER_WRITE
358+ GROUP_EXECUTE GROUP_READ
359+ WORLD_EXECUTE WORLD_READ
360+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/scripts"
361+ )
362+endfunction()
363+
364+function(add_meta_dependencies UPSTREAM_TARGET)
365+ cmake_parse_arguments(TEST "" "" "DEPENDS" ${ARGN})
366+
367+ foreach(depend ${TEST_DEPENDS})
368+ add_dependencies(${UPSTREAM_TARGET} ${depend})
369+
370+ # add depend to the meta test script that we will install on system
371+ set(filename "${CMAKE_BINARY_DIR}/tests/scripts/${UPSTREAM_TARGET}.sh")
372+ if (EXISTS "${filename}")
373+ file(APPEND "${filename}" "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/tests/scripts/${depend}.sh\n")
374+ endif()
375+ endforeach()
376+endfunction()
377+
212# add_qmltest_target(target_name target
378# add_qmltest_target(target_name target
213# COMMAND test_exe [arg1 [...]] # execute this test with arguments
379# COMMAND test_exe [arg1 [...]] # execute this test with arguments
214# [...] # see above for available arguments:
380# [...] # see above for available arguments:
@@ -231,6 +397,11 @@ function(add_qmltest_target TARGET_NAME TARGET)
231 DEPENDS ${TARGET} ${QMLTEST_DEPENDS}
397 DEPENDS ${TARGET} ${QMLTEST_DEPENDS}
232 )
398 )
233
399
400+ install_test_script(${TARGET_NAME}
401+ ENVIRONMENT ${QMLTEST_ENVIRONMENT}
402+ COMMAND ${QMLTEST_COMMAND}
403+ )
404+
234 if(QMLTEST_ADD_TEST)
405 if(QMLTEST_ADD_TEST)
235 add_test(
406 add_test(
236 NAME ${TARGET_NAME}
407 NAME ${TARGET_NAME}
@@ -248,7 +419,7 @@ function(add_qmltest_target TARGET_NAME TARGET)
248 endif()
419 endif()
249
420
250 foreach(UPSTREAM_TARGET ${QMLTEST_TARGETS})
421 foreach(UPSTREAM_TARGET ${QMLTEST_TARGETS})
251− add_dependencies(${UPSTREAM_TARGET} ${TARGET_NAME})
422+ add_meta_dependencies(${UPSTREAM_TARGET} DEPENDS ${TARGET_NAME})
252 endforeach()
423 endforeach()
253endfunction()
424endfunction()
254
425
debian/control+19−8
@@ -11,6 +11,7 @@ Build-Depends: cmake,
11# to g++ so we don't try to run arm g++
11# to g++ so we don't try to run arm g++
12# on an x86 CPU for example, when cross-compiling.
12# on an x86 CPU for example, when cross-compiling.
13 g++:native,
13 g++:native,
14+ gdb,
14 graphviz,
15 graphviz,
15 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
16 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
16 libandroid-properties-dev,
17 libandroid-properties-dev,
@@ -68,6 +69,7 @@ Build-Depends: cmake,
68 qtdeclarative5-ubuntu-content1,
69 qtdeclarative5-ubuntu-content1,
69 qtdeclarative5-ubuntu-settings-components (>= 0.11),
70 qtdeclarative5-ubuntu-settings-components (>= 0.11),
70 ttf-ubuntu-font-family,
71 ttf-ubuntu-font-family,
72+ xvfb,
71Standards-Version: 3.9.4
73Standards-Version: 3.9.4
72Homepage: http://launchpad.net/unity
74Homepage: http://launchpad.net/unity
73# If you aren't a member of ~unity-team but need to upload
75# If you aren't a member of ~unity-team but need to upload
@@ -164,7 +166,7 @@ Depends: qml-module-qtquick-layouts,
164 unity-notifications-impl-3,
166 unity-notifications-impl-3,
165 unity-plugin-scopes | unity-scopes-impl,
167 unity-plugin-scopes | unity-scopes-impl,
166 unity-scopes-impl-12,
168 unity-scopes-impl-12,
167− unity8-fake-env | unity-application-impl,
169+ unity8-tests | unity-application-impl,
168 ${misc:Depends},
170 ${misc:Depends},
169Breaks: unity8 (<< 7.86),
171Breaks: unity8 (<< 7.86),
170Replaces: unity8 (<< 7.86),
172Replaces: unity8 (<< 7.86),
@@ -190,27 +192,36 @@ Depends: autopilot-qt5 (>= 1.4),
190 ubuntu-ui-toolkit-autopilot (>= 1.3.2030),
192 ubuntu-ui-toolkit-autopilot (>= 1.3.2030),
191 unity-scope-click,
193 unity-scope-click,
192 unity8 (= ${source:Version}),
194 unity8 (= ${source:Version}),
193− unity8-fake-env (= ${source:Version}),
195+ unity8-tests (= ${source:Version}),
194 url-dispatcher-tools,
196 url-dispatcher-tools,
195 xvfb,
197 xvfb,
196 ${misc:Depends},
198 ${misc:Depends},
197 ${python3:Depends},
199 ${python3:Depends},
198− ${shlibs:Depends},
199Description: Test package for Unity 8 shell
200Description: Test package for Unity 8 shell
200 Autopilot tests for the unity8 package
201 Autopilot tests for the unity8 package
201
202
202−Package: unity8-fake-env
203+Package: unity8-tests
203Architecture: any
204Architecture: any
204Multi-Arch: same
205Multi-Arch: same
205Pre-Depends: ${misc:Pre-Depends},
206Pre-Depends: ${misc:Pre-Depends},
207+Depends: dbus-test-runner,
208+ parallel,
209+ qt5-default,
210+ qtdeclarative5-dev-tools,
211+ unity8 (= ${source:Version}),
212+ xvfb,
206−Depends: ${misc:Depends},
213+ ${misc:Depends},
207 ${shlibs:Depends},
214 ${shlibs:Depends},
208Provides: unity-application-impl,
215Provides: unity-application-impl,
209 unity-application-impl-22,
216 unity-application-impl-22,
217+ unity8-fake-env,
210−Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1)
218+Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1),
219+ unity8-fake-env,
220+Conflicts: unity8-fake-env,
211−Description: Fake environment for running Unity 8 shell
221+Description: Scripts and mocks for running Unity 8 shell tests
212 Provides fake implementations of some QML modules used by Unity 8 shell
222 Provides fake implementations of some QML modules used by Unity 8 shell
213− (e.g Ubuntu.Application) so that you can run it in a sandboxed environment.
223+ (e.g Ubuntu.Application) so that you can run it in a sandboxed environment
224+ and scripts to run its test suite.
214
225
215Package: unity8-private
226Package: unity8-private
216Architecture: any
227Architecture: any
debian/rules+2−2
@@ -35,9 +35,9 @@ override_dh_installdeb:
35
35
36# use private lib directories
36# use private lib directories
37override_dh_makeshlibs:
37override_dh_makeshlibs:
38− dh_makeshlibs -Nunity8-private -Nunity8-fake-env
38+ dh_makeshlibs -Nunity8-private -Nunity8-tests
39
39
40override_dh_shlibdeps:
40override_dh_shlibdeps:
41 # Some mock libraries link against liblightdm-qt5-3.so which we want to
41 # Some mock libraries link against liblightdm-qt5-3.so which we want to
42 # avoid, since we only really link against our mock one, not the system one.
42 # avoid, since we only really link against our mock one, not the system one.
43− dh_shlibdeps -XlibMockLightDM-qml.so -XlibMockAccountsService-qml.so
43+ dh_shlibdeps -XlibMockLightDM-qml.so -XlibMockAccountsService-qml.so -Lunity8-private
debian/shlibs.localnew file+1
@@ -0,0 +1 @@
1+libunity8-private 0 unity8-private
debian/tests/control+2−3
@@ -1,8 +1,7 @@
1Tests: qmluitests.sh
1Tests: qmluitests.sh
2Restrictions: allow-stderr
2Restrictions: allow-stderr
3−Depends: @,
3+Depends: dpkg-dev,
4− @builddeps@,
4+ unity8-tests,
5− xvfb,
6
5
7Tests: autopilot.sh
6Tests: autopilot.sh
8Restrictions: allow-stderr,
7Restrictions: allow-stderr,
debian/tests/qmluitests.sh+4−14
@@ -1,21 +1,11 @@
1#!/bin/sh
1#!/bin/sh
2+# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
2
3
3# log all commands and abort on error
4# log all commands and abort on error
4set -xe
5set -xe
5
6
6−SHELL_QML_PATH=$(pkg-config --variable=plugindir unity-shell-api)
7+DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
7−UNITY_SOURCE_DIR=$(readlink -f $(dirname $(readlink -f $0))/../..)
8
8
9−dh_auto_configure -- -DCMAKE_INSTALL_LOCALSTATEDIR="/var" \
10− -DARTIFACTS_DIR=${ADT_ARTIFACTS} \
9+export ARTIFACTS_DIR="${ADT_ARTIFACTS}"
11− -DUNITY_PLUGINPATH=${SHELL_QML_PATH} \
12− -DUNITY_MOCKPATH=${SHELL_QML_PATH}/mocks
13−dh_auto_build --parallel -- -C tests/mocks
14−dh_auto_build --parallel -- -C tests/plugins
15−dh_auto_build --parallel -- -C tests/qmltests
16−dh_auto_build --parallel -- -C tests/uqmlscene
17−dh_auto_build --parallel -- -C tests/utils
18
10
19−export UNITY_SOURCE_DIR
11+/usr/lib/$DEB_HOST_MULTIARCH/unity8/tests/scripts/xvfballtests.sh
20−
21−dh_auto_build --parallel -- -k xvfballtests
debian/unity8-fake-env.install → debian/unity8-tests.installrenamed+4
@@ -3,4 +3,8 @@ usr/bin/unity-mock-indicator-service
3usr/lib/*/unity8/qml/mocks
3usr/lib/*/unity8/qml/mocks
4usr/lib/*/unity8/qml/nonmirplugins
4usr/lib/*/unity8/qml/nonmirplugins
5usr/lib/*/unity8/qml/scopefakes
5usr/lib/*/unity8/qml/scopefakes
6+usr/lib/*/unity8/qml/utils
7+usr/lib/*/unity8/tests
8+usr/lib/*/unity8/uqmlscene
6usr/share/unity8/mocks
9usr/share/unity8/mocks
10+usr/share/unity8/tests
debian/unity8-tests.lintian-overridesnew file+1
@@ -0,0 +1 @@
1+unity8-tests: unusual-interpreter usr/lib/*/unity8/tests/scripts/*.sh #!/usr/bin/parallel
include/paths.h.in+26−1
@@ -41,7 +41,10 @@ inline QString installRoot() {
41}
41}
42
42
43inline bool isRunningInstalled() {
43inline bool isRunningInstalled() {
44+ // Tests don't use the normal binary, so we want to check binary *and*
45+ // the environment. Installed tests have UNITY_TESTING_DATADIR set.
46+ static bool installed_test_env = !qgetenv("UNITY_TESTING_DATADIR").isEmpty();
44− return !installRoot().isNull();
47+ return !installRoot().isNull() || installed_test_env;
45}
48}
46
49
47inline QString buildDirectory() {
50inline QString buildDirectory() {
@@ -62,6 +65,28 @@ inline QString translationDirectory() {
62 }
65 }
63}
66}
64
67
68+inline QString testDataDir() {
69+ // Can't use isRunningInstalled, since tests don't use the normal unity8
70+ // executable. $UNITY_TESTING_DATADIR is set by installed tests.
71+ QString datadir(qgetenv("UNITY_TESTING_DATADIR"));
72+ if (datadir.isEmpty()) {
73+ return sourceDirectory() + "/tests";
74+ } else {
75+ return datadir + "/tests";
76+ }
77+}
78+
79+inline QString testLibDir() {
80+ // Can't use isRunningInstalled, since tests don't use the normal unity8
81+ // executable. $UNITY_TESTING_DATADIR is set by installed tests.
82+ QString libdir(qgetenv("UNITY_TESTING_LIBDIR"));
83+ if (libdir.isEmpty()) {
84+ return buildDirectory() + "/tests";
85+ } else {
86+ return libdir + "/tests";
87+ }
88+}
89+
65inline QString qmlDirectory() {
90inline QString qmlDirectory() {
66 if (isRunningInstalled()) {
91 if (isRunningInstalled()) {
67 return installRoot() + QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
92 return installRoot() + QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
plugins/Ubuntu/Gestures/CMakeLists.txt+1−1
@@ -16,7 +16,7 @@ pkg_check_modules(UBUNTUGESTURES REQUIRED UbuntuGestures)
16
16
17add_definitions(-DUBUNTUGESTURESQML_LIBRARY)
17add_definitions(-DUBUNTUGESTURESQML_LIBRARY)
18
18
19−add_library(UbuntuGesturesQml MODULE ${UbuntuGesturesQml_SOURCES})
19+add_library(UbuntuGesturesQml SHARED ${UbuntuGesturesQml_SOURCES})
20target_link_libraries(UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
20target_link_libraries(UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
21
21
22qt5_use_modules(UbuntuGesturesQml Core Quick)
22qt5_use_modules(UbuntuGesturesQml Core Quick)
plugins/Wizard/PageList.cpp+3−1
@@ -46,7 +46,9 @@ PageList::PageList(QObject *parent)
46 QSet<QString> disabledPages;
46 QSet<QString> disabledPages;
47 QStringList dataDirs;
47 QStringList dataDirs;
48
48
49− if (!isRunningInstalled() && getenv("WIZARD_TESTING") == nullptr) {
49+ if (getenv("WIZARD_TESTING") != nullptr) {
50+ dataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
51+ } else if (!isRunningInstalled()) {
50 dataDirs << qmlDirectory();
52 dataDirs << qmlDirectory();
51 } else {
53 } else {
52 dataDirs = shellDataDirs();
54 dataDirs = shellDataDirs();
tests/CMakeLists.txt+16−8
@@ -1,17 +1,14 @@
1include(QmlTest)
1include(QmlTest)
2
2
3# QML tests that do not require graphical capabilities.
3# QML tests that do not require graphical capabilities.
4−add_custom_target(unittests)
4+add_meta_test(unittests)
5
5
6# QML tests that require graphical capabilities.
6# QML tests that require graphical capabilities.
7−add_custom_target(uitests)
7+add_meta_test(uitests)
8−add_custom_target(xvfbuitests)
8+add_meta_test(xvfbuitests)
9
9
10−add_custom_target(alltests)
11−add_dependencies(alltests unittests uitests)
10+add_meta_test(alltests DEPENDS unittests uitests)
12−
13−add_custom_target(xvfballtests)
14−add_dependencies(xvfballtests unittests xvfbuitests)
11+add_meta_test(xvfballtests DEPENDS unittests xvfbuitests)
15
12
16# Support libraries and plugins
13# Support libraries and plugins
17add_subdirectory(mocks)
14add_subdirectory(mocks)
@@ -121,6 +118,11 @@ function(add_unity8_qmlbenchmark PATH COMPONENT_NAME ITERATIONS)
121 add_unity8_qmltest(${PATH} ${COMPONENT_NAME} ITERATIONS ${ITERATIONS} ${ARGN})
118 add_unity8_qmltest(${PATH} ${COMPONENT_NAME} ITERATIONS ${ITERATIONS} ${ARGN})
122endfunction()
119endfunction()
123
120
121+# add files needed for qml tests, just here for better alignment with add_unity8_qmltest
122+function(add_unity8_qmltest_data PATH COMPONENT_NAME)
123+ add_qml_test_data("${PATH}" "${COMPONENT_NAME}")
124+endfunction()
125+
124# used to make dbus adaptor classes from xml to mock system services
126# used to make dbus adaptor classes from xml to mock system services
125if(DEFINED ENV{DEB_BUILD_MULTIARCH})
127if(DEFINED ENV{DEB_BUILD_MULTIARCH})
126 set(QDBUSXML2CPP_EXECUTABLE "/usr/lib/$ENV{DEB_BUILD_MULTIARCH}/qt5/bin/qdbusxml2cpp")
128 set(QDBUSXML2CPP_EXECUTABLE "/usr/lib/$ENV{DEB_BUILD_MULTIARCH}/qt5/bin/qdbusxml2cpp")
@@ -128,6 +130,12 @@ else()
128 FIND_PROGRAM(QDBUSXML2CPP_EXECUTABLE qdbusxml2cpp)
130 FIND_PROGRAM(QDBUSXML2CPP_EXECUTABLE qdbusxml2cpp)
129endif()
131endif()
130
132
133+
134+install(DIRECTORY data graphics
135+ DESTINATION "${SHELL_APP_DIR}/tests"
136+)
137+
138+
131# Actual test definitions
139# Actual test definitions
132add_subdirectory(plugins)
140add_subdirectory(plugins)
133add_subdirectory(qmltests)
141add_subdirectory(qmltests)
tests/graphics/screenshots/gallery@12.pngnew file

Binary file not shown.

tests/mocks/AccountsService/CMakeLists.txt−1
@@ -20,6 +20,5 @@ target_link_libraries(MockAccountsService-qml
20 )
20 )
21
21
22add_unity8_mock(AccountsService 0.1 AccountsService
22add_unity8_mock(AccountsService 0.1 AccountsService
23− PREFIX mocks
24 TARGETS MockAccountsService-qml
23 TARGETS MockAccountsService-qml
25 )
24 )
tests/mocks/CMakeLists.txt+13−14
@@ -11,21 +11,20 @@ macro(add_unity8_mock PLUGIN VERSION PATH)
11 set(single PREFIX)
11 set(single PREFIX)
12 cmake_parse_arguments(MOCK "" "${single}" "" ${ARGN})
12 cmake_parse_arguments(MOCK "" "${single}" "" ${ARGN})
13
13
14− if(MOCK_PREFIX)
15− export_qmlfiles(${PLUGIN} ${PATH}
16− DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX}
17− TARGET_PREFIX ${MOCK_PREFIX}-Mock
14+ if (NOT MOCK_PREFIX)
18− ${MOCK_UNPARSED_ARGUMENTS}
19− )
20− export_qmlplugin(${PLUGIN} ${VERSION} ${PATH}
21− DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX}
22− TARGET_PREFIX ${MOCK_PREFIX}-Mock
15+ set(MOCK_PREFIX mocks)
23− ${MOCK_UNPARSED_ARGUMENTS}
24− )
25− else()
26− export_qmlfiles(${PLUGIN} ${PATH} TARGET_PREFIX Mock ${MOCK_UNPARSED_ARGUMENTS})
27− export_qmlplugin(${PLUGIN} ${VERSION} ${PATH} TARGET_PREFIX Mock ${MOCK_UNPARSED_ARGUMENTS})
28 endif()
16 endif()
17+
18+ export_qmlfiles(${PLUGIN} ${PATH}
19+ DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX}
20+ TARGET_PREFIX ${MOCK_PREFIX}-Mock
21+ ${MOCK_UNPARSED_ARGUMENTS}
22+ )
23+ export_qmlplugin(${PLUGIN} ${VERSION} ${PATH}
24+ DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX}
25+ TARGET_PREFIX ${MOCK_PREFIX}-Mock
26+ ${MOCK_UNPARSED_ARGUMENTS}
27+ )
29endmacro()
28endmacro()
30
29
31add_subdirectory(AccountsService)
30add_subdirectory(AccountsService)
tests/mocks/Cursor/CMakeLists.txt+1−1
@@ -1 +1 @@
1−add_unity8_mock(Cursor 1.1 Cursor PREFIX mocks)
1+add_unity8_mock(Cursor 1.1 Cursor)
tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt−1
@@ -45,7 +45,6 @@ target_link_libraries(MockLightDM-qml
45qt5_use_modules(MockLightDM-qml DBus Gui Qml)
45qt5_use_modules(MockLightDM-qml DBus Gui Qml)
46
46
47add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
47add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
48− PREFIX mocks
49 TARGETS MockLightDM-qml
48 TARGETS MockLightDM-qml
50 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
49 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
51)
50)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt+2−1
@@ -13,7 +13,8 @@ add_library(MockLightDM SHARED ${LibLightDM_SOURCES})
13qt5_use_modules(MockLightDM Gui)
13qt5_use_modules(MockLightDM Gui)
14
14
15set_target_properties(MockLightDM PROPERTIES
15set_target_properties(MockLightDM PROPERTIES
16− OUTPUT_NAME lightdm-qt5-3)
16+ OUTPUT_NAME lightdm-qt5-3
17+ SOVERSION 0)
17
18
18install(TARGETS MockLightDM
19install(TARGETS MockLightDM
19 DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
20 DESTINATION ${SHELL_INSTALL_QML}/mocks/LightDM/IntegratedLightDM/liblightdm
tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/CMakeLists.txt+1−1
@@ -7,4 +7,4 @@ add_library(MockSecurityPrivacy MODULE ${MOCK_SECURITYPRIVACY_SOURCES})
7
7
8qt5_use_modules(MockSecurityPrivacy Qml Quick Core)
8qt5_use_modules(MockSecurityPrivacy Qml Quick Core)
9
9
10−add_unity8_mock(Ubuntu.SystemSettings.SecurityPrivacy 1.0 Ubuntu/SystemSettings/SecurityPrivacy PREFIX mocks TARGETS MockSecurityPrivacy)
10+add_unity8_mock(Ubuntu.SystemSettings.SecurityPrivacy 1.0 Ubuntu/SystemSettings/SecurityPrivacy TARGETS MockSecurityPrivacy)
tests/mocks/Unity/Application/ApplicationInfo.cpp+1−2
@@ -138,8 +138,7 @@ void ApplicationInfo::createSurface()
138
138
139void ApplicationInfo::setIconId(const QString &iconId)
139void ApplicationInfo::setIconId(const QString &iconId)
140{
140{
141− setIcon(QString(sourceDirectory() + "/tests/graphics/applicationIcons/%2@18.png")
141+ setIcon(QUrl(testDataDir() + "/graphics/applicationIcons/" + iconId + "@18.png"));
142− .arg(iconId));
143}
142}
144
143
145void ApplicationInfo::setScreenshotId(const QString &screenshotId)
144void ApplicationInfo::setScreenshotId(const QString &screenshotId)
tests/mocks/Unity/Application/CMakeLists.txt+1−1
@@ -27,7 +27,7 @@ set_target_properties(NonMirUnityApplicationQml PROPERTIES OUTPUT_NAME FakeUnity
27qt5_use_modules(FakeUnityApplicationQml Core Quick DBus)
27qt5_use_modules(FakeUnityApplicationQml Core Quick DBus)
28qt5_use_modules(NonMirUnityApplicationQml Core Quick DBus)
28qt5_use_modules(NonMirUnityApplicationQml Core Quick DBus)
29
29
30−add_unity8_mock(Unity.Application 0.1 Unity/Application PREFIX mocks TARGETS FakeUnityApplicationQml)
30+add_unity8_mock(Unity.Application 0.1 Unity/Application TARGETS FakeUnityApplicationQml)
31add_unity8_mock(Unity.Application 0.1 Unity/Application
31add_unity8_mock(Unity.Application 0.1 Unity/Application
32 PREFIX nonmirplugins
32 PREFIX nonmirplugins
33 TARGETS NonMirUnityApplicationQml
33 TARGETS NonMirUnityApplicationQml
tests/mocks/Unity/CMakeLists.txt+3
@@ -68,4 +68,7 @@ target_link_libraries(FakeUnityQml
68
68
69qt5_use_modules(FakeUnityQml Qml)
69qt5_use_modules(FakeUnityQml Qml)
70
70
71+add_unity8_mock(Unity 0.2 Unity TARGETS FakeUnityQml)
72+
73+# and one copy in a separate directory for autopilot
71add_unity8_mock(Unity 0.2 Unity PREFIX scopefakes TARGETS FakeUnityQml)
74add_unity8_mock(Unity 0.2 Unity PREFIX scopefakes TARGETS FakeUnityQml)
tests/mocks/Unity/Indicators/CMakeLists.txt+4
@@ -31,6 +31,10 @@ target_link_libraries(IndicatorsFakeQml
31 QMenuModelQml
31 QMenuModelQml
32)
32)
33
33
34+set_target_properties(IndicatorsFakeQml PROPERTIES
35+ INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/QMenuModel"
36+)
37+
34qt5_use_modules(IndicatorsFakeQml Core Qml Quick)
38qt5_use_modules(IndicatorsFakeQml Core Qml Quick)
35
39
36add_unity8_mock(Unity.Indicators 0.1 Unity/Indicators TARGETS IndicatorsFakeQml)
40add_unity8_mock(Unity.Indicators 0.1 Unity/Indicators TARGETS IndicatorsFakeQml)
tests/mocks/Unity/Launcher/MockLauncherItem.cpp+1−1
@@ -29,7 +29,7 @@ MockLauncherItem::MockLauncherItem(const QString &appId, const QString& desktopF
29 m_appId(appId),
29 m_appId(appId),
30 m_desktopFile(desktopFile),
30 m_desktopFile(desktopFile),
31 m_name(name),
31 m_name(name),
32− m_icon("../../tests/graphics/applicationIcons/" + icon + ".png"),
32+ m_icon(testDataDir() + "/graphics/applicationIcons/" + icon + ".png"),
33 m_pinned(false),
33 m_pinned(false),
34 m_running(false),
34 m_running(false),
35 m_recent(false),
35 m_recent(false),
tests/mocks/Unity/fake_scope.cpp+2−2
@@ -266,11 +266,11 @@ QVariantMap Scope::customizations() const
266 m["foreground-color"] = "blue";
266 m["foreground-color"] = "blue";
267 m["page-header"] = h;
267 m["page-header"] = h;
268 } else if (m_id == "MockScope4") {
268 } else if (m_id == "MockScope4") {
269− h["navigation-background"] = QUrl(sourceDirectory() + "/tests/qmltests/Dash/artwork/background.png");
269+ h["navigation-background"] = QUrl(testDataDir() + "/qmltests/Dash/artwork/background.png");
270 m["page-header"] = h;
270 m["page-header"] = h;
271 } else if (m_id == "MockScope5") {
271 } else if (m_id == "MockScope5") {
272 h["background"] = "gradient:///lightgrey/grey";
272 h["background"] = "gradient:///lightgrey/grey";
273− h["logo"] = QUrl(sourceDirectory() + "/tests/qmltests/Dash/tst_PageHeader/logo-ubuntu-orange.svg");
273+ h["logo"] = QUrl(testDataDir() + "/qmltests/Dash/tst_PageHeader/logo-ubuntu-orange.svg");
274 h["divider-color"] = "red";
274 h["divider-color"] = "red";
275 h["navigation-background"] = "color:///black";
275 h["navigation-background"] = "color:///black";
276 m["page-header"] = h;
276 m["page-header"] = h;
tests/plugins/AccountsService/CMakeLists.txt+6
@@ -41,6 +41,9 @@ add_executable(mock-server
41 UscServer.cpp
41 UscServer.cpp
42 )
42 )
43qt5_use_modules(mock-server Core DBus)
43qt5_use_modules(mock-server Core DBus)
44+install(TARGETS mock-server
45+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/AccountsService"
46+)
44
47
45add_executable(test-accountsservice
48add_executable(test-accountsservice
46 ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp
49 ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp
@@ -48,6 +51,9 @@ add_executable(test-accountsservice
48 client.cpp
51 client.cpp
49 )
52 )
50qt5_use_modules(test-accountsservice Core DBus Test)
53qt5_use_modules(test-accountsservice Core DBus Test)
54+install(TARGETS test-accountsservice
55+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/AccountsService"
56+)
51
57
52add_unity8_unittest(AccountsService dbus-test-runner
58add_unity8_unittest(AccountsService dbus-test-runner
53 ARG_PREFIX "--parameter"
59 ARG_PREFIX "--parameter"
tests/plugins/Dash/CMakeLists.txt+26−1
@@ -26,7 +26,7 @@ include_directories(
26
26
27remove_definitions(-DQT_NO_KEYWORDS)
27remove_definitions(-DQT_NO_KEYWORDS)
28
28
29−add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
29+add_definitions(-DTEST_DIR="plugins/Dash")
30
30
31macro(add_lvwph_test FILENAME TESTNAME)
31macro(add_lvwph_test FILENAME TESTNAME)
32 add_executable(${TESTNAME}TestExec
32 add_executable(${TESTNAME}TestExec
@@ -34,6 +34,9 @@ macro(add_lvwph_test FILENAME TESTNAME)
34 ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/Dash/listviewwithpageheader.cpp)
34 ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/Dash/listviewwithpageheader.cpp)
35 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
35 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
36 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
36 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
37+ install(TARGETS ${TESTNAME}TestExec
38+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
39+ )
37
40
38 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
41 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
39endmacro()
42endmacro()
@@ -50,6 +53,9 @@ macro(add_dashview_try_test FILENAME TESTNAME)
50 )
53 )
51 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
54 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
52 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
55 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
56+ install(TARGETS ${TESTNAME}TestExec
57+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
58+ )
53
59
54 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
60 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
55
61
@@ -60,6 +66,9 @@ macro(add_dashview_try_test FILENAME TESTNAME)
60 )
66 )
61 qt5_use_modules(${TESTNAME}TryExec Test Core Qml)
67 qt5_use_modules(${TESTNAME}TryExec Test Core Qml)
62 target_link_libraries(${TESTNAME}TryExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
68 target_link_libraries(${TESTNAME}TryExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
69+ install(TARGETS ${TESTNAME}TryExec
70+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
71+ )
63 add_manual_test(${TESTNAME} ${TESTNAME}TryExec DEPENDS Dash-qml)
72 add_manual_test(${TESTNAME} ${TESTNAME}TryExec DEPENDS Dash-qml)
64endmacro()
73endmacro()
65
74
@@ -67,11 +76,27 @@ add_dashview_try_test(verticaljournal VerticalJournal)
67add_dashview_try_test(horizontaljournal HorizontalJournal)
76add_dashview_try_test(horizontaljournal HorizontalJournal)
68add_dashview_try_test(organicgrid OrganicGrid)
77add_dashview_try_test(organicgrid OrganicGrid)
69
78
79+# Install data files needed for tests
80+file(GLOB qml_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" *.qml)
81+foreach(qml_file ${qml_files})
82+ add_qml_test_data(. "${qml_file}")
83+endforeach()
84+
70# CardCreator test
85# CardCreator test
71add_executable(CardCreatorTestExec cardcreatortest.cpp)
86add_executable(CardCreatorTestExec cardcreatortest.cpp)
72qt5_use_modules(CardCreatorTestExec Test Core Qml)
87qt5_use_modules(CardCreatorTestExec Test Core Qml)
73target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
88target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
89+install(TARGETS CardCreatorTestExec
90+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
91+)
74add_unity8_uitest(CardCreator CardCreatorTestExec DEPENDS Dash-qml)
92add_unity8_uitest(CardCreator CardCreatorTestExec DEPENDS Dash-qml)
93+add_qml_test_data(. cardcreator)
94+
95+# This one qml file imports a file in an arch-specific directory, so to make its
96+# import line relative, we install it into an arch-specific directory too.
97+add_qml_test_data(. cardcreatortest.qml
98+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
99+)
75
100
76# plain qml test
101# plain qml test
77foreach(dash_test ScopeStyle ListViewWithPageHeaderQML CardAttributes CroppedImageMinimumSourceSize)
102foreach(dash_test ScopeStyle ListViewWithPageHeaderQML CardAttributes CroppedImageMinimumSourceSize)
tests/plugins/Dash/cardcreatortest.cpp+7−2
@@ -22,6 +22,8 @@
22#include <QDebug>
22#include <QDebug>
23#include <QTemporaryFile>
23#include <QTemporaryFile>
24
24
25+#include <paths.h>
26+
25class CardCreatorTest : public QObject
27class CardCreatorTest : public QObject
26{
28{
27 Q_OBJECT
29 Q_OBJECT
@@ -35,7 +37,10 @@ private Q_SLOTS:
35 void init()
37 void init()
36 {
38 {
37 view = new QQuickView();
39 view = new QQuickView();
40+ if (isRunningInstalled())
38− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/cardcreatortest.qml"));
41+ view->setSource(QUrl::fromLocalFile(testLibDir() + "/" TEST_DIR "/cardcreatortest.qml"));
42+ else
43+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/cardcreatortest.qml"));
39 view->show();
44 view->show();
40 QTest::qWaitForWindowExposed(view);
45 QTest::qWaitForWindowExposed(view);
41 }
46 }
@@ -76,7 +81,7 @@ private Q_SLOTS:
76 const QString artShapeStyleString("artShapeStyle: ");
81 const QString artShapeStyleString("artShapeStyle: ");
77 const QString resultString("result: ");
82 const QString resultString("result: ");
78
83
79− const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
84+ const QString testDirPath = testDataDir() + "/" TEST_DIR "/cardcreator/";
80 QDir d(testDirPath);
85 QDir d(testDirPath);
81 const QStringList testFiles = d.entryList(QStringList() << "*.tst");
86 const QStringList testFiles = d.entryList(QStringList() << "*.tst");
82 foreach(const QString &testFileName, testFiles) {
87 foreach(const QString &testFileName, testFiles) {
tests/plugins/Dash/horizontaljournaltest.cpp+3−1
@@ -27,6 +27,8 @@
27
27
28#include "horizontaljournal.h"
28#include "horizontaljournal.h"
29
29
30+#include <paths.h>
31+
30class WidthModel : public QAbstractListModel {
32class WidthModel : public QAbstractListModel {
31public:
33public:
32 QHash<int, QByteArray> roleNames() const override
34 QHash<int, QByteArray> roleNames() const override
@@ -126,7 +128,7 @@ private Q_SLOTS:
126 widthList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
128 widthList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
127 model->setStringList(widthList);
129 model->setStringList(widthList);
128
130
129− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltest.qml"));
131+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltest.qml"));
130
132
131 view->show();
133 view->show();
132 view->resize(470, 400);
134 view->resize(470, 400);
tests/plugins/Dash/horizontaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
26
26
27#include "horizontaljournal.h"
27#include "horizontaljournal.h"
28
28
29+#include <paths.h>
30+
29class QWidthModela : public QStringListModel {
31class QWidthModela : public QStringListModel {
30 Q_OBJECT
32 Q_OBJECT
31public:
33public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
75 view->rootContext()->setContextProperty("listModel", &listModel);
77 view->rootContext()->setContextProperty("listModel", &listModel);
76 view->rootContext()->setContextProperty("vjModel", &model);
78 view->rootContext()->setContextProperty("vjModel", &model);
77
79
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltry.qml"));
79
81
80 view->show();
82 view->show();
81 view->resize(530, 400);
83 view->resize(530, 400);
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+3−1
@@ -26,6 +26,8 @@
26#include <private/qquickanimation_p.h>
26#include <private/qquickanimation_p.h>
27#include <private/qquickitem_p.h>
27#include <private/qquickitem_p.h>
28
28
29+#include <paths.h>
30+
29class StringListModel : public QAbstractListModel
31class StringListModel : public QAbstractListModel
30{
32{
31public:
33public:
@@ -165,7 +167,7 @@ private Q_SLOTS:
165 void init()
167 void init()
166 {
168 {
167 view = new QQuickView();
169 view = new QQuickView();
168− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
170+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsectionexternalmodel.qml"));
169 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
171 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
170 QVERIFY(lvwph);
172 QVERIFY(lvwph);
171 view->show();
173 view->show();
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp+3−1
@@ -25,6 +25,8 @@
25#include <private/qquickanimation_p.h>
25#include <private/qquickanimation_p.h>
26#include <private/qquickitem_p.h>
26#include <private/qquickitem_p.h>
27
27
28+#include <paths.h>
29+
28class ListViewWithPageHeaderTestSection : public QObject
30class ListViewWithPageHeaderTestSection : public QObject
29{
31{
30 Q_OBJECT
32 Q_OBJECT
@@ -130,7 +132,7 @@ private Q_SLOTS:
130 void init()
132 void init()
131 {
133 {
132 view = new QQuickView();
134 view = new QQuickView();
133− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
135+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsection.qml"));
134 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
136 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
135 model = view->rootObject()->findChild<QQmlListModel*>();
137 model = view->rootObject()->findChild<QQmlListModel*>();
136 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
138 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/listviewwithpageheadertest.cpp+3−1
@@ -27,6 +27,8 @@
27
27
28#include <limits>
28#include <limits>
29
29
30+#include <paths.h>
31+
30// TODO Think on how doing a test for lost items
32// TODO Think on how doing a test for lost items
31// particullary making sure that lost items are culled
33// particullary making sure that lost items are culled
32// and then removed in the next updatePolish cycle
34// and then removed in the next updatePolish cycle
@@ -121,7 +123,7 @@ private Q_SLOTS:
121 void init()
123 void init()
122 {
124 {
123 view = new QQuickView();
125 view = new QQuickView();
124− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
126+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertest.qml"));
125 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
127 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
126 model = view->rootObject()->findChild<QQmlListModel*>();
128 model = view->rootObject()->findChild<QQmlListModel*>();
127 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
129 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/organicgridtest.cpp+3−1
@@ -27,6 +27,8 @@
27
27
28#include "organicgrid.h"
28#include "organicgrid.h"
29
29
30+#include <paths.h>
31+
30class DummyModel : public QAbstractListModel {
32class DummyModel : public QAbstractListModel {
31public:
33public:
32 DummyModel() : m_count(0) {}
34 DummyModel() : m_count(0) {}
@@ -127,7 +129,7 @@ private Q_SLOTS:
127 model = new DummyModel();
129 model = new DummyModel();
128 model->setCount(21);
130 model->setCount(21);
129
131
130− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtest.qml"));
132+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtest.qml"));
131
133
132 view->show();
134 view->show();
133 QTest::qWaitForWindowExposed(view);
135 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/organicgridtry.cpp+3−1
@@ -26,6 +26,8 @@
26
26
27#include "verticaljournal.h"
27#include "verticaljournal.h"
28
28
29+#include <paths.h>
30+
29class DummyModel : public QAbstractListModel {
31class DummyModel : public QAbstractListModel {
30 Q_OBJECT
32 Q_OBJECT
31public:
33public:
@@ -83,7 +85,7 @@ int main(int argc, char *argv[])
83 view->rootContext()->setContextProperty("listModel", &listModel);
85 view->rootContext()->setContextProperty("listModel", &listModel);
84 view->rootContext()->setContextProperty("gridModel", &model);
86 view->rootContext()->setContextProperty("gridModel", &model);
85
87
86− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtry.qml"));
88+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtry.qml"));
87
89
88 view->show();
90 view->show();
89 view->resize(530, 400);
91 view->resize(530, 400);
tests/plugins/Dash/verticaljournaltest.cpp+3−1
@@ -27,6 +27,8 @@
27
27
28#include "verticaljournal.h"
28#include "verticaljournal.h"
29
29
30+#include <paths.h>
31+
30class HeightModel : public QAbstractListModel {
32class HeightModel : public QAbstractListModel {
31public:
33public:
32 QHash<int, QByteArray> roleNames() const override
34 QHash<int, QByteArray> roleNames() const override
@@ -142,7 +144,7 @@ private Q_SLOTS:
142 heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
144 heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
143 model->setStringList(heightList);
145 model->setStringList(heightList);
144
146
145− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltest.qml"));
147+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltest.qml"));
146
148
147 view->show();
149 view->show();
148 QTest::qWaitForWindowExposed(view);
150 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/verticaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
26
26
27#include "verticaljournal.h"
27#include "verticaljournal.h"
28
28
29+#include <paths.h>
30+
29class QHeightModel : public QStringListModel {
31class QHeightModel : public QStringListModel {
30 Q_OBJECT
32 Q_OBJECT
31public:
33public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
75 view->rootContext()->setContextProperty("listModel", &listModel);
77 view->rootContext()->setContextProperty("listModel", &listModel);
76 view->rootContext()->setContextProperty("vjModel", &model);
78 view->rootContext()->setContextProperty("vjModel", &model);
77
79
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltry.qml"));
79
81
80 view->show();
82 view->show();
81 view->resize(530, 400);
83 view->resize(530, 400);
tests/plugins/GlobalShortcut/CMakeLists.txt+11−5
@@ -3,12 +3,18 @@ include_directories(
3 ${CMAKE_CURRENT_BINARY_DIR}
3 ${CMAKE_CURRENT_BINARY_DIR}
4 )
4 )
5
5
6−add_definitions(
6+add_definitions(-DTEST_DIR="plugins/GlobalShortcut")
7− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
8− )
9−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
10
7
11add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
8add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
12qt5_use_modules(GlobalShortcutTestExec Test Quick)
9qt5_use_modules(GlobalShortcutTestExec Test Quick)
13target_link_libraries(GlobalShortcutTestExec ${Qt5Quick_LIBRARIES} GlobalShortcut-qml)
10target_link_libraries(GlobalShortcutTestExec ${Qt5Quick_LIBRARIES} GlobalShortcut-qml)
11+install(TARGETS GlobalShortcutTestExec
12+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/GlobalShortcut"
13+)
14+install(FILES shortcut.qml
15+ DESTINATION "${SHELL_APP_DIR}/tests/plugins/GlobalShortcut"
16+)
14−add_unity8_uitest(GlobalShortcut GlobalShortcutTestExec DEPENDS GlobalShortcut-qml)
17+add_unity8_uitest(GlobalShortcut GlobalShortcutTestExec
18+ DEPENDS GlobalShortcut-qml
19+ ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/GlobalShortcut
20+)
tests/plugins/GlobalShortcut/GlobalShortcutTest.cpp+3−2
@@ -21,6 +21,8 @@
21#include <QtQuick/QQuickItem>
21#include <QtQuick/QQuickItem>
22#include <QQmlEngine>
22#include <QQmlEngine>
23
23
24+#include <paths.h>
25+
24class GlobalShortcutTest: public QObject
26class GlobalShortcutTest: public QObject
25{
27{
26 Q_OBJECT
28 Q_OBJECT
@@ -30,8 +32,7 @@ private Q_SLOTS:
30 void initTestCase()
32 void initTestCase()
31 {
33 {
32 m_view = new QQuickView();
34 m_view = new QQuickView();
33− m_view->engine()->addImportPath(BUILT_PLUGINS_DIR);
34− m_view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/shortcut.qml"));
35+ m_view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/shortcut.qml"));
35 m_shortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("shortcut").value<QObject*>());
36 m_shortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("shortcut").value<QObject*>());
36 QVERIFY(m_shortcut);
37 QVERIFY(m_shortcut);
37 m_inactiveShortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("inactiveShortcut").value<QObject*>());
38 m_inactiveShortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("inactiveShortcut").value<QObject*>());
tests/plugins/Greeter/Unity/Launcher/CMakeLists.txt+5−20
@@ -9,7 +9,7 @@ include_directories(
9 )
9 )
10
10
11add_definitions(-DSM_BUSNAME=sessionBus)
11add_definitions(-DSM_BUSNAME=sessionBus)
12−add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
12+add_definitions(-DTEST_DIR="plugins/Greeter/Unity/Launcher")
13
13
14### LauncherModelASTest
14### LauncherModelASTest
15add_executable(launchermodelastestExec
15add_executable(launchermodelastestExec
@@ -30,7 +30,10 @@ target_link_libraries(launchermodelastestExec
30 ${GSETTINGS_QT_LDFLAGS}
30 ${GSETTINGS_QT_LDFLAGS}
31 )
31 )
32add_dependencies(launchermodelastestExec mock-server)
32add_dependencies(launchermodelastestExec mock-server)
33−qt5_use_modules(launchermodelastestExec Test Core DBus Gui)
33+qt5_use_modules(launchermodelastestExec Test Core DBus Gui Qml)
34+install(TARGETS launchermodelastestExec
35+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Greeter/Unity/Launcher"
36+)
34add_unity8_unittest(LauncherModelAS dbus-test-runner
37add_unity8_unittest(LauncherModelAS dbus-test-runner
35 ARG_PREFIX "--parameter"
38 ARG_PREFIX "--parameter"
36 ARGS
39 ARGS
@@ -39,21 +42,3 @@ add_unity8_unittest(LauncherModelAS dbus-test-runner
39 --task $<TARGET_FILE:launchermodelastestExec>
42 --task $<TARGET_FILE:launchermodelastestExec>
40 --wait-for org.freedesktop.Accounts
43 --wait-for org.freedesktop.Accounts
41)
44)
42−
43−# copy .desktop files into build directory for shadow builds
44−file(GLOB DESKTOP_FILES *.desktop)
45−
46−foreach(DESKTOP_FILE ${DESKTOP_FILES})
47− file(COPY "${DESKTOP_FILE}"
48− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
49− )
50−endforeach()
51−
52−# copy .svg files into build directory for shadow builds
53−file(GLOB DESKTOP_FILES *.svg)
54−
55−foreach(DESKTOP_FILE ${DESKTOP_FILES})
56− file(COPY "${DESKTOP_FILE}"
57− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
58− )
59−endforeach()
tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp+4
@@ -28,6 +28,7 @@
28#include <QSignalSpy>
28#include <QSignalSpy>
29#include <QtTest>
29#include <QtTest>
30
30
31+#include <paths.h>
31
32
32class LauncherModelASTest : public QObject
33class LauncherModelASTest : public QObject
33{
34{
@@ -45,6 +46,9 @@ private Q_SLOTS:
45 }
46 }
46
47
47 void init() {
48 void init() {
49+ // Launcher will look in current dir in testing mode for data
50+ QDir::setCurrent(testDataDir() + "/" TEST_DIR);
51+
48 // Prepare some fake list
52 // Prepare some fake list
49 QList<QVariantMap> list;
53 QList<QVariantMap> list;
50 QVariantMap item;
54 QVariantMap item;
tests/plugins/ImageCache/CMakeLists.txt+10
@@ -8,6 +8,7 @@ include_directories(
8 )
8 )
9
9
10add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
10add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
11+add_definitions(-DTEST_DIR="plugins/ImageCache")
11remove_definitions(-DQT_NO_KEYWORDS)
12remove_definitions(-DQT_NO_KEYWORDS)
12
13
13add_executable(ImageCacheTestExec
14add_executable(ImageCacheTestExec
@@ -18,3 +19,12 @@ add_unity8_uitest(ImageCache ImageCacheTestExec
18 DEPENDS ImageCache-qml
19 DEPENDS ImageCache-qml
19 IMPORT_PATHS ${UNITY_PLUGINPATH}
20 IMPORT_PATHS ${UNITY_PLUGINPATH}
20 )
21 )
22+install(TARGETS ImageCacheTestExec
23+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/ImageCache"
24+)
25+install(FILES test.qml
26+ DESTINATION "${SHELL_APP_DIR}/tests/plugins/ImageCache"
27+)
28+install(DIRECTORY graphics
29+ DESTINATION "${SHELL_APP_DIR}/tests/plugins/ImageCache"
30+)
tests/plugins/ImageCache/test.cpp+4−2
@@ -24,6 +24,8 @@
24#include <time.h>
24#include <time.h>
25#include <utime.h>
25#include <utime.h>
26
26
27+#include <paths.h>
28+
27Q_DECLARE_METATYPE(QQuickImage::Status)
29Q_DECLARE_METATYPE(QQuickImage::Status)
28
30
29class ImageCacheTest : public QObject
31class ImageCacheTest : public QObject
@@ -52,7 +54,7 @@ private:
52
54
53 QString sourceFile(const QString &name)
55 QString sourceFile(const QString &name)
54 {
56 {
55− return CURRENT_SOURCE_DIR "/graphics/" + name;
57+ return testDataDir() + "/" TEST_DIR "/graphics/" + name;
56 }
58 }
57
59
58 QString cachedFile(bool isPath, const QString &name)
60 QString cachedFile(bool isPath, const QString &name)
@@ -93,7 +95,7 @@ private Q_SLOTS:
93 qputenv("HOME", home->path().toUtf8());
95 qputenv("HOME", home->path().toUtf8());
94
96
95 view = new QQuickView();
97 view = new QQuickView();
96− view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/test.qml"));
98+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/test.qml"));
97 image = view->rootObject();
99 image = view->rootObject();
98
100
99 view->show();
101 view->show();
tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt+21−5
@@ -1,6 +1,3 @@
1−add_definitions(
2− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
3− )
4include_directories(
1include_directories(
5 ${GLIB_INCLUDE_DIRS}
2 ${GLIB_INCLUDE_DIRS}
6 ${CMAKE_CURRENT_BINARY_DIR}
3 ${CMAKE_CURRENT_BINARY_DIR}
@@ -21,11 +18,17 @@ target_include_directories(GreeterDBusTestExec PUBLIC
21 ${CMAKE_SOURCE_DIR}/plugins/LightDM
18 ${CMAKE_SOURCE_DIR}/plugins/LightDM
22 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
19 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
23 )
20 )
21+set_target_properties(GreeterDBusTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm")
22+install(TARGETS GreeterDBusTestExec
23+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
24+ )
25+install(FILES greeter.qml
26+ DESTINATION "${SHELL_APP_DIR}/tests/plugins/LightDM/IntegratedLightDM"
27+ )
24add_unity8_uitest(GreeterDBus dbus-test-runner
28add_unity8_uitest(GreeterDBus dbus-test-runner
25 ARG_PREFIX "--parameter"
29 ARG_PREFIX "--parameter"
26 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
30 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
27− DEPENDS MockLightDM
31+ DEPENDS MockLightDM MockLightDM-qml
28− IMPORT_PATHS ${UNITY_MOCKPATH}
29 )
32 )
30
33
31add_executable(GreeterPamTestExec
34add_executable(GreeterPamTestExec
@@ -41,6 +44,9 @@ target_include_directories(GreeterPamTestExec PUBLIC
41 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
44 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
42 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
45 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
43 )
46 )
47+install(TARGETS GreeterPamTestExec
48+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
49+ )
44add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
50add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
45
51
46# SessionsModelTest
52# SessionsModelTest
@@ -59,6 +65,9 @@ target_include_directories(GreeterSessionsModelTestExec PUBLIC
59 ${CMAKE_SOURCE_DIR}/plugins/Utils
65 ${CMAKE_SOURCE_DIR}/plugins/Utils
60 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
66 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
61 )
67 )
68+install(TARGETS GreeterSessionsModelTestExec
69+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
70+ )
62add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec
71add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec
63 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
72 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
64 DEPENDS MockLightDM
73 DEPENDS MockLightDM
@@ -82,6 +91,10 @@ target_include_directories(GreeterUsersModelTestExec PUBLIC
82 ${CMAKE_SOURCE_DIR}/plugins/Utils
91 ${CMAKE_SOURCE_DIR}/plugins/Utils
83 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
92 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
84 )
93 )
94+set_target_properties(GreeterUsersModelTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/IntegratedLightDM/liblightdm")
95+install(TARGETS GreeterUsersModelTestExec
96+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
97+ )
85add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
98add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
86 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
99 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
87 DEPENDS MockLightDM
100 DEPENDS MockLightDM
@@ -99,6 +112,9 @@ target_include_directories(GreeterIntegratedTestExec PUBLIC
99 ${GLIB_INCLUDE_DIRS}
112 ${GLIB_INCLUDE_DIRS}
100 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
113 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
101 )
114 )
115+install(TARGETS GreeterIntegratedTestExec
116+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
117+ )
102add_unity8_unittest(GreeterIntegrated dbus-test-runner
118add_unity8_unittest(GreeterIntegrated dbus-test-runner
103 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
119 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
104 ARG_PREFIX "--parameter"
120 ARG_PREFIX "--parameter"
tests/plugins/LightDM/IntegratedLightDM/dbus.cpp+2−1
@@ -23,6 +23,7 @@
23#include <QQuickItem>
23#include <QQuickItem>
24#include <QQuickView>
24#include <QQuickView>
25#include <QtTestGui>
25#include <QtTestGui>
26+#include <paths.h>
26
27
27class GreeterDBusTest : public QObject
28class GreeterDBusTest : public QObject
28{
29{
@@ -58,7 +59,7 @@ private Q_SLOTS:
58 void init()
59 void init()
59 {
60 {
60 view = new QQuickView();
61 view = new QQuickView();
61− view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/greeter.qml"));
62+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/plugins/LightDM/IntegratedLightDM/greeter.qml"));
62 greeter = dynamic_cast<Greeter*>(view->rootObject()->property("greeter").value<QObject*>());
63 greeter = dynamic_cast<Greeter*>(view->rootObject()->property("greeter").value<QObject*>());
63 QVERIFY(greeter);
64 QVERIFY(greeter);
64 QVERIFY(greeter->authenticationUser() == "");
65 QVERIFY(greeter->authenticationUser() == "");
tests/plugins/SessionBroadcast/CMakeLists.txt+6
@@ -25,6 +25,9 @@ add_executable(MockBroadcastServer
25 BroadcastServer.cpp
25 BroadcastServer.cpp
26)
26)
27qt5_use_modules(MockBroadcastServer Core DBus)
27qt5_use_modules(MockBroadcastServer Core DBus)
28+install(TARGETS MockBroadcastServer
29+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/SessionBroadcast"
30+)
28
31
29### SessionBroadcastTest
32### SessionBroadcastTest
30add_executable(sessionbroadcasttestExec
33add_executable(sessionbroadcasttestExec
@@ -32,6 +35,9 @@ add_executable(sessionbroadcasttestExec
32 sessionbroadcasttest.cpp
35 sessionbroadcasttest.cpp
33)
36)
34qt5_use_modules(sessionbroadcasttestExec Test Core Qml DBus)
37qt5_use_modules(sessionbroadcasttestExec Test Core Qml DBus)
38+install(TARGETS sessionbroadcasttestExec
39+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/SessionBroadcast"
40+)
35
41
36add_unity8_unittest(SessionBroadcast dbus-test-runner
42add_unity8_unittest(SessionBroadcast dbus-test-runner
37 ARG_PREFIX "--parameter"
43 ARG_PREFIX "--parameter"
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+8−4
@@ -16,12 +16,15 @@ include_directories(
16 ${CMAKE_CURRENT_BINARY_DIR}
16 ${CMAKE_CURRENT_BINARY_DIR}
17 )
17 )
18
18
19−export_qmlfiles(UbuntuGesturesTest .)
20−
21macro(build_gesture_test CLASSNAME)
19macro(build_gesture_test CLASSNAME)
22 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
20 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
23 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
21 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
24 target_link_libraries(${CLASSNAME}TestExec UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
22 target_link_libraries(${CLASSNAME}TestExec UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
23+ install(TARGETS ${CLASSNAME}TestExec
24+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Ubuntu/Gestures"
25+ )
26+ # To find libUbuntuGestures.so
27+ set_target_properties(${CLASSNAME}TestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
25endmacro()
28endmacro()
26
29
27set(UNITY_IMPORT_PATHS
30set(UNITY_IMPORT_PATHS
@@ -33,7 +36,6 @@ macro(add_gesture_unit_test CLASSNAME)
33 build_gesture_test(${CLASSNAME})
36 build_gesture_test(${CLASSNAME})
34 add_unity8_unittest(${CLASSNAME} ${CLASSNAME}TestExec
37 add_unity8_unittest(${CLASSNAME} ${CLASSNAME}TestExec
35 ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
38 ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
36− DEPENDS UbuntuGesturesTest-qmlfiles
37 ${ARGN}
39 ${ARGN}
38 )
40 )
39endmacro()
41endmacro()
@@ -42,12 +44,14 @@ macro(add_gesture_ui_test CLASSNAME)
42 build_gesture_test(${CLASSNAME})
44 build_gesture_test(${CLASSNAME})
43 add_unity8_uitest(${CLASSNAME} ${CLASSNAME}TestExec
45 add_unity8_uitest(${CLASSNAME} ${CLASSNAME}TestExec
44 ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
46 ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
45− DEPENDS UbuntuGesturesTest-qmlfiles
46 ${ARGN}
47 ${ARGN}
47 )
48 )
48 add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${UNITY_IMPORT_PATHS})
49 add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${UNITY_IMPORT_PATHS})
49endmacro()
50endmacro()
50
51
52+add_qml_test_data(. empty.qml)
53+add_qml_test_data(. touchGateExample.qml)
54+
51add_gesture_ui_test(FloatingFlickable)
55add_gesture_ui_test(FloatingFlickable)
52add_gesture_ui_test(PressedOutsideNotifier)
56add_gesture_ui_test(PressedOutsideNotifier)
53add_gesture_ui_test(TouchDispatcher)
57add_gesture_ui_test(TouchDispatcher)
tests/plugins/Ubuntu/Gestures/GestureTest.cpp+2−1
@@ -24,6 +24,7 @@
24
24
25#include <UbuntuGestures/private/timer_p.h>
25#include <UbuntuGestures/private/timer_p.h>
26#include <UbuntuGestures/private/touchregistry_p.h>
26#include <UbuntuGestures/private/touchregistry_p.h>
27+#include <paths.h>
27
28
28UG_USE_NAMESPACE
29UG_USE_NAMESPACE
29
30
@@ -45,7 +46,7 @@ void GestureTest::init()
45{
46{
46 m_view = new QQuickView;
47 m_view = new QQuickView;
47 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
48 m_view->setResizeMode(QQuickView::SizeRootObjectToView);
48− m_view->setSource(QUrl::fromLocalFile(m_qmlFilename));
49+ m_view->setSource(QUrl::fromLocalFile(testDataDir() + "/plugins/Ubuntu/Gestures/" + m_qmlFilename));
49 m_view->show();
50 m_view->show();
50 QVERIFY(QTest::qWaitForWindowExposed(m_view));
51 QVERIFY(QTest::qWaitForWindowExposed(m_view));
51 QVERIFY(m_view->rootObject() != 0);
52 QVERIFY(m_view->rootObject() != 0);
tests/plugins/Ubuntu/Gestures/tst_FloatingFlickable.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.4
18import Ubuntu.Components 1.3
18import Ubuntu.Components 1.3
19import Ubuntu.Gestures 0.1
19import Ubuntu.Gestures 0.1
20import Unity.Test 0.1
20import Unity.Test 0.1
21−import "../../../../../qml/Components"
21+import "../../../../qml/Components"
22
22
23Rectangle {
23Rectangle {
24 id: root
24 id: root
tests/plugins/Ubuntu/Gestures/tst_TouchGate.cpp+3−1
@@ -29,6 +29,8 @@
29
29
30#include "TestItem.h"
30#include "TestItem.h"
31
31
32+#include <paths.h>
33+
32UG_USE_NAMESPACE
34UG_USE_NAMESPACE
33
35
34class CandidateItem : public QQuickItem
36class CandidateItem : public QQuickItem
@@ -98,7 +100,7 @@ void tst_TouchGate::init()
98 touchRegistry = TouchRegistry::instance();
100 touchRegistry = TouchRegistry::instance();
99
101
100 view = createView();
102 view = createView();
101− view->setSource(QUrl::fromLocalFile("touchGateExample.qml"));
103+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/plugins/Ubuntu/Gestures/touchGateExample.qml"));
102 view->show();
104 view->show();
103 QVERIFY(QTest::qWaitForWindowExposed(view));
105 QVERIFY(QTest::qWaitForWindowExposed(view));
104 QVERIFY(view->rootObject() != 0);
106 QVERIFY(view->rootObject() != 0);
tests/plugins/Unity/Indicators/CMakeLists.txt+11−1
@@ -24,8 +24,18 @@ macro(indicator_test TEST)
24 ${GIO_LIBRARIES}
24 ${GIO_LIBRARIES}
25 ${QMENUMODEL_LDFLAGS}
25 ${QMENUMODEL_LDFLAGS}
26 )
26 )
27+ install(TARGETS ${TEST}Exec
28+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Indicators"
29+ )
30+
31+ set(ldpath "")
32+ foreach(lib ${test_ADDITIONAL_LIBS})
33+ set(ldpath "$<TARGET_FILE_DIR:${lib}>:")
34+ endforeach(lib)
27
35
28− add_unity8_unittest(${TEST} ${TEST}Exec)
36+ add_unity8_unittest(${TEST} ${TEST}Exec
37+ ENVIRONMENT "LD_LIBRARY_PATH=${ldpath}"
38+ )
29endmacro(indicator_test)
39endmacro(indicator_test)
30
40
31indicator_test(IndicatorsManager ADDITIONAL_LIBS IndicatorsQml)
41indicator_test(IndicatorsManager ADDITIONAL_LIBS IndicatorsQml)
tests/plugins/Unity/Indicators/IndicatorsManagerTest.cpp+1−1
@@ -31,7 +31,7 @@ private Q_SLOTS:
31
31
32 void initTestCase()
32 void initTestCase()
33 {
33 {
34− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
34+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
35 }
35 }
36
36
37 void cleanupTestCase()
37 void cleanupTestCase()
tests/plugins/Unity/Indicators/IndicatorsModelTest.cpp+1−1
@@ -32,7 +32,7 @@ private Q_SLOTS:
32
32
33 void initTestCase()
33 void initTestCase()
34 {
34 {
35− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
35+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
36 }
36 }
37
37
38 void cleanupTestCase()
38 void cleanupTestCase()
tests/plugins/Unity/Launcher/CMakeLists.txt+9−3
@@ -17,7 +17,7 @@ include_directories(
17 )
17 )
18
18
19add_definitions(-DSM_BUSNAME=sessionBus)
19add_definitions(-DSM_BUSNAME=sessionBus)
20−add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
20+add_definitions(-DTEST_DIR="plugins/Unity/Launcher")
21
21
22### LauncherModelTest
22### LauncherModelTest
23add_executable(launchermodeltestExec
23add_executable(launchermodeltestExec
@@ -43,10 +43,13 @@ target_link_libraries(launchermodeltestExec
43 ${UAL_LIBRARIES}
43 ${UAL_LIBRARIES}
44 )
44 )
45add_dependencies(launchermodeltestExec mock-server)
45add_dependencies(launchermodeltestExec mock-server)
46−qt5_use_modules(launchermodeltestExec Test Core DBus Xml Gui)
46+qt5_use_modules(launchermodeltestExec Test Core DBus Xml Gui Qml)
47+install(TARGETS launchermodeltestExec
48+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Launcher"
49+ )
47
50
48add_unity8_unittest(LauncherModel dbus-test-runner
51add_unity8_unittest(LauncherModel dbus-test-runner
49− ENVIRONMENT "XDG_DATA_HOME=${CMAKE_CURRENT_BINARY_DIR}"
52+ ENVIRONMENT "APPDIR=${CMAKE_CURRENT_BINARY_DIR}/applications"
50 ARG_PREFIX "--parameter"
53 ARG_PREFIX "--parameter"
51 ARGS
54 ARGS
52 --task $<TARGET_FILE:mock-server>
55 --task $<TARGET_FILE:mock-server>
@@ -59,3 +62,6 @@ add_unity8_unittest(LauncherModel dbus-test-runner
59file(COPY applications
62file(COPY applications
60 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
63 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
61 )
64 )
65+install(DIRECTORY applications
66+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Launcher"
67+ )
tests/plugins/Unity/Launcher/launchermodeltest.cpp+17
@@ -32,6 +32,7 @@
32#include <QDomDocument>
32#include <QDomDocument>
33
33
34#include <glib.h>
34#include <glib.h>
35+#include <paths.h>
35
36
36// This is a mock, specifically to test the LauncherModel
37// This is a mock, specifically to test the LauncherModel
37class MockApp: public unity::shell::application::ApplicationInfoInterface
38class MockApp: public unity::shell::application::ApplicationInfoInterface
@@ -139,6 +140,7 @@ class LauncherModelTest : public QObject
139private:
140private:
140 LauncherModel *launcherModel;
141 LauncherModel *launcherModel;
141 MockAppManager *appManager;
142 MockAppManager *appManager;
143+ QTemporaryDir tmpDir;
142
144
143 QList<QVariantMap> getASConfig() {
145 QList<QVariantMap> getASConfig() {
144 AccountsServiceDBusAdaptor *as = launcherModel->m_asAdapter->m_accounts;
146 AccountsServiceDBusAdaptor *as = launcherModel->m_asAdapter->m_accounts;
@@ -148,11 +150,23 @@ private:
148 return qdbus_cast<QList<QVariantMap>>(reply.value().value<QDBusArgument>());
150 return qdbus_cast<QList<QVariantMap>>(reply.value().value<QDBusArgument>());
149 }
151 }
150
152
153+ // Link our app data from a tempdir & tell glib/UAL to look there.
154+ // We do this because we want to be able to delete the applications dir
155+ // during testing, but that dir may be read-only (installed on system).
156+ void setUpAppDir() {
157+ QFile appDir(qgetenv("APPDIR"));
158+ appDir.link(tmpDir.path() + "/applications");
159+
160+ qputenv("XDG_DATA_HOME", tmpDir.path().toUtf8());
161+ }
162+
151private Q_SLOTS:
163private Q_SLOTS:
152
164
153 void initTestCase() {
165 void initTestCase() {
154 qDBusRegisterMetaType<QList<QVariantMap>>();
166 qDBusRegisterMetaType<QList<QVariantMap>>();
155
167
168+ setUpAppDir();
169+
156 launcherModel = new LauncherModel(this);
170 launcherModel = new LauncherModel(this);
157 QCoreApplication::processEvents(); // to let the model register on DBus
171 QCoreApplication::processEvents(); // to let the model register on DBus
158 QCOMPARE(launcherModel->rowCount(QModelIndex()), 0);
172 QCOMPARE(launcherModel->rowCount(QModelIndex()), 0);
@@ -163,6 +177,9 @@ private Q_SLOTS:
163
177
164 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
178 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
165 void init() {
179 void init() {
180+ // Switching to tmpDir makes manipulating our appdir symlink easier.
181+ QDir::setCurrent(tmpDir.path());
182+
166 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
183 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
167 QStringLiteral("/org/freedesktop/Accounts"),
184 QStringLiteral("/org/freedesktop/Accounts"),
168 QStringLiteral("org.freedesktop.Accounts"));
185 QStringLiteral("org.freedesktop.Accounts"));
tests/plugins/Unity/Session/CMakeLists.txt+6
@@ -29,6 +29,9 @@ add_executable(LightDMServer
29 server.cpp
29 server.cpp
30)
30)
31qt5_use_modules(LightDMServer Core DBus)
31qt5_use_modules(LightDMServer Core DBus)
32+install(TARGETS LightDMServer
33+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Session"
34+ )
32
35
33### SessionBackendTest
36### SessionBackendTest
34add_executable(sessionbackendtestExec
37add_executable(sessionbackendtestExec
@@ -40,6 +43,9 @@ target_link_libraries(sessionbackendtestExec
40 ${GLIB_LIBRARIES}
43 ${GLIB_LIBRARIES}
41 )
44 )
42qt5_use_modules(sessionbackendtestExec Test Core Qml DBus)
45qt5_use_modules(sessionbackendtestExec Test Core Qml DBus)
46+install(TARGETS sessionbackendtestExec
47+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Session"
48+)
43
49
44add_unity8_unittest(SessionBackend dbus-test-runner
50add_unity8_unittest(SessionBackend dbus-test-runner
45 ENVIRONMENT XDG_SESSION_PATH=/session
51 ENVIRONMENT XDG_SESSION_PATH=/session
tests/plugins/Utils/CMakeLists.txt+8−1
@@ -15,8 +15,11 @@ foreach(util_test
15 add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp)
15 add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp)
16 qt5_use_modules(${util_test}TestExec Test Core Qml)
16 qt5_use_modules(${util_test}TestExec Test Core Qml)
17 target_link_libraries(${util_test}TestExec Utils-qml)
17 target_link_libraries(${util_test}TestExec Utils-qml)
18+ install(TARGETS ${util_test}TestExec
19+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Utils"
20+ )
18 add_unity8_unittest(${util_test} ${util_test}TestExec ADD_TEST
21 add_unity8_unittest(${util_test} ${util_test}TestExec ADD_TEST
19− ENVIRONMENT XDG_CONFIG_HOME=${CMAKE_CURRENT_BINARY_DIR}
22+ ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Utils
20 )
23 )
21
24
22endforeach()
25endforeach()
@@ -28,7 +31,11 @@ add_unity8_qmlunittest(. UtilsStyle)
28add_executable(URLDispatcherTestExec URLDispatcherTest.cpp)
31add_executable(URLDispatcherTestExec URLDispatcherTest.cpp)
29qt5_use_modules(URLDispatcherTestExec Test Core Qml)
32qt5_use_modules(URLDispatcherTestExec Test Core Qml)
30target_link_libraries(URLDispatcherTestExec Utils-qml)
33target_link_libraries(URLDispatcherTestExec Utils-qml)
34+install(TARGETS URLDispatcherTestExec
35+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Utils"
36+)
31add_unity8_unittest(URLDispatcher dbus-test-runner
37add_unity8_unittest(URLDispatcher dbus-test-runner
32 ARG_PREFIX "--parameter"
38 ARG_PREFIX "--parameter"
33 ARGS --task $<TARGET_FILE:URLDispatcherTestExec>
39 ARGS --task $<TARGET_FILE:URLDispatcherTestExec>
40+ ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Utils
34)
41)
tests/plugins/Utils/DeviceConfigParserTest.cpp+4−1
@@ -21,6 +21,7 @@
21#include <QTest>
21#include <QTest>
22#include <QDebug>
22#include <QDebug>
23#include <QSettings>
23#include <QSettings>
24+#include <QTemporaryDir>
24
25
25class DeviceConfigParserTest : public QObject
26class DeviceConfigParserTest : public QObject
26{
27{
@@ -45,13 +46,15 @@ private Q_SLOTS:
45 }
46 }
46
47
47 void testCustomFile() {
48 void testCustomFile() {
49+ QTemporaryDir dir;
48− QSettings s("./devices.conf", QSettings::IniFormat);
50+ QSettings s(dir.path() + "/devices.conf", QSettings::IniFormat);
49 s.beginGroup("fakedevice");
51 s.beginGroup("fakedevice");
50
52
51 s.setValue("SupportedOrientations", QStringList() << "Portrait" << "Landscape" << "InvertedLandscape");
53 s.setValue("SupportedOrientations", QStringList() << "Portrait" << "Landscape" << "InvertedLandscape");
52 s.setValue("PrimaryOrientation", "InvertedLandscape");
54 s.setValue("PrimaryOrientation", "InvertedLandscape");
53 s.sync();
55 s.sync();
54
56
57+ qputenv("XDG_CONFIG_HOME", dir.path().toUtf8());
55 DeviceConfigParser p;
58 DeviceConfigParser p;
56 p.setName("fakedevice");
59 p.setName("fakedevice");
57
60
tests/plugins/Wizard/CMakeLists.txt+6
@@ -8,6 +8,9 @@ add_executable(tst-wizard-pagelist
8 ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp
8 ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp
9)
9)
10qt5_use_modules(tst-wizard-pagelist Core Qml Test)
10qt5_use_modules(tst-wizard-pagelist Core Qml Test)
11+install(TARGETS tst-wizard-pagelist
12+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Wizard"
13+)
11add_unity8_unittest(WizardPageList tst-wizard-pagelist ENVIRONMENT WIZARD_TESTING=1)
14add_unity8_unittest(WizardPageList tst-wizard-pagelist ENVIRONMENT WIZARD_TESTING=1)
12
15
13add_executable(tst-wizard-system
16add_executable(tst-wizard-system
@@ -15,4 +18,7 @@ add_executable(tst-wizard-system
15 ${CMAKE_SOURCE_DIR}/plugins/Wizard/System.cpp
18 ${CMAKE_SOURCE_DIR}/plugins/Wizard/System.cpp
16)
19)
17qt5_use_modules(tst-wizard-system Core DBus Qml Test)
20qt5_use_modules(tst-wizard-system Core DBus Qml Test)
21+install(TARGETS tst-wizard-system
22+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Wizard"
23+)
18add_unity8_unittest(WizardSystem tst-wizard-system)
24add_unity8_unittest(WizardSystem tst-wizard-system)
tests/qmltests/CMakeLists.txt+17
@@ -6,6 +6,7 @@ add_unity8_qmltest(. DisabledScreenNotice)
6add_unity8_qmltest(. Shell)
6add_unity8_qmltest(. Shell)
7add_unity8_qmltest(. ShellWithPin)
7add_unity8_qmltest(. ShellWithPin)
8add_unity8_qmltest(. DeviceConfiguration)
8add_unity8_qmltest(. DeviceConfiguration)
9+add_unity8_qmltest_data(. EdgeBarrierControls)
9add_unity8_qmltest(ApplicationMenus MenuBar)
10add_unity8_qmltest(ApplicationMenus MenuBar)
10add_unity8_qmltest(ApplicationMenus MenuPopup)
11add_unity8_qmltest(ApplicationMenus MenuPopup)
11add_unity8_qmltest(Components Background)
12add_unity8_qmltest(Components Background)
@@ -13,6 +14,7 @@ add_unity8_qmltest(Components Carousel)
13add_unity8_qmltest(Components Dialogs)
14add_unity8_qmltest(Components Dialogs)
14add_unity8_qmltest(Components DraggingArea)
15add_unity8_qmltest(Components DraggingArea)
15add_unity8_qmltest(Components LazyImage)
16add_unity8_qmltest(Components LazyImage)
17+add_unity8_qmltest_data(Components tst_LazyImage)
16add_unity8_qmltest(Components Lockscreen)
18add_unity8_qmltest(Components Lockscreen)
17add_unity8_qmltest(Components MediaServices)
19add_unity8_qmltest(Components MediaServices)
18add_unity8_qmltest(Components ModeSwitchWarningDialog)
20add_unity8_qmltest(Components ModeSwitchWarningDialog)
@@ -35,6 +37,9 @@ add_unity8_qmltest(Dash CardTool)
35add_unity8_qmltest(Dash GenericScopeView)
37add_unity8_qmltest(Dash GenericScopeView)
36add_unity8_qmltest(Dash DashPageHeader)
38add_unity8_qmltest(Dash DashPageHeader)
37add_unity8_qmltest(Dash PreviewView)
39add_unity8_qmltest(Dash PreviewView)
40+add_unity8_qmltest_data(Dash artwork)
41+add_unity8_qmltest_data(Dash CardHelpers.js)
42+add_unity8_qmltest_data(Dash tst_PageHeader)
38add_unity8_qmltest(Dash/Previews Preview)
43add_unity8_qmltest(Dash/Previews Preview)
39add_unity8_qmltest(Dash/Previews PreviewActions)
44add_unity8_qmltest(Dash/Previews PreviewActions)
40add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
45add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
@@ -57,6 +62,7 @@ add_unity8_qmltest(Dash/Previews PreviewTextSummary)
57add_unity8_qmltest(Dash/Previews PreviewVideoPlayback)
62add_unity8_qmltest(Dash/Previews PreviewVideoPlayback)
58add_unity8_qmltest(Dash/Previews PreviewWidgetFactory)
63add_unity8_qmltest(Dash/Previews PreviewWidgetFactory)
59add_unity8_qmltest(Dash/Previews PreviewZoomableImage)
64add_unity8_qmltest(Dash/Previews PreviewZoomableImage)
65+add_unity8_qmltest_data(Dash/Previews MockPreviewWidget)
60add_unity8_qmltest(Dash/Filters FilterOptionSelector)
66add_unity8_qmltest(Dash/Filters FilterOptionSelector)
61add_unity8_qmltest(Dash/Filters FilterRangeInput)
67add_unity8_qmltest(Dash/Filters FilterRangeInput)
62add_unity8_qmltest(Dash/Filters FilterValueSlider)
68add_unity8_qmltest(Dash/Filters FilterValueSlider)
@@ -72,11 +78,13 @@ add_unity8_qmltest(Greeter Greeter)
72add_unity8_qmltest(Greeter Infographics)
78add_unity8_qmltest(Greeter Infographics)
73add_unity8_qmltest(Greeter NarrowView)
79add_unity8_qmltest(Greeter NarrowView)
74add_unity8_qmltest(Greeter WideView)
80add_unity8_qmltest(Greeter WideView)
81+add_unity8_qmltest_data(Greeter TestView)
75add_unity8_qmltest(Launcher Launcher)
82add_unity8_qmltest(Launcher Launcher)
76add_unity8_qmltest(Notifications Notifications)
83add_unity8_qmltest(Notifications Notifications)
77add_unity8_qmltest(Notifications VisualSnapDecisionsQueue)
84add_unity8_qmltest(Notifications VisualSnapDecisionsQueue)
78add_unity8_qmltest(Notifications OptionToggle)
85add_unity8_qmltest(Notifications OptionToggle)
79add_unity8_qmltest(Notifications SwipeToAct)
86add_unity8_qmltest(Notifications SwipeToAct)
87+add_unity8_qmltest_data(Notifications Notification)
80add_unity8_qmltest(Panel ActiveCallHint)
88add_unity8_qmltest(Panel ActiveCallHint)
81add_unity8_qmltest(Panel PanelItemRow)
89add_unity8_qmltest(Panel PanelItemRow)
82add_unity8_qmltest(Panel PanelMenuPage)
90add_unity8_qmltest(Panel PanelMenuPage)
@@ -84,6 +92,7 @@ add_unity8_qmltest(Panel PanelBar)
84add_unity8_qmltest(Panel PanelMenu)
92add_unity8_qmltest(Panel PanelMenu)
85add_unity8_qmltest(Panel MenuContent)
93add_unity8_qmltest(Panel MenuContent)
86add_unity8_qmltest(Panel Panel)
94add_unity8_qmltest(Panel Panel)
95+add_unity8_qmltest_data(Panel PanelTest)
87add_unity8_qmltest(Panel/Indicators IndicatorItem)
96add_unity8_qmltest(Panel/Indicators IndicatorItem)
88add_unity8_qmltest(Panel/Indicators IndicatorsLight)
97add_unity8_qmltest(Panel/Indicators IndicatorsLight)
89add_unity8_qmltest(Panel/Indicators IndicatorMenuItemFactory)
98add_unity8_qmltest(Panel/Indicators IndicatorMenuItemFactory)
@@ -97,6 +106,14 @@ add_unity8_qmltest(Stage WindowResizeArea)
97add_unity8_qmltest(Stage Splash)
106add_unity8_qmltest(Stage Splash)
98add_unity8_qmltest(Stage DecoratedWindow)
107add_unity8_qmltest(Stage DecoratedWindow)
99add_unity8_qmltest(Stage WindowDecoration)
108add_unity8_qmltest(Stage WindowDecoration)
109+add_unity8_qmltest_data(Stage ApplicationCheckBox)
110+add_unity8_qmltest_data(Stage SizeHintField)
111+add_unity8_qmltest_data(Stage SurfaceManagerControls)
112+add_unity8_qmltest_data(Stage SurfaceManagerField)
100add_unity8_qmltest(Tutorial Tutorial)
113add_unity8_qmltest(Tutorial Tutorial)
101add_unity8_qmltest(Wizard Wizard ENVIRONMENT "OXIDE_NO_SANDBOX=1")
114add_unity8_qmltest(Wizard Wizard ENVIRONMENT "OXIDE_NO_SANDBOX=1")
115+add_unity8_qmltest_data(Wizard licenses)
116+add_unity8_qmltest_data(Wizard nolicenses)
102add_unity8_qmltest(utils/Unity/Test UnityTest)
117add_unity8_qmltest(utils/Unity/Test UnityTest)
118+add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTest)
119+add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTestChild)
tests/qmltests/Components/CMakeLists.txt+18−3
@@ -1,4 +1,4 @@
1−add_definitions(-DTEST_DIR="${CMAKE_CURRENT_LIST_DIR}")
1+add_definitions(-DTEST_DIR="qmltests/Components")
2
2
3pkg_check_modules(UBUNTUGESTURES REQUIRED UbuntuGestures)
3pkg_check_modules(UBUNTUGESTURES REQUIRED UbuntuGestures)
4
4
@@ -20,13 +20,28 @@ include_directories(
20add_executable(DragHandleTestExec tst_DragHandle.cpp)
20add_executable(DragHandleTestExec tst_DragHandle.cpp)
21qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick)
21qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick)
22target_link_libraries(DragHandleTestExec UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
22target_link_libraries(DragHandleTestExec UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
23+install(TARGETS DragHandleTestExec
24+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/qmltests/Components"
25+ )
26+set_target_properties(DragHandleTestExec PROPERTIES
27+ INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/Ubuntu/Gestures:${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}"
28+ )
23
29
24−add_unity8_uitest(DragHandle DragHandleTestExec ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures)
30+add_unity8_uitest(DragHandle DragHandleTestExec)
25add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_IMPORT_PATHS})
31add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_IMPORT_PATHS})
32+add_unity8_qmltest_data(. tst_DragHandle.qml)
33+add_unity8_qmltest_data(. tst_DragHandle)
26
34
27########## tst_EdgeDragEvaluator
35########## tst_EdgeDragEvaluator
28add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
36add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
29qt5_use_modules(EdgeDragEvaluatorTestExec Test Core Qml Gui Quick)
37qt5_use_modules(EdgeDragEvaluatorTestExec Test Core Qml Gui Quick)
30target_link_libraries(EdgeDragEvaluatorTestExec UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
38target_link_libraries(EdgeDragEvaluatorTestExec UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
39+install(TARGETS EdgeDragEvaluatorTestExec
40+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/qmltests/Components"
41+ )
42+set_target_properties(EdgeDragEvaluatorTestExec PROPERTIES
43+ INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/Ubuntu/Gestures:${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}"
44+ )
31
45
32−add_unity8_uitest(EdgeDragEvaluator EdgeDragEvaluatorTestExec ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures)
46+add_unity8_uitest(EdgeDragEvaluator EdgeDragEvaluatorTestExec)
47+add_unity8_qmltest_data(. tst_EdgeDragEvaluator.qml)
tests/qmltests/Components/tst_DragHandle.cpp+4−2
@@ -27,6 +27,8 @@
27#include <UbuntuGestures/private/timer_p.h>
27#include <UbuntuGestures/private/timer_p.h>
28#include "Direction.h"
28#include "Direction.h"
29
29
30+#include <paths.h>
31+
30UG_USE_NAMESPACE
32UG_USE_NAMESPACE
31
33
32class tst_DragHandle: public QObject
34class tst_DragHandle: public QObject
@@ -84,7 +86,7 @@ void tst_DragHandle::cleanupTestCase()
84void tst_DragHandle::init()
86void tst_DragHandle::init()
85{
87{
86 m_view = createView();
88 m_view = createView();
87− m_view->setSource(QUrl::fromLocalFile(TEST_DIR"/tst_DragHandle.qml"));
89+ m_view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/tst_DragHandle.qml"));
88 m_view->show();
90 m_view->show();
89 QVERIFY(QTest::qWaitForWindowExposed(m_view));
91 QVERIFY(QTest::qWaitForWindowExposed(m_view));
90 QVERIFY(m_view->rootObject() != 0);
92 QVERIFY(m_view->rootObject() != 0);
@@ -113,7 +115,7 @@ QQuickView *tst_DragHandle::createView()
113{
115{
114 QQuickView *window = new QQuickView(0);
116 QQuickView *window = new QQuickView(0);
115 window->setResizeMode(QQuickView::SizeRootObjectToView);
117 window->setResizeMode(QQuickView::SizeRootObjectToView);
116− window->engine()->addImportPath(QLatin1String(TEST_DIR));
118+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
117
119
118 return window;
120 return window;
119}
121}
tests/qmltests/Components/tst_EdgeDragEvaluator.cpp+4−2
@@ -26,6 +26,8 @@
26#include <Direction.h>
26#include <Direction.h>
27#include <UbuntuGestures/private/timer_p.h>
27#include <UbuntuGestures/private/timer_p.h>
28
28
29+#include <paths.h>
30+
29UG_USE_NAMESPACE
31UG_USE_NAMESPACE
30
32
31class tst_EdgeDragEvaluator: public QObject
33class tst_EdgeDragEvaluator: public QObject
@@ -67,7 +69,7 @@ void tst_EdgeDragEvaluator::init()
67{
69{
68
70
69 m_view = createView();
71 m_view = createView();
70− m_view->setSource(QUrl::fromLocalFile(TEST_DIR"/tst_EdgeDragEvaluator.qml"));
72+ m_view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/tst_EdgeDragEvaluator.qml"));
71 m_view->show();
73 m_view->show();
72 QVERIFY(QTest::qWaitForWindowExposed(m_view));
74 QVERIFY(QTest::qWaitForWindowExposed(m_view));
73 QVERIFY(m_view->rootObject() != 0);
75 QVERIFY(m_view->rootObject() != 0);
@@ -99,7 +101,7 @@ QQuickView *tst_EdgeDragEvaluator::createView()
99{
101{
100 QQuickView *window = new QQuickView(0);
102 QQuickView *window = new QQuickView(0);
101 window->setResizeMode(QQuickView::SizeRootObjectToView);
103 window->setResizeMode(QQuickView::SizeRootObjectToView);
102− window->engine()->addImportPath(QLatin1String(TEST_DIR));
104+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
103
105
104 return window;
106 return window;
105}
107}
tests/qmltests/Components/tst_ZoomableImage.qml+1−1
@@ -36,7 +36,7 @@ Rectangle {
36 }
36 }
37
37
38 property var widgetData2: {
38 property var widgetData2: {
39− "source": "../../mocks/Unity/Application/resources/screenshots/gallery@12.png",
39+ "source": Qt.resolvedUrl("../../graphics/screenshots/gallery@12.png"),
40 "zoomable": true
40 "zoomable": true
41 }
41 }
42
42
tests/qmltests/Dash/Previews/tst_PreviewImageGallery.qml+13−13
@@ -31,31 +31,31 @@ Rectangle {
31
31
32 property var sourcesModel1: {
32 property var sourcesModel1: {
33 "sources": [
33 "sources": [
34− "../../../tests/graphics/avatars/amanda@12.png",
34+ Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
35− "../../../tests/graphics/avatars/funky@12.png",
35+ Qt.resolvedUrl("../../../graphics/avatars/funky@12.png"),
36− "../../../tests/graphics/clock@18.png",
36+ Qt.resolvedUrl("../../../graphics/clock@18.png"),
37− "../../graphics/borked"
37+ Qt.resolvedUrl("../../../../qml/graphics/borked")
38 ]
38 ]
39 }
39 }
40
40
41 property var sourcesModel1WithFallback: {
41 property var sourcesModel1WithFallback: {
42 "sources": [
42 "sources": [
43− "../../../tests/graphics/avatars/amanda@12.png",
43+ Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
44− "../../../tests/graphics/avatars/funky@12.png",
44+ Qt.resolvedUrl("../../../graphics/avatars/funky@12.png"),
45− "../../../tests/graphics/clock@18.png",
45+ Qt.resolvedUrl("../../../graphics/clock@18.png"),
46− "../../graphics/borked"
46+ Qt.resolvedUrl("../../../../qml/graphics/borked")
47 ]
47 ]
48− , "fallback": "../../../tests/graphics/clock@18.png"
48+ , "fallback": Qt.resolvedUrl("../../../graphics/clock@18.png")
49 }
49 }
50
50
51 property var sourcesModelEmptyWithFallback: {
51 property var sourcesModelEmptyWithFallback: {
52 "sources": [
52 "sources": [
53− "../../../tests/graphics/avatars/amanda@12.png",
53+ Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
54− "../../../tests/graphics/avatars/funky@12.png",
54+ Qt.resolvedUrl("../../../graphics/avatars/funky@12.png"),
55− "../../../tests/graphics/clock@18.png",
55+ Qt.resolvedUrl("../../../graphics/clock@18.png"),
56 ""
56 ""
57 ]
57 ]
58− , "fallback": "../../../tests/graphics/clock@18.png"
58+ , "fallback": Qt.resolvedUrl("../../../graphics/clock@18.png")
59 }
59 }
60
60
61 PreviewImageGallery {
61 PreviewImageGallery {
tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml+5−5
@@ -26,7 +26,7 @@ Rectangle {
26 color: "lightgrey"
26 color: "lightgrey"
27
27
28 property var widgetData0: {
28 property var widgetData0: {
29− "source": "../../../tests/graphics/avatars/amanda@12.png",
29+ "source": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
30 "zoomable": false
30 "zoomable": false
31 }
31 }
32
32
@@ -36,17 +36,17 @@ Rectangle {
36
36
37 property var widgetData2: {
37 property var widgetData2: {
38 "source": "fadsasf",
38 "source": "fadsasf",
39− "fallback": "../../../tests/graphics/avatars/amanda@12.png"
39+ "fallback": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png")
40 }
40 }
41
41
42 property var widgetData3: {
42 property var widgetData3: {
43 "source": "",
43 "source": "",
44− "fallback": "../../../tests/graphics/avatars/amanda@12.png"
44+ "fallback": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png")
45 }
45 }
46
46
47 property var widgetData4: {
47 property var widgetData4: {
48 "source": "fadsasf",
48 "source": "fadsasf",
49− "fallback": "../../../tests/graphics/avatars/amanda@12.png"
49+ "fallback": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png")
50 }
50 }
51
51
52 Loader {
52 Loader {
@@ -129,7 +129,7 @@ Rectangle {
129 waitForRendering(lazyImage);
129 waitForRendering(lazyImage);
130 tryCompare(lazyImage, "state", "ready");
130 tryCompare(lazyImage, "state", "ready");
131 verify(lazyImage.sourceImage.source.toString().indexOf("amanda") > -1);
131 verify(lazyImage.sourceImage.source.toString().indexOf("amanda") > -1);
132− zoomableImage.widgetData["source"] = "../../../tests/graphics/avatars/funky@12.png"
132+ zoomableImage.widgetData["source"] = Qt.resolvedUrl("../../../graphics/avatars/funky@12.png")
133 zoomableImage.widgetDataChanged();
133 zoomableImage.widgetDataChanged();
134 tryCompare(lazyImage, "state", "ready");
134 tryCompare(lazyImage, "state", "ready");
135 verify(lazyImage.sourceImage.source.toString().indexOf("funky") > -1);
135 verify(lazyImage.sourceImage.source.toString().indexOf("funky") > -1);
tests/qmltests/Dash/tst_GenericScopeView.qml+1−1
@@ -463,7 +463,7 @@ Item {
463 { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#ffffff", logo: "" },
463 { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#ffffff", logo: "" },
464 { tag: "Foreground", index: 1, foreground: "yellow", background: "color:///#ffffff", logo: "" },
464 { tag: "Foreground", index: 1, foreground: "yellow", background: "color:///#ffffff", logo: "" },
465 { tag: "Logo+Background", index: 2, foreground: UbuntuColors.darkGrey, background: "gradient:///lightgrey/grey",
465 { tag: "Logo+Background", index: 2, foreground: UbuntuColors.darkGrey, background: "gradient:///lightgrey/grey",
466− logo: Qt.resolvedUrl("../Dash/tst_PageHeader/logo-ubuntu-orange.svg") },
466+ logo: Qt.resolvedUrl("tst_PageHeader/logo-ubuntu-orange.svg") },
467 ];
467 ];
468 }
468 }
469
469
tests/qmltests/Notifications/tst_Notifications.qml+11−11
@@ -61,8 +61,8 @@ Item {
61 "hints": {},
61 "hints": {},
62 "summary": "Cole Raby",
62 "summary": "Cole Raby",
63 "body": "I did not expect it to be <b>that</b> late.",
63 "body": "I did not expect it to be <b>that</b> late.",
64− "icon": "../../tests/graphics/avatars/amanda.png",
64+ "icon": Qt.resolvedUrl("../../graphics/avatars/amanda.png"),
65− "secondaryIcon": "../../tests/graphics/applicationIcons/facebook.png",
65+ "secondaryIcon": Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
66 "rawActions": ["reply_id", "Dummy"]})
66 "rawActions": ["reply_id", "Dummy"]})
67 n.completed.connect(mockModel.onCompleted)
67 n.completed.connect(mockModel.onCompleted)
68 mockModel.append(n)
68 mockModel.append(n)
@@ -75,7 +75,7 @@ Item {
75 "hints": {"x-canonical-non-shaped-icon": "true"},
75 "hints": {"x-canonical-non-shaped-icon": "true"},
76 "summary": "Contacts",
76 "summary": "Contacts",
77 "body": "Synchronised contacts-database &amp; cloud-storage.",
77 "body": "Synchronised contacts-database &amp; cloud-storage.",
78− "icon": "../../tests/graphics/applicationIcons/contacts-app.png",
78+ "icon": Qt.resolvedUrl("../../graphics/applicationIcons/contacts-app.png"),
79 "secondaryIcon": "",
79 "secondaryIcon": "",
80 "rawActions": ["reply_id", "Dummy"]})
80 "rawActions": ["reply_id", "Dummy"]})
81 n.completed.connect(mockModel.onCompleted)
81 n.completed.connect(mockModel.onCompleted)
@@ -89,7 +89,7 @@ Item {
89 "hints": {"x-canonical-non-shaped-icon": "false"},
89 "hints": {"x-canonical-non-shaped-icon": "false"},
90 "summary": "Photo upload completed",
90 "summary": "Photo upload completed",
91 "body": "",
91 "body": "",
92− "icon": "../../tests/graphics/applicationIcons/facebook.png",
92+ "icon": Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
93 "secondaryIcon": "",
93 "secondaryIcon": "",
94 "rawActions": ["reply_id", "Dummy"]})
94 "rawActions": ["reply_id", "Dummy"]})
95 n.completed.connect(mockModel.onCompleted)
95 n.completed.connect(mockModel.onCompleted)
@@ -103,7 +103,7 @@ Item {
103 "hints": {},
103 "hints": {},
104 "summary": "Interactive notification",
104 "summary": "Interactive notification",
105 "body": "This is a notification that can be clicked",
105 "body": "This is a notification that can be clicked",
106− "icon": "../../tests/graphics/avatars/anna_olsson.png",
106+ "icon": Qt.resolvedUrl("../../graphics/avatars/anna_olsson.png"),
107 "secondaryIcon": "",
107 "secondaryIcon": "",
108 "rawActions": ["reply_id", "Dummy"]})
108 "rawActions": ["reply_id", "Dummy"]})
109 n.completed.connect(mockModel.onCompleted)
109 n.completed.connect(mockModel.onCompleted)
@@ -287,7 +287,7 @@ Item {
287 type: Notification.Ephemeral
287 type: Notification.Ephemeral
288 summary: "Photo upload completed"
288 summary: "Photo upload completed"
289 body: ""
289 body: ""
290− icon: "../../tests/graphics/applicationIcons/facebook.png"
290+ icon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png")
291 secondaryIcon: ""
291 secondaryIcon: ""
292 value: 0
292 value: 0
293 rawActions: []
293 rawActions: []
@@ -301,7 +301,7 @@ Item {
301 summary: "New comment successfully published"
301 summary: "New comment successfully published"
302 body: ""
302 body: ""
303 icon: ""
303 icon: ""
304− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png"
304+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png")
305 value: 0
305 value: 0
306 rawActions: []
306 rawActions: []
307 },
307 },
@@ -312,7 +312,7 @@ Item {
312 "sound-file": "dummy.ogg"}
312 "sound-file": "dummy.ogg"}
313 summary: "Interactive notification"
313 summary: "Interactive notification"
314 body: "This is a notification that can be clicked"
314 body: "This is a notification that can be clicked"
315− icon: "../../tests/graphics/avatars/amanda.png"
315+ icon: Qt.resolvedUrl("../../graphics/avatars/amanda.png")
316 secondaryIcon: ""
316 secondaryIcon: ""
317 value: 0
317 value: 0
318 rawActions: ["reply_id", "Dummy"]
318 rawActions: ["reply_id", "Dummy"]
@@ -324,7 +324,7 @@ Item {
324 "sound-file": "dummy.ogg"}
324 "sound-file": "dummy.ogg"}
325 summary: "Bro Coly"
325 summary: "Bro Coly"
326 body: "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
326 body: "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
327− icon: "../../tests/graphics/avatars/anna_olsson.png"
327+ icon: Qt.resolvedUrl("../../graphics/avatars/anna_olsson.png")
328 secondaryIcon: ""
328 secondaryIcon: ""
329 value: 0
329 value: 0
330 rawActions: ["accept_id", "Accept",
330 rawActions: ["accept_id", "Accept",
@@ -337,8 +337,8 @@ Item {
337 "sound-file": "dummy.ogg"}
337 "sound-file": "dummy.ogg"}
338 summary: "Cole Raby"
338 summary: "Cole Raby"
339 body: "I did not expect it to be that late."
339 body: "I did not expect it to be that late."
340− icon: "../../tests/graphics/avatars/funky.png"
340+ icon: Qt.resolvedUrl("../../graphics/avatars/funky.png")
341− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png"
341+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png")
342 value: 0
342 value: 0
343 rawActions: []
343 rawActions: []
344 },
344 },
tests/qmltests/Notifications/tst_SwipeToAct.qml+5−5
@@ -61,7 +61,7 @@ Item {
61 hints: {"x-canonical-snap-decisions-swipe": "true"},
61 hints: {"x-canonical-snap-decisions-swipe": "true"},
62 summary: "Incoming call",
62 summary: "Incoming call",
63 body: "Frank Zappa\n+44 (0)7736 027340",
63 body: "Frank Zappa\n+44 (0)7736 027340",
64− icon: "../../tests/graphics/avatars/amanda.png",
64+ icon: Qt.resolvedUrl("../../graphics/avatars/amanda.png"),
65 secondaryIcon: "image://theme/incoming-call",
65 secondaryIcon: "image://theme/incoming-call",
66 actions: [{ id: "ok_id", label: "Ok"},
66 actions: [{ id: "ok_id", label: "Ok"},
67 { id: "cancel_id", label: "Cancel"},
67 { id: "cancel_id", label: "Cancel"},
@@ -177,8 +177,8 @@ Item {
177 hints: {"x-canonical-snap-decisions-swipe": "true"},
177 hints: {"x-canonical-snap-decisions-swipe": "true"},
178 summary: "Incoming call",
178 summary: "Incoming call",
179 body: "Frank Zappa\n+44 (0)7736 027340",
179 body: "Frank Zappa\n+44 (0)7736 027340",
180− icon: "../../tests/graphics/avatars/amanda.png",
180+ icon: Qt.resolvedUrl("../../graphics/avatars/amanda.png"),
181− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png",
181+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
182 actions: myActionModel,
182 actions: myActionModel,
183 summaryVisible: true,
183 summaryVisible: true,
184 bodyVisible: true,
184 bodyVisible: true,
@@ -196,8 +196,8 @@ Item {
196 hints: {"x-canonical-snap-decisions-swipe": "true"},
196 hints: {"x-canonical-snap-decisions-swipe": "true"},
197 summary: "Incoming call",
197 summary: "Incoming call",
198 body: "Bro Coly\n+49 (0)221 426973",
198 body: "Bro Coly\n+49 (0)221 426973",
199− icon: "../../tests/graphics/avatars/funky.png",
199+ icon: Qt.resolvedUrl("../../graphics/avatars/funky.png"),
200− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png",
200+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
201 actions: myActionModel,
201 actions: myActionModel,
202 summaryVisible: true,
202 summaryVisible: true,
203 bodyVisible: true,
203 bodyVisible: true,
tests/qmltests/tst_Shell.qml+2−2
@@ -693,8 +693,8 @@ Rectangle {
693 hints: {"x-canonical-private-affirmative-tint": "true"},
693 hints: {"x-canonical-private-affirmative-tint": "true"},
694 summary: "Tom Ato",
694 summary: "Tom Ato",
695 body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
695 body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
696− icon: "../../tests/graphics/avatars/funky.png",
696+ icon: Qt.resolvedUrl("../graphics/avatars/funky.png"),
697− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png",
697+ secondaryIcon: Qt.resolvedUrl("../graphics/applicationIcons/facebook.png"),
698 actions: [{ id: "ok_id", label: "Ok"},
698 actions: [{ id: "ok_id", label: "Ok"},
699 { id: "cancel_id", label: "Cancel"},
699 { id: "cancel_id", label: "Cancel"},
700 { id: "notreally_id", label: "Not really"},
700 { id: "notreally_id", label: "Not really"},
tests/uqmlscene/CMakeLists.txt+4
@@ -23,3 +23,7 @@ target_link_libraries(uqmlscene
23 ${XCB_LDFLAGS}
23 ${XCB_LDFLAGS}
24 UbuntuGestures
24 UbuntuGestures
25 )
25 )
26+
27+install(TARGETS uqmlscene
28+ RUNTIME DESTINATION ${SHELL_PRIVATE_LIBDIR}
29+ )
tests/utils/modules/Unity/Test/CMakeLists.txt+4−2
@@ -33,7 +33,9 @@ if (ENABLE_TOUCH_EMULATION)
33 target_link_libraries(UnityTestQml ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
33 target_link_libraries(UnityTestQml ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
34endif()
34endif()
35
35
36+# To find libUbuntuGestures.so
37+set_target_properties(UnityTestQml PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
38+
36qt5_use_modules(UnityTestQml Core Quick Test)
39qt5_use_modules(UnityTestQml Core Quick Test)
37
40
38−export_qmlfiles(Unity.Test Unity/Test)
39−export_qmlplugin(Unity.Test 0.1 Unity/Test TARGETS UnityTestQml)
41+add_unity8_mock(Unity.Test 0.1 Unity/Test PREFIX utils TARGETS UnityTestQml)