Repository navigation
test(ut): add regression cases for 12 blocked PMS bugs without fix commits - #636
Conversation
Reviewer's GuideThis test-only PR adds 13 regression cases for 12 previously unfixed PMS bugs across window management, startup/DBus lifecycle, editor operations, color marking, and settings, records eight unsupported bugs as skips, and updates an existing BadAlloc test to avoid a baseline-specific UAF; the reported validation covers all 61 targets with 2086/2086 passing. 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 found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/common/test_settings.cpp" line_range="1235" />
<code_context>
+ QString lastMode;
+ int pokes = 0;
+ QObject::connect(Settings::instance(), &Settings::sigChangeWindowSize,
+ [&lastMode, &pokes](QString mode) {
+ lastMode = mode;
+ ++pokes;
</code_context>
<issue_to_address>
**Signal callback outlives its captures**
When `sigChangeWindowSize` is emitted after the test returns, the context-less connection on the suite-wide `Settings::instance()` invokes a lambda that references the expired `lastMode` and `pokes` locals, causing use-after-scope and potentially corrupting memory or crashing the test process.
Give the connection a test-scoped context or disconnect it before the captured locals leave scope.
</issue_to_address>
### Comment 2
<location path="tests/editor_core/test_dtextedit_edit.cpp" line_range="1370" />
<code_context>
+ edit->m_bIsAltMod = true;
+
+ // Act: 列复制(ignoreCheck=true 绕开权限校验,聚焦列分支)
+ edit->copy(true);
+
+ // Assert: 剪贴板为各选区按行拼接;文本未被改动;列选区仍在
</code_context>
<issue_to_address>
**Column cut has no regression case**
When column-selection cut is broken while copy and paste continue to work, a defect limited to column-selection cut remains undetected because the new cases exercise `copy(true)` and `paste()`, but never invoke cut or verify its text and clipboard effects. Add a column-cut case with assertions for both.
Add a column-selection cut test that checks the clipboard contents and the resulting document text.
</issue_to_address>| QString lastMode; | ||
| int pokes = 0; | ||
| QObject::connect(Settings::instance(), &Settings::sigChangeWindowSize, | ||
| [&lastMode, &pokes](QString mode) { |
There was a problem hiding this comment.
🟠 High · Signal callback outlives its captures
When sigChangeWindowSize is emitted after the test returns, the context-less connection on the suite-wide Settings::instance() invokes a lambda that references the expired lastMode and pokes locals, causing use-after-scope and potentially corrupting memory or crashing the test process.
Give the connection a test-scoped context or disconnect it before the captured locals leave scope.
Prompt for AI agents
In `tests/common/test_settings.cpp` at line 1235:
**Signal callback outlives its captures**
When `sigChangeWindowSize` is emitted after the test returns, the context-less connection on the suite-wide `Settings::instance()` invokes a lambda that references the expired `lastMode` and `pokes` locals, causing use-after-scope and potentially corrupting memory or crashing the test process.
Give the connection a test-scoped context or disconnect it before the captured locals leave scope.| edit->m_bIsAltMod = true; | ||
|
|
||
| // Act: 列复制(ignoreCheck=true 绕开权限校验,聚焦列分支) | ||
| edit->copy(true); |
There was a problem hiding this comment.
🟡 Medium · Column cut has no regression case
When column-selection cut is broken while copy and paste continue to work, a defect limited to column-selection cut remains undetected because the new cases exercise copy(true) and paste(), but never invoke cut or verify its text and clipboard effects. Add a column-cut case with assertions for both.
Add a column-selection cut test that checks the clipboard contents and the resulting document text.
Prompt for AI agents
In `tests/editor_core/test_dtextedit_edit.cpp` at line 1370:
**Column cut has no regression case**
When column-selection cut is broken while copy and paste continue to work, a defect limited to column-selection cut remains undetected because the new cases exercise `copy(true)` and `paste()`, but never invoke cut or verify its text and clipboard effects. Add a column-cut case with assertions for both.
Add a column-selection cut test that checks the clipboard contents and the resulting document text.…mmits Anchor 13 GTest cases to current master semantics (d634cba) using PMS reproduction steps, covering tab move-out/restore, window close scheduling, column edit, color mark-all, window-state option and titlebar focus chain; 8 remaining bugs recorded as SKIP with evidence in work order (no testable code path). 新增13个GTest回归用例,为无修复提交的12个PMS bug按复现步骤+当前代码 语义锚定(标签页移出回填、窗口退出调度、列编辑、颜色标记全部、窗口 状态选项、标题栏焦点链);其余8个bug经核实无代码断言路径,在工作单 记录SKIP理由。 Log: 补齐PMS批次4无修复提交bug的回归单测 Influence: 仅测试文件变更,不影响应用功能。
The error path already registers quit()+deleteLater() since upstream a66591e, so the manual deleteLater in the test ran on an already destroyed object and SIGBUSed the suite after relink; assert guard cleared by runSync's DeferredDelete dispatch instead. 异常路径自 a66591e 起已自带 quit()+deleteLater(),用例中手动补删在 对象析构后执行导致重链后 SIGBUS;改为断言 runSync 派发后 guard 已清空。 Log: 修复批次2用例在新基线上的释放语义错配 Influence: 仅测试文件变更,不影响应用功能。
136c3fd to
1c4f864
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos 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 |
1 similar comment
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos 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 |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 建议将列选区创建逻辑抽取为 createColumnSelections(edit, lines, selWidth) 辅助方法,减少 BUG46081 两个测试间的初始化代码重复 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 无 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 无 💡 改进建议代码示例本报告由 AI 代码审查工具自动生成 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
概要
批次 4(PMS 补强收尾):为 20 个无修复提交的 s1/s2 PMS bug 补齐回归单元测试。
d634cbad)锚定commit: N/A(批次4:无修复提交,按 PMS 复现步骤 + master 代码锚定)BUG184107_BadAllocDuringRead:异常路径自 a66591e 起已自带 deleteLater,旧用例手动补删在新基线上成 UAF(SIGBUS),改为断言异常路径自回收验证
影响范围
仅测试文件与 tests/.ut-inventory.json 变更,不影响应用功能。
Log: 补齐PMS批次4无修复提交bug的回归单测
Summary by Sourcery
Expand unit-test regression coverage for unresolved PMS bugs while aligning an existing cleanup test with current behavior.
Bug Fixes:
Enhancements:
Tests:
Chores: