test: add autotests Google Test framework + core/common-module unit tests - #512
test: add autotests Google Test framework + core/common-module unit tests#512add-uos wants to merge 2 commits into
Conversation
Introduce a standalone autotests/ test suite (Google Test + gmock, lcov coverage) for deepin-editor and cover the common module's core classes. Batch 1 classes (all done, 0 failed, 0 skipped): - Utils, Config, PerformanceMonitor, Eventlogutils, TextFileSaver, FileLoadThread, CSyntaxHighlighter, UrlInfo Batch statistics: - Total target classes: 8 - Passed: 8 - Failed: 0 - Skipped: 0 - Google Test cases: 68 (all passing, QT_QPA_PLATFORM=offscreen) - Function coverage (lcov, */src/*): 6.3% (76/1199) -- baseline Framework: - autotests/CMakeLists.txt: standalone project; compiles app sources into a single deepin-editor-autotest executable (deepin-editor has no lib target), per-class test files under autotests/<module>/test_*.cpp. - 3rdparty/stub/: built-in stub-ext (no network download). - run-ut.sh: configure + build + run + lcov + report, sources an optional ~/ut-deps user-local -dev prefix for headless/CI reproducibility. - report_generator/: HTML/CSV report emitter. Baseline commit: - eba9ef7 - test: fix 11 failing unit tests for deepin-editor (Qt6/TextFileSaver refactor) - 2026-08-07
Cover the QPlainTextEdit-based editor undo/redo command classes with round-trip redo/undo tests, and switch the test harness main() to QApplication so QWidget-based tests (QPlainTextEdit) run headless. Batch 2 classes (all done, 0 failed, 0 skipped): - DeleteTextUndoCommand2, MidButtonInsertTextUndoCommand, DragInsertTextUndoCommand Batch statistics: - Total target classes: 3 - Passed: 3 - Failed: 0 - Skipped: 0 - Google Test cases added: 4 (72 total, all passing) - Function coverage (lcov, */src/*): 7.1% (85/1199) Baseline commit: - eba9ef7 - test: fix 11 failing unit tests for deepin-editor (Qt6/TextFileSaver refactor) - 2026-08-07
There was a problem hiding this comment.
Sorry @add-uos, your pull request is larger than the review limit of 150000 diff characters
|
[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 |
Reviewer's GuideAdds a standalone Google Test-based autotest framework for deepin-editor, including build scaffolding, a local stub library, a rich HTML/CSV report generator pipeline, and an initial batch of unit tests for core common/editor modules, all without modifying production source code. Flow diagram for the new run-ut.sh unit test pipelineflowchart TD
A[run-ut.sh] --> B{from_step <= 1?}
B -->|yes| C[step_1_prepare_build_env]
C --> D[step_2_configure_cmake]
D --> E[step_3_compile_tests]
E --> F[step_4_run_tests<br/>ctest, test_output.log, test_results.xml]
F --> G[step_5_generate_coverage<br/>lcov, genhtml]
G --> H[step_6_generate_test_report<br/>python3 generate-report.py]
B -->|no, from_step=4| F
B -->|no, from_step=5| G
B -->|no, from_step=6| H
H --> I[test_report.html]
H --> J[test_data.json]
G --> K[coverage/html/index.html]
subgraph BuildDir[build-autotests]
C
D
E
F
G
end
subgraph Reports[test-reports]
F
G
H
I
J
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
@add-uos: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
deepin-editor 单元测试(autotests/)—— 自动生成首轮
为 deepin-editor 新增独立的
autotests/Google Test 测试套件(lcov 覆盖率),首轮覆盖核心模块。框架
autotests/CMakeLists.txt:独立 CMake 项目;deepin-editor 无库目标,故将应用源码直接编译进单个deepin-editor-autotest可执行文件,按类组织autotests/<module>/test_<class>.cpp。3rdparty/stub/:内置 stub-ext(不从网络下载)。run-ut.sh:配置 + 编译 + 运行 + lcov + 报告,自动加载可选的~/ut-deps用户级 -dev 前缀以支持无头/CI 复现。report_generator/:HTML/CSV 报告生成器。首轮覆盖类(全部通过,0 失败 / 0 跳过)
common:
Utils、Config、PerformanceMonitor、Eventlogutils、TextFileSaver、FileLoadThread、CSyntaxHighlighter、UrlInfoeditor:
DeleteTextUndoCommand2、MidButtonInsertTextUndoCommand、DragInsertTextUndoCommand结果
QT_QPA_PLATFORM=offscreen)*/src/*):7.1%(85/1199)——首轮基线复现
./autotests/run-ut.sh # 报告:build-autotests/test-reports/test_report.html、build-autotests/coverage/html/index.html说明
eba9ef7c(test: fix 11 failing unit tests ...)。Summary by Sourcery
Add a standalone Google Test-based autotest framework, including build scripts, stubbing infrastructure, and HTML/CSV reporting, to cover core/common deepin-editor modules and establish a coverage-measured testing baseline.
New Features:
Build:
Tests:
Chores: