Repository navigation
Conversation
…topinfo Introduce a CMake-based unit test framework under autotests/, enabled via the BUILD_TESTS option (default ON). The framework uses GoogleTest with per-target test discovery, the stub-ext stubbing helper for private/internal APIs, optional gcov coverage, a one-shot runner script (run-ut.sh) and a summary generator (gen-ut-summary.py). The existing qmake build (.pro) is unaffected; CMake is an opt-in parallel build for testing. Add the first batch of unit tests for the utility/configuration classes: - Utils: 34 cases (color format conversion, validation, helpers) - Settings: 11 cases (config read/write and persistence) - DesktopInfo: 10 cases (desktop environment detection) All 55 cases pass with Qt6/DTK6.
There was a problem hiding this comment.
Sorry @add-uos, your pull request is larger than the review limit of 150,000 diff characters
|
Warning
详情 {
"export": {
"autotests/run-ut.sh": {
"b": [
"export QT_QPA_PLATFORM=${QT_QPA_PLATFORM:-offscreen}",
"export ASAN_OPTIONS=${ASAN_OPTIONS:-detect_leaks=1}",
"export LSAN_OPTIONS=suppressions=\"$SCRIPT_DIR/lsan_suppressions.txt\"",
" export projectdir=\"$PROJECT_ROOT\"",
" export builddir=\"build-${TEST_DIR}\"",
" export reportdir=\"build-${TEST_DIR}\"",
" export GTEST_XML_DIR=\"$GTEST_XML_DIR\"",
" export COVERAGE_INFO=\"$BUILD_DIR/coverage.info\""
]
}
},
"unset": {
"autotests/src/test_DesktopInfo.cpp": {
"b": [
" qunsetenv(var_.constData());"
]
}
}
} |
This was referenced Aug 25, 2026
lzwind
approved these changes
Aug 27, 2026
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Introduce a CMake-based unit test framework under
autotests/(enabled via theBUILD_TESTSoption) and add the first batch of GoogleTest unit tests for the utility/configuration classes.This is the first PR of a 3-part series that upstreams unit tests for deepin-picker. The other two PRs only add additional
test_*.cppfiles, which are automatically picked up by this framework viafile(GLOB test_*.cpp)once merged.Why
deepin-picker currently has no unit tests. This adds a reusable test framework and starts covering the core classes.
Changes
CMakeLists.txt: root CMake build with aBUILD_TESTSoption that wires inautotests/.autotests/: GoogleTest framework — per-target test discovery, thestub-extstubbing helper for private/internal APIs, optional gcov coverage, a one-shot runner (run-ut.sh) and a summary generator (gen-ut-summary.py).autotests/src/test_Utils.cpp— 34 casesautotests/src/test_Settings.cpp— 11 casesautotests/src/test_DesktopInfo.cpp— 10 casesNotes
deepin-picker.pro) is unaffected; CMake is an opt-in parallel build used only for testing.autotests/src/CMakeLists.txtglobstest_*.cpp, so subsequent test-only PRs need no CMake edits.Verification
Built and run with Qt6 / DTK6:
All 55 cases pass:
test_Utils(34),test_Settings(11),test_DesktopInfo(10).