aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmltc/CMakeLists.txt
diff options
context:
space:
mode:
authorAndrei Golubev <andrei.golubev@qt.io>2022-01-31 17:27:43 +0100
committerAndrei Golubev <andrei.golubev@qt.io>2022-02-02 21:54:29 +0100
commit6380f10185c0ec6b444cc9140480dc11f87bc67d (patch)
treef00315763ab02bdc3328f5ce713ea3ec81487cea /tests/auto/qml/qmltc/CMakeLists.txt
parent5ca8cf28f946093b5af69fe89575bc87d26b2fd9 (diff)
Restructure QML module of qmltc tests
Use a more canonical qmlcppcodegen-like structure, showcasing a better QML module As this change makes a single QML module instead of two QML modules (for the _diskcache and _nodiskcache scenarios), there are pros and cons Pros: + Prepares us for proper introduction of QQmlJSResourceFileMapper + Theorically allows tests to avoid (additional) weird imports Cons: - Denies the ability to test generated types under default QT_NAMESPACE (in addition to user-provided namespace). This is fine as we don't need this feature until we are able to compile QQC2 and modules alike Task-number: QTBUG-99198 Task-number: QTBUG-100103 Pick-to: 6.3 Change-Id: I13a594a1859719bc0af3370029e6be7b1744656b Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qmltc/CMakeLists.txt')
-rw-r--r--tests/auto/qml/qmltc/CMakeLists.txt143
1 files changed, 15 insertions, 128 deletions
diff --git a/tests/auto/qml/qmltc/CMakeLists.txt b/tests/auto/qml/qmltc/CMakeLists.txt
index 258a330fad..4f468c41e9 100644
--- a/tests/auto/qml/qmltc/CMakeLists.txt
+++ b/tests/auto/qml/qmltc/CMakeLists.txt
@@ -1,148 +1,35 @@
-set(cpp_sources
- tst_qmltc.h tst_qmltc.cpp
+add_subdirectory(data)
- # test files:
+set(test_sources
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
+ tst_qmltc.h tst_qmltc.cpp
)
-set(common_libraries
- Qt::Core
- Qt::QmlPrivate
- Qt::QuickPrivate
- Qt::TestPrivate
- Qt::Gui # QColor, QMatrix4x4, ...
+set(qmltc_module_libs
+ qmltc_test_module
+ # We need to link against a <module>plugin here for the following:
+ # - Properly see `import QmltcTests` (that could be resolved differently
+ # but this works as well)
+ # - Properly see C++ types exposed to QML in the engine (we need C++
+ # automatic type registration that comes from the plugin)
+ qmltc_test_moduleplugin
)
-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
+ SOURCES ${test_sources}
+ LIBRARIES ${qmltc_module_libs}
)
target_compile_definitions(tst_qmltc_diskcache PRIVATE
QMLTC_TESTS_DISABLE_CACHE=0
)
-qt_internal_target_compile_qml_to_cpp(tst_qmltc_diskcache
- NAMESPACE QmltcTest
- QML_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
+ SOURCES ${test_sources}
+ LIBRARIES ${qmltc_module_libs}
)
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
- QML_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