Fix/enable orphan unit tests - #891
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideEnables two previously orphaned test suites by fixing includes and linking, wires their headers into the main test harness, and deletes seven dead orphan test files whose corresponding production classes are unused and API-drifted. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- Instead of hardcoding
-lgobject-2.0intoLIBS, consider wiring it through the same pkg-config or shared library configuration mechanism used for the rest of the GLib stack so the test project stays portable across different toolchains/platforms. - The direct
../../src/widgets/colorbutton.{h,cpp}paths in the test project duplicate source locations; if possible, refactor to reuse an existing shared .pri/.pro fragment or library target so that future moves/renames ofcolorbuttondon’t require manual updates in the test build.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- Instead of hardcoding `-lgobject-2.0` into `LIBS`, consider wiring it through the same pkg-config or shared library configuration mechanism used for the rest of the GLib stack so the test project stays portable across different toolchains/platforms.
- The direct `../../src/widgets/colorbutton.{h,cpp}` paths in the test project duplicate source locations; if possible, refactor to reuse an existing shared .pri/.pro fragment or library target so that future moves/renames of `colorbutton` don’t require manual updates in the test build.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Investigation of 9 remaining orphan test files (not compiled by the
test build) via code graph + build attempts. Findings:
Enabled (4 new test cases, 1487 -> 1491):
- widgets/ut_colorbutton.h: fix include path (../widgets/ ->
../../src/widgets/), adds ColorButtonTest
- gstrecord/ut_gstrecordx.h: add -lgobject-2.0 to LIBS, adds
GstRecordXTest (hardware cases already skipped via SKIP_TESTS)
Deleted (7 dead test files, -629 lines):
- utils/ut_toolshape.h: empty fixture with 0 TEST_F cases
- dbusinterface/ut_drawinterface.h: wrong include path + depends on
external deepin-draw DBus + system("killall")
- widgets/ut_majtoolbar.h / widgets/ut_subtoolbar.h /
ut_record_option_panel.h / utils/ut_screenutils.h /
ut_process_tree_ext.h: root cause is main project builds on Qt5
while tests use Qt6; ConfigSettings was refactored value()->
getValue() but these source files retain active calls to the old
API (they only "compiled" because the test build never compiled
them). The corresponding source classes (MajToolBar, SubToolBar,
RecordOptionPanel, ScreenUtils, ProcessTree) have zero external
references in the project — legacy dead code.
对9个剩余孤儿测试通过代码图谱+编译尝试分析:启用ut_colorbutton(修
复include路径)和ut_gstrecordx(加-lgobject-2.0链接),新增4个测试
用例(1487->1491);删除7个死代码测试文件。根因是主项目用Qt5构建、
测试用Qt6,ConfigSettings重构value()->getValue()后5个源文件仍残留
旧API调用,对应类在项目中零外部引用,属历史遗留死代码。
Log: 启用有效孤儿测试并删除死代码测试
Influence: 新增4个测试用例(1491总计),删除7个无效孤儿测试文件(-629行),清理test_all_interfaces.h暂缓注释。
8dc7ae8 to
628021e
Compare
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码修改已足够规范,无需额外改进示例
// 路径修复已准确到位:
#include "../../src/widgets/colorbutton.h" |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: lzwind, 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 |
|
/merge |
Investigation of 9 remaining orphan test files (not compiled by the test build) via code graph + build attempts. Findings:
Enabled (4 new test cases, 1487 -> 1491):
../../src/widgets/), adds ColorButtonTest
Deleted (7 dead test files, -629 lines):
对9个剩余孤儿测试通过代码图谱+编译尝试分析:启用ut_colorbutton(修
复include路径)和ut_gstrecordx(加-lgobject-2.0链接),新增4个测试 用例(1487->1491);删除7个死代码测试文件。根因是主项目用Qt5构建、
测试用Qt6,ConfigSettings重构value()->getValue()后5个源文件仍残留 旧API调用,对应类在项目中零外部引用,属历史遗留死代码。
Log: 启用有效孤儿测试并删除死代码测试
Influence: 新增4个测试用例(1491总计),删除7个无效孤儿测试文件(-629行),清理test_all_interfaces.h暂缓注释。
Summary by Sourcery
Enable previously orphaned unit tests for ColorButton and GstRecordX while removing obsolete test files and updating test build links.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: