Port type registrar test to cmake
Unfortunately, the type registrar simply does not work with manually moced files, and headers without any extension are not picked up by automoc. Task-number: QTBUG-84869 Task-number: QTBUG-84906 Change-Id: If1adbb9bfb3f793f3ee90f5b27cece233e354443 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
This commit is contained in:
parent
2a091e78d2
commit
5b0b326791
|
@ -97,5 +97,5 @@ if(QT_FEATURE_private_tests)
|
|||
add_subdirectory(qqmldelegatemodel) # special case
|
||||
endif()
|
||||
if(NOT CMAKE_CROSSCOMPILING)
|
||||
# add_subdirectory(qmltyperegistrar) # special case need to port
|
||||
add_subdirectory(qmltyperegistrar)
|
||||
endif()
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# Generated from qmltyperegistrar.pro.
|
||||
|
||||
#####################################################################
|
||||
## tst_qmltyperegistrar Test:
|
||||
#####################################################################
|
||||
|
||||
qt_manual_moc(moc_files OUTPUT_MOC_JSON_FILES json_list noextheader) # special case
|
||||
qt_add_test(tst_qmltyperegistrar
|
||||
SOURCES
|
||||
hppheader.hpp
|
||||
# noextheader special case
|
||||
tst_qmltyperegistrar.cpp tst_qmltyperegistrar.h
|
||||
INCLUDE_DIRECTORIES
|
||||
foreign
|
||||
PUBLIC_LIBRARIES
|
||||
# Remove: Lforeign
|
||||
Qt::Qml
|
||||
foreign
|
||||
)
|
||||
target_compile_definitions(tst_qmltyperegistrar PRIVATE BUILD_WITH_CMAKE) # special case
|
||||
|
||||
#### Keys ignored in scope 2:.:.:tst_qmltyperegistrar.pro:<TRUE>:
|
||||
# QMLTYPES_FILENAME = "tst_qmltyperegistrar.qmltypes"
|
||||
# QML_FOREIGN_METATYPES = "foreign/foreign_metatypes.json"
|
||||
# QML_IMPORT_NAME = "QmlTypeRegistrarTest"
|
||||
# QML_IMPORT_VERSION = "1.0"
|
||||
# TEMPLATE = "app"
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
||||
|
||||
set_target_properties(tst_qmltyperegistrar PROPERTIES
|
||||
QT_QML_MODULE_INSTALL_QMLTYPES TRUE
|
||||
QT_QML_MODULE_VERSION 1.0
|
||||
QT_QML_MODULE_URI QmlTypeRegistrarTest
|
||||
QT_QMLTYPES_FILENAME tst_qmltyperegistrar.qmltypes # special case
|
||||
)
|
||||
|
||||
qt6_qml_type_registration(tst_qmltyperegistrar ${json_list}) # special case
|
||||
add_subdirectory(foreign)
|
|
@ -0,0 +1,21 @@
|
|||
# Generated from foreign.pro.
|
||||
|
||||
#####################################################################
|
||||
## foreign Generic Library:
|
||||
#####################################################################
|
||||
|
||||
qt_add_cmake_library(foreign
|
||||
STATIC
|
||||
SOURCES
|
||||
foreign.cpp foreign.h
|
||||
PUBLIC_LIBRARIES
|
||||
Qt::Core
|
||||
)
|
||||
set_property(TARGET foreign PROPERTY AUTOMOC ON)
|
||||
qt6_generate_meta_types_json_file(foreign)
|
||||
|
||||
#### Keys ignored in scope 1:.:.:foreign.pro:<TRUE>:
|
||||
# TEMPLATE = "lib"
|
||||
|
||||
## Scopes:
|
||||
#####################################################################
|
|
@ -48,12 +48,18 @@ void tst_qmltyperegistrar::qmltypesHasForeign()
|
|||
void tst_qmltyperegistrar::qmltypesHasHppClassAndNoext()
|
||||
{
|
||||
QVERIFY(qmltypesData.contains("HppClass"));
|
||||
#ifdef BUILD_WITH_CMAKE
|
||||
QEXPECT_FAIL("", "Type registration does not work manually moced files", Continue);
|
||||
#endif
|
||||
QVERIFY(qmltypesData.contains("Noext"));
|
||||
}
|
||||
|
||||
void tst_qmltyperegistrar::qmltypesHasFileNames()
|
||||
{
|
||||
QVERIFY(qmltypesData.contains("file: \"hppheader.hpp\""));
|
||||
#ifdef BUILD_WITH_CMAKE
|
||||
QEXPECT_FAIL("", "Type registration does not work manually moced files", Continue);
|
||||
#endif
|
||||
QVERIFY(qmltypesData.contains("file: \"noextheader\""));
|
||||
QVERIFY(qmltypesData.contains("file: \"tst_qmltyperegistrar.h\""));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue