Repository navigation
fix: enable BUILD_TESTING in debian packaging - #841
Conversation
Reviewer's GuideConfigurationEnable test targets during Debian builds and adjust coverage, runtime environment, fixtures, and the non-coverage test target so the suite can build and run under packaging constraints.
TestsExpand category parser and matching tests to cover supported mappings, tie-breaking, edge cases, and the documented missing XDG reading mapping.
Add app-info monitor tests for lifecycle, fixture discovery, GIO-derived fields, conversion helpers, and change signals.
Add a reusable folder-model stub used to isolate model-adapter tests from the shared provider.
Expand GIO app-info tests for desktop-file lookup and launching with valid and invalid fixture IDs.
Expand icon utility tests across sizing, SVG loading, caching, calendar icons, and theme-icon lookup paths.
Adapt item-arrangement tests to the folder-model stub and verify forwarding, page operations, and singleton creation.
Update items-page tests to use the stub-backed arrangement model and clean up the singleton provider after the test.
Correct the shared-model adapter test to pass the normalized desktop ID to the lookup API.
Add trash monitor tests for construction, item counts, and event-specific signal behavior.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
3fc427d to
1c0ae61
Compare
1. Enable BUILD_TESTING=ON in debian/rules for dpkg packaging 2. Add unit tests for models, utils, and GIO modules (18 targets) 3. Add coverage instrumentation with gcov for test builds 4. Add foldermodelstub.h and fix CMake configuration for test runtime 5. Set up headless Qt and XDG_DATA_HOME fixtures for test execution test: 添加单元测试并启用打包测试 1. 在 debian/rules 中启用 BUILD_TESTING=ON 以支持 dpkg 打包测试 2. 为模型、工具类和 GIO 模块添加单元测试(18 个目标) 3. 使用 gcov 添加覆盖率插桩支持测试构建 4. 添加 foldermodelstub.h 并修复 CMake 配置以支持测试运行 5. 设置无头 Qt 和 XDG_DATA_HOME 测试夹具以支持测试执行 Influence: 1. Verify dpkg build compiles and runs dde-launchpad unit tests 2. Verify 18 test cases pass with ctest 3. Verify coverage report generation with gcov Influence: 1. 验证 dpkg 打包时编译并运行 dde-launchpad 单元测试 2. 验证 18 个测试用例通过 ctest 执行 3. 验证 gcov 覆盖率报告生成 Log: Enable unit test compilation and execution during dpkg packaging Log: 打包时启用单元测试编译与执行
1c0ae61 to
216f34c
Compare
|
Sorry @MyLeeJiEun, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 21 hours and 11 minutes by commenting |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['无需修改,语法逻辑正确'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['将 fromGStrV 声明移入 appinfomonitor.h,或通过 allAppInfosShouldBeShown() 间接测试', "移除 'transiation' 测试键或使用 QEXPECT_FAIL 文档化生产代码拼写缺陷", 'getThemeIconCalendarDynamic 改用 QEXPECT_FAIL + QVERIFY(result) 断言正确行为', '使用 init() 槽重置 FolderModelStub 状态,避免测试间状态依赖', '统一注释语言为英文', 'commitDndOperationDoesNotCrash 增加 QCOMPARE 验证 lastMove 的 ID 值', 'trashItemCountReturnsNonNegative 改用 QVERIFY(count >= 0) 或添加 XDG_DATA_HOME 隔离'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['临时文件名追加 QCoreApplication::applicationPid() 增强唯一性'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['无需安全加固'] 💡 改进建议代码示例// tests/iconutilstest.cpp — getThemeIconCalendarDynamic 改进示例
void TestIconUtils::getThemeIconCalendarDynamic()
{
QString tempDir = QStandardPaths::standardLocations(QStandardPaths::TempLocation).constFirst();
QString calendarTempFile = tempDir + "/" +
QString::number(QDate::currentDate().year()) + "_" +
QString::number(QDate::currentDate().dayOfYear()) + "_" +
QString::number(QCoreApplication::applicationPid()) + ".svg";
struct FileCleaner {
QString name;
~FileCleaner() { if (!name.isEmpty()) QFile::remove(name); }
} cleaner{calendarTempFile};
QPixmap pixmap;
// Use QEXPECT_FAIL to document the known production bug
// (iconutils.cpp:68 uses iconName instead of actualIconName)
QEXPECT_FAIL("", "getThemeIcon uses iconName instead of actualIconName for loadSvg (known defect)", Continue);
bool result = IconUtils::getThemeIcon(pixmap, QStringLiteral("dde-calendar-dynamic"), 32);
QVERIFY(result);
}
// tests/categoryutilstest.cpp — remove or mark "transiation" typo
void TestCategoryUtils::parseXdgCategoryStringAllDevelopmentEntries()
{
const QStringList keys = {
QStringLiteral("development"), QStringLiteral("building"),
QStringLiteral("debugger"), QStringLiteral("guidesigner"),
QStringLiteral("ide"), QStringLiteral("profiling"),
QStringLiteral("revisioncontrol"),
// "transiation" is a known typo in production xname2ty mapping;
// the correct spelling "translation" maps to CategoryReading.
// Remove this key or use QEXPECT_FAIL to document the defect.
QStringLiteral("webdevelopment"),
};
for (const auto &key : keys) {
const auto result = CategoryUtils::parseXdgCategoryString(key);
QVERIFY2(result.size() >= 1, qPrintable(QStringLiteral("No result for: ") + key));
QVERIFY2(result.contains(C::CategoryDevelopment), qPrintable(QStringLiteral("Missing Development for: ") + key));
}
}
// tests/itemarrangementproxymodeltest.cpp — use init() to reset stub state
void TestItemArrangementProxyModel::init()
{
m_folderModel.broughtToFront.clear();
m_folderModel.lastMove.clear();
}
// tests/trashmonitortest.cpp — use QVERIFY(count >= 0) for robustness
void TestTrashMonitor::trashItemCountReturnsNonNegative()
{
TrashMonitor monitor(nullptr);
int count = monitor.trashItemCount();
QVERIFY(count >= 0);
}本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy, 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 |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Enable BUILD_TESTING in debian packaging for dde-launchpad
This PR enables unit test compilation and execution during dpkg packaging by adding
-DBUILD_TESTING=ONto the CMake configure flags indebian/rules, and adds comprehensive unit tests for dde-launchpad.Changes
debian/rules: Appended-DBUILD_TESTING=ONtooverride_dh_auto_configureCMake parameterstests/: Added 18 unit test targets covering models, utils, and GIO modulestests/CMakeLists.txt: Added coverage instrumentation, test fixtures, and headless Qt configurationtests/foldermodelstub.h: Added stub for dde-shell shared folder model interfaceTest Results
Related Issue
DDE-574
Summary by Sourcery
Enable and harden the project’s unit-test suite for Debian packaging while broadening coverage across application, model, category, monitoring, and icon functionality.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests: