test(editor): extend tests and remove empty stubs - #502
Conversation
There was a problem hiding this comment.
Sorry @pengfeixx, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Reviewer's GuideThis PR extends unit test coverage for several editor and controls classes (EditWrapper, ParseFileEvent, FlashTween, WarningNotices, LeftAreaTextEdit), updates license headers, and removes obsolete commented‑out tests for DetectCode and InsertBlockByTextCommand. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Add test cases for WarningNotices, EditWrapper, FlashTween, LeftAreaTextEdit and DetectCode. Remove empty commented-out tests. Log: 扩充controls和editor模块测试,清理空测试 Influence: 提升EditWrapper等类的覆盖率,移除无效测试
Log: 更新已修改文件的SPDX版权头年份范围 Influence: 无
4bfcbfd to
567857d
Compare
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // tests/src/editor/ut_editwrapper.cpp
// 建议使用 QTemporaryFile 替代硬编码的 /tmp 路径
#include <QTemporaryFile>
// ...
TEST(UT_Editwrapper_forceSaveInvalidCharFile, save_success)
{
Stub s;
s.set(ADDR(TextEdit, writeEncodeHistoryRecord), editwrapper_force::writeEncodeHistoryRecord_stub);
Window *pWindow = new Window();
pWindow->addBlankTab(QString());
EditWrapper *wra = pWindow->currentWrapper();
wra->m_pTextEdit->setPlainText("force save content");
// 使用 QTemporaryFile 生成安全的临时文件路径
QTemporaryFile tempFile;
tempFile.setAutoRemove(true); // 自动清理
if (!tempFile.open()) {
FAIL() << "Failed to create temporary file";
}
QString tempPath = tempFile.fileName();
tempFile.close(); // 关闭文件以便后续写入测试
wra->m_sInvalidCharOriginalPath = tempPath;
bool ok = wra->forceSaveInvalidCharFile();
EXPECT_TRUE(ok);
EXPECT_FALSE(wra->m_bInvalidCharPreview);
// QFile::remove(tempPath); // 不再需要手动删除,QTemporaryFile 会处理
pWindow->deleteLater();
} |
|
[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. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/merge |
Add test cases for WarningNotices, EditWrapper, FlashTween, LeftAreaTextEdit and DetectCode. Remove empty commented-out tests.
Log: 扩充controls和editor模块测试,清理空测试
Influence: 提升EditWrapper等类的覆盖率,移除无效测试
Summary by Sourcery
Extend unit test coverage for editor and controls components while cleaning up obsolete test stubs.
Tests:
Chores: