From fdf5d11ff6f3f5034d7d7f7664f4cc76deb26ef5 Mon Sep 17 00:00:00 2001 From: Alexey Edelev Date: Wed, 9 Feb 2022 16:24:24 +0100 Subject: CMake: Add BUILTIN_TESTDATA option to qt_internal_add_test Multiple tests use qt_internal_add_resource that copies the functionality that is already implemented inside the qt_internal_add_test function. Simplify these test by replacing the qt_internal_add_resource call with the new BUILTIN_TESTDATA option. Change-Id: I18475b817d6f87264f0de53817d6c26c5ccab4e2 Reviewed-by: Alexandru Croitor --- cmake/QtTestHelpers.cmake | 35 +++++++++++++++-- tests/auto/corelib/io/qfileselector/CMakeLists.txt | 19 ++++------ tests/auto/corelib/io/qsettings/CMakeLists.txt | 31 +++++++-------- tests/auto/corelib/kernel/qvariant/CMakeLists.txt | 22 ++++------- tests/auto/gui/kernel/CMakeLists.txt | 4 +- .../auto/gui/kernel/qguiapplication/CMakeLists.txt | 34 ++++------------- .../gui/kernel/qguivariant/test/CMakeLists.txt | 21 ++++------- tests/auto/gui/kernel/qkeysequence/CMakeLists.txt | 22 ++++------- tests/auto/gui/painting/qcolorspace/CMakeLists.txt | 29 ++++---------- tests/auto/gui/rhi/qrhi/CMakeLists.txt | 21 ++++------- tests/auto/gui/rhi/qshader/CMakeLists.txt | 21 ++++------- tests/auto/gui/text/qfont/CMakeLists.txt | 22 ++++------- tests/auto/gui/text/qglyphrun/CMakeLists.txt | 19 ++++------ tests/auto/gui/text/qrawfont/CMakeLists.txt | 23 +++++------ .../gui/util/qtexturefilereader/CMakeLists.txt | 21 ++++------- tests/auto/testlib/selftests/CMakeLists.txt | 28 +++++--------- .../widgets/dialogs/qfontdialog/CMakeLists.txt | 28 ++++++-------- tests/auto/widgets/dialogs/qwizard/CMakeLists.txt | 23 +++++------ .../graphicsview/qgraphicsscene/CMakeLists.txt | 44 ++++++++-------------- tests/auto/widgets/kernel/qwidget/CMakeLists.txt | 26 +++++-------- tests/auto/widgets/styles/CMakeLists.txt | 4 +- .../widgets/styles/qstylesheetstyle/CMakeLists.txt | 26 ++++--------- 22 files changed, 207 insertions(+), 316 deletions(-) diff --git a/cmake/QtTestHelpers.cmake b/cmake/QtTestHelpers.cmake index a076dd3fd7..c8a8d91fd7 100644 --- a/cmake/QtTestHelpers.cmake +++ b/cmake/QtTestHelpers.cmake @@ -181,12 +181,39 @@ endfunction() # You may avoid test wrapping by either passing NO_WRAPPER option or switching QT_NO_TEST_WRAPPERS # to ON. This is helpful if you want to use internal CMake tools within tests, like memory or # sanitizer checks. See https://cmake.org/cmake/help/v3.19/manual/ctest.1.html#ctest-memcheck-step +# Arguments: +# BUILTIN_TESTDATA the option forces adding the provded TESTDATA to resources. function(qt_internal_add_test name) # EXCEPTIONS is a noop as they are enabled by default. + set(optional_args + RUN_SERIAL + EXCEPTIONS + NO_EXCEPTIONS + GUI + QMLTEST + CATCH + LOWDPI + NO_WRAPPER + BUILTIN_TESTDATA + ) + set(single_value_args + OUTPUT_DIRECTORY + WORKING_DIRECTORY + TIMEOUT + VERSION + ) + set(multi_value_args + QML_IMPORTPATH + TESTDATA + QT_TEST_SERVER_LIST + ${__default_private_args} + ${__default_public_args} + ) qt_parse_all_arguments(arg "qt_add_test" - "RUN_SERIAL;EXCEPTIONS;NO_EXCEPTIONS;GUI;QMLTEST;CATCH;LOWDPI;NO_WRAPPER" - "OUTPUT_DIRECTORY;WORKING_DIRECTORY;TIMEOUT;VERSION" - "QML_IMPORTPATH;TESTDATA;QT_TEST_SERVER_LIST;${__default_private_args};${__default_public_args}" ${ARGN} + "${optional_args}" + "${single_value_args}" + "${multi_value_args}" + ${ARGN} ) if (NOT arg_OUTPUT_DIRECTORY) @@ -364,7 +391,7 @@ function(qt_internal_add_test name) endif() endif() - if(ANDROID OR IOS OR INTEGRITY) + if(ANDROID OR IOS OR INTEGRITY OR arg_BUILTIN_TESTDATA) set(builtin_testdata TRUE) endif() diff --git a/tests/auto/corelib/io/qfileselector/CMakeLists.txt b/tests/auto/corelib/io/qfileselector/CMakeLists.txt index 5f254044df..1ceb91212a 100644 --- a/tests/auto/corelib/io/qfileselector/CMakeLists.txt +++ b/tests/auto/corelib/io/qfileselector/CMakeLists.txt @@ -4,13 +4,6 @@ ## tst_qfileselectors Test: ##################################################################### -qt_internal_add_test(tst_qfileselectors - SOURCES - tst_qfileselector.cpp - PUBLIC_LIBRARIES - Qt::CorePrivate -) - # Resources: set(qfileselector_resource_files "extras/+custom1/test" @@ -62,10 +55,12 @@ set(qfileselector_resource_files "platforms/test5" ) -qt_internal_add_resource(tst_qfileselectors "qfileselector" - PREFIX - "/" - FILES - ${qfileselector_resource_files} +qt_internal_add_test(tst_qfileselectors + SOURCES + tst_qfileselector.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate + TESTDATA ${qfileselector_resource_files} + BUILTIN_TESTDATA ) diff --git a/tests/auto/corelib/io/qsettings/CMakeLists.txt b/tests/auto/corelib/io/qsettings/CMakeLists.txt index 55a360166b..c9ba64f0ca 100644 --- a/tests/auto/corelib/io/qsettings/CMakeLists.txt +++ b/tests/auto/corelib/io/qsettings/CMakeLists.txt @@ -4,19 +4,7 @@ ## tst_qsettings Test: ##################################################################### -qt_internal_add_test(tst_qsettings - SOURCES - tst_qsettings.cpp - DEFINES - QT_DISABLE_DEPRECATED_BEFORE=0 - INCLUDE_DIRECTORIES - ../../kernel/qmetatype - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui -) - -# Resources: +# Test: set(qsettings_resource_files "bom.ini" "resourcefile.ini" @@ -29,11 +17,18 @@ set(qsettings_resource_files "float.ini" ) -qt_internal_add_resource(tst_qsettings "qsettings" - PREFIX - "/" - FILES - ${qsettings_resource_files} +qt_internal_add_test(tst_qsettings + SOURCES + tst_qsettings.cpp + DEFINES + QT_DISABLE_DEPRECATED_BEFORE=0 + INCLUDE_DIRECTORIES + ../../kernel/qmetatype + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Gui + TESTDATA ${qsettings_resource_files} + BUILTIN_TESTDATA ) diff --git a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt index 45bfa4e480..85a90b440f 100644 --- a/tests/auto/corelib/kernel/qvariant/CMakeLists.txt +++ b/tests/auto/corelib/kernel/qvariant/CMakeLists.txt @@ -4,6 +4,12 @@ ## tst_qvariant Test: ##################################################################### +# Resources: +set(qvariant_resource_files + "stream/qt4.9/" + "stream/qt5.0/" +) + qt_internal_add_test(tst_qvariant SOURCES tst_qvariant.cpp @@ -14,22 +20,10 @@ qt_internal_add_test(tst_qvariant PUBLIC_LIBRARIES Qt::CorePrivate Qt::Gui + TESTDATA ${qvariant_resource_files} + BUILTIN_TESTDATA ) -# Resources: -set(qvariant_resource_files - "stream/qt4.9/" - "stream/qt5.0/" -) - -qt_internal_add_resource(tst_qvariant "qvariant" - PREFIX - "/" - FILES - ${qvariant_resource_files} -) - - ## Scopes: ##################################################################### diff --git a/tests/auto/gui/kernel/CMakeLists.txt b/tests/auto/gui/kernel/CMakeLists.txt index 74657ed1b6..1e72872516 100644 --- a/tests/auto/gui/kernel/CMakeLists.txt +++ b/tests/auto/gui/kernel/CMakeLists.txt @@ -22,7 +22,9 @@ add_subdirectory(qpalette) add_subdirectory(qscreen) add_subdirectory(qsurfaceformat) add_subdirectory(qwindow) -add_subdirectory(qguiapplication) +if(QT_FEATURE_private_tests) + add_subdirectory(qguiapplication) +endif() add_subdirectory(qpixelformat) add_subdirectory(qrasterwindow) add_subdirectory(qaddpostroutine) diff --git a/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt index ffd07cad26..1518df22a4 100644 --- a/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt +++ b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt @@ -1,9 +1,5 @@ # Generated from qguiapplication.pro. -if(NOT QT_FEATURE_private_tests) - return() -endif() - ##################################################################### ## tst_qguiapplication Test: ##################################################################### @@ -16,6 +12,12 @@ else() endif() # special case end +# Resources: +set(tst_qguiapplication_resource_files + "icons/appicon.png" + "icons/usericon.png" +) + qt_internal_add_test(tst_qguiapplication VERSION ${target_version} # special case SOURCES @@ -28,19 +30,8 @@ qt_internal_add_test(tst_qguiapplication PUBLIC_LIBRARIES Qt::CorePrivate Qt::GuiPrivate -) - -# Resources: -set(tst_qguiapplication_resource_files - "icons/appicon.png" - "icons/usericon.png" -) - -qt_internal_add_resource(tst_qguiapplication "tst_qguiapplication" - PREFIX - "/" - FILES - ${tst_qguiapplication_resource_files} + TESTDATA ${tst_qguiapplication_resource_files} + BUILTIN_TESTDATA ) # special case begin @@ -49,12 +40,3 @@ if (APPLE) set_property(TARGET tst_qguiapplication PROPERTY PROPERTY MACOSX_BUNDLE TRUE) endif() # special case end - -## Scopes: -##################################################################### - -#### Keys ignored in scope 3:.:../../../corelib/kernel/qcoreapplication:../../../corelib/kernel/qcoreapplication/qcoreapplication.pro:WIN32: -# VERSION = "1.2.3.4" - -#### Keys ignored in scope 4:.:../../../corelib/kernel/qcoreapplication:../../../corelib/kernel/qcoreapplication/qcoreapplication.pro:else: -# VERSION = "1.2.3" diff --git a/tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt b/tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt index a3292511bd..49e985fa82 100644 --- a/tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt +++ b/tests/auto/gui/kernel/qguivariant/test/CMakeLists.txt @@ -4,6 +4,12 @@ ## tst_qguivariant Test: ##################################################################### +# Resources: +file(GLOB_RECURSE qguivariant_resource_files + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "data/*" +) + qt_internal_add_test(tst_qguivariant SOURCES tst_qguivariant.cpp @@ -11,17 +17,6 @@ qt_internal_add_test(tst_qguivariant ../../../../other/qvariant_common PUBLIC_LIBRARIES Qt::Gui + TESTDATA ${qguivariant_resource_files} + BUILTIN_TESTDATA ) - -# Resources: -set(qguivariant_resource_files - "data" -) - -qt_internal_add_resource(tst_qguivariant "qguivariant" - PREFIX - "/" - FILES - ${qguivariant_resource_files} -) - diff --git a/tests/auto/gui/kernel/qkeysequence/CMakeLists.txt b/tests/auto/gui/kernel/qkeysequence/CMakeLists.txt index 9d0e25d356..ea71ce3870 100644 --- a/tests/auto/gui/kernel/qkeysequence/CMakeLists.txt +++ b/tests/auto/gui/kernel/qkeysequence/CMakeLists.txt @@ -4,6 +4,12 @@ ## tst_qkeysequence Test: ##################################################################### +# Resources: +set(qkeysequence_resource_files + "keys_de.qm" + "qt_de.qm" +) + qt_internal_add_test(tst_qkeysequence SOURCES tst_qkeysequence.cpp @@ -11,18 +17,6 @@ qt_internal_add_test(tst_qkeysequence Qt::CorePrivate Qt::Gui Qt::GuiPrivate + TESTDATA ${qkeysequence_resource_files} + BUILTIN_TESTDATA ) - -# Resources: -set(qkeysequence_resource_files - "keys_de.qm" - "qt_de.qm" -) - -qt_internal_add_resource(tst_qkeysequence "qkeysequence" - PREFIX - "/" - FILES - ${qkeysequence_resource_files} -) - diff --git a/tests/auto/gui/painting/qcolorspace/CMakeLists.txt b/tests/auto/gui/painting/qcolorspace/CMakeLists.txt index 9e3460d363..ef53c50551 100644 --- a/tests/auto/gui/painting/qcolorspace/CMakeLists.txt +++ b/tests/auto/gui/painting/qcolorspace/CMakeLists.txt @@ -5,10 +5,14 @@ ##################################################################### # Collect test data -file(GLOB_RECURSE test_data_glob +file(GLOB_RECURSE test_data RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} - resources/*) -list(APPEND test_data ${test_data_glob}) + resources/* +) + +foreach(file IN LISTS test_data) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() qt_internal_add_test(tst_qcolorspace SOURCES @@ -18,22 +22,5 @@ qt_internal_add_test(tst_qcolorspace Qt::Gui Qt::GuiPrivate TESTDATA ${test_data} + BUILTIN_TESTDATA ) - -file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "resources/*") -foreach(file IN LISTS resource_glob_0) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -# Resources: -set(qmake_immediate_resource_files - ${resource_glob_0} -) - -qt_internal_add_resource(tst_qcolorspace "qmake_immediate" - PREFIX - "/" - FILES - ${qmake_immediate_resource_files} -) - diff --git a/tests/auto/gui/rhi/qrhi/CMakeLists.txt b/tests/auto/gui/rhi/qrhi/CMakeLists.txt index 65d072c6b9..e0e97f6509 100644 --- a/tests/auto/gui/rhi/qrhi/CMakeLists.txt +++ b/tests/auto/gui/rhi/qrhi/CMakeLists.txt @@ -4,23 +4,18 @@ ## tst_qrhi Test: ##################################################################### +# Resources: +file(GLOB_RECURSE qrhi_resource_files + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + data/* +) + qt_internal_add_test(tst_qrhi SOURCES tst_qrhi.cpp PUBLIC_LIBRARIES Qt::Gui Qt::GuiPrivate + TESTDATA ${qrhi_resource_files} + BUILTIN_TESTDATA ) - -# Resources: -set(qrhi_resource_files - "data" -) - -qt_internal_add_resource(tst_qrhi "qrhi" - PREFIX - "/" - FILES - ${qrhi_resource_files} -) - diff --git a/tests/auto/gui/rhi/qshader/CMakeLists.txt b/tests/auto/gui/rhi/qshader/CMakeLists.txt index 9a0e246aa4..9807b19e53 100644 --- a/tests/auto/gui/rhi/qshader/CMakeLists.txt +++ b/tests/auto/gui/rhi/qshader/CMakeLists.txt @@ -4,23 +4,18 @@ ## tst_qshader Test: ##################################################################### +# Resources: +file(GLOB_RECURSE qshader_resource_files + RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "data/*" +) + qt_internal_add_test(tst_qshader SOURCES tst_qshader.cpp PUBLIC_LIBRARIES Qt::Gui Qt::GuiPrivate + TESTDATA ${qshader_resource_files} + BUILTIN_TESTDATA ) - -# Resources: -set(qshader_resource_files - "data" -) - -qt_internal_add_resource(tst_qshader "qshader" - PREFIX - "/" - FILES - ${qshader_resource_files} -) - diff --git a/tests/auto/gui/text/qfont/CMakeLists.txt b/tests/auto/gui/text/qfont/CMakeLists.txt index 6e0583bc30..048416495b 100644 --- a/tests/auto/gui/text/qfont/CMakeLists.txt +++ b/tests/auto/gui/text/qfont/CMakeLists.txt @@ -4,6 +4,12 @@ ## tst_qfont Test: ##################################################################### +# Resources: +set(testfont_resource_files + "datastream.515" + "weirdfont.otf" +) + qt_internal_add_test(tst_qfont SOURCES tst_qfont.cpp @@ -12,22 +18,10 @@ qt_internal_add_test(tst_qfont Qt::Gui Qt::GuiPrivate Qt::TestPrivate + TESTDATA ${testfont_resource_files} + BUILTIN_TESTDATA ) -# Resources: -set(testfont_resource_files - "datastream.515" - "weirdfont.otf" -) - -qt_internal_add_resource(tst_qfont "testfont" - PREFIX - "/" - FILES - ${testfont_resource_files} -) - - ## Scopes: ##################################################################### diff --git a/tests/auto/gui/text/qglyphrun/CMakeLists.txt b/tests/auto/gui/text/qglyphrun/CMakeLists.txt index b0585af16f..4c5a7c44c0 100644 --- a/tests/auto/gui/text/qglyphrun/CMakeLists.txt +++ b/tests/auto/gui/text/qglyphrun/CMakeLists.txt @@ -4,13 +4,6 @@ ## tst_qglyphrun Test: ##################################################################### -qt_internal_add_test(tst_qglyphrun - SOURCES - tst_qglyphrun.cpp - PUBLIC_LIBRARIES - Qt::Gui -) - # Resources: set_source_files_properties("../../../shared/resources/test.ttf" PROPERTIES QT_RESOURCE_ALIAS "test.ttf" @@ -19,10 +12,12 @@ set(testdata_resource_files "../../../shared/resources/test.ttf" ) -qt_internal_add_resource(tst_qglyphrun "testdata" - PREFIX - "/" - FILES - ${testdata_resource_files} +qt_internal_add_test(tst_qglyphrun + SOURCES + tst_qglyphrun.cpp + PUBLIC_LIBRARIES + Qt::Gui + TESTDATA ${testdata_resource_files} + BUILTIN_TESTDATA ) diff --git a/tests/auto/gui/text/qrawfont/CMakeLists.txt b/tests/auto/gui/text/qrawfont/CMakeLists.txt index 04db8d8760..c7a883d9ce 100644 --- a/tests/auto/gui/text/qrawfont/CMakeLists.txt +++ b/tests/auto/gui/text/qrawfont/CMakeLists.txt @@ -4,15 +4,6 @@ ## tst_qrawfont Test: ##################################################################### -qt_internal_add_test(tst_qrawfont - SOURCES - tst_qrawfont.cpp - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate -) - # Resources: set_source_files_properties("../../../shared/resources/testfont.ttf" PROPERTIES QT_RESOURCE_ALIAS "testfont.ttf" @@ -23,10 +14,14 @@ set(testdata_resource_files "testfont_os2_v1.ttf" ) -qt_internal_add_resource(tst_qrawfont "testdata" - PREFIX - "/" - FILES - ${testdata_resource_files} +qt_internal_add_test(tst_qrawfont + SOURCES + tst_qrawfont.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate + TESTDATA ${testdata_resource_files} + BUILTIN_TESTDATA ) diff --git a/tests/auto/gui/util/qtexturefilereader/CMakeLists.txt b/tests/auto/gui/util/qtexturefilereader/CMakeLists.txt index de809f577d..b7fc79854e 100644 --- a/tests/auto/gui/util/qtexturefilereader/CMakeLists.txt +++ b/tests/auto/gui/util/qtexturefilereader/CMakeLists.txt @@ -4,14 +4,6 @@ ## tst_qtexturefilereader Test: ##################################################################### -qt_internal_add_test(tst_qtexturefilereader - SOURCES - tst_qtexturefilereader.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::GuiPrivate -) - # Resources: set(qtexturefilereader_resource_files "texturefiles/car.ktx" @@ -23,10 +15,13 @@ set(qtexturefilereader_resource_files "texturefiles/pattern.pkm" ) -qt_internal_add_resource(tst_qtexturefilereader "qtexturefilereader" - PREFIX - "/" - FILES - ${qtexturefilereader_resource_files} +qt_internal_add_test(tst_qtexturefilereader + SOURCES + tst_qtexturefilereader.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::GuiPrivate + TESTDATA ${qtexturefilereader_resource_files} + BUILTIN_TESTDATA ) diff --git a/tests/auto/testlib/selftests/CMakeLists.txt b/tests/auto/testlib/selftests/CMakeLists.txt index 2dd26211f2..8e64fcd6d7 100644 --- a/tests/auto/testlib/selftests/CMakeLists.txt +++ b/tests/auto/testlib/selftests/CMakeLists.txt @@ -4,6 +4,13 @@ include(../../../../src/testlib/selfcover.cmake) # ------------- Test runner ------------- +# Resources: + +file(GLOB qmake_expected_files_resource_files RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "expected_*") +foreach(file IN LISTS qmake_expected_files_resource_files) + set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") +endforeach() + qt_internal_add_test(tst_selftests OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/" EXCEPTIONS @@ -13,6 +20,8 @@ qt_internal_add_test(tst_selftests catch.cpp PUBLIC_LIBRARIES Qt::TestPrivate + TESTDATA ${qmake_expected_files_resource_files} + BUILTIN_TESTDATA # These lines need to be commented out as they need to be enabled # COMPILE_OPTIONS # conditionally @@ -24,25 +33,6 @@ qt_internal_add_test(tst_selftests # "$$COVERAGE_OPTIONS" ) -file(GLOB resource_glob_0 RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "expected_*") -foreach(file IN LISTS resource_glob_0) - set_source_files_properties("${CMAKE_CURRENT_SOURCE_DIR}/${file}" PROPERTIES QT_RESOURCE_ALIAS "${file}") -endforeach() - -# Resources: -set(qmake_expected_files_resource_files - ${resource_glob_0} -) - -qt_internal_add_resource(tst_selftests "qmake_expected_files" - PREFIX - "/" - BASE - "${CMAKE_CURRENT_SOURCE_DIR}" - FILES - ${qmake_expected_files_resource_files} -) - qt_internal_apply_testlib_coverage_options(tst_selftests) # ------------- Sub tests ------------- diff --git a/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt b/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt index 4e231cc6cc..cc19461d7a 100644 --- a/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt +++ b/tests/auto/widgets/dialogs/qfontdialog/CMakeLists.txt @@ -4,17 +4,6 @@ ## tst_qfontdialog Test: ##################################################################### -qt_internal_add_test(tst_qfontdialog - SOURCES - tst_qfontdialog.cpp - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::Widgets - Qt::WidgetsPrivate -) - # Resources: set_source_files_properties("../../../shared/resources/test.ttf" PROPERTIES QT_RESOURCE_ALIAS "test.ttf" @@ -27,13 +16,18 @@ set(testfonts_resource_files "../../../shared/resources/testfont.ttf" ) -qt_internal_add_resource(tst_qfontdialog "testfonts" - PREFIX - "/" - FILES - ${testfonts_resource_files} +qt_internal_add_test(tst_qfontdialog + SOURCES + tst_qfontdialog.cpp + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate + Qt::Widgets + Qt::WidgetsPrivate + TESTDATA ${testfonts_resource_files} + BUILTIN_TESTDATA ) - ## Scopes: ##################################################################### diff --git a/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt b/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt index 81dc9e85b2..32fc41f5c9 100644 --- a/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt +++ b/tests/auto/widgets/dialogs/qwizard/CMakeLists.txt @@ -4,15 +4,6 @@ ## tst_qwizard Test: ##################################################################### -qt_internal_add_test(tst_qwizard - SOURCES - tst_qwizard.cpp - tst_qwizard_2.cpp - PUBLIC_LIBRARIES - Qt::Gui - Qt::Widgets -) - # Resources: set(qwizard_resource_files "images/background.png" @@ -21,10 +12,14 @@ set(qwizard_resource_files "images/watermark.png" ) -qt_internal_add_resource(tst_qwizard "qwizard" - PREFIX - "/" - FILES - ${qwizard_resource_files} +qt_internal_add_test(tst_qwizard + SOURCES + tst_qwizard.cpp + tst_qwizard_2.cpp + PUBLIC_LIBRARIES + Qt::Gui + Qt::Widgets + TESTDATA ${qwizard_resource_files} + BUILTIN_TESTDATA ) diff --git a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt index 3c870e473e..ce4d6de7cd 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt +++ b/tests/auto/widgets/graphicsview/qgraphicsscene/CMakeLists.txt @@ -4,32 +4,10 @@ ## tst_qgraphicsscene Test: ##################################################################### -qt_internal_add_test(tst_qgraphicsscene - LOWDPI # special case - SOURCES - tst_qgraphicsscene.cpp - DEFINES - QT_NO_CAST_TO_ASCII - PUBLIC_LIBRARIES - Qt::CorePrivate - Qt::Gui - Qt::GuiPrivate - Qt::Widgets - Qt::WidgetsPrivate -) - # Resources: -set(images_resource_files - "Ash_European.jpg" -) -qt_internal_add_resource(tst_qgraphicsscene "images" - PREFIX - "/" - FILES - ${images_resource_files} -) set(testdata_resource_files + "Ash_European.jpg" "testData/render/all-all-45-deg-left.png" "testData/render/all-all-45-deg-right.png" "testData/render/all-all-scale-2x.png" @@ -60,14 +38,22 @@ set(testdata_resource_files "testData/render/topright-topleft-untransformed.png" ) -qt_internal_add_resource(tst_qgraphicsscene "testdata" - PREFIX - "/" - FILES - ${testdata_resource_files} +qt_internal_add_test(tst_qgraphicsscene + LOWDPI # special case + SOURCES + tst_qgraphicsscene.cpp + DEFINES + QT_NO_CAST_TO_ASCII + PUBLIC_LIBRARIES + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate + Qt::Widgets + Qt::WidgetsPrivate + TESTDATA ${testdata_resource_files} + BUILTIN_TESTDATA ) - ## Scopes: ##################################################################### diff --git a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt index d04db40e87..e2370a011a 100644 --- a/tests/auto/widgets/kernel/qwidget/CMakeLists.txt +++ b/tests/auto/widgets/kernel/qwidget/CMakeLists.txt @@ -4,6 +4,14 @@ ## tst_qwidget Test: ##################################################################### +# Resources: +set(qwidget_resource_files + "geometry-fullscreen.dat" + "geometry-maximized.dat" + "geometry.dat" + "hellotr_la.qm" +) + qt_internal_add_test(tst_qwidget SOURCES tst_qwidget.cpp @@ -14,24 +22,10 @@ qt_internal_add_test(tst_qwidget Qt::TestPrivate Qt::Widgets Qt::WidgetsPrivate + TESTDATA ${qwidget_resource_files} + BUILTIN_TESTDATA ) -# Resources: -set(qwidget_resource_files - "geometry-fullscreen.dat" - "geometry-maximized.dat" - "geometry.dat" - "hellotr_la.qm" -) - -qt_internal_add_resource(tst_qwidget "qwidget" - PREFIX - "/" - FILES - ${qwidget_resource_files} -) - - #### Keys ignored in scope 1:.:.:qwidget.pro:: # testcase.timeout = "600" diff --git a/tests/auto/widgets/styles/CMakeLists.txt b/tests/auto/widgets/styles/CMakeLists.txt index b1c9d1fce3..5d84d5e08a 100644 --- a/tests/auto/widgets/styles/CMakeLists.txt +++ b/tests/auto/widgets/styles/CMakeLists.txt @@ -3,7 +3,9 @@ if(APPLE) add_subdirectory(qmacstyle) endif() -add_subdirectory(qstyle) +if(QT_FEATURE_private_tests) + add_subdirectory(qstyle) +endif() add_subdirectory(qstyleoption) if(QT_FEATURE_private_tests AND NOT ANDROID AND NOT QNX AND NOT UIKIT) add_subdirectory(qstylesheetstyle) diff --git a/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt b/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt index bf4e52862c..fd66ed2a2c 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt +++ b/tests/auto/widgets/styles/qstylesheetstyle/CMakeLists.txt @@ -1,13 +1,15 @@ # Generated from qstylesheetstyle.pro. -if(NOT QT_FEATURE_private_tests) - return() -endif() - ##################################################################### ## tst_qstylesheetstyle Test: ##################################################################### +# Resources: +set(resources_resource_files + "images/testimage.png" + "images/testimage@2x.png" +) + qt_internal_add_test(tst_qstylesheetstyle SOURCES tst_qstylesheetstyle.cpp @@ -17,21 +19,9 @@ qt_internal_add_test(tst_qstylesheetstyle Qt::TestPrivate Qt::Widgets Qt::WidgetsPrivate + TESTDATA ${resources_resource_files} + BUILTIN_TESTDATA ) -# Resources: -set(resources_resource_files - "images/testimage.png" - "images/testimage@2x.png" -) - -qt_internal_add_resource(tst_qstylesheetstyle "resources" - PREFIX - "/" - FILES - ${resources_resource_files} -) - - #### Keys ignored in scope 1:.:.:qstylesheetstyle.pro:: # _REQUIREMENTS = "qtConfig(private_tests)" -- cgit v1.2.3