mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Add support for unit testing
* Downgraded macOS CI to Qt 6.2.0 due to a bug in Qt Test module * Revised cmake build scripts * For now, only building via cmake is supported PR #17338.
This commit is contained in:
parent
890630944d
commit
03da68b1cf
12 changed files with 311 additions and 206 deletions
19
test/CMakeLists.txt
Normal file
19
test/CMakeLists.txt
Normal file
|
@ -0,0 +1,19 @@
|
|||
if (QT6)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Test)
|
||||
else()
|
||||
find_package(Qt5 REQUIRED COMPONENTS Test)
|
||||
endif()
|
||||
|
||||
enable_testing(true)
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)
|
||||
|
||||
include_directories("../src")
|
||||
|
||||
file(GLOB testFiles "${CMAKE_CURRENT_SOURCE_DIR}/test*.cpp")
|
||||
foreach(testFile ${testFiles})
|
||||
get_filename_component(testFilename "${testFile}" NAME_WLE)
|
||||
|
||||
add_executable("${testFilename}" "${testFile}")
|
||||
target_link_libraries("${testFilename}" PRIVATE Qt::Test qbt_base)
|
||||
add_test(NAME "${testFilename}" COMMAND "${testFilename}")
|
||||
endforeach()
|
Loading…
Add table
Add a link
Reference in a new issue