diff options
author | Joerg Bornemann <joerg.bornemann@qt.io> | 2021-08-23 12:45:42 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-24 22:06:15 +0000 |
commit | 1bd497675909df47e7b8bb7a7b544ad37bdc6eb1 (patch) | |
tree | e31f3350228eb0b6b4dfeb062244c2a16231bc1d /tests | |
parent | 41acb54b89af9ec830e187f59432fe35408b834f (diff) |
Revive tst_qresourceengine
This test was not ported to CMake yet.
Fixes: QTBUG-88601
Change-Id: Ied3b1a0e2ddfbcf003cb0d8d01d5f64cb83cf4e7
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit d9f8b689637aa4559ee57dc80aef0d4325d14e0c)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
5 files changed, 68 insertions, 3 deletions
diff --git a/tests/auto/corelib/io/CMakeLists.txt b/tests/auto/corelib/io/CMakeLists.txt index 4bdb03ff99..fa88de838b 100644 --- a/tests/auto/corelib/io/CMakeLists.txt +++ b/tests/auto/corelib/io/CMakeLists.txt @@ -29,7 +29,7 @@ if(TARGET Qt::Concurrent) endif() if(NOT ANDROID) add_subdirectory(qdir) - # add_subdirectory(qresourceengine) # special case needs fixes + add_subdirectory(qresourceengine) endif() if(QT_FEATURE_private_tests OR UNIX) add_subdirectory(qfilesystementry) diff --git a/tests/auto/corelib/io/qresourceengine/CMakeLists.txt b/tests/auto/corelib/io/qresourceengine/CMakeLists.txt new file mode 100644 index 0000000000..7152d988c9 --- /dev/null +++ b/tests/auto/corelib/io/qresourceengine/CMakeLists.txt @@ -0,0 +1,44 @@ +##################################################################### +## tst_qresourceengine Test: +##################################################################### + +if (NOT QT_BUILD_STANDALONE_TESTS AND NOT QT_BUILDING_QT) + cmake_minimum_required(VERSION 3.16) + project(tst_qresourceengine LANGUAGES C CXX ASM) + find_package(Qt6BuildInternals COMPONENTS STANDALONE_TEST) +endif() + +# Collect test data +set(test_data "parentdir.txt") +file(GLOB_RECURSE test_data_glob + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + testqrc/*) +list(APPEND test_data ${test_data_glob}) +file(GLOB_RECURSE test_data_glob + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + *.rcc) +list(APPEND test_data ${test_data_glob}) + +qt_internal_add_test(tst_qresourceengine + SOURCES + tst_qresourceengine.cpp + LIBRARIES + Qt::CorePrivate + moctestplugin + TESTDATA ${test_data} +) + +qt_add_resources(additional_sources testqrc/test.qrc) +target_sources(tst_qresourceengine PRIVATE ${additional_sources}) + +if(ANDROID AND NOT ANDROID_EMBEDDED) + qt_add_resources(additional_sources android_testdata.qrc) + target_sources(tst_qresourceengine PRIVATE ${additional_sources}) +endif() + +qt_add_binary_resources(tst_qresourceengine_runtime_resource "testqrc/test.qrc" + DESTINATION "${CMAKE_CURRENT_BINARY_DIR}/runtime_resource.rcc" + OPTIONS -root "/runtime_resource/" -binary) +add_dependencies(tst_qresourceengine tst_qresourceengine_runtime_resource) + +add_subdirectory(staticplugin) diff --git a/tests/auto/corelib/io/qresourceengine/staticplugin/.gitignore b/tests/auto/corelib/io/qresourceengine/staticplugin/.gitignore deleted file mode 100644 index c397dde6a5..0000000000 --- a/tests/auto/corelib/io/qresourceengine/staticplugin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -moctestplugin_plugin_resources.cpp diff --git a/tests/auto/corelib/io/qresourceengine/staticplugin/CMakeLists.txt b/tests/auto/corelib/io/qresourceengine/staticplugin/CMakeLists.txt new file mode 100644 index 0000000000..5e2e374310 --- /dev/null +++ b/tests/auto/corelib/io/qresourceengine/staticplugin/CMakeLists.txt @@ -0,0 +1,22 @@ +##################################################################### +## moctestplugin Generic Library: +##################################################################### + +qt_internal_add_cmake_library(moctestplugin + STATIC + SOURCES + main.cpp + LIBRARIES + Qt::Core + DEFINES + QT_STATICPLUGIN +) + +qt_internal_add_resource(moctestplugin "qmake_plugin_resource" + PREFIX + "/staticplugin" + FILES + "main.cpp" +) + +qt_autogen_tools_initial_setup(moctestplugin) diff --git a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp index b2f7aedab0..b7a2416db2 100644 --- a/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp +++ b/tests/auto/corelib/io/qresourceengine/tst_qresourceengine.cpp @@ -490,7 +490,7 @@ void tst_QResourceEngine::checkStructure() void tst_QResourceEngine::searchPath_data() { - auto searchPath = QFileInfo(QFINDTESTDATA("testqrc")).canonicalFilePath(); + auto searchPath = QFileInfo(QT_TESTCASE_SOURCEDIR "/testqrc").canonicalFilePath(); QTest::addColumn<QString>("searchPathPrefix"); QTest::addColumn<QString>("searchPath"); |