on xenial help sign in
Run the qmluitests.sh autopkg test against the installed package.

This is faster and more accurate than rebuilding unity8 and running tests from the build dir. Approved by: Albert Astals Cid, Unity8 CI Bot

commitf7f18b05e8e2559507a50b0655778581642ade90 authorMichael Terry <michael.terry@canonical.com> dateTue 10 Jan 2017, 14:42 (10 years ago) parenta6d26bcfa68d4d
73 files changed+588−185
CMakeLists.txt−2 cmake/modules/QmlTest.cmake+182−11 debian/control+19−8 debian/rules+2−2 debian/shlibs.local+1 debian/tests/control+2−3 debian/tests/qmluitests.sh+4−14 debian/unity8-fake-env.install → debian/unity8-tests.install+4 debian/unity8-tests.lintian-overrides+1 include/paths.h.in+26−1 plugins/Ubuntu/Gestures/CMakeLists.txt+1−1 plugins/Wizard/PageList.cpp+3−1 tests/CMakeLists.txt+16−8 tests/graphics/screenshots/gallery@12.png tests/mocks/AccountsService/CMakeLists.txt−1 tests/mocks/CMakeLists.txt+13−14 tests/mocks/Cursor/CMakeLists.txt+1−1 tests/mocks/LightDM/IntegratedLightDM/CMakeLists.txt−1 tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt+2−1 tests/mocks/Ubuntu/SystemSettings/SecurityPrivacy/CMakeLists.txt+1−1 tests/mocks/Unity/Application/ApplicationInfo.cpp+1−2 tests/mocks/Unity/Application/CMakeLists.txt+1−1 tests/mocks/Unity/CMakeLists.txt+3 tests/mocks/Unity/Indicators/CMakeLists.txt+4 tests/mocks/Unity/Launcher/MockLauncherItem.cpp+1−1 tests/mocks/Unity/fake_scope.cpp+2−2 tests/plugins/AccountsService/CMakeLists.txt+6 tests/plugins/Dash/CMakeLists.txt+26−1 tests/plugins/Dash/cardcreatortest.cpp+7−2 tests/plugins/Dash/horizontaljournaltest.cpp+3−1 tests/plugins/Dash/horizontaljournaltry.cpp+3−1 tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+3−1 tests/plugins/Dash/listviewwithpageheadersectiontest.cpp+3−1 tests/plugins/Dash/listviewwithpageheadertest.cpp+3−1 tests/plugins/Dash/organicgridtest.cpp+3−1 tests/plugins/Dash/organicgridtry.cpp+3−1 tests/plugins/Dash/verticaljournaltest.cpp+3−1 tests/plugins/Dash/verticaljournaltry.cpp+3−1 tests/plugins/GlobalShortcut/CMakeLists.txt+11−5 tests/plugins/GlobalShortcut/GlobalShortcutTest.cpp+3−2 tests/plugins/Greeter/Unity/Launcher/CMakeLists.txt+5−20 tests/plugins/Greeter/Unity/Launcher/launchermodelastest.cpp+4 tests/plugins/ImageCache/CMakeLists.txt+10 tests/plugins/ImageCache/test.cpp+4−2 tests/plugins/LightDM/IntegratedLightDM/CMakeLists.txt+21−5 tests/plugins/LightDM/IntegratedLightDM/dbus.cpp+2−1 tests/plugins/SessionBroadcast/CMakeLists.txt+6 tests/plugins/Ubuntu/Gestures/CMakeLists.txt+8−4 tests/plugins/Ubuntu/Gestures/GestureTest.cpp+2−1 tests/plugins/Ubuntu/Gestures/tst_FloatingFlickable.qml+1−1 tests/plugins/Ubuntu/Gestures/tst_TouchGate.cpp+3−1 tests/plugins/Unity/Indicators/CMakeLists.txt+11−1 tests/plugins/Unity/Indicators/IndicatorsManagerTest.cpp+1−1 tests/plugins/Unity/Indicators/IndicatorsModelTest.cpp+1−1 tests/plugins/Unity/Launcher/CMakeLists.txt+9−3 tests/plugins/Unity/Launcher/launchermodeltest.cpp+17 tests/plugins/Unity/Session/CMakeLists.txt+6 tests/plugins/Utils/CMakeLists.txt+8−1 tests/plugins/Utils/DeviceConfigParserTest.cpp+4−1 tests/plugins/Wizard/CMakeLists.txt+6 tests/qmltests/CMakeLists.txt+17 tests/qmltests/Components/CMakeLists.txt+18−3 tests/qmltests/Components/tst_DragHandle.cpp+4−2 tests/qmltests/Components/tst_EdgeDragEvaluator.cpp+4−2 tests/qmltests/Components/tst_ZoomableImage.qml+1−1 tests/qmltests/Dash/Previews/tst_PreviewImageGallery.qml+13−13 tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml+5−5 tests/qmltests/Dash/tst_GenericScopeView.qml+1−1 tests/qmltests/Notifications/tst_Notifications.qml+11−11 tests/qmltests/Notifications/tst_SwipeToAct.qml+5−5 tests/qmltests/tst_Shell.qml+2−2 tests/uqmlscene/CMakeLists.txt+4 tests/utils/modules/Unity/Test/CMakeLists.txt+4−2
CMakeLists.txt−2
@@ -151,8 +151,6 @@ include_directories(
151151 ${APPLICATION_API_INCLUDE_DIRS}
152152)
153153
154−set(ARTIFACTS_DIR "" CACHE PATH "Store test artifacts in this directory.")
155−
156154# Quiet logger
157155set(QUIET_LOGGER OFF CACHE BOOL "Disable test output on stdout.")
158156if(NOT QUIET_LOGGER)
cmake/modules/QmlTest.cmake+182−11
@@ -55,6 +55,55 @@ function(add_qml_test PATH COMPONENT_NAME)
5555endfunction()
5656
5757
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+
58107# add_qml_unittest(path component_name
59108# [...]
60109# )
@@ -71,6 +120,10 @@ function(add_qml_unittest PATH COMPONENT_NAME)
71120 ${ARGN}
72121 ARGS -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
73122 )
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()
74127endfunction()
75128
76129
@@ -91,6 +144,10 @@ function(add_manual_qml_test PATH COMPONENT_NAME)
91144 ${ARGN}
92145 ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
93146 )
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()
94151endfunction()
95152
96153
@@ -108,8 +165,7 @@ endfunction()
108165#
109166# Logging options in the standard form of "-o filename,format"
110167# will be appended to the arguments list, prefixed with ARG_PREFIX.
111−# XUnitXML files will be stored in current binary dir or under
112−# ARTIFACTS_DIR, if set.
168+# XUnitXML files will be stored in current binary dir.
113169#
114170# Three targets will be created:
115171# - test${component_name} - Runs the test
@@ -122,14 +178,8 @@ function(add_executable_test COMPONENT_NAME TARGET)
122178 cmake_parse_arguments(QMLTEST "${QMLTEST_OPTIONS}" "${QMLTEST_SINGLE}" "${QMLTEST_MULTI}" ${ARGN})
123179 mangle_arguments()
124180
125− if(ARTIFACTS_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)
132− endif()
181+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
182+ set(file_logger -o ${CMAKE_CURRENT_BINARY_DIR}/test${COMPONENT_NAME}.xml,xunitxml)
133183
134184 bake_arguments("${QMLTEST_ARG_PREFIX}" args ${iterations} ${file_logger} ${STDOUT_LOGGER})
135185
@@ -207,8 +257,124 @@ function(add_manual_test COMPONENT_NAME TARGET)
207257endfunction()
208258
209259
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+
210286################### INTERNAL ####################
211287
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+
212378# add_qmltest_target(target_name target
213379# COMMAND test_exe [arg1 [...]] # execute this test with arguments
214380# [...] # see above for available arguments:
@@ -231,6 +397,11 @@ function(add_qmltest_target TARGET_NAME TARGET)
231397 DEPENDS ${TARGET} ${QMLTEST_DEPENDS}
232398 )
233399
400+ install_test_script(${TARGET_NAME}
401+ ENVIRONMENT ${QMLTEST_ENVIRONMENT}
402+ COMMAND ${QMLTEST_COMMAND}
403+ )
404+
234405 if(QMLTEST_ADD_TEST)
235406 add_test(
236407 NAME ${TARGET_NAME}
@@ -248,7 +419,7 @@ function(add_qmltest_target TARGET_NAME TARGET)
248419 endif()
249420
250421 foreach(UPSTREAM_TARGET ${QMLTEST_TARGETS})
251− add_dependencies(${UPSTREAM_TARGET} ${TARGET_NAME})
422+ add_meta_dependencies(${UPSTREAM_TARGET} DEPENDS ${TARGET_NAME})
252423 endforeach()
253424endfunction()
254425
debian/control+19−8
@@ -11,6 +11,7 @@ Build-Depends: cmake,
1111# to g++ so we don't try to run arm g++
1212# on an x86 CPU for example, when cross-compiling.
1313 g++:native,
14+ gdb,
1415 graphviz,
1516 gsettings-ubuntu-schemas (>= 0.0.2+14.10.20140815),
1617 libandroid-properties-dev,
@@ -69,6 +70,7 @@ Build-Depends: cmake,
6970 qtdeclarative5-ubuntu-content1,
7071 qtdeclarative5-ubuntu-settings-components (>= 0.11),
7172 ttf-ubuntu-font-family,
73+ xvfb,
7274Standards-Version: 3.9.4
7375Homepage: http://launchpad.net/unity
7476# If you aren't a member of ~unity-team but need to upload
@@ -166,7 +168,7 @@ Depends: qml-module-qtquick-layouts,
166168 unity-notifications-impl-3,
167169 unity-plugin-scopes | unity-scopes-impl,
168170 unity-scopes-impl-12,
169− unity8-fake-env | unity-application-impl,
171+ unity8-tests | unity-application-impl,
170172 ${misc:Depends},
171173Breaks: unity8 (<< 7.86),
172174Replaces: unity8 (<< 7.86),
@@ -192,27 +194,36 @@ Depends: autopilot-qt5 (>= 1.4),
192194 ubuntu-ui-toolkit-autopilot (>= 1.3.2030),
193195 unity-scope-click,
194196 unity8 (= ${source:Version}),
195− unity8-fake-env (= ${source:Version}),
197+ unity8-tests (= ${source:Version}),
196198 url-dispatcher-tools,
197199 xvfb,
198200 ${misc:Depends},
199201 ${python3:Depends},
200− ${shlibs:Depends},
201202Description: Test package for Unity 8 shell
202203 Autopilot tests for the unity8 package
203204
204−Package: unity8-fake-env
205+Package: unity8-tests
205206Architecture: any
206207Multi-Arch: same
207208Pre-Depends: ${misc:Pre-Depends},
208−Depends: ${misc:Depends},
209+Depends: dbus-test-runner,
210+ parallel,
211+ qt5-default,
212+ qtdeclarative5-dev-tools,
213+ unity8 (= ${source:Version}),
214+ xvfb,
215+ ${misc:Depends},
209216 ${shlibs:Depends},
210217Provides: unity-application-impl,
211218 unity-application-impl-23,
212−Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1)
213−Description: Fake environment for running Unity 8 shell
219+ unity8-fake-env,
220+Replaces: unity8-autopilot (<< 8.02+15.04.20150422-0ubuntu1),
221+ unity8-fake-env,
222+Conflicts: unity8-fake-env,
223+Description: Scripts and mocks for running Unity 8 shell tests
214224 Provides fake implementations of some QML modules used by Unity 8 shell
215− (e.g Ubuntu.Application) so that you can run it in a sandboxed environment.
225+ (e.g Ubuntu.Application) so that you can run it in a sandboxed environment
226+ and scripts to run its test suite.
216227
217228Package: unity8-private
218229Architecture: any
debian/rules+2−2
@@ -35,9 +35,9 @@ override_dh_installdeb:
3535
3636# use private lib directories
3737override_dh_makeshlibs:
38− dh_makeshlibs -Nunity8-private -Nunity8-fake-env
38+ dh_makeshlibs -Nunity8-private -Nunity8-tests
3939
4040override_dh_shlibdeps:
4141 # Some mock libraries link against liblightdm-qt5-3.so which we want to
4242 # 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 @@
11Tests: qmluitests.sh
22Restrictions: allow-stderr
3−Depends: @,
4− @builddeps@,
5− xvfb,
3+Depends: dpkg-dev,
4+ unity8-tests,
65
76Tests: autopilot.sh
87Restrictions: allow-stderr,
debian/tests/qmluitests.sh+4−14
@@ -1,21 +1,11 @@
11#!/bin/sh
2+# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
23
34# log all commands and abort on error
45set -xe
56
6−SHELL_QML_PATH=$(pkg-config --variable=plugindir unity-shell-api)
7−UNITY_SOURCE_DIR=$(readlink -f $(dirname $(readlink -f $0))/../..)
7+DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
88
9−dh_auto_configure -- -DCMAKE_INSTALL_LOCALSTATEDIR="/var" \
10− -DARTIFACTS_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
9+export ARTIFACTS_DIR="${ADT_ARTIFACTS}"
1810
19−export UNITY_SOURCE_DIR
20−
21−dh_auto_build --parallel -- -k xvfballtests
11+/usr/lib/$DEB_HOST_MULTIARCH/unity8/tests/scripts/xvfballtests.sh
debian/unity8-fake-env.install → debian/unity8-tests.installrenamed+4
@@ -3,4 +3,8 @@ usr/bin/unity-mock-indicator-service
33usr/lib/*/unity8/qml/mocks
44usr/lib/*/unity8/qml/nonmirplugins
55usr/lib/*/unity8/qml/scopefakes
6+usr/lib/*/unity8/qml/utils
7+usr/lib/*/unity8/tests
8+usr/lib/*/unity8/uqmlscene
69usr/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() {
4141}
4242
4343inline bool isRunningInstalled() {
44− return !installRoot().isNull();
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();
47+ return !installRoot().isNull() || installed_test_env;
4548}
4649
4750inline QString buildDirectory() {
@@ -62,6 +65,28 @@ inline QString translationDirectory() {
6265 }
6366}
6467
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+
6590inline QString qmlDirectory() {
6691 if (isRunningInstalled()) {
6792 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)
1616
1717add_definitions(-DUBUNTUGESTURESQML_LIBRARY)
1818
19−add_library(UbuntuGesturesQml MODULE ${UbuntuGesturesQml_SOURCES})
19+add_library(UbuntuGesturesQml SHARED ${UbuntuGesturesQml_SOURCES})
2020target_link_libraries(UbuntuGesturesQml ${UBUNTUGESTURES_LIBRARIES})
2121
2222qt5_use_modules(UbuntuGesturesQml Core Quick)
plugins/Wizard/PageList.cpp+3−1
@@ -46,7 +46,9 @@ PageList::PageList(QObject *parent)
4646 QSet<QString> disabledPages;
4747 QStringList dataDirs;
4848
49− if (!isRunningInstalled() && getenv("WIZARD_TESTING") == nullptr) {
49+ if (getenv("WIZARD_TESTING") != nullptr) {
50+ dataDirs = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation);
51+ } else if (!isRunningInstalled()) {
5052 dataDirs << qmlDirectory();
5153 } else {
5254 dataDirs = shellDataDirs();
tests/CMakeLists.txt+16−8
@@ -1,17 +1,14 @@
11include(QmlTest)
22
33# QML tests that do not require graphical capabilities.
4−add_custom_target(unittests)
4+add_meta_test(unittests)
55
66# QML tests that require graphical capabilities.
7−add_custom_target(uitests)
8−add_custom_target(xvfbuitests)
7+add_meta_test(uitests)
8+add_meta_test(xvfbuitests)
99
10−add_custom_target(alltests)
11−add_dependencies(alltests unittests uitests)
12−
13−add_custom_target(xvfballtests)
14−add_dependencies(xvfballtests unittests xvfbuitests)
10+add_meta_test(alltests DEPENDS unittests uitests)
11+add_meta_test(xvfballtests DEPENDS unittests xvfbuitests)
1512
1613# Support libraries and plugins
1714add_subdirectory(mocks)
@@ -121,6 +118,11 @@ function(add_unity8_qmlbenchmark PATH COMPONENT_NAME ITERATIONS)
121118 add_unity8_qmltest(${PATH} ${COMPONENT_NAME} ITERATIONS ${ITERATIONS} ${ARGN})
122119endfunction()
123120
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+
124126# used to make dbus adaptor classes from xml to mock system services
125127if(DEFINED ENV{DEB_BUILD_MULTIARCH})
126128 set(QDBUSXML2CPP_EXECUTABLE "/usr/lib/$ENV{DEB_BUILD_MULTIARCH}/qt5/bin/qdbusxml2cpp")
@@ -128,6 +130,12 @@ else()
128130 FIND_PROGRAM(QDBUSXML2CPP_EXECUTABLE qdbusxml2cpp)
129131endif()
130132
133+
134+install(DIRECTORY data graphics
135+ DESTINATION "${SHELL_APP_DIR}/tests"
136+)
137+
138+
131139# Actual test definitions
132140add_subdirectory(plugins)
133141add_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
2020 )
2121
2222add_unity8_mock(AccountsService 0.1 AccountsService
23− PREFIX mocks
2423 TARGETS MockAccountsService-qml
2524 )
tests/mocks/CMakeLists.txt+13−14
@@ -11,21 +11,20 @@ macro(add_unity8_mock PLUGIN VERSION PATH)
1111 set(single PREFIX)
1212 cmake_parse_arguments(MOCK "" "${single}" "" ${ARGN})
1313
14− if(MOCK_PREFIX)
15− export_qmlfiles(${PLUGIN} ${PATH}
16− DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX}
17− TARGET_PREFIX ${MOCK_PREFIX}-Mock
18− ${MOCK_UNPARSED_ARGUMENTS}
19− )
20− export_qmlplugin(${PLUGIN} ${VERSION} ${PATH}
21− DESTINATION ${SHELL_INSTALL_QML}/${MOCK_PREFIX}
22− TARGET_PREFIX ${MOCK_PREFIX}-Mock
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})
14+ if (NOT MOCK_PREFIX)
15+ set(MOCK_PREFIX mocks)
2816 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+ )
2928endmacro()
3029
3130add_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
4545qt5_use_modules(MockLightDM-qml DBus Gui Qml)
4646
4747add_unity8_mock(LightDM.IntegratedLightDM 0.1 LightDM/IntegratedLightDM
48− PREFIX mocks
4948 TARGETS MockLightDM-qml
5049 ENVIRONMENT "LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}/liblightdm"
5150)
tests/mocks/LightDM/IntegratedLightDM/liblightdm/CMakeLists.txt+2−1
@@ -13,7 +13,8 @@ add_library(MockLightDM SHARED ${LibLightDM_SOURCES})
1313qt5_use_modules(MockLightDM Gui)
1414
1515set_target_properties(MockLightDM PROPERTIES
16− OUTPUT_NAME lightdm-qt5-3)
16+ OUTPUT_NAME lightdm-qt5-3
17+ SOVERSION 0)
1718
1819install(TARGETS MockLightDM
1920 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})
77
88qt5_use_modules(MockSecurityPrivacy Qml Quick Core)
99
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
@@ -181,8 +181,7 @@ void ApplicationInfo::createSurface()
181181
182182void ApplicationInfo::setIconId(const QString &iconId)
183183{
184− setIcon(QString(sourceDirectory() + "/tests/graphics/applicationIcons/%2@18.png")
185− .arg(iconId));
184+ setIcon(QUrl(testDataDir() + "/graphics/applicationIcons/" + iconId + "@18.png"));
186185}
187186
188187void 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
2727qt5_use_modules(FakeUnityApplicationQml Core Quick DBus)
2828qt5_use_modules(NonMirUnityApplicationQml Core Quick DBus)
2929
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)
3131add_unity8_mock(Unity.Application 0.1 Unity/Application
3232 PREFIX nonmirplugins
3333 TARGETS NonMirUnityApplicationQml
tests/mocks/Unity/CMakeLists.txt+3
@@ -67,4 +67,7 @@ target_link_libraries(FakeUnityQml
6767
6868qt5_use_modules(FakeUnityQml Qml)
6969
70+add_unity8_mock(Unity 0.2 Unity TARGETS FakeUnityQml)
71+
72+# and one copy in a separate directory for autopilot
7073add_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
3131 QMenuModelQml
3232)
3333
34+set_target_properties(IndicatorsFakeQml PROPERTIES
35+ INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/QMenuModel"
36+)
37+
3438qt5_use_modules(IndicatorsFakeQml Core Qml Quick)
3539
3640add_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
2929 m_appId(appId),
3030 m_desktopFile(desktopFile),
3131 m_name(name),
32− m_icon("../../tests/graphics/applicationIcons/" + icon + ".png"),
32+ m_icon(testDataDir() + "/graphics/applicationIcons/" + icon + ".png"),
3333 m_pinned(false),
3434 m_running(false),
3535 m_recent(false),
tests/mocks/Unity/fake_scope.cpp+2−2
@@ -266,11 +266,11 @@ QVariantMap Scope::customizations() const
266266 m["foreground-color"] = "blue";
267267 m["page-header"] = h;
268268 } 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");
270270 m["page-header"] = h;
271271 } else if (m_id == "MockScope5") {
272272 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");
274274 h["divider-color"] = "red";
275275 h["navigation-background"] = "color:///black";
276276 m["page-header"] = h;
tests/plugins/AccountsService/CMakeLists.txt+6
@@ -41,6 +41,9 @@ add_executable(mock-server
4141 UscServer.cpp
4242 )
4343qt5_use_modules(mock-server Core DBus)
44+install(TARGETS mock-server
45+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/AccountsService"
46+)
4447
4548add_executable(test-accountsservice
4649 ${CMAKE_SOURCE_DIR}/plugins/AccountsService/AccountsService.cpp
@@ -48,6 +51,9 @@ add_executable(test-accountsservice
4851 client.cpp
4952 )
5053qt5_use_modules(test-accountsservice Core DBus Test)
54+install(TARGETS test-accountsservice
55+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/AccountsService"
56+)
5157
5258add_unity8_unittest(AccountsService dbus-test-runner
5359 ARG_PREFIX "--parameter"
tests/plugins/Dash/CMakeLists.txt+26−1
@@ -26,7 +26,7 @@ include_directories(
2626
2727remove_definitions(-DQT_NO_KEYWORDS)
2828
29−add_definitions(-DDASHVIEWSTEST_FOLDER="${CMAKE_CURRENT_SOURCE_DIR}")
29+add_definitions(-DTEST_DIR="plugins/Dash")
3030
3131macro(add_lvwph_test FILENAME TESTNAME)
3232 add_executable(${TESTNAME}TestExec
@@ -34,6 +34,9 @@ macro(add_lvwph_test FILENAME TESTNAME)
3434 ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/Dash/listviewwithpageheader.cpp)
3535 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
3636 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
37+ install(TARGETS ${TESTNAME}TestExec
38+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
39+ )
3740
3841 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
3942endmacro()
@@ -50,6 +53,9 @@ macro(add_dashview_try_test FILENAME TESTNAME)
5053 )
5154 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
5255 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
56+ install(TARGETS ${TESTNAME}TestExec
57+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
58+ )
5359
5460 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
5561
@@ -60,6 +66,9 @@ macro(add_dashview_try_test FILENAME TESTNAME)
6066 )
6167 qt5_use_modules(${TESTNAME}TryExec Test Core Qml)
6268 target_link_libraries(${TESTNAME}TryExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
69+ install(TARGETS ${TESTNAME}TryExec
70+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
71+ )
6372 add_manual_test(${TESTNAME} ${TESTNAME}TryExec DEPENDS Dash-qml)
6473endmacro()
6574
@@ -67,11 +76,27 @@ add_dashview_try_test(verticaljournal VerticalJournal)
6776add_dashview_try_test(horizontaljournal HorizontalJournal)
6877add_dashview_try_test(organicgrid OrganicGrid)
6978
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+
7085# CardCreator test
7186add_executable(CardCreatorTestExec cardcreatortest.cpp)
7287qt5_use_modules(CardCreatorTestExec Test Core Qml)
7388target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
89+install(TARGETS CardCreatorTestExec
90+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
91+)
7492add_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+)
75100
76101# plain qml test
77102foreach(dash_test ScopeStyle ListViewWithPageHeaderQML CardAttributes CroppedImageMinimumSourceSize)
tests/plugins/Dash/cardcreatortest.cpp+7−2
@@ -22,6 +22,8 @@
2222#include <QDebug>
2323#include <QTemporaryFile>
2424
25+#include <paths.h>
26+
2527class CardCreatorTest : public QObject
2628{
2729 Q_OBJECT
@@ -35,7 +37,10 @@ private Q_SLOTS:
3537 void init()
3638 {
3739 view = new QQuickView();
38− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/cardcreatortest.qml"));
40+ if (isRunningInstalled())
41+ view->setSource(QUrl::fromLocalFile(testLibDir() + "/" TEST_DIR "/cardcreatortest.qml"));
42+ else
43+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/cardcreatortest.qml"));
3944 view->show();
4045 QTest::qWaitForWindowExposed(view);
4146 }
@@ -76,7 +81,7 @@ private Q_SLOTS:
7681 const QString artShapeStyleString("artShapeStyle: ");
7782 const QString resultString("result: ");
7883
79− const QString testDirPath = DASHVIEWSTEST_FOLDER "/cardcreator/";
84+ const QString testDirPath = testDataDir() + "/" TEST_DIR "/cardcreator/";
8085 QDir d(testDirPath);
8186 const QStringList testFiles = d.entryList(QStringList() << "*.tst");
8287 foreach(const QString &testFileName, testFiles) {
tests/plugins/Dash/horizontaljournaltest.cpp+3−1
@@ -27,6 +27,8 @@
2727
2828#include "horizontaljournal.h"
2929
30+#include <paths.h>
31+
3032class WidthModel : public QAbstractListModel {
3133public:
3234 QHash<int, QByteArray> roleNames() const override
@@ -126,7 +128,7 @@ private Q_SLOTS:
126128 widthList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
127129 model->setStringList(widthList);
128130
129− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltest.qml"));
131+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltest.qml"));
130132
131133 view->show();
132134 view->resize(470, 400);
tests/plugins/Dash/horizontaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
2626
2727#include "horizontaljournal.h"
2828
29+#include <paths.h>
30+
2931class QWidthModela : public QStringListModel {
3032 Q_OBJECT
3133public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
7577 view->rootContext()->setContextProperty("listModel", &listModel);
7678 view->rootContext()->setContextProperty("vjModel", &model);
7779
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/horizontaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/horizontaljournaltry.qml"));
7981
8082 view->show();
8183 view->resize(530, 400);
tests/plugins/Dash/listviewwithpageheadersectionexternalmodeltest.cpp+3−1
@@ -26,6 +26,8 @@
2626#include <private/qquickanimation_p.h>
2727#include <private/qquickitem_p.h>
2828
29+#include <paths.h>
30+
2931class StringListModel : public QAbstractListModel
3032{
3133public:
@@ -165,7 +167,7 @@ private Q_SLOTS:
165167 void init()
166168 {
167169 view = new QQuickView();
168− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsectionexternalmodel.qml"));
170+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsectionexternalmodel.qml"));
169171 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
170172 QVERIFY(lvwph);
171173 view->show();
tests/plugins/Dash/listviewwithpageheadersectiontest.cpp+3−1
@@ -25,6 +25,8 @@
2525#include <private/qquickanimation_p.h>
2626#include <private/qquickitem_p.h>
2727
28+#include <paths.h>
29+
2830class ListViewWithPageHeaderTestSection : public QObject
2931{
3032 Q_OBJECT
@@ -130,7 +132,7 @@ private Q_SLOTS:
130132 void init()
131133 {
132134 view = new QQuickView();
133− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertestsection.qml"));
135+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertestsection.qml"));
134136 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
135137 model = view->rootObject()->findChild<QQmlListModel*>();
136138 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/listviewwithpageheadertest.cpp+3−1
@@ -27,6 +27,8 @@
2727
2828#include <limits>
2929
30+#include <paths.h>
31+
3032// TODO Think on how doing a test for lost items
3133// particullary making sure that lost items are culled
3234// and then removed in the next updatePolish cycle
@@ -121,7 +123,7 @@ private Q_SLOTS:
121123 void init()
122124 {
123125 view = new QQuickView();
124− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/listviewwithpageheadertest.qml"));
126+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/listviewwithpageheadertest.qml"));
125127 lvwph = static_cast<ListViewWithPageHeader*>(view->rootObject()->findChild<QQuickFlickable*>());
126128 model = view->rootObject()->findChild<QQmlListModel*>();
127129 otherDelegate = view->rootObject()->findChild<QQmlComponent*>();
tests/plugins/Dash/organicgridtest.cpp+3−1
@@ -27,6 +27,8 @@
2727
2828#include "organicgrid.h"
2929
30+#include <paths.h>
31+
3032class DummyModel : public QAbstractListModel {
3133public:
3234 DummyModel() : m_count(0) {}
@@ -127,7 +129,7 @@ private Q_SLOTS:
127129 model = new DummyModel();
128130 model->setCount(21);
129131
130− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtest.qml"));
132+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtest.qml"));
131133
132134 view->show();
133135 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/organicgridtry.cpp+3−1
@@ -26,6 +26,8 @@
2626
2727#include "verticaljournal.h"
2828
29+#include <paths.h>
30+
2931class DummyModel : public QAbstractListModel {
3032 Q_OBJECT
3133public:
@@ -83,7 +85,7 @@ int main(int argc, char *argv[])
8385 view->rootContext()->setContextProperty("listModel", &listModel);
8486 view->rootContext()->setContextProperty("gridModel", &model);
8587
86− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/organicgridtry.qml"));
88+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/organicgridtry.qml"));
8789
8890 view->show();
8991 view->resize(530, 400);
tests/plugins/Dash/verticaljournaltest.cpp+3−1
@@ -27,6 +27,8 @@
2727
2828#include "verticaljournal.h"
2929
30+#include <paths.h>
31+
3032class HeightModel : public QAbstractListModel {
3133public:
3234 QHash<int, QByteArray> roleNames() const override
@@ -142,7 +144,7 @@ private Q_SLOTS:
142144 heightList << "100" << "50" << "125" << "10" << "40" << "70" << "200" << "110" << "160" << "20" << "20" << "65" << "80" << "200" << "300" << "130" << "400" << "300" << "500" << "10";
143145 model->setStringList(heightList);
144146
145− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltest.qml"));
147+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltest.qml"));
146148
147149 view->show();
148150 QTest::qWaitForWindowExposed(view);
tests/plugins/Dash/verticaljournaltry.cpp+3−1
@@ -26,6 +26,8 @@
2626
2727#include "verticaljournal.h"
2828
29+#include <paths.h>
30+
2931class QHeightModel : public QStringListModel {
3032 Q_OBJECT
3133public:
@@ -75,7 +77,7 @@ int main(int argc, char *argv[])
7577 view->rootContext()->setContextProperty("listModel", &listModel);
7678 view->rootContext()->setContextProperty("vjModel", &model);
7779
78− view->setSource(QUrl::fromLocalFile(DASHVIEWSTEST_FOLDER "/verticaljournaltry.qml"));
80+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/verticaljournaltry.qml"));
7981
8082 view->show();
8183 view->resize(530, 400);
tests/plugins/GlobalShortcut/CMakeLists.txt+11−5
@@ -3,12 +3,18 @@ include_directories(
33 ${CMAKE_CURRENT_BINARY_DIR}
44 )
55
6−add_definitions(
7− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
8− )
9−add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
6+add_definitions(-DTEST_DIR="plugins/GlobalShortcut")
107
118add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
129qt5_use_modules(GlobalShortcutTestExec Test Quick)
1310target_link_libraries(GlobalShortcutTestExec ${Qt5Quick_LIBRARIES} GlobalShortcut-qml)
14−add_unity8_uitest(GlobalShortcut GlobalShortcutTestExec DEPENDS 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+)
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 @@
2121#include <QtQuick/QQuickItem>
2222#include <QQmlEngine>
2323
24+#include <paths.h>
25+
2426class GlobalShortcutTest: public QObject
2527{
2628 Q_OBJECT
@@ -30,8 +32,7 @@ private Q_SLOTS:
3032 void initTestCase()
3133 {
3234 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"));
3536 m_shortcut = dynamic_cast<GlobalShortcut*>(m_view->rootObject()->property("shortcut").value<QObject*>());
3637 QVERIFY(m_shortcut);
3738 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(
99 )
1010
1111add_definitions(-DSM_BUSNAME=sessionBus)
12−add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
12+add_definitions(-DTEST_DIR="plugins/Greeter/Unity/Launcher")
1313
1414### LauncherModelASTest
1515add_executable(launchermodelastestExec
@@ -30,7 +30,10 @@ target_link_libraries(launchermodelastestExec
3030 ${GSETTINGS_QT_LDFLAGS}
3131 )
3232add_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+)
3437add_unity8_unittest(LauncherModelAS dbus-test-runner
3538 ARG_PREFIX "--parameter"
3639 ARGS
@@ -39,21 +42,3 @@ add_unity8_unittest(LauncherModelAS dbus-test-runner
3942 --task $<TARGET_FILE:launchermodelastestExec>
4043 --wait-for org.freedesktop.Accounts
4144)
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 @@
2828#include <QSignalSpy>
2929#include <QtTest>
3030
31+#include <paths.h>
3132
3233class LauncherModelASTest : public QObject
3334{
@@ -45,6 +46,9 @@ private Q_SLOTS:
4546 }
4647
4748 void init() {
49+ // Launcher will look in current dir in testing mode for data
50+ QDir::setCurrent(testDataDir() + "/" TEST_DIR);
51+
4852 // Prepare some fake list
4953 QList<QVariantMap> list;
5054 QVariantMap item;
tests/plugins/ImageCache/CMakeLists.txt+10
@@ -8,6 +8,7 @@ include_directories(
88 )
99
1010add_definitions(-DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
11+add_definitions(-DTEST_DIR="plugins/ImageCache")
1112remove_definitions(-DQT_NO_KEYWORDS)
1213
1314add_executable(ImageCacheTestExec
@@ -18,3 +19,12 @@ add_unity8_uitest(ImageCache ImageCacheTestExec
1819 DEPENDS ImageCache-qml
1920 IMPORT_PATHS ${UNITY_PLUGINPATH}
2021 )
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 @@
2424#include <time.h>
2525#include <utime.h>
2626
27+#include <paths.h>
28+
2729Q_DECLARE_METATYPE(QQuickImage::Status)
2830
2931class ImageCacheTest : public QObject
@@ -52,7 +54,7 @@ private:
5254
5355 QString sourceFile(const QString &name)
5456 {
55− return CURRENT_SOURCE_DIR "/graphics/" + name;
57+ return testDataDir() + "/" TEST_DIR "/graphics/" + name;
5658 }
5759
5860 QString cachedFile(bool isPath, const QString &name)
@@ -93,7 +95,7 @@ private Q_SLOTS:
9395 qputenv("HOME", home->path().toUtf8());
9496
9597 view = new QQuickView();
96− view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/test.qml"));
98+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/" TEST_DIR "/test.qml"));
9799 image = view->rootObject();
98100
99101 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− )
41include_directories(
52 ${GLIB_INCLUDE_DIRS}
63 ${CMAKE_CURRENT_BINARY_DIR}
@@ -21,11 +18,17 @@ target_include_directories(GreeterDBusTestExec PUBLIC
2118 ${CMAKE_SOURCE_DIR}/plugins/LightDM
2219 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
2320 )
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+ )
2428add_unity8_uitest(GreeterDBus dbus-test-runner
2529 ARG_PREFIX "--parameter"
2630 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
27− DEPENDS MockLightDM
28− IMPORT_PATHS ${UNITY_MOCKPATH}
31+ DEPENDS MockLightDM MockLightDM-qml
2932 )
3033
3134add_executable(GreeterPamTestExec
@@ -41,6 +44,9 @@ target_include_directories(GreeterPamTestExec PUBLIC
4144 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM
4245 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
4346 )
47+install(TARGETS GreeterPamTestExec
48+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
49+ )
4450add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
4551
4652# SessionsModelTest
@@ -59,6 +65,9 @@ target_include_directories(GreeterSessionsModelTestExec PUBLIC
5965 ${CMAKE_SOURCE_DIR}/plugins/Utils
6066 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
6167 )
68+install(TARGETS GreeterSessionsModelTestExec
69+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
70+ )
6271add_unity8_uitest(GreeterSessions GreeterSessionsModelTestExec
6372 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
6473 DEPENDS MockLightDM
@@ -82,6 +91,10 @@ target_include_directories(GreeterUsersModelTestExec PUBLIC
8291 ${CMAKE_SOURCE_DIR}/plugins/Utils
8392 ${CMAKE_SOURCE_DIR}/tests/mocks/LightDM/IntegratedLightDM
8493 )
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+ )
8598add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
8699 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
87100 DEPENDS MockLightDM
@@ -99,6 +112,9 @@ target_include_directories(GreeterIntegratedTestExec PUBLIC
99112 ${GLIB_INCLUDE_DIRS}
100113 ${CMAKE_SOURCE_DIR}/plugins/LightDM/IntegratedLightDM/liblightdm
101114 )
115+install(TARGETS GreeterIntegratedTestExec
116+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/LightDM/IntegratedLightDM"
117+ )
102118add_unity8_unittest(GreeterIntegrated dbus-test-runner
103119 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
104120 ARG_PREFIX "--parameter"
tests/plugins/LightDM/IntegratedLightDM/dbus.cpp+2−1
@@ -23,6 +23,7 @@
2323#include <QQuickItem>
2424#include <QQuickView>
2525#include <QtTestGui>
26+#include <paths.h>
2627
2728class GreeterDBusTest : public QObject
2829{
@@ -58,7 +59,7 @@ private Q_SLOTS:
5859 void init()
5960 {
6061 view = new QQuickView();
61− view->setSource(QUrl::fromLocalFile(CURRENT_SOURCE_DIR "/greeter.qml"));
62+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/plugins/LightDM/IntegratedLightDM/greeter.qml"));
6263 greeter = dynamic_cast<Greeter*>(view->rootObject()->property("greeter").value<QObject*>());
6364 QVERIFY(greeter);
6465 QVERIFY(greeter->authenticationUser() == "");
tests/plugins/SessionBroadcast/CMakeLists.txt+6
@@ -25,6 +25,9 @@ add_executable(MockBroadcastServer
2525 BroadcastServer.cpp
2626)
2727qt5_use_modules(MockBroadcastServer Core DBus)
28+install(TARGETS MockBroadcastServer
29+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/SessionBroadcast"
30+)
2831
2932### SessionBroadcastTest
3033add_executable(sessionbroadcasttestExec
@@ -32,6 +35,9 @@ add_executable(sessionbroadcasttestExec
3235 sessionbroadcasttest.cpp
3336)
3437qt5_use_modules(sessionbroadcasttestExec Test Core Qml DBus)
38+install(TARGETS sessionbroadcasttestExec
39+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/SessionBroadcast"
40+)
3541
3642add_unity8_unittest(SessionBroadcast dbus-test-runner
3743 ARG_PREFIX "--parameter"
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+8−4
@@ -16,12 +16,15 @@ include_directories(
1616 ${CMAKE_CURRENT_BINARY_DIR}
1717 )
1818
19−export_qmlfiles(UbuntuGesturesTest .)
20−
2119macro(build_gesture_test CLASSNAME)
2220 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
2321 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
2422 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}")
2528endmacro()
2629
2730set(UNITY_IMPORT_PATHS
@@ -33,7 +36,6 @@ macro(add_gesture_unit_test CLASSNAME)
3336 build_gesture_test(${CLASSNAME})
3437 add_unity8_unittest(${CLASSNAME} ${CLASSNAME}TestExec
3538 ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
36− DEPENDS UbuntuGesturesTest-qmlfiles
3739 ${ARGN}
3840 )
3941endmacro()
@@ -42,12 +44,14 @@ macro(add_gesture_ui_test CLASSNAME)
4244 build_gesture_test(${CLASSNAME})
4345 add_unity8_uitest(${CLASSNAME} ${CLASSNAME}TestExec
4446 ENVIRONMENT LD_LIBRARY_PATH=${UNITY_PLUGINPATH}/Ubuntu/Gestures
45− DEPENDS UbuntuGesturesTest-qmlfiles
4647 ${ARGN}
4748 )
4849 add_manual_qml_test(. ${CLASSNAME} IMPORT_PATHS ${UNITY_IMPORT_PATHS})
4950endmacro()
5051
52+add_qml_test_data(. empty.qml)
53+add_qml_test_data(. touchGateExample.qml)
54+
5155add_gesture_ui_test(FloatingFlickable)
5256add_gesture_ui_test(PressedOutsideNotifier)
5357add_gesture_ui_test(TouchDispatcher)
tests/plugins/Ubuntu/Gestures/GestureTest.cpp+2−1
@@ -24,6 +24,7 @@
2424
2525#include <UbuntuGestures/private/timer_p.h>
2626#include <UbuntuGestures/private/touchregistry_p.h>
27+#include <paths.h>
2728
2829UG_USE_NAMESPACE
2930
@@ -45,7 +46,7 @@ void GestureTest::init()
4546{
4647 m_view = new QQuickView;
4748 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));
4950 m_view->show();
5051 QVERIFY(QTest::qWaitForWindowExposed(m_view));
5152 QVERIFY(m_view->rootObject() != 0);
tests/plugins/Ubuntu/Gestures/tst_FloatingFlickable.qml+1−1
@@ -18,7 +18,7 @@ import QtQuick 2.4
1818import Ubuntu.Components 1.3
1919import Ubuntu.Gestures 0.1
2020import Unity.Test 0.1
21−import "../../../../../qml/Components"
21+import "../../../../qml/Components"
2222
2323Rectangle {
2424 id: root
tests/plugins/Ubuntu/Gestures/tst_TouchGate.cpp+3−1
@@ -29,6 +29,8 @@
2929
3030#include "TestItem.h"
3131
32+#include <paths.h>
33+
3234UG_USE_NAMESPACE
3335
3436class CandidateItem : public QQuickItem
@@ -98,7 +100,7 @@ void tst_TouchGate::init()
98100 touchRegistry = TouchRegistry::instance();
99101
100102 view = createView();
101− view->setSource(QUrl::fromLocalFile("touchGateExample.qml"));
103+ view->setSource(QUrl::fromLocalFile(testDataDir() + "/plugins/Ubuntu/Gestures/touchGateExample.qml"));
102104 view->show();
103105 QVERIFY(QTest::qWaitForWindowExposed(view));
104106 QVERIFY(view->rootObject() != 0);
tests/plugins/Unity/Indicators/CMakeLists.txt+11−1
@@ -24,8 +24,18 @@ macro(indicator_test TEST)
2424 ${GIO_LIBRARIES}
2525 ${QMENUMODEL_LDFLAGS}
2626 )
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)
2735
28− add_unity8_unittest(${TEST} ${TEST}Exec)
36+ add_unity8_unittest(${TEST} ${TEST}Exec
37+ ENVIRONMENT "LD_LIBRARY_PATH=${ldpath}"
38+ )
2939endmacro(indicator_test)
3040
3141indicator_test(IndicatorsManager ADDITIONAL_LIBS IndicatorsQml)
tests/plugins/Unity/Indicators/IndicatorsManagerTest.cpp+1−1
@@ -31,7 +31,7 @@ private Q_SLOTS:
3131
3232 void initTestCase()
3333 {
34− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
34+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
3535 }
3636
3737 void cleanupTestCase()
tests/plugins/Unity/Indicators/IndicatorsModelTest.cpp+1−1
@@ -32,7 +32,7 @@ private Q_SLOTS:
3232
3333 void initTestCase()
3434 {
35− setenv("XDG_DATA_DIRS", (sourceDirectory() + "/tests/data").toLatin1().data(), 1);
35+ setenv("XDG_DATA_DIRS", (testDataDir() + "/data").toLatin1().data(), 1);
3636 }
3737
3838 void cleanupTestCase()
tests/plugins/Unity/Launcher/CMakeLists.txt+9−3
@@ -17,7 +17,7 @@ include_directories(
1717 )
1818
1919add_definitions(-DSM_BUSNAME=sessionBus)
20−add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
20+add_definitions(-DTEST_DIR="plugins/Unity/Launcher")
2121
2222### LauncherModelTest
2323add_executable(launchermodeltestExec
@@ -44,10 +44,13 @@ target_link_libraries(launchermodeltestExec
4444 ${UAL_LIBRARIES}
4545 )
4646add_dependencies(launchermodeltestExec mock-server)
47−qt5_use_modules(launchermodeltestExec Test Core DBus Xml Gui)
47+qt5_use_modules(launchermodeltestExec Test Core DBus Xml Gui Qml)
48+install(TARGETS launchermodeltestExec
49+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Launcher"
50+ )
4851
4952add_unity8_unittest(LauncherModel dbus-test-runner
50− ENVIRONMENT "XDG_DATA_HOME=${CMAKE_CURRENT_BINARY_DIR}"
53+ ENVIRONMENT "APPDIR=${CMAKE_CURRENT_BINARY_DIR}/applications"
5154 ARG_PREFIX "--parameter"
5255 ARGS
5356 --task $<TARGET_FILE:mock-server>
@@ -60,3 +63,6 @@ add_unity8_unittest(LauncherModel dbus-test-runner
6063file(COPY applications
6164 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
6265 )
66+install(DIRECTORY applications
67+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Launcher"
68+ )
tests/plugins/Unity/Launcher/launchermodeltest.cpp+17
@@ -32,6 +32,7 @@
3232#include <QDomDocument>
3333
3434#include <glib.h>
35+#include <paths.h>
3536
3637namespace unityapi = unity::shell::application;
3738
@@ -145,6 +146,7 @@ class LauncherModelTest : public QObject
145146private:
146147 LauncherModel *launcherModel;
147148 MockAppManager *appManager;
149+ QTemporaryDir tmpDir;
148150
149151 QList<QVariantMap> getASConfig() {
150152 AccountsServiceDBusAdaptor *as = launcherModel->m_asAdapter->m_accounts;
@@ -154,11 +156,23 @@ private:
154156 return qdbus_cast<QList<QVariantMap>>(reply.value().value<QDBusArgument>());
155157 }
156158
159+ // Link our app data from a tempdir & tell glib/UAL to look there.
160+ // We do this because we want to be able to delete the applications dir
161+ // during testing, but that dir may be read-only (installed on system).
162+ void setUpAppDir() {
163+ QFile appDir(qgetenv("APPDIR"));
164+ appDir.link(tmpDir.path() + "/applications");
165+
166+ qputenv("XDG_DATA_HOME", tmpDir.path().toUtf8());
167+ }
168+
157169private Q_SLOTS:
158170
159171 void initTestCase() {
160172 qDBusRegisterMetaType<QList<QVariantMap>>();
161173
174+ setUpAppDir();
175+
162176 launcherModel = new LauncherModel(this);
163177 QCoreApplication::processEvents(); // to let the model register on DBus
164178 QCOMPARE(launcherModel->rowCount(QModelIndex()), 0);
@@ -169,6 +183,9 @@ private Q_SLOTS:
169183
170184 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
171185 void init() {
186+ // Switching to tmpDir makes manipulating our appdir symlink easier.
187+ QDir::setCurrent(tmpDir.path());
188+
172189 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
173190 QStringLiteral("/org/freedesktop/Accounts"),
174191 QStringLiteral("org.freedesktop.Accounts"));
tests/plugins/Unity/Session/CMakeLists.txt+6
@@ -29,6 +29,9 @@ add_executable(LightDMServer
2929 server.cpp
3030)
3131qt5_use_modules(LightDMServer Core DBus)
32+install(TARGETS LightDMServer
33+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Session"
34+ )
3235
3336### SessionBackendTest
3437add_executable(sessionbackendtestExec
@@ -40,6 +43,9 @@ target_link_libraries(sessionbackendtestExec
4043 ${GLIB_LIBRARIES}
4144 )
4245qt5_use_modules(sessionbackendtestExec Test Core Qml DBus)
46+install(TARGETS sessionbackendtestExec
47+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Session"
48+)
4349
4450add_unity8_unittest(SessionBackend dbus-test-runner
4551 ENVIRONMENT XDG_SESSION_PATH=/session
tests/plugins/Utils/CMakeLists.txt+8−1
@@ -15,8 +15,11 @@ foreach(util_test
1515 add_executable(${util_test}TestExec ${util_test}Test.cpp ModelTest.cpp)
1616 qt5_use_modules(${util_test}TestExec Test Core Qml)
1717 target_link_libraries(${util_test}TestExec Utils-qml)
18+ install(TARGETS ${util_test}TestExec
19+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Utils"
20+ )
1821 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
2023 )
2124
2225endforeach()
@@ -28,7 +31,11 @@ add_unity8_qmlunittest(. UtilsStyle)
2831add_executable(URLDispatcherTestExec URLDispatcherTest.cpp)
2932qt5_use_modules(URLDispatcherTestExec Test Core Qml)
3033target_link_libraries(URLDispatcherTestExec Utils-qml)
34+install(TARGETS URLDispatcherTestExec
35+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Utils"
36+)
3137add_unity8_unittest(URLDispatcher dbus-test-runner
3238 ARG_PREFIX "--parameter"
3339 ARGS --task $<TARGET_FILE:URLDispatcherTestExec>
40+ ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Utils
3441)
tests/plugins/Utils/DeviceConfigParserTest.cpp+4−1
@@ -21,6 +21,7 @@
2121#include <QTest>
2222#include <QDebug>
2323#include <QSettings>
24+#include <QTemporaryDir>
2425
2526class DeviceConfigParserTest : public QObject
2627{
@@ -45,13 +46,15 @@ private Q_SLOTS:
4546 }
4647
4748 void testCustomFile() {
48− QSettings s("./devices.conf", QSettings::IniFormat);
49+ QTemporaryDir dir;
50+ QSettings s(dir.path() + "/devices.conf", QSettings::IniFormat);
4951 s.beginGroup("fakedevice");
5052
5153 s.setValue("SupportedOrientations", QStringList() << "Portrait" << "Landscape" << "InvertedLandscape");
5254 s.setValue("PrimaryOrientation", "InvertedLandscape");
5355 s.sync();
5456
57+ qputenv("XDG_CONFIG_HOME", dir.path().toUtf8());
5558 DeviceConfigParser p;
5659 p.setName("fakedevice");
5760
tests/plugins/Wizard/CMakeLists.txt+6
@@ -8,6 +8,9 @@ add_executable(tst-wizard-pagelist
88 ${CMAKE_SOURCE_DIR}/plugins/Wizard/PageList.cpp
99)
1010qt5_use_modules(tst-wizard-pagelist Core Qml Test)
11+install(TARGETS tst-wizard-pagelist
12+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Wizard"
13+)
1114add_unity8_unittest(WizardPageList tst-wizard-pagelist ENVIRONMENT WIZARD_TESTING=1)
1215
1316add_executable(tst-wizard-system
@@ -15,4 +18,7 @@ add_executable(tst-wizard-system
1518 ${CMAKE_SOURCE_DIR}/plugins/Wizard/System.cpp
1619)
1720qt5_use_modules(tst-wizard-system Core DBus Qml Test)
21+install(TARGETS tst-wizard-system
22+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Wizard"
23+)
1824add_unity8_unittest(WizardSystem tst-wizard-system)
tests/qmltests/CMakeLists.txt+17
@@ -6,11 +6,13 @@ add_unity8_qmltest(. DisabledScreenNotice)
66add_unity8_qmltest(. Shell)
77add_unity8_qmltest(. ShellWithPin)
88add_unity8_qmltest(. DeviceConfiguration)
9+add_unity8_qmltest_data(. EdgeBarrierControls)
910add_unity8_qmltest(Components Background)
1011add_unity8_qmltest(Components Carousel)
1112add_unity8_qmltest(Components Dialogs)
1213add_unity8_qmltest(Components DraggingArea)
1314add_unity8_qmltest(Components LazyImage)
15+add_unity8_qmltest_data(Components tst_LazyImage)
1416add_unity8_qmltest(Components Lockscreen)
1517add_unity8_qmltest(Components MediaServices)
1618add_unity8_qmltest(Components ModeSwitchWarningDialog)
@@ -33,6 +35,9 @@ add_unity8_qmltest(Dash CardTool)
3335add_unity8_qmltest(Dash GenericScopeView)
3436add_unity8_qmltest(Dash DashPageHeader)
3537add_unity8_qmltest(Dash PreviewView)
38+add_unity8_qmltest_data(Dash artwork)
39+add_unity8_qmltest_data(Dash CardHelpers.js)
40+add_unity8_qmltest_data(Dash tst_PageHeader)
3641add_unity8_qmltest(Dash/Previews Preview)
3742add_unity8_qmltest(Dash/Previews PreviewActions)
3843add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
@@ -55,6 +60,7 @@ add_unity8_qmltest(Dash/Previews PreviewTextSummary)
5560add_unity8_qmltest(Dash/Previews PreviewVideoPlayback)
5661add_unity8_qmltest(Dash/Previews PreviewWidgetFactory)
5762add_unity8_qmltest(Dash/Previews PreviewZoomableImage)
63+add_unity8_qmltest_data(Dash/Previews MockPreviewWidget)
5864add_unity8_qmltest(Dash/Filters FilterOptionSelector)
5965add_unity8_qmltest(Dash/Filters FilterRangeInput)
6066add_unity8_qmltest(Dash/Filters FilterValueSlider)
@@ -70,12 +76,14 @@ add_unity8_qmltest(Greeter Greeter)
7076add_unity8_qmltest(Greeter Infographics)
7177add_unity8_qmltest(Greeter NarrowView)
7278add_unity8_qmltest(Greeter WideView)
79+add_unity8_qmltest_data(Greeter TestView)
7380add_unity8_qmltest(Launcher Launcher)
7481add_unity8_qmltest(Launcher Drawer)
7582add_unity8_qmltest(Notifications Notifications)
7683add_unity8_qmltest(Notifications VisualSnapDecisionsQueue)
7784add_unity8_qmltest(Notifications OptionToggle)
7885add_unity8_qmltest(Notifications SwipeToAct)
86+add_unity8_qmltest_data(Notifications Notification)
7987add_unity8_qmltest(Panel ActiveCallHint)
8088add_unity8_qmltest(Panel IndicatorItem)
8189add_unity8_qmltest(Panel IndicatorItemRow)
@@ -84,6 +92,7 @@ add_unity8_qmltest(Panel IndicatorsBar)
8492add_unity8_qmltest(Panel IndicatorsMenu)
8593add_unity8_qmltest(Panel MenuContent)
8694add_unity8_qmltest(Panel Panel)
95+add_unity8_qmltest_data(Panel IndicatorTest)
8796add_unity8_qmltest(Panel/Indicators IndicatorsLight)
8897add_unity8_qmltest(Panel/Indicators MenuItemFactory)
8998add_unity8_qmltest(Panel/Indicators MessageMenuItemFactory)
@@ -95,6 +104,14 @@ add_unity8_qmltest(Stage TabletStage)
95104add_unity8_qmltest(Stage WindowResizeArea)
96105add_unity8_qmltest(Stage Splash)
97106add_unity8_qmltest(Stage DecoratedWindow)
107+add_unity8_qmltest_data(Stage ApplicationCheckBox)
108+add_unity8_qmltest_data(Stage SizeHintField)
109+add_unity8_qmltest_data(Stage SurfaceManagerControls)
110+add_unity8_qmltest_data(Stage SurfaceManagerField)
98111add_unity8_qmltest(Tutorial Tutorial)
99112add_unity8_qmltest(Wizard Wizard ENVIRONMENT "OXIDE_NO_SANDBOX=1")
113+add_unity8_qmltest_data(Wizard licenses)
114+add_unity8_qmltest_data(Wizard nolicenses)
100115add_unity8_qmltest(utils/Unity/Test UnityTest)
116+add_unity8_qmltest_data(utils/Unity/Test MockObjectForInstanceOfTest)
117+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")
22
33pkg_check_modules(UBUNTUGESTURES REQUIRED UbuntuGestures)
44
@@ -20,13 +20,28 @@ include_directories(
2020add_executable(DragHandleTestExec tst_DragHandle.cpp)
2121qt5_use_modules(DragHandleTestExec Test Core Qml Gui Quick)
2222target_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+ )
2329
24−add_unity8_uitest(DragHandle DragHandleTestExec ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/Ubuntu/Gestures)
30+add_unity8_uitest(DragHandle DragHandleTestExec)
2531add_manual_qml_test(. DragHandle IMPORT_PATHS ${UNITY_IMPORT_PATHS})
32+add_unity8_qmltest_data(. tst_DragHandle.qml)
33+add_unity8_qmltest_data(. tst_DragHandle)
2634
2735########## tst_EdgeDragEvaluator
2836add_executable(EdgeDragEvaluatorTestExec tst_EdgeDragEvaluator.cpp)
2937qt5_use_modules(EdgeDragEvaluatorTestExec Test Core Qml Gui Quick)
3038target_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+ )
3145
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 @@
2727#include <UbuntuGestures/private/timer_p.h>
2828#include "Direction.h"
2929
30+#include <paths.h>
31+
3032UG_USE_NAMESPACE
3133
3234class tst_DragHandle: public QObject
@@ -84,7 +86,7 @@ void tst_DragHandle::cleanupTestCase()
8486void tst_DragHandle::init()
8587{
8688 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"));
8890 m_view->show();
8991 QVERIFY(QTest::qWaitForWindowExposed(m_view));
9092 QVERIFY(m_view->rootObject() != 0);
@@ -113,7 +115,7 @@ QQuickView *tst_DragHandle::createView()
113115{
114116 QQuickView *window = new QQuickView(0);
115117 window->setResizeMode(QQuickView::SizeRootObjectToView);
116− window->engine()->addImportPath(QLatin1String(TEST_DIR));
118+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
117119
118120 return window;
119121}
tests/qmltests/Components/tst_EdgeDragEvaluator.cpp+4−2
@@ -26,6 +26,8 @@
2626#include <Direction.h>
2727#include <UbuntuGestures/private/timer_p.h>
2828
29+#include <paths.h>
30+
2931UG_USE_NAMESPACE
3032
3133class tst_EdgeDragEvaluator: public QObject
@@ -67,7 +69,7 @@ void tst_EdgeDragEvaluator::init()
6769{
6870
6971 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"));
7173 m_view->show();
7274 QVERIFY(QTest::qWaitForWindowExposed(m_view));
7375 QVERIFY(m_view->rootObject() != 0);
@@ -99,7 +101,7 @@ QQuickView *tst_EdgeDragEvaluator::createView()
99101{
100102 QQuickView *window = new QQuickView(0);
101103 window->setResizeMode(QQuickView::SizeRootObjectToView);
102− window->engine()->addImportPath(QLatin1String(TEST_DIR));
104+ window->engine()->addImportPath(testDataDir() + "/" TEST_DIR);
103105
104106 return window;
105107}
tests/qmltests/Components/tst_ZoomableImage.qml+1−1
@@ -36,7 +36,7 @@ Rectangle {
3636 }
3737
3838 property var widgetData2: {
39− "source": "../../mocks/Unity/Application/resources/screenshots/gallery@12.png",
39+ "source": Qt.resolvedUrl("../../graphics/screenshots/gallery@12.png"),
4040 "zoomable": true
4141 }
4242
tests/qmltests/Dash/Previews/tst_PreviewImageGallery.qml+13−13
@@ -31,31 +31,31 @@ Rectangle {
3131
3232 property var sourcesModel1: {
3333 "sources": [
34− "../../../tests/graphics/avatars/amanda@12.png",
35− "../../../tests/graphics/avatars/funky@12.png",
36− "../../../tests/graphics/clock@18.png",
37− "../../graphics/borked"
34+ Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
35+ Qt.resolvedUrl("../../../graphics/avatars/funky@12.png"),
36+ Qt.resolvedUrl("../../../graphics/clock@18.png"),
37+ Qt.resolvedUrl("../../../../qml/graphics/borked")
3838 ]
3939 }
4040
4141 property var sourcesModel1WithFallback: {
4242 "sources": [
43− "../../../tests/graphics/avatars/amanda@12.png",
44− "../../../tests/graphics/avatars/funky@12.png",
45− "../../../tests/graphics/clock@18.png",
46− "../../graphics/borked"
43+ Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
44+ Qt.resolvedUrl("../../../graphics/avatars/funky@12.png"),
45+ Qt.resolvedUrl("../../../graphics/clock@18.png"),
46+ Qt.resolvedUrl("../../../../qml/graphics/borked")
4747 ]
48− , "fallback": "../../../tests/graphics/clock@18.png"
48+ , "fallback": Qt.resolvedUrl("../../../graphics/clock@18.png")
4949 }
5050
5151 property var sourcesModelEmptyWithFallback: {
5252 "sources": [
53− "../../../tests/graphics/avatars/amanda@12.png",
54− "../../../tests/graphics/avatars/funky@12.png",
55− "../../../tests/graphics/clock@18.png",
53+ Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
54+ Qt.resolvedUrl("../../../graphics/avatars/funky@12.png"),
55+ Qt.resolvedUrl("../../../graphics/clock@18.png"),
5656 ""
5757 ]
58− , "fallback": "../../../tests/graphics/clock@18.png"
58+ , "fallback": Qt.resolvedUrl("../../../graphics/clock@18.png")
5959 }
6060
6161 PreviewImageGallery {
tests/qmltests/Dash/Previews/tst_PreviewZoomableImage.qml+5−5
@@ -26,7 +26,7 @@ Rectangle {
2626 color: "lightgrey"
2727
2828 property var widgetData0: {
29− "source": "../../../tests/graphics/avatars/amanda@12.png",
29+ "source": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png"),
3030 "zoomable": false
3131 }
3232
@@ -36,17 +36,17 @@ Rectangle {
3636
3737 property var widgetData2: {
3838 "source": "fadsasf",
39− "fallback": "../../../tests/graphics/avatars/amanda@12.png"
39+ "fallback": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png")
4040 }
4141
4242 property var widgetData3: {
4343 "source": "",
44− "fallback": "../../../tests/graphics/avatars/amanda@12.png"
44+ "fallback": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png")
4545 }
4646
4747 property var widgetData4: {
4848 "source": "fadsasf",
49− "fallback": "../../../tests/graphics/avatars/amanda@12.png"
49+ "fallback": Qt.resolvedUrl("../../../graphics/avatars/amanda@12.png")
5050 }
5151
5252 Loader {
@@ -129,7 +129,7 @@ Rectangle {
129129 waitForRendering(lazyImage);
130130 tryCompare(lazyImage, "state", "ready");
131131 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")
133133 zoomableImage.widgetDataChanged();
134134 tryCompare(lazyImage, "state", "ready");
135135 verify(lazyImage.sourceImage.source.toString().indexOf("funky") > -1);
tests/qmltests/Dash/tst_GenericScopeView.qml+1−1
@@ -463,7 +463,7 @@ Item {
463463 { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#ffffff", logo: "" },
464464 { tag: "Foreground", index: 1, foreground: "yellow", background: "color:///#ffffff", logo: "" },
465465 { 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") },
467467 ];
468468 }
469469
tests/qmltests/Notifications/tst_Notifications.qml+11−11
@@ -61,8 +61,8 @@ Item {
6161 "hints": {},
6262 "summary": "Cole Raby",
6363 "body": "I did not expect it to be <b>that</b> late.",
64− "icon": "../../tests/graphics/avatars/amanda.png",
65− "secondaryIcon": "../../tests/graphics/applicationIcons/facebook.png",
64+ "icon": Qt.resolvedUrl("../../graphics/avatars/amanda.png"),
65+ "secondaryIcon": Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
6666 "rawActions": ["reply_id", "Dummy"]})
6767 n.completed.connect(mockModel.onCompleted)
6868 mockModel.append(n)
@@ -75,7 +75,7 @@ Item {
7575 "hints": {"x-canonical-non-shaped-icon": "true"},
7676 "summary": "Contacts",
7777 "body": "Synchronised contacts-database &amp; cloud-storage.",
78− "icon": "../../tests/graphics/applicationIcons/contacts-app.png",
78+ "icon": Qt.resolvedUrl("../../graphics/applicationIcons/contacts-app.png"),
7979 "secondaryIcon": "",
8080 "rawActions": ["reply_id", "Dummy"]})
8181 n.completed.connect(mockModel.onCompleted)
@@ -89,7 +89,7 @@ Item {
8989 "hints": {"x-canonical-non-shaped-icon": "false"},
9090 "summary": "Photo upload completed",
9191 "body": "",
92− "icon": "../../tests/graphics/applicationIcons/facebook.png",
92+ "icon": Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
9393 "secondaryIcon": "",
9494 "rawActions": ["reply_id", "Dummy"]})
9595 n.completed.connect(mockModel.onCompleted)
@@ -103,7 +103,7 @@ Item {
103103 "hints": {},
104104 "summary": "Interactive notification",
105105 "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"),
107107 "secondaryIcon": "",
108108 "rawActions": ["reply_id", "Dummy"]})
109109 n.completed.connect(mockModel.onCompleted)
@@ -287,7 +287,7 @@ Item {
287287 type: Notification.Ephemeral
288288 summary: "Photo upload completed"
289289 body: ""
290− icon: "../../tests/graphics/applicationIcons/facebook.png"
290+ icon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png")
291291 secondaryIcon: ""
292292 value: 0
293293 rawActions: []
@@ -301,7 +301,7 @@ Item {
301301 summary: "New comment successfully published"
302302 body: ""
303303 icon: ""
304− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png"
304+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png")
305305 value: 0
306306 rawActions: []
307307 },
@@ -312,7 +312,7 @@ Item {
312312 "sound-file": "dummy.ogg"}
313313 summary: "Interactive notification"
314314 body: "This is a notification that can be clicked"
315− icon: "../../tests/graphics/avatars/amanda.png"
315+ icon: Qt.resolvedUrl("../../graphics/avatars/amanda.png")
316316 secondaryIcon: ""
317317 value: 0
318318 rawActions: ["reply_id", "Dummy"]
@@ -324,7 +324,7 @@ Item {
324324 "sound-file": "dummy.ogg"}
325325 summary: "Bro Coly"
326326 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")
328328 secondaryIcon: ""
329329 value: 0
330330 rawActions: ["accept_id", "Accept",
@@ -337,8 +337,8 @@ Item {
337337 "sound-file": "dummy.ogg"}
338338 summary: "Cole Raby"
339339 body: "I did not expect it to be that late."
340− icon: "../../tests/graphics/avatars/funky.png"
341− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png"
340+ icon: Qt.resolvedUrl("../../graphics/avatars/funky.png")
341+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png")
342342 value: 0
343343 rawActions: []
344344 },
tests/qmltests/Notifications/tst_SwipeToAct.qml+5−5
@@ -61,7 +61,7 @@ Item {
6161 hints: {"x-canonical-snap-decisions-swipe": "true"},
6262 summary: "Incoming call",
6363 body: "Frank Zappa\n+44 (0)7736 027340",
64− icon: "../../tests/graphics/avatars/amanda.png",
64+ icon: Qt.resolvedUrl("../../graphics/avatars/amanda.png"),
6565 secondaryIcon: "image://theme/incoming-call",
6666 actions: [{ id: "ok_id", label: "Ok"},
6767 { id: "cancel_id", label: "Cancel"},
@@ -177,8 +177,8 @@ Item {
177177 hints: {"x-canonical-snap-decisions-swipe": "true"},
178178 summary: "Incoming call",
179179 body: "Frank Zappa\n+44 (0)7736 027340",
180− icon: "../../tests/graphics/avatars/amanda.png",
181− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png",
180+ icon: Qt.resolvedUrl("../../graphics/avatars/amanda.png"),
181+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
182182 actions: myActionModel,
183183 summaryVisible: true,
184184 bodyVisible: true,
@@ -196,8 +196,8 @@ Item {
196196 hints: {"x-canonical-snap-decisions-swipe": "true"},
197197 summary: "Incoming call",
198198 body: "Bro Coly\n+49 (0)221 426973",
199− icon: "../../tests/graphics/avatars/funky.png",
200− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png",
199+ icon: Qt.resolvedUrl("../../graphics/avatars/funky.png"),
200+ secondaryIcon: Qt.resolvedUrl("../../graphics/applicationIcons/facebook.png"),
201201 actions: myActionModel,
202202 summaryVisible: true,
203203 bodyVisible: true,
tests/qmltests/tst_Shell.qml+2−2
@@ -727,8 +727,8 @@ Rectangle {
727727 hints: {"x-canonical-private-affirmative-tint": "true"},
728728 summary: "Tom Ato",
729729 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.",
730− icon: "../../tests/graphics/avatars/funky.png",
731− secondaryIcon: "../../tests/graphics/applicationIcons/facebook.png",
730+ icon: Qt.resolvedUrl("../graphics/avatars/funky.png"),
731+ secondaryIcon: Qt.resolvedUrl("../graphics/applicationIcons/facebook.png"),
732732 actions: [{ id: "ok_id", label: "Ok"},
733733 { id: "cancel_id", label: "Cancel"},
734734 { id: "notreally_id", label: "Not really"},
tests/uqmlscene/CMakeLists.txt+4
@@ -27,3 +27,7 @@ target_link_libraries(uqmlscene
2727 ${XCB_LDFLAGS}
2828 UbuntuGestures
2929 )
30+
31+install(TARGETS uqmlscene
32+ RUNTIME DESTINATION ${SHELL_PRIVATE_LIBDIR}
33+ )
tests/utils/modules/Unity/Test/CMakeLists.txt+4−2
@@ -33,7 +33,9 @@ if (ENABLE_TOUCH_EMULATION)
3333 target_link_libraries(UnityTestQml ${MOUSETOUCHADAPTOR_LIBS_LDFLAGS})
3434endif()
3535
36+# To find libUbuntuGestures.so
37+set_target_properties(UnityTestQml PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}")
38+
3639qt5_use_modules(UnityTestQml Core Quick Test)
3740
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)