Move all business logic into liblivecaption_core (no Qt dependency) and the widgets into liblivecaption_ui, leaving two executables: the caption window and the CLI, which no longer links Qt Widgets. Abstract the ASR backend behind IAsr so the streaming policy and the live pipeline can be tested with a scripted fake backend instead of a real model. 把全部业务逻辑下沉到不依赖 Qt 的 liblivecaption_core,界面独立成 liblivecaption_ui,拆出悬浮窗与命令行两个可执行程序(CLI 不再链接 Qt Widgets);并用 IAsr 抽象推理后端,使流式策略与实时管线可脱离真模型 用假实现做单元测试。测试还抓到一个真 bug:段恰好结束在 chunk 边界时 只提交了稳定部分,最后几个词被丢掉,已修。
16 lines
582 B
CMake
16 lines
582 B
CMake
# 单元测试:只依赖 core,不需要模型文件、不需要显示环境。
|
|
# 需要真模型的集成测试不放在这里(会另外打 label)。
|
|
find_package(Qt6 REQUIRED COMPONENTS Test)
|
|
|
|
function(lc_add_test name)
|
|
add_executable(${name} ${name}.cpp)
|
|
target_link_libraries(${name} PRIVATE livecaption_core Qt6::Test)
|
|
target_include_directories(${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
add_test(NAME ${name} COMMAND ${name})
|
|
endfunction()
|
|
|
|
lc_add_test(tst_transcript)
|
|
lc_add_test(tst_vad)
|
|
lc_add_test(tst_streamingasr)
|
|
lc_add_test(tst_livepipeline)
|