~ci-train-bot/ubuntu-settings-components/ubuntu-settings-components-ubuntu-zesty-2106

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
include(QmlTest)

# QML tests that require graphical capabilities.
add_custom_target(uitests)
add_custom_target(xvfbuitests)

add_custom_target(alltests)
add_dependencies(alltests uitests)

add_custom_target(xvfballtests)
add_dependencies(xvfballtests xvfbuitests)

add_subdirectory(utils)

set(USC_PLUGINPATH "${CMAKE_BINARY_DIR}/plugins" CACHE PATH "Path to pre-built u-s-c plugin dir.")

set(USC_IMPORT_PATHS
    ${CMAKE_BINARY_DIR}/tests/qmltests/mocks
    ${CMAKE_BINARY_DIR}/tests/utils/modules
    ${USC_PLUGINPATH}
)

macro(usc_parse_arguments)
    cmake_parse_arguments(USCTEST
        "${QMLTEST_OPTIONS}"
        "${QMLTEST_SINGLE}"
        "${QMLTEST_MULTI}"
        ${ARGN}
    )

    set(environment
        UNITY_TESTING=1
        LANGUAGE=C
        LC_ALL=C.UTF-8
    )
endmacro()

# add a graphical qml test
# see QmlTest.cmake for additional options
function(add_usc_qmltest PATH COMPONENT_NAME)
    usc_parse_arguments(${ARGN})
    add_qml_test(${PATH} ${COMPONENT_NAME}
        DEPENDS UbuntuTest
        IMPORT_PATHS ${USC_IMPORT_PATHS}
        TARGETS uitests
        ${ARGN}
        ENVIRONMENT ${environment}
                    ${USCTEST_ENVIRONMENT}
    )
endfunction()

add_subdirectory(imports)
add_subdirectory(qmltests)