test(ut): 补充第2批单元测试,新增3个测试套件 - #448
Conversation
There was a problem hiding this comment.
Sorry @pengfeixx, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: pengfeixx The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's GuideAdds two new Qt/GTest-based unit test suites for VoiceToTextTaskManager and RecordingCurves, re-enables and updates a previously excluded VNMainWndDelayInitTask test, and adjusts CMake test configuration to compile the restored test file, collectively improving function coverage on the associated components. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
1ccd76a to
1a3f152
Compare
新增/修复7个文件:
- tests/src/handler/ut_voice_to_text_task_manager.{h,cpp}: 新增语音转文字
任务管理器测试(11个用例),覆盖 addTask/getTask/setTaskResult/
getTasksForNote/hasActiveTask/removeTask
- tests/src/audio/ut_recording_curves.{h,cpp}: 新增录音曲线组件测试
(9个用例),覆盖构造/updateVolume/startRecording/stopRecording/
pauseRecording/paint
- tests/src/task/ut_vnmainwnddelayinittask.{h,cpp}: 修复历史排除测试
(移除不存在的 views/vnotemainwindow.h 引用),新增2个用例
- tests/CMakeLists.txt: 移除 ut_vnmainwnddelayinittask.cpp 排除项
验证结果:全部466个测试通过,0失败0崩溃
函数覆盖率:65.6%(678/1034),较上批63.9%提升1.7个百分点
Refs: V-1329
1a3f152 to
e717f2c
Compare
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已足够优秀,无需强制修改
// 若未来需防止 clearAllTasks 在生产环境被误调用,可增加编译期隔离
void VoiceToTextTaskManager::clearAllTasks()
{
#ifdef QT_TESTLIB_LIB
m_tasks.clear();
#else
qWarning() << "clearAllTasks is strictly restricted to test environment!";
#endif
} |
|
/merge |
背景
补充语音记事本单元测试,提升函数覆盖率至100%(Refs: V-1329)。
本批为第2批,第1批(修复5个失败用例)已合入。
修改内容(7个文件)
新增2个测试套件
tests/src/handler/ut_voice_to_text_task_manager.{h,cpp}(新增)— 语音转文字任务管理器测试,11个用例,覆盖:
addTask(有效/空 voiceId)getTask(存在/不存在)setTaskResult(成功/失败/不存在)getTasksForNotehasActiveTask(转换中/完成后)removeTask(存在/不存在)tests/src/audio/ut_recording_curves.{h,cpp}(新增)— 录音曲线组件测试,9个用例,覆盖:
updateVolume(多种增益值)startRecording/stopRecording/pauseRecording(启停/切换)paint(有增益/零增益)修复1个历史排除测试
tests/src/task/ut_vnmainwnddelayinittask.{h,cpp}(修改)— 修复被 CMakeLists 排除的历史测试:
views/vnotemainwindow.h引用(QML 改造后该头文件已删除)runtests/CMakeLists.txt(修改)— 移除
ut_vnmainwnddelayinittask.cpp的排除项,使其重新参与编译验证结果
覆盖率提升明细
voice_to_text_task_manager.cpprecording_curves.cppvnmainwnddelayinittask.cpp后续计划
待本批合入后继续下一批,优先目标:
imageprovider.cpp、voiceplayerbase.cpp、qtplayer.cpp、voice_to_text_handler.cpp等 0% 覆盖文件。Summary by Sourcery
Add new unit tests for voice-to-text task management and recording curves components, and restore a previously excluded delay-init task test to improve test coverage.
New Features:
Bug Fixes:
Build: