Skip to content

test(page): align 3 tests with fixed source behavior - #968

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:test-align-page-driver-tests-with-fixed-source
Nov 11, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
add-uos:test-align-page-driver-tests-with-fixed-source

Conversation

@add-uos

@add-uos add-uos commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

问题 / Problem

流水线 UT 失败 3 个用例(task-25710492 / 9a2caa8 合入后):

  • UT_PageDriverControl.UT_PageDriverControl_closeEvent_Done
  • UT_PageDriverControl.UT_PageDriverControl_isRunning_visible
  • UT_PageDriverManager_Misc.UT_PageDriverManager_networkIsOnline

三个用例均为在 9a2caa84(7 项源码缺陷修复)之前编写,固化的是修复前的旧缺陷行为(networkIsOnline 用例注释中自标"逻辑疑似反转(Mode 5 缺陷候选)"),源码修复合入后断言全部反转失效。

修复 / Fix(仅测试代码,无生产逻辑变更)

用例 旧断言(缺陷行为) 新断言(修复后行为)
closeEvent_Done close 重入 → refreshInfo 发 2 次 + 窗口隐藏 重入已消除 → 仅发 1 次,事件不拦截
isRunning_visible 匹配不存在的 "PageDriverControlWindow" 匹配构造函数设置的 "PageDriverControl" 且窗口可见
networkIsOnline == Disconnected 反置:Online→false != Disconnected:Online/Unknown→true、Disconnected→false

另更新 ut_pagedrivercontrol.cpp SPDX 版权年份 2022 → 2022 - 2026。

自测 / Verification

  • 本地 tests/test-prj-running.sh(Qt6):3281/3281 全部通过,0 失败
  • 行覆盖率 90.90%,函数覆盖率 95.80%
  • 失败用例与流水线 task-25710492cbd04b5cb39f1bccf06888d6 完全一致,修复后本地复现消失

Summary by Sourcery

Update page driver tests to reflect corrected source behavior and restore the full test suite.

Enhancements:

  • Align page driver unit-test expectations with the corrected close-event, running-state, and network-reachability behavior.

Tests:

  • Update three page driver tests to validate the fixed production behavior and prevent regressions.

Chores:

  • Refresh the SPDX copyright year range for the page driver control test.

UT_PageDriverControl_closeEvent_Done: close reentry was eliminated,
closeEvent now emits refreshInfo exactly once instead of twice.
UT_PageDriverControl_isRunning_visible: isRunning matches the
constructor-set objectName "PageDriverControl", not the nonexistent
"PageDriverControlWindow".
UT_PageDriverManager_networkIsOnline: Qt6 branch returns
reachability != Disconnected, so Online/Unknown are online and
Disconnected is offline.

同步三个单测与源码缺陷修复后的行为:closeEvent 重入消除后
refreshInfo 仅触发一次;isRunning 匹配构造函数设置的 objectName;
networkIsOnline 修正反置判断,Online/Unknown 在线、Disconnected 离线。

Log: 修复与源码行为不一致的三个单测
Influence: 仅测试代码,无生产逻辑变更;本地 3281/3281 全部通过。
@sourcery-ai

sourcery-ai Bot commented Nov 10, 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 16 hours and 28 minutes by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Tests

Update the Done close-event test and file copyright notice to reflect the single refresh and accepted close event after re-entry was eliminated.

  • deepin-devicemanager/tests/src/Page/ut_pagedrivercontrol.cpp L2, L175-178

Make the visible isRunning test use the constructor’s PageDriverControl object name and verify that renaming the window makes it unrecognized.

  • deepin-devicemanager/tests/src/Page/ut_pagedrivercontrol.cpp L275-276, L281-287

Align the networkIsOnline test expectations with the fixed reachability behavior: Online and Unknown are online, while Disconnected is offline.

  • deepin-devicemanager/tests/src/Page/ut_pagedrivermanager_misc.cpp L171, L176-186

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


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交为测试代码对齐变更,将3个单元测试的断言期望与修复后的源码行为保持一致。变更仅涉及测试文件,语法正确、逻辑清晰、注释完整,无安全漏洞,无性能问题。启发式扫描与OCR审查均未发现问题。

🔍 详细分析

1. 语法逻辑 ✅

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

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

建议: []


2. 代码质量 ✅

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

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

建议: []


3. 代码性能 ✅

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

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

建议: []


4. 代码安全 🔒

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

🔐 发现 0 个安全漏洞

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

建议: []


💡 改进建议代码示例


本报告由 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 Nov 11, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot
deepin-bot Bot merged commit 2fa1615 into linuxdeepin:master Nov 11, 2026
16 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