on xenial help sign in
More fixes
581f8c9Michael Terry
cmake/modules/QmlTest.cmake+77−28
@@ -55,6 +55,45 @@ 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+ set(filename "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/${COMPONENT_NAME}")
67+
68+ if (IS_DIRECTORY "${filename}")
69+ # As a convenience, allow specifying a directory and we will install
70+ # all files in the dir. We do it this way rather than passing
71+ # DIRECTORY to install() because we want to process any qml files.
72+ file(GLOB subfiles RELATIVE "${filename}" "${filename}/*")
73+ foreach(subfile ${subfiles})
74+ add_qml_test_data("${PATH}/${COMPONENT_NAME}" "${subfile}")
75+ endforeach()
76+ return()
77+ endif()
78+
79+ if (NOT EXISTS "${filename}")
80+ set(filename "${filename}.qml")
81+ set(COMPONENT_NAME "${COMPONENT_NAME}.qml")
82+ endif()
83+
84+ if ("${filename}" MATCHES "\\.qml$")
85+ file(READ "${filename}" contents)
86+ string(REGEX REPLACE "(\"[./]*/)qml/" "\\1" contents "${contents}")
87+ set(filename "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/${COMPONENT_NAME}")
88+ file(WRITE "${filename}" "${contents}")
89+ endif()
90+
91+ install(FILES "${filename}"
92+ DESTINATION "${SHELL_APP_DIR}/tests/qmltests/${PATH}"
93+ )
94+endfunction()
95+
96+
58# add_qml_unittest(path component_name
97# add_qml_unittest(path component_name
59# [...]
98# [...]
60# )
99# )
@@ -72,7 +111,9 @@ function(add_qml_unittest PATH COMPONENT_NAME)
72 ARGS -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
111 ARGS -input ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
73 )
112 )
74
113
75− install_qmltest("${PATH}" "${COMPONENT_NAME}")
114+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml")
115+ add_qml_test_data("${PATH}" "tst_${COMPONENT_NAME}.qml")
116+ endif()
76endfunction()
117endfunction()
77
118
78
119
@@ -94,7 +135,9 @@ function(add_manual_qml_test PATH COMPONENT_NAME)
94 ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
135 ARGS ${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml ${QMLTEST_ARGS}
95 )
136 )
96
137
97− install_qmltest("${PATH}" "${COMPONENT_NAME}")
138+ if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml")
139+ add_qml_test_data("${PATH}" "tst_${COMPONENT_NAME}.qml")
140+ endif()
98endfunction()
141endfunction()
99
142
100
143
@@ -213,19 +256,6 @@ endfunction()
213
256
214################### INTERNAL ####################
257################### INTERNAL ####################
215
258
216−function(install_qmltest PATH COMPONENT_NAME)
217− set(filename "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml")
218− set(out_filename "${CMAKE_CURRENT_BINARY_DIR}/${PATH}/tst_${COMPONENT_NAME}.qml")
219− if (EXISTS "${filename}")
220− file(READ "${filename}" contents)
221− string(REGEX REPLACE "(import \"[./]*)/qml" "\\1" contents "${contents}")
222− file(WRITE "${out_filename}" "${contents}")
223− install(FILES "${out_filename}"
224− DESTINATION "${SHELL_APP_DIR}/tests/qmltests/${PATH}"
225− )
226− endif()
227−endfunction()
228−
229function(add_test_target TARGET_NAME)
259function(add_test_target TARGET_NAME)
230 cmake_parse_arguments(TEST "" "" "COMMAND;ENVIRONMENT;DEPENDS" ${ARGN})
260 cmake_parse_arguments(TEST "" "" "COMMAND;ENVIRONMENT;DEPENDS" ${ARGN})
231
261
@@ -241,7 +271,8 @@ function(add_test_target TARGET_NAME)
241 foreach(ONE_ENV ${TEST_ENVIRONMENT})
271 foreach(ONE_ENV ${TEST_ENVIRONMENT})
242 set(script "${script}export ${ONE_ENV}\n")
272 set(script "${script}export ${ONE_ENV}\n")
243 endforeach()
273 endforeach()
244− set(script "${script}export UNITY_TESTING_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}/\"\n")
274+ set(script "${script}export UNITY_TESTING_DATADIR=\"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}\"\n")
275+ set(script "${script}export UNITY_TESTING_LIBDIR=\"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}\"\n")
245 set(script "${script}\n")
276 set(script "${script}\n")
246 foreach(ONE_CMD ${TEST_COMMAND})
277 foreach(ONE_CMD ${TEST_COMMAND})
247 if (NOT ONE_CMD MATCHES "\\$\\(")
278 if (NOT ONE_CMD MATCHES "\\$\\(")
@@ -251,26 +282,44 @@ function(add_test_target TARGET_NAME)
251 endforeach()
282 endforeach()
252 set(script "${script}$@")
283 set(script "${script}$@")
253
284
254− # Now some replacements...
285+ set(filename "${CMAKE_BINARY_DIR}/tests/scripts/${TARGET_NAME}.sh")
255− # replace build/source roots with their install paths
256− string(REPLACE "${CMAKE_BINARY_DIR}/tests/mocks" "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/qml/mocks" script "${script}")
257− string(REPLACE "${CMAKE_BINARY_DIR}/tests/uqmlscene" "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}" script "${script}")
258− string(REPLACE "${CMAKE_BINARY_DIR}/tests/utils/modules" "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/qml/utils" script "${script}")
259− string(REPLACE "${CMAKE_BINARY_DIR}/plugins" "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/qml" script "${script}")
260− string(REPLACE "${CMAKE_SOURCE_DIR}/tests/qmltests" "${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}/tests/qmltests" script "${script}")
261− # tests like to write xml output to our builddir; we don't need that
262− string(REGEX REPLACE "( '--parameter')? '-o'( '--parameter')? '[^ ]*,xunitxml' " " " script "${script}")
263
286
287+ # Generate script to file then read it back to resolve any generator
288+ # expressions before we try to replace paths.
264 file(GENERATE
289 file(GENERATE
265− OUTPUT "${CMAKE_BINARY_DIR}/tests/scripts/${TARGET_NAME}.sh"
290+ OUTPUT "${filename}"
266 CONTENT "${script}"
291 CONTENT "${script}"
267 )
292 )
268
293
269− install(FILES "${CMAKE_BINARY_DIR}/tests/scripts/${TARGET_NAME}.sh"
294+ # Do replacement at install time to save needless work and to make sure
295+ # we are modifying file after generate step above (which doesn't happen
296+ # immediately). We can't use a custom-defined function or macro here...
297+ # So instead we use a giant ugly code block.
298+
299+ # START OF CODE BLOCK --------------------------------------------------
300+ install(CODE "
301+ file(READ \"${filename}\" replacestr)
302+
303+ # Now some replacements...
304+ # replace build/source roots with their install paths
305+ string(REPLACE \"${CMAKE_BINARY_DIR}/plugins\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}\" replacestr \"\${replacestr}\")
306+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/mocks\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks\" replacestr \"\${replacestr}\")
307+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/plugins\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/tests/plugins\" replacestr \"\${replacestr}\")
308+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/uqmlscene\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}\" replacestr \"\${replacestr}\")
309+ string(REPLACE \"${CMAKE_BINARY_DIR}/tests/utils/modules\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/utils\" replacestr \"\${replacestr}\")
310+ string(REPLACE \"${CMAKE_SOURCE_DIR}/tests/qmltests\" \"${CMAKE_INSTALL_PREFIX}/${SHELL_APP_DIR}/tests/qmltests\" replacestr \"\${replacestr}\")
311+ # tests like to write xml output to our builddir; we don't need that
312+ string(REGEX REPLACE \"( '--parameter')? '-o'( '--parameter')? '[^ ]*,xunitxml' \" \" \" replacestr \"\${replacestr}\")
313+
314+ file(WRITE \"${filename}\" \"\${replacestr}\")
315+ ")
316+ # END OF CODE BLOCK --------------------------------------------------
317+
318+ install(FILES "${filename}"
270 PERMISSIONS OWNER_EXECUTE OWNER_READ
319 PERMISSIONS OWNER_EXECUTE OWNER_READ
271 GROUP_EXECUTE GROUP_READ
320 GROUP_EXECUTE GROUP_READ
272 WORLD_EXECUTE WORLD_READ
321 WORLD_EXECUTE WORLD_READ
273− DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests"
322+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/scripts"
274 )
323 )
275endfunction()
324endfunction()
276
325
include/paths.h.in+22
@@ -51,6 +51,28 @@ inline QString translationDirectory() {
51 }
51 }
52}
52}
53
53
54+inline QString testDataDir() {
55+ // Can't use isRunningInstalled, since tests don't use the normal unity8
56+ // executable. $UNITY_TESTING_DATADIR is set by installed tests.
57+ QString datadir(qgetenv("UNITY_TESTING_DATADIR"));
58+ if (datadir.isEmpty()) {
59+ return sourceDirectory() + "/tests";
60+ } else {
61+ return datadir + "/tests";
62+ }
63+}
64+
65+inline QString testLibDir() {
66+ // Can't use isRunningInstalled, since tests don't use the normal unity8
67+ // executable. $UNITY_TESTING_DATADIR is set by installed tests.
68+ QString libdir(qgetenv("UNITY_TESTING_LIBDIR"));
69+ if (libdir.isEmpty()) {
70+ return buildDirectory() + "/tests";
71+ } else {
72+ return libdir + "/tests";
73+ }
74+}
75+
54inline QString qmlDirectory() {
76inline QString qmlDirectory() {
55 if (isRunningInstalled()) {
77 if (isRunningInstalled()) {
56 return QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
78 return QStringLiteral("@CMAKE_INSTALL_PREFIX@/@SHELL_APP_DIR@/");
plugins/Ubuntu/Gestures/CMakeLists.txt+1−1
@@ -16,7 +16,7 @@ set(UbuntuGesturesQml_SOURCES
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)
20target_link_libraries(UbuntuGesturesQml UbuntuGestures)
21
21
22qt5_use_modules(UbuntuGesturesQml Core Quick)
22qt5_use_modules(UbuntuGesturesQml Core Quick)
tests/CMakeLists.txt+2−6
@@ -48,7 +48,6 @@ macro(unity8_parse_arguments)
48 list(APPEND ld_paths
48 list(APPEND ld_paths
49 ${UNITY_MOCKPATH}/libusermetrics
49 ${UNITY_MOCKPATH}/libusermetrics
50 ${UNITY_MOCKPATH}/IntegratedLightDM/liblightdm
50 ${UNITY_MOCKPATH}/IntegratedLightDM/liblightdm
51− ${UNITY_MOCKPATH}/QMenuModel
52 )
51 )
53 endif()
52 endif()
54
53
@@ -127,12 +126,9 @@ function(add_unity8_qmlbenchmark PATH COMPONENT_NAME ITERATIONS)
127 add_unity8_qmltest(${PATH} ${COMPONENT_NAME} ITERATIONS ${ITERATIONS} ${ARGN})
126 add_unity8_qmltest(${PATH} ${COMPONENT_NAME} ITERATIONS ${ITERATIONS} ${ARGN})
128endfunction()
127endfunction()
129
128
130−# add files needed for qml tests
129+# add files needed for qml tests, just here for better alignment with add_unity8_qmltest
131function(add_unity8_qmltest_data PATH COMPONENT_NAME)
130function(add_unity8_qmltest_data PATH COMPONENT_NAME)
132− set(filename "${CMAKE_CURRENT_SOURCE_DIR}/${PATH}/${COMPONENT_NAME}.qml")
131+ add_qml_test_data("${PATH}" "${COMPONENT_NAME}")
133− install(FILES "${filename}"
134− DESTINATION "${SHELL_APP_DIR}/tests/qmltests/${PATH}"
135− )
136endfunction()
132endfunction()
137
133
138
134
tests/mocks/Unity/Application/ApplicationInfo.cpp+1−5
@@ -120,11 +120,7 @@ void ApplicationInfo::setSession(Session* session)
120
120
121void ApplicationInfo::setIconId(const QString &iconId)
121void ApplicationInfo::setIconId(const QString &iconId)
122{
122{
123− QString datadir(qgetenv("UNITY_TESTING_DATADIR"));
124− if (datadir.isEmpty())
125− datadir = "../.."; // relative path for code checkout
126−
127− setIcon(QUrl(datadir + "/tests/graphics/applicationIcons/" + iconId + "@18.png"));
123+ setIcon(QUrl(testDataDir() + "/graphics/applicationIcons/" + iconId + "@18.png"));
128}
124}
129
125
130void ApplicationInfo::setScreenshotId(const QString &screenshotId)
126void ApplicationInfo::setScreenshotId(const QString &screenshotId)
tests/mocks/Unity/CMakeLists.txt+3
@@ -65,4 +65,7 @@ target_link_libraries(FakeUnityQml
65
65
66qt5_use_modules(FakeUnityQml Qml)
66qt5_use_modules(FakeUnityQml Qml)
67
67
68+add_unity8_mock(Unity 0.2 Unity TARGETS FakeUnityQml)
69+
70+# and one copy in a separate directory for autopilot
68add_unity8_mock(Unity 0.2 Unity PREFIX scopefakes TARGETS FakeUnityQml)
71add_unity8_mock(Unity 0.2 Unity PREFIX scopefakes TARGETS FakeUnityQml)
tests/mocks/Unity/Indicators/CMakeLists.txt+4
@@ -30,6 +30,10 @@ target_link_libraries(IndicatorsFakeQml
30 QMenuModelQml
30 QMenuModelQml
31)
31)
32
32
33+set_target_properties(IndicatorsFakeQml PROPERTIES
34+ INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_INSTALL_QML}/mocks/QMenuModel"
35+)
36+
33qt5_use_modules(IndicatorsFakeQml Core Qml Quick)
37qt5_use_modules(IndicatorsFakeQml Core Qml Quick)
34
38
35add_unity8_mock(Unity.Indicators 0.1 Unity/Indicators TARGETS IndicatorsFakeQml)
39add_unity8_mock(Unity.Indicators 0.1 Unity/Indicators TARGETS IndicatorsFakeQml)
tests/mocks/Unity/Launcher/MockLauncherItem.cpp+2−6
@@ -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(icon),
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),
@@ -63,11 +63,7 @@ QString MockLauncherItem::name() const
63
63
64QString MockLauncherItem::icon() const
64QString MockLauncherItem::icon() const
65{
65{
66− QString datadir(qgetenv("UNITY_TESTING_DATADIR"));
66+ return m_icon;
67− if (datadir.isEmpty())
68− datadir = "../.."; // relative path for code checkout
69−
70− return datadir + "/tests/graphics/applicationIcons/" + m_icon + ".png";
71}
67}
72
68
73bool MockLauncherItem::pinned() const
69bool MockLauncherItem::pinned() const
tests/mocks/Unity/fake_scope.cpp+2−2
@@ -258,11 +258,11 @@ QVariantMap Scope::customizations() const
258 m["foreground-color"] = "blue";
258 m["foreground-color"] = "blue";
259 m["page-header"] = h;
259 m["page-header"] = h;
260 } else if (m_id == "MockScope4") {
260 } else if (m_id == "MockScope4") {
261− h["navigation-background"] = QUrl(sourceDirectory() + "/tests/qmltests/Dash/artwork/background.png");
261+ h["navigation-background"] = QUrl(testDataDir() + "/qmltests/Dash/artwork/background.png");
262 m["page-header"] = h;
262 m["page-header"] = h;
263 } else if (m_id == "MockScope5") {
263 } else if (m_id == "MockScope5") {
264 h["background"] = "gradient:///lightgrey/grey";
264 h["background"] = "gradient:///lightgrey/grey";
265− h["logo"] = QUrl(sourceDirectory() + "/tests/qmltests/Dash/tst_PageHeader/logo-ubuntu-orange.svg");
265+ h["logo"] = QUrl(testDataDir() + "/qmltests/Dash/tst_PageHeader/logo-ubuntu-orange.svg");
266 h["divider-color"] = "red";
266 h["divider-color"] = "red";
267 h["navigation-background"] = "color:///black";
267 h["navigation-background"] = "color:///black";
268 m["page-header"] = h;
268 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+12
@@ -30,6 +30,9 @@ macro(add_lvwph_test FILENAME TESTNAME)
30 ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/Dash/listviewwithpageheader.cpp)
30 ${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/Dash/listviewwithpageheader.cpp)
31 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
31 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
32 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
32 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
33+ install(TARGETS ${TESTNAME}TestExec
34+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
35+ )
33
36
34 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
37 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
35endmacro()
38endmacro()
@@ -46,6 +49,9 @@ macro(add_dashview_try_test FILENAME TESTNAME)
46 )
49 )
47 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
50 qt5_use_modules(${TESTNAME}TestExec Test Core Qml)
48 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
51 target_link_libraries(${TESTNAME}TestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
52+ install(TARGETS ${TESTNAME}TestExec
53+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
54+ )
49
55
50 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
56 add_unity8_uitest(${TESTNAME} ${TESTNAME}TestExec DEPENDS Dash-qml)
51
57
@@ -56,6 +62,9 @@ macro(add_dashview_try_test FILENAME TESTNAME)
56 )
62 )
57 qt5_use_modules(${TESTNAME}TryExec Test Core Qml)
63 qt5_use_modules(${TESTNAME}TryExec Test Core Qml)
58 target_link_libraries(${TESTNAME}TryExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
64 target_link_libraries(${TESTNAME}TryExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
65+ install(TARGETS ${TESTNAME}TryExec
66+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
67+ )
59 add_manual_test(${TESTNAME} ${TESTNAME}TryExec DEPENDS Dash-qml)
68 add_manual_test(${TESTNAME} ${TESTNAME}TryExec DEPENDS Dash-qml)
60endmacro()
69endmacro()
61
70
@@ -67,6 +76,9 @@ add_dashview_try_test(organicgrid OrganicGrid)
67add_executable(CardCreatorTestExec cardcreatortest.cpp)
76add_executable(CardCreatorTestExec cardcreatortest.cpp)
68qt5_use_modules(CardCreatorTestExec Test Core Qml)
77qt5_use_modules(CardCreatorTestExec Test Core Qml)
69target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
78target_link_libraries(CardCreatorTestExec ${Qt5Gui_LIBRARIES} ${Qt5Quick_LIBRARIES})
79+install(TARGETS CardCreatorTestExec
80+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Dash"
81+)
70add_unity8_uitest(CardCreator CardCreatorTestExec DEPENDS Dash-qml)
82add_unity8_uitest(CardCreator CardCreatorTestExec DEPENDS Dash-qml)
71
83
72# plain qml test
84# plain qml test
tests/plugins/GlobalShortcut/CMakeLists.txt+10−1
@@ -11,4 +11,13 @@ add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
11add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
11add_executable(GlobalShortcutTestExec GlobalShortcutTest.cpp ${CMAKE_SOURCE_DIR}/plugins/GlobalShortcut/globalshortcut.cpp)
12qt5_use_modules(GlobalShortcutTestExec Test Quick)
12qt5_use_modules(GlobalShortcutTestExec Test Quick)
13target_link_libraries(GlobalShortcutTestExec ${Qt5Quick_LIBRARIES} GlobalShortcut-qml)
13target_link_libraries(GlobalShortcutTestExec ${Qt5Quick_LIBRARIES} GlobalShortcut-qml)
14+install(TARGETS GlobalShortcutTestExec
15+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/GlobalShortcut"
16+)
17+install(FILES shortcut.qml
18+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/GlobalShortcut"
19+)
14−add_unity8_uitest(GlobalShortcut GlobalShortcutTestExec DEPENDS GlobalShortcut-qml)
20+add_unity8_uitest(GlobalShortcut GlobalShortcutTestExec
21+ DEPENDS GlobalShortcut-qml
22+ ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/GlobalShortcut
23+)
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(-DTESTDIR="plugins/Greeter/Unity/Launcher")
13add_definitions(-DLAUNCHER_TESTING)
13add_definitions(-DLAUNCHER_TESTING)
14
14
15### LauncherModelASTest
15### LauncherModelASTest
@@ -31,7 +31,10 @@ target_link_libraries(launchermodelastestExec
31 ${GSETTINGS_QT_LDFLAGS}
31 ${GSETTINGS_QT_LDFLAGS}
32 )
32 )
33add_dependencies(launchermodelastestExec mock-server)
33add_dependencies(launchermodelastestExec mock-server)
34−qt5_use_modules(launchermodelastestExec Test Core DBus Gui)
34+qt5_use_modules(launchermodelastestExec Test Core DBus Gui Qml)
35+install(TARGETS launchermodelastestExec
36+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Greeter/Unity/Launcher"
37+)
35add_unity8_unittest(LauncherModelAS dbus-test-runner
38add_unity8_unittest(LauncherModelAS dbus-test-runner
36 ARG_PREFIX "--parameter"
39 ARG_PREFIX "--parameter"
37 ARGS
40 ARGS
@@ -40,21 +43,3 @@ add_unity8_unittest(LauncherModelAS dbus-test-runner
40 --task $<TARGET_FILE:launchermodelastestExec>
43 --task $<TARGET_FILE:launchermodelastestExec>
41 --wait-for org.freedesktop.Accounts
44 --wait-for org.freedesktop.Accounts
42)
45)
43−
44−# copy .desktop files into build directory for shadow builds
45−file(GLOB DESKTOP_FILES *.desktop)
46−
47−foreach(DESKTOP_FILE ${DESKTOP_FILES})
48− file(COPY "${DESKTOP_FILE}"
49− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
50− )
51−endforeach()
52−
53−# copy .svg files into build directory for shadow builds
54−file(GLOB DESKTOP_FILES *.svg)
55−
56−foreach(DESKTOP_FILE ${DESKTOP_FILES})
57− file(COPY "${DESKTOP_FILE}"
58− DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
59− )
60−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(testLibDir() + "/" + TESTDIR);
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/IntegratedLightDM/CMakeLists.txt+19−17
@@ -1,6 +1,3 @@
1−add_definitions(
2− -DCURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}"
3− )
4include_directories(
1include_directories(
5 ${CMAKE_CURRENT_BINARY_DIR}
2 ${CMAKE_CURRENT_BINARY_DIR}
6 )
3 )
@@ -9,18 +6,19 @@ add_executable(GreeterDBusTestExec
9 dbus.cpp
6 dbus.cpp
10 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
7 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/Greeter.cpp
11 )
8 )
12−# This add_dependencies is needed since we're linking with with -L and -l below
13−# make seems to work but ninja breaks without it
14−add_dependencies(GreeterDBusTestExec MockLightDM)
15qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
9qt5_use_modules(GreeterDBusTestExec Core DBus Quick Test)
16−target_link_libraries(GreeterDBusTestExec
10+target_link_libraries(GreeterDBusTestExec MockLightDM)
17− -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
18− -llightdm-qt5-2
19− )
20target_include_directories(GreeterDBusTestExec PUBLIC
11target_include_directories(GreeterDBusTestExec PUBLIC
21 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
12 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
22 ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
13 ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
23 )
14 )
15+set_target_properties(GreeterDBusTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/qml/mocks/IntegratedLightDM/liblightdm")
16+install(TARGETS GreeterDBusTestExec
17+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/IntegratedLightDM"
18+)
19+install(FILES greeter.qml
20+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/IntegratedLightDM"
21+)
24add_unity8_uitest(GreeterDBus dbus-test-runner
22add_unity8_uitest(GreeterDBus dbus-test-runner
25 ARG_PREFIX "--parameter"
23 ARG_PREFIX "--parameter"
26 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
24 ARGS --task $<TARGET_FILE:GreeterDBusTestExec>
@@ -40,6 +38,9 @@ target_link_libraries(GreeterPamTestExec
40target_include_directories(GreeterPamTestExec PUBLIC
38target_include_directories(GreeterPamTestExec PUBLIC
41 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
39 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
42 )
40 )
41+install(TARGETS GreeterPamTestExec
42+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/IntegratedLightDM"
43+)
43add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
44add_qmltest_target(testGreeterPam GreeterPamTestExec COMMAND $<TARGET_FILE:GreeterPamTestExec>)
44
45
45add_executable(GreeterUsersModelTestExec
46add_executable(GreeterUsersModelTestExec
@@ -47,19 +48,17 @@ add_executable(GreeterUsersModelTestExec
47 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
48 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/UsersModel.cpp
48 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
49 ${CMAKE_SOURCE_DIR}/plugins/Utils/unitysortfilterproxymodelqml.cpp
49 )
50 )
50−# This add_dependencies is needed since we're linking with with -L and -l below
51−# make seems to work but ninja breaks without it
52−add_dependencies(GreeterUsersModelTestExec MockLightDM)
53qt5_use_modules(GreeterUsersModelTestExec Core Test)
51qt5_use_modules(GreeterUsersModelTestExec Core Test)
54−target_link_libraries(GreeterUsersModelTestExec
52+target_link_libraries(GreeterUsersModelTestExec MockLightDM)
55− -L${CMAKE_BINARY_DIR}/tests/mocks/IntegratedLightDM/liblightdm
56− -llightdm-qt5-2
57− )
58target_include_directories(GreeterUsersModelTestExec PUBLIC
53target_include_directories(GreeterUsersModelTestExec PUBLIC
59 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
54 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM
60 ${CMAKE_SOURCE_DIR}/plugins/Utils
55 ${CMAKE_SOURCE_DIR}/plugins/Utils
61 ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
56 ${CMAKE_SOURCE_DIR}/tests/mocks/IntegratedLightDM
62 )
57 )
58+set_target_properties(GreeterUsersModelTestExec PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SHELL_PRIVATE_LIBDIR}/qml/mocks/IntegratedLightDM/liblightdm")
59+install(TARGETS GreeterUsersModelTestExec
60+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/IntegratedLightDM"
61+)
63add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
62add_unity8_uitest(GreeterUsers GreeterUsersModelTestExec
64 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
63 ENVIRONMENT LIBLIGHTDM_MOCK_MODE=full
65 DEPENDS MockLightDM
64 DEPENDS MockLightDM
@@ -78,6 +77,9 @@ target_include_directories(GreeterIntegratedTestExec PUBLIC
78 ${GLIB_INCLUDE_DIRS}
77 ${GLIB_INCLUDE_DIRS}
79 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
78 ${CMAKE_SOURCE_DIR}/plugins/IntegratedLightDM/liblightdm
80 )
79 )
80+install(TARGETS GreeterIntegratedTestExec
81+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/IntegratedLightDM"
82+)
81add_unity8_unittest(GreeterIntegrated dbus-test-runner
83add_unity8_unittest(GreeterIntegrated dbus-test-runner
82 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
84 ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/plugins/IntegratedLightDM/liblightdm/
83 ARG_PREFIX "--parameter"
85 ARG_PREFIX "--parameter"
tests/plugins/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(testLibDir() + "/plugins/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/ScreenGrabber/CMakeLists.txt+6
@@ -11,4 +11,10 @@ add_definitions(-DBUILT_PLUGINS_DIR="${CMAKE_BINARY_DIR}/plugins")
11add_executable(ScreenGrabberTestExec ScreenGrabberTest.cpp ${CMAKE_SOURCE_DIR}/plugins/ScreenGrabber/screengrabber.cpp)
11add_executable(ScreenGrabberTestExec ScreenGrabberTest.cpp ${CMAKE_SOURCE_DIR}/plugins/ScreenGrabber/screengrabber.cpp)
12qt5_use_modules(ScreenGrabberTestExec Test Quick Concurrent)
12qt5_use_modules(ScreenGrabberTestExec Test Quick Concurrent)
13target_link_libraries(ScreenGrabberTestExec ${Qt5Quick_LIBRARIES} ScreenGrabber-qml)
13target_link_libraries(ScreenGrabberTestExec ${Qt5Quick_LIBRARIES} ScreenGrabber-qml)
14+install(TARGETS ScreenGrabberTestExec
15+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/ScreenGrabber"
16+)
17+install(FILES grabber.qml
18+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/ScreenGrabber"
19+)
14add_unity8_uitest(ScreenGrabber ScreenGrabberTestExec DEPENDS ScreenGrabber-qml)
20add_unity8_uitest(ScreenGrabber ScreenGrabberTestExec DEPENDS ScreenGrabber-qml)
tests/plugins/Ubuntu/Gestures/CMakeLists.txt+8−1
@@ -12,12 +12,19 @@ include_directories(
12 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
12 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
13 )
13 )
14
14
15−export_qmlfiles(UbuntuGesturesTest .)
15+export_qmlfiles(UbuntuGesturesTest .
16+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Ubuntu/Gestures"
17+)
16
18
17macro(build_gesture_test CLASSNAME)
19macro(build_gesture_test CLASSNAME)
18 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
20 add_executable(${CLASSNAME}TestExec tst_${CLASSNAME}.cpp GestureTest.cpp TestItem.cpp)
19 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
21 qt5_use_modules(${CLASSNAME}TestExec Test Core Qml Gui Quick)
20 target_link_libraries(${CLASSNAME}TestExec UbuntuGesturesQml UbuntuGestures)
22 target_link_libraries(${CLASSNAME}TestExec UbuntuGesturesQml UbuntuGestures)
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}")
21endmacro()
28endmacro()
22
29
23set(UNITY_IMPORT_PATHS
30set(UNITY_IMPORT_PATHS
tests/plugins/Ubuntu/Gestures/GestureTest.cpp+2−1
@@ -24,6 +24,7 @@
24
24
25#include <Timer.h>
25#include <Timer.h>
26#include <TouchRegistry.h>
26#include <TouchRegistry.h>
27+#include <paths.h>
27
28
28using namespace UbuntuGestures;
29using namespace UbuntuGestures;
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(testLibDir() + "/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/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/Launcher/CMakeLists.txt+11−2
@@ -11,7 +11,7 @@ include_directories(
11 )
11 )
12
12
13add_definitions(-DSM_BUSNAME=sessionBus)
13add_definitions(-DSM_BUSNAME=sessionBus)
14−add_definitions(-DSRCDIR="${CMAKE_CURRENT_SOURCE_DIR}")
14+add_definitions(-DTESTDIR="plugins/Unity/Launcher")
15add_definitions(-DLAUNCHER_TESTING)
15add_definitions(-DLAUNCHER_TESTING)
16
16
17### LauncherModelTest
17### LauncherModelTest
@@ -37,7 +37,10 @@ target_link_libraries(launchermodeltestExec
37 ${GSETTINGS_QT_LDFLAGS}
37 ${GSETTINGS_QT_LDFLAGS}
38 )
38 )
39add_dependencies(launchermodeltestExec mock-server)
39add_dependencies(launchermodeltestExec mock-server)
40−qt5_use_modules(launchermodeltestExec Test Core DBus Xml Gui)
40+qt5_use_modules(launchermodeltestExec Test Core DBus Xml Gui Qml)
41+install(TARGETS launchermodeltestExec
42+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Launcher"
43+ )
41
44
42add_unity8_unittest(LauncherModel dbus-test-runner
45add_unity8_unittest(LauncherModel dbus-test-runner
43 ARG_PREFIX "--parameter"
46 ARG_PREFIX "--parameter"
@@ -56,6 +59,9 @@ foreach(DESKTOP_FILE ${DESKTOP_FILES})
56 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
59 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
57 )
60 )
58endforeach()
61endforeach()
62+install(FILES ${DESKTOP_FILES}
63+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Launcher"
64+ )
59
65
60# copy .svg files into build directory for shadow builds
66# copy .svg files into build directory for shadow builds
61file(GLOB DESKTOP_FILES *.svg)
67file(GLOB DESKTOP_FILES *.svg)
@@ -65,3 +71,6 @@ foreach(DESKTOP_FILE ${DESKTOP_FILES})
65 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
71 DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
66 )
72 )
67endforeach()
73endforeach()
74+install(FILES ${DESKTOP_FILES}
75+ DESTINATION "${SHELL_PRIVATE_LIBDIR}/tests/plugins/Unity/Launcher"
76+ )
tests/plugins/Unity/Launcher/launchermodeltest.cpp+5−4
@@ -34,6 +34,8 @@
34#include <QDBusMetaType>
34#include <QDBusMetaType>
35#include <QDomDocument>
35#include <QDomDocument>
36
36
37+#include <paths.h>
38+
37// This is a mock, specifically to test the LauncherModel
39// This is a mock, specifically to test the LauncherModel
38class MockApp: public unity::shell::application::ApplicationInfoInterface
40class MockApp: public unity::shell::application::ApplicationInfoInterface
39{
41{
@@ -163,6 +165,9 @@ private Q_SLOTS:
163
165
164 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
166 // Adding 2 apps to the mock appmanager. Both should appear in the launcher.
165 void init() {
167 void init() {
168+ // Launcher will look in current dir in testing mode for data
169+ QDir::setCurrent(testLibDir() + "/" + TESTDIR);
170+
166 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
171 QDBusInterface accountsInterface(QStringLiteral("org.freedesktop.Accounts"),
167 QStringLiteral("/org/freedesktop/Accounts"),
172 QStringLiteral("/org/freedesktop/Accounts"),
168 QStringLiteral("org.freedesktop.Accounts"));
173 QStringLiteral("org.freedesktop.Accounts"));
@@ -576,7 +581,6 @@ private Q_SLOTS:
576 appManager->removeApplication(0);
581 appManager->removeApplication(0);
577
582
578 // "delete" the .desktop files
583 // "delete" the .desktop files
579− QString oldCurrent = QDir::currentPath();
580 if (deleted) {
584 if (deleted) {
581 // In testing mode, the launcher searches the current dir for the sample .desktop file
585 // In testing mode, the launcher searches the current dir for the sample .desktop file
582 // We can make that fail by changing the current dir
586 // We can make that fail by changing the current dir
@@ -591,9 +595,6 @@ private Q_SLOTS:
591 QCOMPARE(reply.isValid(), true);
595 QCOMPARE(reply.isValid(), true);
592
596
593 QCOMPARE(launcherModel->rowCount(), deleted ? 0 : 2);
597 QCOMPARE(launcherModel->rowCount(), deleted ? 0 : 2);
594−
595− // Restoring current dir
596− QDir::setCurrent(oldCurrent);
597 }
598 }
598
599
599 void testSettings() {
600 void testSettings() {
tests/plugins/Utils/CMakeLists.txt+4−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()
tests/plugins/Utils/DeviceConfigParserTest.cpp+3−1
@@ -45,13 +45,15 @@ private Q_SLOTS:
45 }
45 }
46
46
47 void testCustomFile() {
47 void testCustomFile() {
48+ QTemporaryDir dir;
48− QSettings s("./devices.conf", QSettings::IniFormat);
49+ QSettings s(dir.path() + "/devices.conf", QSettings::IniFormat);
49 s.beginGroup("fakedevice");
50 s.beginGroup("fakedevice");
50
51
51 s.setValue("SupportedOrientations", QStringList() << "Portrait" << "Landscape" << "InvertedLandscape");
52 s.setValue("SupportedOrientations", QStringList() << "Portrait" << "Landscape" << "InvertedLandscape");
52 s.setValue("PrimaryOrientation", "InvertedLandscape");
53 s.setValue("PrimaryOrientation", "InvertedLandscape");
53 s.sync();
54 s.sync();
54
55
56+ qputenv("XDG_CONFIG_HOME", dir.path().toUtf8());
55 DeviceConfigParser p;
57 DeviceConfigParser p;
56 p.setName("fakedevice");
58 p.setName("fakedevice");
57
59
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+4−1
@@ -12,7 +12,7 @@ add_unity8_qmltest(Components Carousel)
12add_unity8_qmltest(Components Dialogs LIGHTDM)
12add_unity8_qmltest(Components Dialogs LIGHTDM)
13add_unity8_qmltest(Components DraggingArea)
13add_unity8_qmltest(Components DraggingArea)
14add_unity8_qmltest(Components LazyImage)
14add_unity8_qmltest(Components LazyImage)
15−add_unity8_qmltest_data(Components/tst_LazyImage ImageControls)
15+add_unity8_qmltest_data(Components tst_LazyImage)
16add_unity8_qmltest(Components Lockscreen)
16add_unity8_qmltest(Components Lockscreen)
17add_unity8_qmltest(Components ModeSwitchWarningDialog)
17add_unity8_qmltest(Components ModeSwitchWarningDialog)
18add_unity8_qmltest(Components PhysicalKeysMapper)
18add_unity8_qmltest(Components PhysicalKeysMapper)
@@ -33,6 +33,9 @@ add_unity8_qmltest(Dash CardTool)
33add_unity8_qmltest(Dash GenericScopeView)
33add_unity8_qmltest(Dash GenericScopeView)
34add_unity8_qmltest(Dash DashPageHeader)
34add_unity8_qmltest(Dash DashPageHeader)
35add_unity8_qmltest(Dash PreviewView)
35add_unity8_qmltest(Dash PreviewView)
36+add_unity8_qmltest_data(Dash artwork)
37+add_unity8_qmltest_data(Dash CardHelpers.js)
38+add_unity8_qmltest_data(Dash tst_PageHeader)
36add_unity8_qmltest(Dash/Previews Preview)
39add_unity8_qmltest(Dash/Previews Preview)
37add_unity8_qmltest(Dash/Previews PreviewActions)
40add_unity8_qmltest(Dash/Previews PreviewActions)
38add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
41add_unity8_qmltest(Dash/Previews PreviewAudioPlayback)
tests/qmltests/Dash/tst_GenericScopeView.qml+1−1
@@ -431,7 +431,7 @@ Item {
431 { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#ffffff", logo: "" },
431 { tag: "Default", index: 0, foreground: UbuntuColors.darkGrey, background: "color:///#ffffff", logo: "" },
432 { tag: "Foreground", index: 1, foreground: "yellow", background: "color:///#ffffff", logo: "" },
432 { tag: "Foreground", index: 1, foreground: "yellow", background: "color:///#ffffff", logo: "" },
433 { tag: "Logo+Background", index: 2, foreground: UbuntuColors.darkGrey, background: "gradient:///lightgrey/grey",
433 { tag: "Logo+Background", index: 2, foreground: UbuntuColors.darkGrey, background: "gradient:///lightgrey/grey",
434− logo: Qt.resolvedUrl("../Dash/tst_PageHeader/logo-ubuntu-orange.svg") },
434+ logo: Qt.resolvedUrl("tst_PageHeader/logo-ubuntu-orange.svg") },
435 ];
435 ];
436 }
436 }
437
437