test(libdmusic): raise line coverage above 80%#718
Conversation
Add 19 tests covering PlayerEngine playable-meta cache, list mutations, manual navigation branches, fade switch animations, and Utils DBus property call. Closes the gap from 79.1% to 80.1% line coverage. 新增 19 个用例,覆盖 PlayerEngine 可播放 meta 缓存、列表变更、 手动切歌各分支、淡入淡出动画路径及 Utils DBus 属性调用。 行覆盖率从 79.1% 提升至 80.1%。 Log: 提升单元测试覆盖率到 80% 以上 Influence: 覆盖率提升后回归测试更充分,便于后续重构与缺陷定位。
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
deepin pr auto review★ 总体评分:95分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 建议使用 QSignalSpy 替代固定等待时间,以提升测试稳定性和性能
// 以 test_playerengine.cpp 中的 fadeSwitchWithFadeOutAndFadeInPath 为例:
TEST(PlayerEngineFadeSwitchTest, fadeSwitchWithFadeOutAndFadeInPathOptimized)
{
InjectedEngine env;
env.engine->setPlaybackMode(DmGlobal::RepeatAll);
env.engine->setFadeInOut(true);
DMusic::MediaMeta m1 = makePlayableCda("fs1");
DMusic::MediaMeta m2 = makePlayableCda("fs2");
env.engine->addMetasToPlayList({m1, m2});
env.engine->setMediaMeta(m1);
env.fake->m_fakeState = DmGlobal::Playing;
int before = env.fake->setMediaCallCount;
// 假设 engine 有 metaChanged 信号可用于监听切换完成
QSignalSpy spy(env.engine, &PlayerEngine::metaChanged);
env.engine->playNextMeta(false);
// 等待信号触发,超时时间设为 1000ms 作为兜底
QVERIFY(spy.wait(1000));
EXPECT_GT(env.fake->setMediaCallCount, before);
} |
|
[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 19 tests covering PlayerEngine playable-meta cache, list mutations, manual navigation branches, fade switch animations, and Utils DBus property call. Closes the gap from 79.1% to 80.1% line coverage.
新增 19 个用例,覆盖 PlayerEngine 可播放 meta 缓存、列表变更、
手动切歌各分支、淡入淡出动画路径及 Utils DBus 属性调用。
行覆盖率从 79.1% 提升至 80.1%。
Log: 提升单元测试覆盖率到 80% 以上
Influence: 覆盖率提升后回归测试更充分,便于后续重构与缺陷定位。