diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-09-17 14:12:29 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@qt.io> | 2019-09-26 19:39:39 +0000 |
commit | 5fe75751ed90354eb0968f528974592003c65460 (patch) | |
tree | 34289c653ea7f8c0d891aee0ca6a4be1427bc04d /tests | |
parent | b5daa31da99fbe872b4df047f37da17ae2c119c9 (diff) |
Port QtScxml to CMake
Change-Id: I227f18b6a9825b6974eab6ba9feaf62bd0934133
Reviewed-by: Qt CMake Build Bot
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.prev_CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/CMakeLists.txt | 10 | ||||
-rw-r--r-- | tests/auto/.prev_CMakeLists.txt | 9 | ||||
-rw-r--r-- | tests/auto/CMakeLists.txt | 11 | ||||
-rw-r--r-- | tests/auto/compiled/CMakeLists.txt | 46 | ||||
-rw-r--r-- | tests/auto/dynamicmetaobject/CMakeLists.txt | 31 | ||||
-rw-r--r-- | tests/auto/parser/CMakeLists.txt | 109 | ||||
-rw-r--r-- | tests/auto/scion/.prev_CMakeLists.txt | 50 | ||||
-rw-r--r-- | tests/auto/scion/CMakeLists.txt | 139 | ||||
-rw-r--r-- | tests/auto/statemachine/CMakeLists.txt | 40 | ||||
-rw-r--r-- | tests/auto/statemachineinfo/CMakeLists.txt | 32 |
11 files changed, 487 insertions, 0 deletions
diff --git a/tests/.prev_CMakeLists.txt b/tests/.prev_CMakeLists.txt new file mode 100644 index 0000000..f9ace95 --- /dev/null +++ b/tests/.prev_CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from tests.pro. + +if(NOT TARGET Qt::Test) + cmake_minimum_required(VERSION 3.15.0) + project(QtScxmlTests VERSION 6.0.0 LANGUAGES C CXX) + find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS BuildInternals Core SET_ME_TO_SOMETHING_USEFUL) + find_package(Qt6 ${PROJECT_VERSION} OPTIONAL_COMPONENTS SET_ME_TO_SOMETHING_USEFUL) + qt_set_up_standalone_tests_build() +endif() +qt_build_tests() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt new file mode 100644 index 0000000..b241c6e --- /dev/null +++ b/tests/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from tests.pro. + +if(NOT TARGET Qt::Test) + cmake_minimum_required(VERSION 3.15.0) + project(QtScxmlTests VERSION 6.0.0 LANGUAGES C CXX) + find_package(Qt6 ${PROJECT_VERSION} REQUIRED COMPONENTS BuildInternals Core Scxml Test) # special case + find_package(Qt6 ${PROJECT_VERSION} OPTIONAL_COMPONENTS Qml Gui) # special case + qt_set_up_standalone_tests_build() +endif() +qt_build_tests() diff --git a/tests/auto/.prev_CMakeLists.txt b/tests/auto/.prev_CMakeLists.txt new file mode 100644 index 0000000..dd9caab --- /dev/null +++ b/tests/auto/.prev_CMakeLists.txt @@ -0,0 +1,9 @@ +# Generated from auto.pro. + +add_subdirectory(cmake) +add_subdirectory(compiled) +add_subdirectory(dynamicmetaobject) +add_subdirectory(parser) +add_subdirectory(scion) +add_subdirectory(statemachine) +add_subdirectory(statemachineinfo) diff --git a/tests/auto/CMakeLists.txt b/tests/auto/CMakeLists.txt new file mode 100644 index 0000000..1666cfd --- /dev/null +++ b/tests/auto/CMakeLists.txt @@ -0,0 +1,11 @@ +# Generated from auto.pro. + +# special case begin +# add_subdirectory(cmake) +# special case end +add_subdirectory(compiled) +add_subdirectory(dynamicmetaobject) +add_subdirectory(parser) +add_subdirectory(scion) +add_subdirectory(statemachine) +add_subdirectory(statemachineinfo) diff --git a/tests/auto/compiled/CMakeLists.txt b/tests/auto/compiled/CMakeLists.txt new file mode 100644 index 0000000..6b61bab --- /dev/null +++ b/tests/auto/compiled/CMakeLists.txt @@ -0,0 +1,46 @@ +# Generated from compiled.pro. + +##################################################################### +## tst_compiled Test: +##################################################################### + +add_qt_test(tst_compiled + SOURCES + tst_compiled.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Scxml +) + +# Resources: +set(tst_compiled_resource_files + "submachineA.scxml" + "submachineB.scxml" + "topmachine.scxml" +) + +add_qt_resource(tst_compiled "tst_compiled" + PREFIX + "/" + FILES + ${tst_compiled_resource_files} +) + + +# Statecharts: +add_qt_statecharts(tst_compiled FILES + ids1.scxml + eventnames1.scxml + eventnames2.scxml + statemachineunicodename.scxml + anonymousstate.scxml + submachineunicodename.scxml + datainnulldatamodel.scxml + initialhistory.scxml + connection.scxml + topmachine.scxml +) + +#### Keys ignored in scope 1:.:.:compiled.pro:<TRUE>: +# TEMPLATE = "app" diff --git a/tests/auto/dynamicmetaobject/CMakeLists.txt b/tests/auto/dynamicmetaobject/CMakeLists.txt new file mode 100644 index 0000000..698bb5c --- /dev/null +++ b/tests/auto/dynamicmetaobject/CMakeLists.txt @@ -0,0 +1,31 @@ +# Generated from dynamicmetaobject.pro. + +##################################################################### +## tst_dynamicmetaobject Test: +##################################################################### + +add_qt_test(tst_dynamicmetaobject + SOURCES + tst_dynamicmetaobject.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Scxml +) + +# Resources: +set(tst_dynamicmetaobject_resource_files + "mediaplayer.scxml" + "test1.scxml" +) + +add_qt_resource(tst_dynamicmetaobject "tst_dynamicmetaobject" + PREFIX + "/tst_dynamicmetaobject" + FILES + ${tst_dynamicmetaobject_resource_files} +) + + +#### Keys ignored in scope 1:.:.:dynamicmetaobject.pro:<TRUE>: +# TEMPLATE = "app" diff --git a/tests/auto/parser/CMakeLists.txt b/tests/auto/parser/CMakeLists.txt new file mode 100644 index 0000000..fea776f --- /dev/null +++ b/tests/auto/parser/CMakeLists.txt @@ -0,0 +1,109 @@ +# Generated from parser.pro. + +##################################################################### +## tst_parser Test: +##################################################################### + +add_qt_test(tst_parser + SOURCES + tst_parser.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Scxml +) + +# Resources: +set(tst_parser_resource_files + "data/badInitial.scxml" + "data/badInitial.scxml.errors" + "data/commentInScript.scxml" + "data/commentInScript.scxml.errors" + "data/empty.scxml" + "data/empty.scxml.errors" + "data/eventnames.scxml" + "data/eventnames.scxml.errors" + "data/ids1.scxml" + "data/ids1.scxml.errors" + "data/ids2.scxml" + "data/ids2.scxml.errors" + "data/invalidContent.scxml" + "data/invalidContent.scxml.errors" + "data/invalidRoot1.scxml" + "data/invalidRoot1.scxml.errors" + "data/invalidRoot2.scxml" + "data/invalidRoot2.scxml.errors" + "data/invalidRoot3.scxml" + "data/invalidRoot3.scxml.errors" + "data/invalidRoot6.scxml" + "data/invalidRoot6.scxml.errors" + "data/invalidUnicode1.scxml" + "data/invalidUnicode1.scxml.errors" + "data/invalidXmlHeader1.scxml" + "data/invalidXmlHeader1.scxml.errors" + "data/invalidXmlHeader2.scxml" + "data/invalidXmlHeader2.scxml.errors" + "data/invalidstatemachinename.scxml" + "data/invalidstatemachinename.scxml.errors" + "data/misplacedinvoke.scxml" + "data/misplacedinvoke.scxml.errors" + "data/namespaces1.scxml" + "data/namespaces1.scxml.errors" + "data/nestedScxml.scxml" + "data/nestedScxml.scxml.errors" + "data/noContentInInvoke1.scxml" + "data/noContentInInvoke1.scxml.errors" + "data/noContentInInvoke2.scxml" + "data/noContentInInvoke2.scxml.errors" + "data/noContentInInvoke3.scxml" + "data/noContentInInvoke3.scxml.errors" + "data/noContentInInvoke4.scxml" + "data/noContentInInvoke4.scxml.errors" + "data/prematureEndOfDocument1.scxml" + "data/prematureEndOfDocument1.scxml.errors" + "data/prematureEndOfDocument2.scxml" + "data/prematureEndOfDocument2.scxml.errors" + "data/scxml1.scxml" + "data/scxml1.scxml.errors" + "data/scxml2.scxml" + "data/scxml2.scxml.errors" + "data/syntaxErrors1.scxml" + "data/syntaxErrors1.scxml.errors" + "data/syntaxErrors10.scxml" + "data/syntaxErrors10.scxml.errors" + "data/syntaxErrors11.scxml" + "data/syntaxErrors11.scxml.errors" + "data/syntaxErrors12.scxml" + "data/syntaxErrors12.scxml.errors" + "data/syntaxErrors13.scxml" + "data/syntaxErrors13.scxml.errors" + "data/syntaxErrors14.scxml" + "data/syntaxErrors14.scxml.errors" + "data/syntaxErrors15.scxml" + "data/syntaxErrors15.scxml.errors" + "data/syntaxErrors2.scxml" + "data/syntaxErrors2.scxml.errors" + "data/syntaxErrors3.scxml" + "data/syntaxErrors3.scxml.errors" + "data/syntaxErrors4.scxml" + "data/syntaxErrors4.scxml.errors" + "data/syntaxErrors5.scxml" + "data/syntaxErrors5.scxml.errors" + "data/syntaxErrors7.scxml" + "data/syntaxErrors7.scxml.errors" + "data/syntaxErrors9.scxml" + "data/syntaxErrors9.scxml.errors" + "data/test1.scxml" + "data/test1.scxml.errors" +) + +add_qt_resource(tst_parser "tst_parser" + PREFIX + "/tst_parser" + FILES + ${tst_parser_resource_files} +) + + +#### Keys ignored in scope 1:.:.:parser.pro:<TRUE>: +# TEMPLATE = "app" diff --git a/tests/auto/scion/.prev_CMakeLists.txt b/tests/auto/scion/.prev_CMakeLists.txt new file mode 100644 index 0000000..51bba64 --- /dev/null +++ b/tests/auto/scion/.prev_CMakeLists.txt @@ -0,0 +1,50 @@ +# Generated from scion.pro. + +##################################################################### +## tst_scion Test: +##################################################################### + +add_qt_test(tst_scion + SOURCES + tst_scion.cpp + DEFINES + QT_NO_CAST_FROM_ASCII + QT_NO_CAST_TO_ASCII + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Scxml +) +#### Ignored generated resource: ${CMAKE_CURRENT_BINARY_DIR}/scion.qrc +#### Keys ignored in scope 1:.:.:scion.pro:<TRUE>: +# ALLFILES = "$$SCXMLS_DIR/*.*," +# ALLSCXMLS = "$$SCXMLS_DIR/*.scxml," +# BLACKLISTED = "test216sub1.scxml" "test226sub1.txml" "test239sub1.scxml" "test242sub1.scxml" "test276sub1.scxml" "test530.txml.scxml" "test301.txml.scxml" "test441a.txml.scxml" "test441b.txml.scxml" "test557.txml.scxml" +# QMAKE_EXTRA_COMPILERS = "myscxml" "myscxml_hdr" +# SCXMLS_DIR = "$$absolute_path($$PWD/../../3rdparty/scion-tests/scxml-test-framework/test)" +# TEMPLATE = "app" +# contents = "'<!DOCTYPE" "RCC><RCC" "version=\"1.0\">'" "'<qresource>'" "$$qrc" "'</qresource></RCC>'" +# myscxml.commands = "$$QMAKE_QSCXMLC" "--header" "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.h" "--impl" "${QMAKE_FILE_OUT}" "--namespace" "${QMAKE_FUNC_nameTheNamespace}" "--classname" "${QMAKE_FUNC_nameTheClass}" "${QMAKE_FILE_IN}" +# myscxml.depends = "$$QMAKE_QSCXMLC_EXE" +# myscxml.input = "SCXMLS" +# myscxml.output = "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.cpp" +# myscxml.variable_out = "SOURCES" +# myscxml_hdr.commands = "$$escape_expand(\\n)" +# myscxml_hdr.depends = "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.cpp" +# myscxml_hdr.input = "SCXMLS" +# myscxml_hdr.output = "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.h" +# myscxml_hdr.variable_out = "SCXML_HEADERS" + +## Scopes: +##################################################################### + +#### Keys ignored in scope 2:.:.:scion.pro:defineReplace(nameTheNamespace): +# sn = "__relative_path___absolute_path___dirname_1_____OUT_PWD____SCXMLS_DIR_" + +#### Keys ignored in scope 3:.:.:scion.pro:defineReplace(nameTheClass): +# cn = "__basename_1_" + +extend_target(tst_scion CONDITION MSVC AND WIN32 + COMPILE_OPTIONS + /bigobj +) diff --git a/tests/auto/scion/CMakeLists.txt b/tests/auto/scion/CMakeLists.txt new file mode 100644 index 0000000..70f0c08 --- /dev/null +++ b/tests/auto/scion/CMakeLists.txt @@ -0,0 +1,139 @@ +# Generated from scion.pro. + +##################################################################### +## tst_scion Test: +##################################################################### + +add_qt_test(tst_scion + SOURCES + tst_scion.cpp + DEFINES + QT_NO_CAST_FROM_ASCII + QT_NO_CAST_TO_ASCII + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Scxml +) +#### Ignored generated resource: ${CMAKE_CURRENT_BINARY_DIR}/scion.qrc +#### Keys ignored in scope 1:.:.:scion.pro:<TRUE>: +# ALLFILES = "$$SCXMLS_DIR/*.*," +# ALLSCXMLS = "$$SCXMLS_DIR/*.scxml," +# BLACKLISTED = "test216sub1.scxml" "test226sub1.txml" "test239sub1.scxml" "test242sub1.scxml" "test276sub1.scxml" "test530.txml.scxml" "test301.txml.scxml" "test441a.txml.scxml" "test441b.txml.scxml" "test557.txml.scxml" +# QMAKE_EXTRA_COMPILERS = "myscxml" "myscxml_hdr" +# SCXMLS_DIR = "$$absolute_path($$PWD/../../3rdparty/scion-tests/scxml-test-framework/test)" +# TEMPLATE = "app" +# contents = "'<!DOCTYPE" "RCC><RCC" "version=\"1.0\">'" "'<qresource>'" "$$qrc" "'</qresource></RCC>'" +# myscxml.commands = "$$QMAKE_QSCXMLC" "--header" "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.h" "--impl" "${QMAKE_FILE_OUT}" "--namespace" "${QMAKE_FUNC_nameTheNamespace}" "--classname" "${QMAKE_FUNC_nameTheClass}" "${QMAKE_FILE_IN}" +# myscxml.depends = "$$QMAKE_QSCXMLC_EXE" +# myscxml.input = "SCXMLS" +# myscxml.output = "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.cpp" +# myscxml.variable_out = "SOURCES" +# myscxml_hdr.commands = "$$escape_expand(\\n)" +# myscxml_hdr.depends = "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.cpp" +# myscxml_hdr.input = "SCXMLS" +# myscxml_hdr.output = "scxml/${QMAKE_FUNC_nameTheNamespace}_${QMAKE_FILE_IN_BASE}.h" +# myscxml_hdr.variable_out = "SCXML_HEADERS" + +## Scopes: +##################################################################### + +#### Keys ignored in scope 2:.:.:scion.pro:defineReplace(nameTheNamespace): +# sn = "__relative_path___absolute_path___dirname_1_____OUT_PWD____SCXMLS_DIR_" + +#### Keys ignored in scope 3:.:.:scion.pro:defineReplace(nameTheClass): +# cn = "__basename_1_" + +extend_target(tst_scion CONDITION MSVC AND WIN32 + COMPILE_OPTIONS + /bigobj +) + +# special case begin + +# For a better explanation about the "blacklisted" tests, see tst_scion.cpp +# <invoke> +set(blacklisted + test216sub1.scxml + test226sub1.txml + test239sub1.scxml + test242sub1.scxml + test276sub1.scxml + test530.txml.scxml) + +# other +list(APPEND blacklisted + test301.txml.scxml + test441a.txml.scxml + test441b.txml.scxml + test557.txml.scxml) + +set(scxmls_dir ../../3rdparty/scion-tests/scxml-test-framework/test) +get_filename_component(scxmls_dir ${scxmls_dir} ABSOLUTE) +file(GLOB_RECURSE allscxmls ${scxmls_dir}/*.scxml) + +set(scxmls) +set(inc_list) +set(func_list) +set(test_bases) +foreach(f ${allscxmls}) + get_filename_component(cn ${f} NAME) + if(NOT cn IN_LIST blacklisted) + list(APPEND scxmls ${f}) + + string(REGEX REPLACE "\\.scxml$" "" cn ${cn}) + set(hn ${cn}) + string(REGEX REPLACE "\\.txml$" "" cn ${cn}) + get_filename_component(sn ${f} DIRECTORY) + file(RELATIVE_PATH sn ${scxmls_dir} ${sn}) + string(REGEX REPLACE "[^a-zA-Z_0-9]" "_" sn ${sn}) + + set(out_h scxml/${sn}_${hn}.h) + set(out_cpp scxml/${sn}_${hn}.cpp) + string(APPEND inc_list "#include \"${out_h}\"\n") + string(APPEND func_list " []()->QScxmlStateMachine*{return new ${sn}::${cn};},\n") + + file(RELATIVE_PATH tn ${scxmls_dir} ${f}) + string(REGEX REPLACE "\\.scxml$" "" tn ${tn}) + string(APPEND test_bases " \"${tn}\",\n") + + file(TO_NATIVE_PATH ${out_h} native_out_h) + file(TO_NATIVE_PATH ${out_cpp} native_out_cpp) + add_custom_command( + OUTPUT ${out_cpp} ${out_h} + ${QT_TOOL_PATH_SETUP_COMMAND} + COMMAND ${QT_CMAKE_EXPORT_NAMESPACE}::qscxmlc + ARGS --header ${native_out_h} --impl ${native_out_cpp} --namespace ${sn} --classname ${cn} ${f} + VERBATIM + ) + set_source_files_properties(${out_h} ${out_cpp} PROPERTIES SKIP_AUTOMOC TRUE) + target_sources(tst_scion PRIVATE ${out_h} ${out_cpp}) + endif() +endforeach() + +file(GLOB_RECURSE allfiles ${scxmls_dir}/*.*) +foreach(f ${allfiles}) + file(RELATIVE_PATH base ${scxmls_dir} ${f}) + set_source_files_properties(${f} + PROPERTIES + QT_SKIP_QUICKCOMPILER ON + QT_RESOURCE_ALIAS ${base} + ) +endforeach() + +add_qt_resource(tst_scion "scion" + PREFIX "/" + FILES ${allfiles} +) + +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scxml/compiled_tests.h + "${inc_list}\nstd::function<QScxmlStateMachine *()> creators[] = {\n${func_list}};") +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/scxml/scion.h + "const char *testBases[] = {\n${test_bases}};") +target_sources(tst_scion + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR}/scxml/compiled_tests.h + ${CMAKE_CURRENT_BINARY_DIR}/scxml/scion.h +) + +# special case end diff --git a/tests/auto/statemachine/CMakeLists.txt b/tests/auto/statemachine/CMakeLists.txt new file mode 100644 index 0000000..f0e90e3 --- /dev/null +++ b/tests/auto/statemachine/CMakeLists.txt @@ -0,0 +1,40 @@ +# Generated from statemachine.pro. + +##################################################################### +## tst_statemachine Test: +##################################################################### + +add_qt_test(tst_statemachine + SOURCES + tst_statemachine.cpp + LIBRARIES + Qt::ScxmlPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Scxml +) + +# Resources: +set(tst_statemachine_resource_files + "emptylog.scxml" + "eventoccurred.scxml" + "historystate.scxml" + "ids1.scxml" + "invoke.scxml" + "multipleinvokableservices.scxml" + "stateDotDoneEvent.scxml" + "statenames.scxml" + "statenamesnested.scxml" +) + +add_qt_resource(tst_statemachine "tst_statemachine" + PREFIX + "/tst_statemachine" + FILES + ${tst_statemachine_resource_files} +) + + +#### Keys ignored in scope 1:.:.:statemachine.pro:<TRUE>: +# TEMPLATE = "app" diff --git a/tests/auto/statemachineinfo/CMakeLists.txt b/tests/auto/statemachineinfo/CMakeLists.txt new file mode 100644 index 0000000..06c0cd2 --- /dev/null +++ b/tests/auto/statemachineinfo/CMakeLists.txt @@ -0,0 +1,32 @@ +# Generated from statemachineinfo.pro. + +##################################################################### +## tst_statemachineinfo Test: +##################################################################### + +add_qt_test(tst_statemachineinfo + SOURCES + tst_statemachineinfo.cpp + LIBRARIES + Qt::ScxmlPrivate + PUBLIC_LIBRARIES + Qt::Gui + Qt::Qml + Qt::Scxml +) + +# Resources: +set(tst_statemachineinfo_resource_files + "statemachine.scxml" +) + +add_qt_resource(tst_statemachineinfo "tst_statemachineinfo" + PREFIX + "/tst_statemachineinfo" + FILES + ${tst_statemachineinfo_resource_files} +) + + +#### Keys ignored in scope 1:.:.:statemachineinfo.pro:<TRUE>: +# TEMPLATE = "app" |