Skip to content

test: add unit tests for application, controls and widgets - #561

Merged
pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:test/ut-app-controls-widgets
Sep 4, 2026
Merged

test: add unit tests for application, controls and widgets#561
pengfeixx merged 1 commit into
linuxdeepin:masterfrom
pengfeixx:test/ut-app-controls-widgets

Conversation

@pengfeixx

Copy link
Copy Markdown
Contributor

内容

新增应用级(editorapplication)与查找/替换栏、标签栏、工具栏、设置对话框、底栏、主窗口等控件的 GTest 单元测试,共 20 个文件。

说明

  • 基于 master 独立拉出,可独立评审与合并
  • 仅新增单元测试代码,不改动编辑器本体功能

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

Sorry @pengfeixx, your pull request is larger than the review limit of 150,000 diff characters

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

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

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次提交为纯单元测试代码新增,共20个文件10450行,覆盖EditorApplication、控件层和组件层。未发现安全漏洞,代码结构清晰,注释极为完整,测试策略成熟一致。仅有少量DBus桩代码跨文件重复。

🔍 详细分析

1. 语法逻辑 ✅

评价: 优秀 ✅ 通过

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

建议: 语法正确,逻辑清晰


2. 代码质量 ✅

评价: 优秀 ✅ 通过

潜在问题:

  1. tests/widgets_ut/test_bottombar.cpp, tests/widgets_ut/test_window.cpp, tests/widgets_ut/test_dtextedit_window_integration.cpp:0 - DBus桩矩阵(systemBus/sessionBus/callWithArgumentList拦截)在多个测试文件中重复编写,建议提取为共享工具函数减少维护成本

建议: 建议将DBus桩安装逻辑提取到test_env.h或独立的stub_helper.h中,类似controls_ut模块的test_env.h共享环境模式


3. 代码性能 ✅

评价: 优秀 ✅ 通过

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

建议: 性能良好,资源使用合理


4. 代码安全 🔒

评价: 优秀 ✅ 通过

🔐 发现 0 个安全漏洞

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

建议: 安全合规


💡 改进建议代码示例

// 暂无代码示例

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

@deepin-ci-robot

Copy link
Copy Markdown

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

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 GTest suites covering the editor application, find/replace bars,
tab bar, toolbar, settings dialog, bottom bar and the main window.

新增应用级及查找替换栏、标签栏、工具栏、设置对话框、底栏、主窗口
等控件的 GTest 单元测试。

Log: 新增应用级与控件类单元测试
Influence: 仅新增单元测试代码,不影响编辑器本体功能。
@pengfeixx
pengfeixx force-pushed the test/ut-app-controls-widgets branch from 2753775 to fc74f35 Compare September 4, 2026 08:46
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
  • 检测到敏感词unset变动
详情
    {
    "unset": {
        "tests/app_ut/test_editorapplication.cpp": {
            "b": [
                "        qunsetenv(\"XDG_CONFIG_HOME\");",
                "        qunsetenv(\"XDG_DATA_HOME\");"
            ]
        },
        "tests/controls_ut/test_env.h": {
            "b": [
                "        // qputenv/qunsetenv \u8ba1\u6570\u5e73\u8861\uff0c\u907f\u514d\u5411\u5bbf\u4e3b\u8fdb\u7a0b\u6cc4\u6f0f",
                "            qunsetenv(\"XDG_CONFIG_HOME\");",
                "            qunsetenv(\"XDG_DATA_HOME\");"
            ]
        },
        "tests/widgets_ut/test_bottombar.cpp": {
            "b": [
                "        qunsetenv(\"XDG_CONFIG_HOME\");",
                "        qunsetenv(\"XDG_DATA_HOME\");"
            ]
        },
        "tests/widgets_ut/test_colorselectwdg.cpp": {
            "b": [
                "        qunsetenv(\"XDG_CONFIG_HOME\");",
                "        qunsetenv(\"XDG_DATA_HOME\");"
            ]
        },
        "tests/widgets_ut/test_ddropdownmenu.cpp": {
            "b": [
                "// \u73af\u5883\u9694\u79bb\uff1aXDG \u91cd\u5b9a\u5411\u4e34\u65f6\u76ee\u5f55\uff08SetUpTestSuite/TearDownTestSuite qputenv/qunsetenv \u914d\u5e73\uff09\uff1b",
                "        qunsetenv(\"XDG_CONFIG_HOME\");",
                "        qunsetenv(\"XDG_DATA_HOME\");"
            ]
        },
        "tests/widgets_ut/test_dtextedit_window_integration.cpp": {
            "b": [
                "        qunsetenv(\"XDG_CONFIG_HOME\");",
                "        qunsetenv(\"XDG_DATA_HOME\");"
            ]
        },
        "tests/widgets_ut/test_pathsettintwgt.cpp": {
            "b": [
                "        qunsetenv(\"XDG_CONFIG_HOME\");",
                "        qunsetenv(\"XDG_DATA_HOME\");"
            ]
        }
    }
}

@pengfeixx
pengfeixx merged commit 6db5832 into linuxdeepin:master Sep 4, 2026
13 of 17 checks passed
@pengfeixx
pengfeixx deleted the test/ut-app-controls-widgets branch September 4, 2026 08:48
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