File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- option (BUILD_TESTS "Build all test targets" ON )
1+ option (BUILD_TESTS "Build unit test targets" ON )
22
3+ # Infer tests require ONNX models and audio files — off by default
34if (NOT BUILD_TESTS)
45 set (GAME_INFER_BUILD_TESTS OFF CACHE BOOL "" FORCE )
56 set (SOME_INFER_BUILD_TESTS OFF CACHE BOOL "" FORCE )
67 set (RMVPE_INFER_BUILD_TESTS OFF CACHE BOOL "" FORCE )
78 set (AUDIO_UTIL_BUILD_TESTS OFF CACHE BOOL "" FORCE )
9+ else ()
10+ # Default infer tests to OFF even when BUILD_TESTS=ON
11+ # Enable individually: -DGAME_INFER_BUILD_TESTS=ON etc.
12+ if (NOT DEFINED CACHE{GAME_INFER_BUILD_TESTS})
13+ set (GAME_INFER_BUILD_TESTS OFF CACHE BOOL "Build TestGame (requires GAME model)" FORCE )
14+ endif ()
15+ if (NOT DEFINED CACHE{SOME_INFER_BUILD_TESTS})
16+ set (SOME_INFER_BUILD_TESTS OFF CACHE BOOL "Build TestSome (requires SOME model)" FORCE )
17+ endif ()
18+ if (NOT DEFINED CACHE{RMVPE_INFER_BUILD_TESTS})
19+ set (RMVPE_INFER_BUILD_TESTS OFF CACHE BOOL "Build TestRmvpe (requires RMVPE model)" FORCE )
20+ endif ()
21+ if (NOT DEFINED CACHE{AUDIO_UTIL_BUILD_TESTS})
22+ set (AUDIO_UTIL_BUILD_TESTS OFF CACHE BOOL "Build TestAudioUtil" FORCE )
23+ endif ()
824endif ()
925
1026find_package (QT NAMES Qt6 COMPONENTS Core Gui Widgets Svg Network REQUIRED )
Original file line number Diff line number Diff line change 44
55include (CTest )
66
7+ # ── Infer tests (controlled by per-library options) ──────────────────────────
78if (TARGET TestGame)
89 add_test (NAME TestGame COMMAND TestGame )
910endif ()
@@ -20,8 +21,14 @@ if (TARGET TestAudioUtil)
2021 add_test (NAME TestAudioUtil COMMAND TestAudioUtil )
2122endif ()
2223
24+ # ── Unit tests (always built when BUILD_TESTS=ON) ────────────────────────────
25+ add_subdirectory (types )
2326add_subdirectory (framework )
2427add_subdirectory (domain )
25- add_subdirectory (widgets )
2628add_subdirectory (libs )
27- add_subdirectory (types )
29+
30+ # ── Integration tests (require QApplication / UI, off by default) ────────────
31+ option (BUILD_INTEGRATION_TESTS "Build integration and widget tests (require GUI)" OFF )
32+ if (BUILD_INTEGRATION_TESTS)
33+ add_subdirectory (widgets )
34+ endif ()
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Test REQUIRED)
22
33set (CMAKE_AUTOMOC ON )
44
5+ # ── Unit tests (pure logic, no QApplication needed) ──────────────────────────
56set (DSFW_TESTS
67 TestResult
78 TestJsonHelper
@@ -38,18 +39,20 @@ foreach(test_name ${DOMAIN_TESTS})
3839 add_test (NAME ${test_name} COMMAND ${test_name} )
3940endforeach ()
4041
41- # Integration tests (require QApplication / UI components)
42- set (DSFW_INTEGRATION_TESTS
43- TestAppShellIntegration
44- )
45-
46- foreach (test_name ${DSFW_INTEGRATION_TESTS} )
47- add_executable (${test_name} ${test_name} .cpp )
48- target_link_libraries (${test_name} PRIVATE
49- dsfw-ui-core
50- dsfw-widgets
51- Qt${QT_VERSION_MAJOR}::Widgets
52- Qt${QT_VERSION_MAJOR}::Test
42+ # ── Integration tests (require QApplication / UI components) ─────────────────
43+ if (BUILD_INTEGRATION_TESTS)
44+ set (DSFW_INTEGRATION_TESTS
45+ TestAppShellIntegration
5346 )
54- add_test (NAME ${test_name} COMMAND ${test_name} )
55- endforeach ()
47+
48+ foreach (test_name ${DSFW_INTEGRATION_TESTS} )
49+ add_executable (${test_name} ${test_name} .cpp )
50+ target_link_libraries (${test_name} PRIVATE
51+ dsfw-ui-core
52+ dsfw-widgets
53+ Qt${QT_VERSION_MAJOR}::Widgets
54+ Qt${QT_VERSION_MAJOR}::Test
55+ )
56+ add_test (NAME ${test_name} COMMAND ${test_name} )
57+ endforeach ()
58+ endif ()
You can’t perform that action at this time.
0 commit comments