Skip to content

Commit e2f90a7

Browse files
committed
register GUI tests in CTest
1 parent f0f018d commit e2f90a7

7 files changed

Lines changed: 26 additions & 1 deletion

File tree

cmake/options.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ option(ENABLE_OSS_FUZZ "Enable the OSS-Fuzz related targets"
3939
option(BUILD_GUI "Build the qt application" OFF)
4040
option(WITH_QCHART "Enable QtCharts usage in the GUI" OFF)
4141
option(USE_QT6 "Prefer Qt6 when available" OFF)
42+
option(REGISTER_GUI_TESTS "Register GUI tests in CTest" ON)
4243

4344
option(HAVE_RULES "Usage of rules (needs PCRE library and headers)" OFF)
4445
option(USE_BUNDLED_TINYXML2 "Usage of bundled tinyxml2 library" ON)

cmake/printInfo.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ message( STATUS "ENABLE_OSS_FUZZ = ${ENABLE_OSS_FUZZ}" )
4848
message( STATUS )
4949
message( STATUS "BUILD_GUI = ${BUILD_GUI}" )
5050
if (BUILD_GUI)
51+
message( STATUS "REGISTER_GUI_TESTS = ${REGISTER_GUI_TESTS}" )
5152
message( STATUS "WITH_QCHART = ${WITH_QCHART}" )
5253
message( STATUS "USE_QT6 = ${USE_QT6}" )
5354
message( STATUS "QT_VERSION = ${QT_VERSION}")

gui/test/cppchecklibrarydata/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ target_link_libraries(test-cppchecklibrarydata ${QT_CORE_LIB} ${QT_TEST_LIB})
1414
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1515
# Q_UNUSED() in generated code
1616
target_compile_options_safe(test-cppchecklibrarydata -Wno-extra-semi-stmt)
17+
endif()
18+
19+
if (REGISTER_GUI_TESTS)
20+
add_test(NAME test-cppchecklibrarydata COMMAND $<TARGET_FILE:test-cppchecklibrarydata>)
1721
endif()

gui/test/filelist/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ target_link_libraries(test-filelist ${QT_CORE_LIB} ${QT_TEST_LIB})
1717
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1818
# Q_UNUSED() in generated code
1919
target_compile_options_safe(test-filelist -Wno-extra-semi-stmt)
20+
endif()
21+
22+
if (REGISTER_GUI_TESTS)
23+
# TODO: requires X session
24+
#add_test(NAME test-filelist COMMAND $<TARGET_FILE:test-filelist>)
2025
endif()

gui/test/projectfile/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,8 @@ target_link_libraries(test-projectfile ${QT_CORE_LIB} ${QT_TEST_LIB})
1313
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1414
# Q_UNUSED() in generated code
1515
target_compile_options_safe(test-projectfile -Wno-extra-semi-stmt)
16+
endif()
17+
18+
if (REGISTER_GUI_TESTS)
19+
add_test(NAME test-projectfile COMMAND $<TARGET_FILE:test-projectfile>)
1620
endif()

gui/test/translationhandler/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,10 @@ target_link_libraries(test-translationhandler ${QT_CORE_LIB} ${QT_WIDGETS_LIB} $
1212

1313
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
1414
# Q_UNUSED() in generated code
15-
target_compile_options_safe(test-projectfile -Wno-extra-semi-stmt)
15+
target_compile_options_safe(test-translationhandler -Wno-extra-semi-stmt)
16+
endif()
17+
18+
if (REGISTER_GUI_TESTS)
19+
# TODO: requires X session
20+
#add_test(NAME test-translationhandler COMMAND $<TARGET_FILE:test-translationhandler>)
1621
endif()

gui/test/xmlreportv2/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,8 @@ endif()
2323
if(tinyxml2_FOUND AND NOT USE_BUNDLED_TINYXML2)
2424
target_link_libraries(test-xmlreportv2 ${tinyxml2_LIBRARIES})
2525
endif()
26+
27+
if (REGISTER_GUI_TESTS)
28+
# TODO: requires X session
29+
#add_test(NAME test-xmlreportv2 COMMAND $<TARGET_FILE:test-xmlreportv2>)
30+
endif()

0 commit comments

Comments
 (0)