Skip to content

test(unittest): align setBackingUpDriverUI test with fixed progress semantics - #916

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:test/widget-fix-followup
Oct 26, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:test/widget-fix-followup

Conversation

@add-uos

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

Copy link
Copy Markdown
Contributor

变更内容

PR #877 在 master 修复了 setBackingUpDriverUI 的进度 ×10 缺陷后, 单测中编码旧缺陷行为的用例随之失效:

  • SetBackingUpDriverUI_Called_ProgressScaledByTen(断言 ×10 后的 50)在当前 master 上失败
  • 本 PR 将其重命名为 SetBackingUpDriverUI_Called_ProgressUsesValueAsIs 并断言修正后的语义(进度值按原样写入, 5)
  • 同步刷新 sectionSizeHint 测试中已过时的"源码 dynamic_cast 未判空"注释(判空已由 PR fix: add null check, fix progress value and destructor order in devicemanager #877 合入)

仅改 2 个测试源码文件, 不含生产代码变更。

验证

基于最新 master(54e136b)本地验证: 136/136 用例通过(DetectedStatusWidget 36 + DriverTableView 53 + DetailTreeView 47), 且 DetectedStatusWidget / DriverTableView / DetailTreeView 三个套件进程退出码均为 0(#877 的析构顺序修复使此前的退出阶段崩溃不再出现)。

Summary by Sourcery

Align unit tests with the corrected backup progress semantics and current style-handling behavior.

Enhancements:

  • Update unit tests to reflect the corrected behavior that backup progress values are used as provided.
  • Refresh DriverTableView test comments to match the current null-safe style handling.

Tests:

  • Align DetectedStatusWidget and DriverTableView unit tests with the latest production behavior and test setup.

…emantics

The * 10 progress scaling defect in setBackingUpDriverUI was fixed on
master (PR linuxdeepin#877), so SetBackingUpDriverUI_Called_ProgressScaledByTen
asserting the buggy value 50 now fails. Rename it to
SetBackingUpDriverUI_Called_ProgressUsesValueAsIs and expect the value
written as-is (5). Also refresh stale comments about the unchecked
dynamic_cast<DStyle*> now that sectionSizeHint has a null guard.

Verified against current master: 136/136 cases pass (36+53+47) and the
DetectedStatusWidget suite now exits cleanly.
@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026

Copy link
Copy Markdown

Sorry @add-uos, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 2 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 26, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

本 PR 仅更新两个单元测试源码文件:将 setBackingUpDriverUI 测试对齐到修复后的原样进度语义,并修正 DriverTableView 测试中关于 DStyle 与 dynamic_cast 的过时注释;不涉及生产代码变更,基于最新 master 验证 136/136 个相关用例通过且三个测试套件正常退出。

File-Level Changes

Change Details Files
更新备份进度单元测试,使其验证修复后的“按原值写入”语义。
  • 重命名测试以反映当前进度语义。
  • 将进度断言从 50 调整为传入值 5,并同步更新测试注释。
deepin-devicemanager/tests/src/Widget/ut_detectedstatuswidget.cpp
刷新表格视图测试中的样式环境说明,使注释与生产代码的空指针防护保持一致。
  • 移除 dynamic_cast 未判空导致崩溃的过时说明。
  • 保留 DStyle 预置逻辑以确保测试环境确定性。
deepin-devicemanager/tests/src/Widget/ut_drivertableview.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

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交为纯单元测试代码更新,用于与已修复的源码语义对齐:将 setBackingUpDriverUI 进度断言 由错误的 ×10 缩放(50)更正为原样写入(5),并同步更新 ut_drivertableview 中 DStyle 预置注释, 说明源码已对 dynamic_cast 判空加固。四维度(语法逻辑/代码质量/代码性能/代码安全)均通过, 启发式扫描与 OCR 审查均未发现问题,0 个安全漏洞。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

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

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

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

建议: []


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

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

建议: []


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: []


💡 改进建议代码示例

// 本次变更已正确,无需修复。示例(保持当前写法): // Act: 正在备份界面(进度 5/10, 进度条直接使用传入值) w->setBackingUpDriverUI("RTL8168", 10, 5); // Assert: 进度值按原样写入(源码已移除错误的 ×10 缩放) EXPECT_EQ(w->mp_Progress->value(), 5);

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

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: add-uos, lzwind

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

@add-uos

add-uos commented Oct 26, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
deepin-bot Bot merged commit dac50d9 into linuxdeepin:master Oct 26, 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