aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltc/CMakeLists.txt
blob: 26cb145807589c2cc59aea54f53fe006be691297 (plain)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
set(cpp_sources
    tst_qmltc.h tst_qmltc.cpp

    # test files:
    nameconflict.h nameconflict.cpp
    # attached types:
    cpptypes/testattachedtype.h cpptypes/testattachedtype.cpp
    # grouped types:
    cpptypes/testgroupedtype.h cpptypes/testgroupedtype.cpp
    # private properties:
    cpptypes/testprivateproperty.h cpptypes/testprivateproperty.cpp
    cpptypes/private/testprivateproperty_p.h

    cpptypes/typewithproperties.h cpptypes/typewithproperties.cpp
)

set(qml_sources
    data/HelloWorld.qml
    data/NameConflict.qml
    data/simpleQtQuickTypes.qml
    data/typeWithEnums.qml
    data/methods.qml
    data/properties.qml
    data/ObjectWithId.qml
    data/documentWithIds.qml
    data/importNamespace.qml
    data/ComponentType.qml
    data/componentTypes.qml

    data/signalHandlers.qml
    data/javaScriptFunctions.qml
    data/changingBindings.qml
    data/propertyAlias.qml
    data/propertyAlias_external.qml
    data/propertyChangeHandler.qml
    data/NestedHelloWorld.qml
    data/ComponentHelloWorld.qml
    data/listProperty.qml
    data/listPropertySameName.qml
    data/defaultProperty.qml
    data/defaultPropertyCorrectSelection.qml
    # data/defaultAlias.qml
    data/propertyReturningFunction.qml
    data/attachedProperty.qml
    data/groupedProperty.qml
    data/groupedProperty_qquicktext.qml
    data/localImport.qml
    data/localImport_explicit.qml
    data/newPropertyBoundToOld.qml
    data/oldPropertyBoundToNew.qml
    data/nonLocalQmlPropertyBoundToAny.qml
    data/localDerived.qml
    data/justAnimation.qml
    data/justAnimationOnAlias.qml
    data/behaviorAndAnimation.qml
    data/behaviorAndAnimationOnAlias.qml
    data/singletonUser.qml
    data/bindingsThroughIds.qml
    data/localImport_context.qml
    data/neighbors_context.qml
    data/delegate_context.qml
    data/nontrivial_context.qml
    data/javascriptCaller.qml
    data/listView.qml
    data/bindingOnValueType.qml
    data/keyEvents.qml
    data/complexAliases.qml
    data/PrivateProperty.qml
    data/privatePropertySubclass.qml
    data/calqlatrBits.qml
    data/propertyChangeAndSignalHandlers.qml

    # support types:
    data/DefaultPropertySingleChild.qml
    data/DefaultPropertyManyChildren.qml
    data/LocallyImported.qml
    data/LocalWithOnCompleted.qml
    data/LocallyImported_context.qml
    data/SingletonThing.qml
)

set(js_sources
    data/subfolder/code.js
)

set(common_libraries
    Qt::Core
    Qt::QmlPrivate
    Qt::QuickPrivate
    Qt::TestPrivate
    Qt::Gui # QColor, QMatrix4x4, ...
)

set_source_files_properties(data/NameConflict.qml PROPERTIES
    QT_QMLTC_FILE_BASENAME ResolvedNameConflict)

qt_internal_add_test(tst_qmltc_diskcache
    SOURCES
        ${cpp_sources}
    LIBRARIES
        ${common_libraries}
    INCLUDE_DIRECTORIES
        cpptypes/
)
qt6_add_qml_module(tst_qmltc_diskcache
    VERSION 1.0
    URI QmltcTests
    QML_FILES
        ${qml_sources}
        ${js_sources}
    OUTPUT_DIRECTORY diskcache/QmltcTests
)
target_compile_definitions(tst_qmltc_diskcache PRIVATE
    QMLTC_TESTS_DISABLE_CACHE=0
)
qt_internal_target_compile_qml_to_cpp(tst_qmltc_diskcache
    NAMESPACE QmltcTest
    FILES
        ${qml_sources}
)

qt_internal_add_test(tst_qmltc_nodiskcache
    SOURCES
        ${cpp_sources}
    LIBRARIES
        ${common_libraries}
    INCLUDE_DIRECTORIES
        cpptypes/
)
qt6_add_qml_module(tst_qmltc_nodiskcache
    VERSION 1.0
    URI QmltcTests
    QML_FILES
        ${qml_sources}
        ${js_sources}
    OUTPUT_DIRECTORY nodiskcache/QmltcTests
)
target_compile_definitions(tst_qmltc_nodiskcache PRIVATE
    QMLTC_TESTS_DISABLE_CACHE=1
)
qt_internal_target_compile_qml_to_cpp(tst_qmltc_nodiskcache
    # NAMESPACE QmltcTest # use QT_NAMESPACE instead
    FILES
        ${qml_sources}
)

# Add qmltc documentation example to the tests. This is not beautiful but allows
# to nicely test the documentation snippets automatically (and so making sure
# the code there is up-to-date)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/qml/doc/snippets/qmltc snippets)