test: add tests for deepin-reader batch 1 (7/7 classes) - #411
Conversation
|
TAG Bot TAG: 6.6.2 |
Reviewer's GuideAdds 26 PMS-linked regression tests across seven reader components, validating GUI state transitions, sidebar batching, document conversion failure paths, DBus handling, rendering guards, and utility behavior through targeted stubs and fixtures; it also records discovered defects and updates package metadata. Flow diagram for PMS regression test coverageflowchart TD
Tests["26 PMS-linked regression tests"] --> GUI["GUI state and rendering guards"]
Tests --> Sidebar["Sidebar batching and view-model behavior"]
Tests --> Document["Document conversion and XPS failure paths"]
Tests --> App["DBus handling and utility behavior"]
GUI --> Result["26 new tests pass"]
Sidebar --> Result
Document --> Result
App --> Result
Result --> FullSuite["1226/1226 full test suite passes"]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
f5be96d to
0db1132
Compare
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/sidebar/ut_sidebarimageviewmodel.cpp" line_range="273" />
<code_context>
+ EXPECT_TRUE(m_tester->m_pendingUpdatePages.contains(1));
+ EXPECT_TRUE(m_tester->m_batchUpdateTimer->isActive());
+
+ QSignalSpy spy(m_tester, &SideBarImageViewModel::dataChanged);
+ QTest::qWait(200); // timer 100ms 单次触发 onBatchUpdateTimer
+ EXPECT_GE(spy.count(), 1);
+ EXPECT_TRUE(m_tester->m_pendingUpdatePages.isEmpty());
+ EXPECT_FALSE(m_tester->m_batchUpdateTimer->isActive());
</code_context>
<issue_to_address>
**issue (testing):** BUG343541_handleRenderThumbnail_batchDebounce relies on a fixed 200 ms sleep to observe a 100 ms timer. On a busy CI worker, the test thread or event loop can be delayed beyond that interval, causing spy.count() to remain zero and producing a flaky failure unrelated to the batching behavior.
**Triggers:** When the test process is descheduled or the Qt event loop is delayed for more than 200 ms.
**Suggested fix:** Use an event-driven wait such as QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, ...) instead of a fixed qWait.
```suggestion
QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, 1000); // timer 100ms 单次触发 onBatchUpdateTimer
```
</issue_to_address>| EXPECT_TRUE(m_tester->m_batchUpdateTimer->isActive()); | ||
|
|
||
| QSignalSpy spy(m_tester, &SideBarImageViewModel::dataChanged); | ||
| QTest::qWait(200); // timer 100ms 单次触发 onBatchUpdateTimer |
There was a problem hiding this comment.
issue (testing): BUG343541_handleRenderThumbnail_batchDebounce relies on a fixed 200 ms sleep to observe a 100 ms timer. On a busy CI worker, the test thread or event loop can be delayed beyond that interval, causing spy.count() to remain zero and producing a flaky failure unrelated to the batching behavior.
Triggers: When the test process is descheduled or the Qt event loop is delayed for more than 200 ms.
Suggested fix: Use an event-driven wait such as QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, ...) instead of a fixed qWait.
| QTest::qWait(200); // timer 100ms 单次触发 onBatchUpdateTimer | |
| QTRY_VERIFY_WITH_TIMEOUT(spy.count() >= 1, 1000); // timer 100ms 单次触发 onBatchUpdateTimer |
Generated by qt-autotest-generator skill. Batch 1: DocSheet, SideBarImageViewModel, Central, DBusObject, Utils, Model, ... Cumulative: 7/7 classes, 18/18 methods tested Baseline: master @ ad672ce "chore: Update version to 6.6.2" (2026-09-29) Log: 新增 deepin-reader 单元测试 Influence: 新增 7 个类的单元测试,本批次覆盖率 18/18,累计覆盖率 18/18 PMS 补强(Mode 7→Mode 2):为 10 个 sev1/2 bug 的 18 个目标函数 生成 26 个 BUG<id>_<场景> 回归用例,26/26 通过,全量 1226/1226 通过。 分布: - tests/uiframe/ut_docsheet.cpp +5(bugs 348017/106171/164325) - tests/sidebar/ut_sidebarimageviewmodel.cpp +9(bugs 343541/335473) - tests/uiframe/ut_central.cpp +2(bug 97761) - tests/app/ut_dbusobject.cpp +3(bug 312013) - tests/app/ut_utils.cpp +2(bug 218701) - tests/document/ut_model.cpp +3(bugs 332133/304083) - tests/document/ut_xpsmodel.cpp +2(bug 343541) 覆盖率(build-ut-coverage):lines 84.6%(13088/15465), functions 98.1%(1363/1389),18/18 目标函数 FNDA 全命中。 测试过程中新发现源码缺陷 3 个(记录留本地,不入库): 1. runtime: CentralDocPage::isFullScreen(:897)parentWidget 三级链无空守卫 2. logic: DocumentFactory::getDocument(Model.cpp:160)copy 失败分支 *pprocess 未置空 3. manual: calculateTimeout/getHtmlToPdfPath(Model.cpp:40/60)static 自由函数不可直测 注:PMS 工作单与缺陷记录留本地,不入库。
0db1132 to
0f8622e
Compare
|
[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 |
|
/merge |
概述
PMS 补强(qt-autotest-generator Mode 7→Mode 2):基于 git 历史 PMS bug 修复提交挖掘,为 10 个 sev1/2 bug 的 18 个目标函数生成 26 个 BUG 回归用例。
用例分布
用例命名
BUG<id>_<场景>,注释含 PMS 链接与修复 commit sha。新发现源码缺陷(记录于 tests/.ut-defects.json)
测试方式
Summary by Sourcery
Strengthen deepin-reader’s regression suite with targeted coverage for historical high-severity bugs across application, document, sidebar, and UI components.
Enhancements:
Tests:
Chores: