test: add GTest for panels/dock classes - #1710
Conversation
1. Add docktests for dockiteminfo, hoverpreviewproxymodel, globals, windowmanager and trayitempositionmanager 2. Include 111 test cases (1 disabled, 0 failures) 3. Add independent dock_test_objects OBJECT library to avoid symbol clashes with frame/applets test objects 4. Add stubs/QQmlEngine and stubs/taskmanager.h for Qt6 Qml dev-package-missing and build-time dependency isolation 5. Wire add_subdirectory(docktests) and DOCK_BUILD_COVERAGE gate Influence: 1. Run docktests with QT_QPA_PLATFORM=offscreen, verify 111 cases pass (0 failures, 1 disabled) 2. Verify coverage meets thresholds (function 94.6%, line 92.6%, branch 57.4%) 3. Confirm dock tests build independent of frame/applets 4. Verify dockiteminfo_tests under dbus-run-session test: 为 panels/dock 多模块类补充 GTest 单元测试 1. 新增 docktests,覆盖 dockiteminfo、hoverpreviewproxymodel、 globals、windowmanager 与 trayitempositionmanager 2. 包含 111 个测试用例(1 禁用、0 失败) 3. 新增独立 dock_test_objects OBJECT 库,避免与 frame/applets 测试对象的符号冲突 4. 新增 stubs/QQmlEngine 与 stubs/taskmanager.h,解决 Qt6 Qml 开发包缺失及编译期依赖隔离 5. 接入 add_subdirectory(docktests) 与 DOCK_BUILD_COVERAGE 门控 Influence: 1. 以 QT_QPA_PLATFORM=offscreen 运行 docktests,验证 111 用例通过(0 失败、1 禁用) 2. 验证覆盖率达标(函数 94.6%、行 92.6%、分支 57.4%) 3. 确认 dock 测试独立于 frame/applets 构建 4. 在 dbus-run-session 下验证 dockiteminfo_tests
There was a problem hiding this comment.
Sorry @MyLeeJiEun, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: MyLeeJiEun 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 |
|
Hi @MyLeeJiEun. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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. |
Reviewer's GuideAdds a new docktests GTest suite and coverage target for dock panel classes, wiring it into the existing tests/panels/dock tree, with an OBJECT library for shared non-Q_OBJECT sources and multiple focused test executables for HoverPreviewProxyModel, Globals helpers, DockItemInfo DBus/Debug behavior, WindowManager runtime tracking, and TrayItemPositionManager layout logic, plus minimal Qt stubs to decouple build-time dependencies. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Summary
Adds 111 GTest unit tests for the
panels/dockclasses of dde-shell, which previously had zero test coverage. This is the dock batch, separate from PR #1703 (frame batch) and PR #1707 (applets batch) — no frame or applets files are included here.Test scope (5 classes, 111 tests)
DockItemInfopanels/dock/dockiteminfo.cppHoverPreviewProxyModelpanels/dock/hoverpreviewproxymodel.cppGlobalspanels/dock/global.hWindowManagerpanels/dock/windowmanager.cppTrayItemPositionManagerpanels/dock/trayitempositionmanager.cppAll 111 tests pass (0 failed / 1 disabled). Sources under test are compiled into an independent OBJECT library
dock_test_objects(separate from frame/applets test objects) to avoid symbol clashes. No DConfig / Wayland runtime required — stubs isolate build-time dependencies.Build
Coverage
Enable coverage through the build-system target:
cmake -B build -DBUILD_TESTING=ON -DDOCK_BUILD_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug cmake --build build --target dock_coverage # report: build/dock_coverage/html/index.htmllcov results (generated code excluded):
This PR does not modify
src/— tests only.Notes
tests/panels/dock/taskmanagerpattern (BUILD_TESTINGgate +gtest_discover_tests), registered with adock_ctest prefix.dock_test_objectsOBJECT library avoids symbol clashes with the frame (test(frame): add GTest unit tests for core framework classes (100 tests) #1703) and applets (test(applets): add GTest unit tests for dde-apps classes (54 tests) #1707) test objects.stubs/QQmlEngine,stubs/taskmanager.h) isolate Qt6 Qml dev-package-missing and build-time dependencies.dockiteminfo_testsrequiresdbus-run-sessionfor DBus interaction.Tracking issue: DDE-107 补充 dde-shell 项目测试代码
Summary by Sourcery
Expand dock panel test coverage with isolated GoogleTest targets covering core dock classes and optional coverage reporting.
Enhancements:
Build:
Tests: