Skip to content

test: add unit tests for IDrawTool - #231

Merged
wyu71 merged 1 commit into
linuxdeepin:masterfrom
wyu71:agent/agent/173eb72f4c00
Sep 16, 2026
Merged

wyu71 merged 1 commit into
linuxdeepin:masterfrom
wyu71:agent/agent/173eb72f4c00

Conversation

@wyu71

@wyu71 wyu71 commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Add 18 Google Test unit test cases for IDrawTool class in idrawtool.cpp, covering 5 methods:

  • toolDoStart (4 cases): simulated event with no button, mouse left button, touch event, max touch points exceeded
  • toolDoUpdate (4 cases): empty records, EDoNotthing, EDoQtCoversion, ENormal with no movement
  • toolDoFinish (4 cases): empty records, EDoNotthing, EDoQtCoversion, ENormal
  • getCursor (4 cases): all directions without mouse press, rotation/inrect/none directions, with mouse left press, different tool types
  • dueTouchDoubleClickedStart (4 cases): simulated event, touch first call, touch double-click, mouse double-click

Build & Test Results

  • Build: ✅ Compiled successfully with Qt6 / DTK6
  • Tests: ✅ All 18 IDrawTool tests passed (0 failures)

Changes

  • tests/testItems/test_idrawtool.cpp: New test file with 18 GTest cases
  • tests/CMakeLists.txt: Add DEEPINDRAW_TEST_IDRAWTOOL_ITEM CMake option

Summary by Sourcery

Add unit test coverage for IDrawTool’s input-event and cursor behavior.

Build:

  • Add a CMake option to enable the IDrawTool test suite.

Tests:

  • Add Google Test coverage for IDrawTool event lifecycle, cursor handling, and touch or mouse double-click behavior.

@sourcery-ai

sourcery-ai Bot commented Sep 15, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds 18 Google Test cases covering IDrawTool start, update, finish, cursor, and double-click paths, plus a CMake option and compile definition to enable the suite.

File-Level Changes

Change Details Files
Add broad behavioral coverage for IDrawTool event lifecycle and cursor handling.
  • Exercise start-event handling for simulated, mouse, touch, and touch-limit cases.
  • Verify update behavior for empty, ignored, Qt-conversion, and normal records.
  • Verify finish behavior, event acceptance, and record cleanup across lifecycle states.
  • Check cursor results across handle directions, press states, and tool types.
  • Cover touch and mouse double-click detection, including timer state and repeated touch position.
tests/testItems/test_idrawtool.cpp
Make the new IDrawTool test suite conditionally configurable through CMake.
  • Add an enabled-by-default build option for the IDrawTool tests.
  • Define the test-specific preprocessor macro when the option is enabled.
tests/CMakeLists.txt

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

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

…inish, getCursor, dueTouchDoubleClickedStart

Add 18 Google Test cases for IDrawTool in idrawtool.cpp.

为idrawtool.cpp中IDrawTool类补充18个Google Test单元测试用例。

Log: 补充IDrawTool类5个方法单元测试
Influence: 提升IDrawTool类测试覆盖率
@wyu71
wyu71 force-pushed the agent/agent/173eb72f4c00 branch from f7fa2ad to 9311f04 Compare September 16, 2026 00:55
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: lzwind, wyu71

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

@wyu71
wyu71 merged commit 55efbe3 into linuxdeepin:master Sep 16, 2026
13 of 14 checks passed
@wyu71
wyu71 deleted the agent/agent/173eb72f4c00 branch September 16, 2026 01:57
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