diff options
author | Leander Beernaert <leander.beernaert@qt.io> | 2019-07-16 14:22:37 +0200 |
---|---|---|
committer | Leander Beernaert <leander.beernaert@qt.io> | 2019-07-18 08:05:58 +0000 |
commit | 3212f1b8662b5e5483a0185c22820e2d14593aba (patch) | |
tree | cd4fade474dd814609343a2e84c0c882db05d00b /tests/auto/corelib | |
parent | 341ccc3b590d0a06157f29ce9237bc111e8cebf8 (diff) |
Add special case handling for corelib mimetypes resources
We have to treat the resources from mimetypes in corelibs specially
as they are reused for two test cases. Since we no longer use the qrc
files, we have wrapped the relevant code in a function that can be
called for every target that depends on it.
This change also corrects formatting for the generate CMake code
regarding resource commands.
Change-Id: I50a05c81151d75aefc9ca165f5ffeb9f5cd77162
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/corelib')
6 files changed, 248 insertions, 2 deletions
diff --git a/tests/auto/corelib/mimetypes/CMakeLists.txt b/tests/auto/corelib/mimetypes/CMakeLists.txt index 1e59aa3329..ea0463de36 100644 --- a/tests/auto/corelib/mimetypes/CMakeLists.txt +++ b/tests/auto/corelib/mimetypes/CMakeLists.txt @@ -1,2 +1,14 @@ -# add_subdirectory(qmimetype) +# Generated from mimetypes.pro. +# special case begin +if(FEATURE_private_tests) +# special case end + add_subdirectory(qmimetype) + add_subdirectory(qmimedatabase) +# special case begin +endif() +# special case end + +if(NOT QT_FEATURE_private_tests) + ### remove_subdirectory("qmimetype") +endif() diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt new file mode 100644 index 0000000000..6661952a68 --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/CMakeLists.txt @@ -0,0 +1,10 @@ +# Generated from qmimedatabase.pro. + + +if(TARGET Qt::Concurrent) + add_subdirectory(qmimedatabase-xml) + + if(UNIX AND NOT APPLE AND NOT QNX) + add_subdirectory(qmimedatabase-cache) + endif() +endif() diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt new file mode 100644 index 0000000000..4a3d150123 --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/.prev_CMakeLists.txt @@ -0,0 +1,66 @@ +# Generated from qmimedatabase-cache.pro. + +##################################################################### +## tst_qmimedatabase-cache Test: +##################################################################### + +add_qt_test(tst_qmimedatabase-cache + SOURCES + ../tst_qmimedatabase.h + tst_qmimedatabase-cache.cpp + PUBLIC_LIBRARIES + Qt::Concurrent +) + +# Resources: +set_source_files_properties("../qml-again.xml" + PROPERTIES alias "qml-again.xml"] +) +set_source_files_properties("../test.qml" + PROPERTIES alias "test.qml"] +) +set_source_files_properties("../text-x-objcsrc.xml" + PROPERTIES alias "text-x-objcsrc.xml"] +) +set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml" + PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml"] +) +add_qt_resource(tst_qmimedatabase-cache "testdata" + PREFIX + "/qt-project.org/qmime" + BASE + ".." + FILES + invalid-magic1.xml + invalid-magic2.xml + invalid-magic3.xml + magic-and-hierarchy.foo + magic-and-hierarchy.xml + magic-and-hierarchy2.foo + qml-again.xml + test.qml + text-x-objcsrc.xml + yast2-metapackage-handler-mimetypes.xml +) + + +#### Keys ignored in scope 1:.:.:qmimedatabase-cache.pro:<TRUE>: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qmimedatabase-cache CONDITION 2*_x_ - g + COMPILE_OPTIONS + -W + -Wall + -Wextra + -Wno-long-long + -Wnon-virtual-dtor + -Wshadow +) + +extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX + DEFINES + USE_XDG_DATA_DIRS +) diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt new file mode 100644 index 0000000000..c7e3f9613d --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-cache/CMakeLists.txt @@ -0,0 +1,72 @@ +# Generated from qmimedatabase-cache.pro. + +##################################################################### +## tst_qmimedatabase-cache Test: +##################################################################### + +add_qt_test(tst_qmimedatabase-cache + SOURCES + ../tst_qmimedatabase.h + tst_qmimedatabase-cache.cpp + PUBLIC_LIBRARIES + Qt::Concurrent +) + +# Resources: +set_source_files_properties("../qml-again.xml" + PROPERTIES alias "qml-again.xml" +) +set_source_files_properties("../test.qml" + PROPERTIES alias "test.qml" +) +set_source_files_properties("../text-x-objcsrc.xml" + PROPERTIES alias "text-x-objcsrc.xml" +) +set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml" + PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml" +) +add_qt_resource(tst_qmimedatabase-cache "testdata" + PREFIX + "/qt-project.org/qmime" + BASE + ".." + FILES + invalid-magic1.xml + invalid-magic2.xml + invalid-magic3.xml + magic-and-hierarchy.foo + magic-and-hierarchy.xml + magic-and-hierarchy2.foo + qml-again.xml + test.qml + text-x-objcsrc.xml + yast2-metapackage-handler-mimetypes.xml +) + +# special case begin +set(corelib_source_dir ../../../../../../src/corelib) +include(${corelib_source_dir}/mimetypes/mimetypes_resources.cmake) +corelib_add_mimetypes_resources(tst_qmimedatabase-cache) +# special case end + +#### Keys ignored in scope 1:.:.:qmimedatabase-cache.pro:<TRUE>: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qmimedatabase-cache CONDITION CMAKE_COMPILER_IS_GNUCXX + + COMPILE_OPTIONS + -W + -Wall + -Wextra + -Wno-long-long + -Wnon-virtual-dtor + -Wshadow +) + +extend_target(tst_qmimedatabase-cache CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX + DEFINES + USE_XDG_DATA_DIRS +) diff --git a/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt new file mode 100644 index 0000000000..526b63aafa --- /dev/null +++ b/tests/auto/corelib/mimetypes/qmimedatabase/qmimedatabase-xml/CMakeLists.txt @@ -0,0 +1,72 @@ +# Generated from qmimedatabase-xml.pro. + +##################################################################### +## tst_qmimedatabase-xml Test: +##################################################################### + +add_qt_test(tst_qmimedatabase-xml + SOURCES + ../tst_qmimedatabase.h + tst_qmimedatabase-xml.cpp + PUBLIC_LIBRARIES + Qt::ConcurrentPrivate +) + +# Resources: +set_source_files_properties("../qml-again.xml" + PROPERTIES alias "qml-again.xml" +) +set_source_files_properties("../test.qml" + PROPERTIES alias "test.qml" +) +set_source_files_properties("../text-x-objcsrc.xml" + PROPERTIES alias "text-x-objcsrc.xml" +) +set_source_files_properties("../yast2-metapackage-handler-mimetypes.xml" + PROPERTIES alias "yast2-metapackage-handler-mimetypes.xml" +) + +add_qt_resource(tst_qmimedatabase-xml "testdata" + PREFIX + "/qt-project.org/qmime" + BASE + ".." + FILES + invalid-magic1.xml + invalid-magic2.xml + invalid-magic3.xml + magic-and-hierarchy.foo + magic-and-hierarchy.xml + magic-and-hierarchy2.foo + qml-again.xml + test.qml + text-x-objcsrc.xml + yast2-metapackage-handler-mimetypes.xml +) + +# special case begin +set(corelib_source_dir ../../../../../../src/corelib) +include(${corelib_source_dir}/mimetypes/mimetypes_resources.cmake) +corelib_add_mimetypes_resources(tst_qmimedatabase-xml) +# special case end + +#### Keys ignored in scope 1:.:.:qmimedatabase-xml.pro:<TRUE>: +# CONFIG = "testcase" + +## Scopes: +##################################################################### + +extend_target(tst_qmimedatabase-xml CONDITION CMAKE_COMPILER_IS_GNUCXX + COMPILE_OPTIONS + -W + -Wall + -Wextra + -Wno-long-long + -Wnon-virtual-dtor + -Wshadow +) + +extend_target(tst_qmimedatabase-xml CONDITION UNIX AND NOT APPLE_OSX AND NOT QNX + DEFINES + USE_XDG_DATA_DIRS +) diff --git a/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt b/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt index 9b70d0971a..adfcefb917 100644 --- a/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt +++ b/tests/auto/corelib/mimetypes/qmimetype/CMakeLists.txt @@ -1 +1,15 @@ -add_qt_test(tst_qmimetype SOURCES tst_qmimetype.cpp LIBRARIES Qt::CorePrivate) +# Generated from qmimetype.pro. + +##################################################################### +## tst_qmimetype Test: +##################################################################### + +add_qt_test(tst_qmimetype + SOURCES + tst_qmimetype.cpp + LIBRARIES + Qt::CorePrivate +) + +#### Keys ignored in scope 1:.:.:qmimetype.pro:<TRUE>: +# CONFIG = "testcase" |