Skip to content

test(ut): add regression cases for 12 blocked PMS bugs without fix commits - #636

Merged
deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
add-uos:test/pms-ut-blocked20-20260930
Oct 9, 2026
Merged

deepin-bot[bot] merged 2 commits into
linuxdeepin:masterfrom
add-uos:test/pms-ut-blocked20-20260930

Conversation

@add-uos

@add-uos add-uos commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

概要

批次 4(PMS 补强收尾):为 20 个无修复提交的 s1/s2 PMS bug 补齐回归单元测试。

  • 12 bug 实现 / 13 用例:基于 PMS 复现步骤 + 当前 master 语义(d634cbad)锚定
    • test_window(+5):标签页移出/回填(37292、46084、48750)、wayland 外部拖放 source==nullptr(157589)、标题栏 Tab 焦点链(41754)
    • test_startmanager(+4):窗口关闭调度与 D-Bus 注销顺序(55533、177757、49292)、保留页签关闭后带文件启动(177725)
    • test_dtextedit_edit(+2):列编辑复制/粘贴(46081)
    • test_dtextedit_mark(+1):颜色标记全部(44591)
    • test_settings(+1):窗口状态选项变更不再戳窗口(44975)
  • 8 bug 有据 SKIP:12645、38716、43444、267081、307387、342665、51218、69822(安装包/打包数据、未定案压测、玲珑脚本、输入法环境等,无代码断言路径)
  • 用例回溯注释统一 commit: N/A(批次4:无修复提交,按 PMS 复现步骤 + master 代码锚定)
  • 附带修正批次 2 用例 BUG184107_BadAllocDuringRead:异常路径自 a66591e 起已自带 deleteLater,旧用例手动补删在新基线上成 UAF(SIGBUS),改为断言异常路径自回收

验证

  • 逐目标编译+运行通过:test_window 189、test_startmanager 103、test_dtextedit_edit 83、test_dtextedit_mark 74、test_settings 67(零回归)
  • 全量套件 61 目标 2086/2086 PASS;行覆盖 89.40%、函数覆盖 99.50%

影响范围

仅测试文件与 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:

  • Add regression coverage for 12 PMS-reported window, startup, editor, marking, and settings bugs that lack corresponding fix commits.
  • Correct the BadAlloc regression test to verify the current automatic cleanup behavior without causing a use-after-free.

Enhancements:

  • Document eight PMS issues as justified skips where no code-level assertion path is available.

Tests:

  • Add 13 regression unit tests covering tab migration and focus handling, external Wayland drops, window shutdown sequencing, file opening with tab retention disabled, column copy/paste, color marking, and settings changes.
  • Validate the affected targets and full unit-test suite with all tests passing.

Chores:

  • Update the unit-test inventory for the added PMS regression coverage.

@sourcery-ai

sourcery-ai Bot commented Oct 9, 2026

Copy link
Copy Markdown

Reviewer's Guide

This 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

Change Details Files
Added regression unit coverage for 12 PMS bugs without corresponding fix commits, anchoring expected behavior to the reproduction steps and current master implementation.
  • Added five window regressions covering tab transfer/reinsertion, external Wayland drops without a drag source, and titlebar-to-bottombar focus traversal.
  • Added four StartManager regressions covering multi-window close behavior, single DBus unregister/quit scheduling, unregister-before-quit ordering, and opening a file when tab retention is disabled.
  • Added two column-edit regressions covering copy line joining and paste replacement with undo restoration.
  • Added color-mark-all coverage for applying the selected color to all matches and rendered selections.
  • Added settings coverage ensuring window-state changes update the option without emitting window poke signals.
tests/widgets_ut/test_window.cpp
tests/startmanager/test_startmanager.cpp
tests/editor_core/test_dtextedit_edit.cpp
tests/editor_core/test_dtextedit_mark.cpp
tests/common/test_settings.cpp
Removed unsupported regression cases and standardized provenance metadata for the no-fix PMS tests.
  • Documented eight PMS bugs as evidence-based SKIP cases in the unit-test inventory.
  • Updated test traceability comments to identify the batch and lack of a fix commit.
  • Regenerated the unit-test inventory to reflect the added and skipped cases.
tests/.ut-inventory.json
tests/widgets_ut/test_window.cpp
tests/startmanager/test_startmanager.cpp
tests/editor_core/test_dtextedit_edit.cpp
tests/editor_core/test_dtextedit_mark.cpp
tests/common/test_settings.cpp
Corrected the existing BadAlloc regression test to match the current exception-path ownership behavior.
  • Removed manual deferred deletion that became a use-after-free on the current baseline.
  • Retained the assertion that the worker is automatically reclaimed after the exception path completes.
tests/common2/test_fileloadthread.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨

QString lastMode;
int pokes = 0;
QObject::connect(Settings::instance(), &Settings::sigChangeWindowSize,
[&lastMode, &pokes](QString mode) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟠 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);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

lzwind
lzwind previously approved these changes Oct 9, 2026
…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: 仅测试文件变更,不影响应用功能。
@add-uos
add-uos force-pushed the test/pms-ut-blocked20-20260930 branch from 136c3fd to 1c4f864 Compare October 9, 2026 01:54
@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

1 similar comment
@deepin-ci-robot

Copy link
Copy Markdown

[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.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 99 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交为纯测试代码变更,新增13个GTest回归用例覆盖12个PMS bug场景,修改1个已有用例修复释放语义错配。代码语法正确、逻辑清晰、注释详尽、无安全漏洞。仅个别测试用例的初始化设置代码存在轻微重复。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 无


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. tests/editor_core/test_dtextedit_edit.cpp:1347-1417 - 两个 BUG46081 测试用例的列选区初始化代码(创建3行选区的循环)存在轻微重复,可抽取为辅助方法减少冗余

建议: 建议将列选区创建逻辑抽取为 createColumnSelections(edit, lines, selWidth) 辅助方法,减少 BUG46081 两个测试间的初始化代码重复


3. 代码性能 ✅

评价: 优秀 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: 无


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 存在 0 个安全漏洞

漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个

安全漏洞详情:
✅ 未发现安全漏洞

建议: 无


💡 改进建议代码示例


本报告由 AI 代码审查工具自动生成

@add-uos
add-uos requested a review from lzwind October 9, 2026 02:18
@add-uos

add-uos commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: blocked)

@deepin-bot
deepin-bot Bot merged commit 846b4c1 into linuxdeepin:master Oct 9, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants