mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 09:33:25 -08:00
[Tests] Vendor QtTesting behind an opt-in WITH_GUI_TEST flag
This commit is contained in:
parent
9f30892dff
commit
7c03e4467a
5 changed files with 48 additions and 0 deletions
3
.gitmodules
vendored
3
.gitmodules
vendored
|
|
@ -4,3 +4,6 @@
|
||||||
[submodule "doxygen-awesome-css"]
|
[submodule "doxygen-awesome-css"]
|
||||||
path = doc/doxygen/theme
|
path = doc/doxygen/theme
|
||||||
url = https://github.com/jothepro/doxygen-awesome-css.git
|
url = https://github.com/jothepro/doxygen-awesome-css.git
|
||||||
|
[submodule "external/qttesting"]
|
||||||
|
path = external/qttesting
|
||||||
|
url = https://github.com/Kitware/QtTesting.git
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ option(WITH_CLIENT "Build Cockatrice client" ON)
|
||||||
option(WITH_ORACLE "Build Cockatrice card database tool (Oracle)" ON)
|
option(WITH_ORACLE "Build Cockatrice card database tool (Oracle)" ON)
|
||||||
# Compile Servatrice
|
# Compile Servatrice
|
||||||
option(WITH_SERVER "Build Cockatrice server (Servatrice)" OFF)
|
option(WITH_SERVER "Build Cockatrice server (Servatrice)" OFF)
|
||||||
|
# Compile GUI tests (QtTesting widget-level playback)
|
||||||
|
option(WITH_GUI_TEST "Build the QtTesting-based GUI test harness" OFF)
|
||||||
# Compile tests
|
# Compile tests
|
||||||
option(TEST "Build tests" OFF)
|
option(TEST "Build tests" OFF)
|
||||||
# Build with AddressSanitizer and UndefinedBehaviorSanitizer
|
# Build with AddressSanitizer and UndefinedBehaviorSanitizer
|
||||||
|
|
@ -29,6 +31,14 @@ option(ENABLE_COVERAGE "Build instrumented for GCC line coverage" OFF)
|
||||||
# Use vcpkg regardless of OS
|
# Use vcpkg regardless of OS
|
||||||
option(USE_VCPKG "Use vcpkg regardless of OS" OFF)
|
option(USE_VCPKG "Use vcpkg regardless of OS" OFF)
|
||||||
|
|
||||||
|
# The GUI test harness lives in a submodule; a checkout without it must still configure.
|
||||||
|
if(WITH_GUI_TEST AND NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/external/qttesting/CMakeLists.txt")
|
||||||
|
message(WARNING "WITH_GUI_TEST is ON but external/qttesting is missing, so GUI tests are disabled.\n"
|
||||||
|
"Run 'git submodule update --init external/qttesting' to enable them."
|
||||||
|
)
|
||||||
|
set(WITH_GUI_TEST OFF)
|
||||||
|
endif()
|
||||||
|
|
||||||
# Default to "Release" build type
|
# Default to "Release" build type
|
||||||
# User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call
|
# User-provided value for CMAKE_BUILD_TYPE must be checked before the PROJECT() call
|
||||||
if(DEFINED CMAKE_BUILD_TYPE)
|
if(DEFINED CMAKE_BUILD_TYPE)
|
||||||
|
|
@ -461,6 +471,34 @@ if(WITH_ORACLE)
|
||||||
set(CPACK_INSTALL_CMAKE_PROJECTS "Oracle;Oracle;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
|
set(CPACK_INSTALL_CMAKE_PROJECTS "Oracle;Oracle;ALL;/" ${CPACK_INSTALL_CMAKE_PROJECTS})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(WITH_GUI_TEST)
|
||||||
|
set(QtTesting_QT_VERSION "6")
|
||||||
|
# QtTesting registers its own unit tests when BUILD_TESTING is on. They target the
|
||||||
|
# Qt version the harness was written for and fail on Qt 6.11 (toolbutton
|
||||||
|
# long-press recording), and they are not Cockatrice's tests, so suppress them
|
||||||
|
# for the duration of the subdirectory instead of painting ctest red.
|
||||||
|
if(DEFINED BUILD_TESTING)
|
||||||
|
set(_cockatrice_saved_build_testing ${BUILD_TESTING})
|
||||||
|
endif()
|
||||||
|
set(BUILD_TESTING
|
||||||
|
OFF
|
||||||
|
CACHE BOOL "Build the testing tree." FORCE
|
||||||
|
)
|
||||||
|
add_subdirectory(external/qttesting)
|
||||||
|
if(DEFINED _cockatrice_saved_build_testing)
|
||||||
|
set(BUILD_TESTING
|
||||||
|
${_cockatrice_saved_build_testing}
|
||||||
|
CACHE BOOL "Build the testing tree." FORCE
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
unset(BUILD_TESTING CACHE)
|
||||||
|
endif()
|
||||||
|
# cl.exe has no warnings-as-errors here, and it rejects -Wno-error with D8021.
|
||||||
|
if(NOT MSVC)
|
||||||
|
target_compile_options(qttesting PRIVATE -Wno-error)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
if(TEST)
|
if(TEST)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
add_subdirectory(tests)
|
add_subdirectory(tests)
|
||||||
|
|
|
||||||
|
|
@ -564,6 +564,11 @@ target_link_libraries(
|
||||||
|
|
||||||
cockatrice_target_enable_crash_reporting(cockatrice)
|
cockatrice_target_enable_crash_reporting(cockatrice)
|
||||||
|
|
||||||
|
if(WITH_GUI_TEST)
|
||||||
|
target_link_libraries(cockatrice PRIVATE QtTesting)
|
||||||
|
target_compile_definitions(cockatrice PRIVATE WITH_GUI_TEST)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(UNIX)
|
if(UNIX)
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME}")
|
set(MACOSX_BUNDLE_INFO_STRING "${PROJECT_NAME}")
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
# or set <category> = false to disable logging
|
# or set <category> = false to disable logging
|
||||||
|
|
||||||
#main = true
|
#main = true
|
||||||
|
#recording = true
|
||||||
#qt_translator = true
|
#qt_translator = true
|
||||||
#window_main.* = true
|
#window_main.* = true
|
||||||
#release_channel = true
|
#release_channel = true
|
||||||
|
|
|
||||||
1
external/qttesting
vendored
Submodule
1
external/qttesting
vendored
Submodule
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit c7bb5d372133e94c75cbdc70b04e039b864ea379
|
||||||
Loading…
Add table
Add a link
Reference in a new issue