Skip to content

test(sidebar): isolate bookmark UT cases from shared test data - #418

Merged
deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
dengzhongyuan365-dev:fix/reader-ut-bookmark-state
Oct 13, 2026
Merged

deepin-bot[bot] merged 1 commit into
linuxdeepin:masterfrom
dengzhongyuan365-dev:fix/reader-ut-bookmark-state

Conversation

@dengzhongyuan365-dev

@dengzhongyuan365-dev dengzhongyuan365-dev commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Bookmark cases wrote bookmarks into the shared tests/files/1.pdf and later cases depended on that leftover state, so the full UT run failed.

书签用例把书签写入共享的 1.pdf,后续用例又依赖这份残留状态,
导致全量执行时相互污染失败。

Log: 修复书签 UT 用例间的状态污染
Influence: 书签用例各自清理写盘数据,全量 1264 条 UT 可稳定通过。

Summary by Sourcery

Isolate bookmark unit tests from shared persisted state to ensure reliable full-suite execution.

Bug Fixes:

  • Prevent bookmark unit tests from leaking persisted bookmark state into later tests, eliminating order-dependent full-suite failures.

Enhancements:

  • Make bookmark sidebar loading assertions reflect the actual DocSheet bookmark count instead of assuming an empty list.

Tests:

  • Improve bookmark tests by isolating persisted data, stubbing document page counts where needed, and verifying cleanup after each case.

Bookmark cases wrote bookmarks into the shared tests/files/1.pdf and
later cases depended on that leftover state, so the full UT run failed.

书签用例把书签写入共享的 1.pdf,后续用例又依赖这份残留状态,
导致全量执行时相互污染失败。

Log: 修复书签 UT 用例间的状态污染
Influence: 书签用例各自清理写盘数据,全量 1264 条 UT 可稳定通过。
@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Sorry @dengzhongyuan365-dev, you've used your own review budget of 250,000 diff characters for the last 7 days.

You can request another review in 2 days and 1 hour by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 13, 2026

Copy link
Copy Markdown

Reviewer's Guide

The PR removes shared-document state leakage from bookmark unit tests by stubbing required document metadata and cleaning up persisted bookmarks, while making sidebar loading validation derive expected counts from the DocSheet state. This allows the full unit-test suite to run reliably without ordering-dependent bookmark data.

File-Level Changes

Change Details Files
Isolate bookmark persistence tests by explicitly removing bookmarks written to the shared document.
  • Capture the persistence assertion before cleanup, then remove the bookmark and verify the in-memory collection is clear.
  • Stub pageCount so bookmark setup exercises the write path without depending on an opened document.
  • Scope the setBookMark stub to the delete operation, then clean up the real bookmark afterward and verify removal.
tests/sidebar/ut_bookmarkwidget.cpp
Make sidebar bookmark loading assertions reflect the document's actual bookmark state instead of assuming an empty fixture.
  • Compare the loaded image-list count with the current DocSheet bookmark count.
tests/sidebar/ut_sidebarimagelistview.cpp

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dengzhongyuan365-dev, lzwind

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@dengzhongyuan365-dev

Copy link
Copy Markdown
Member Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit b84d3e7 into linuxdeepin:master Oct 13, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants