Skip to content

test(Page): supplement PageDriver Install/Backup/Restore unit tests and fix copyright headers - #904

Merged
deepin-bot[bot] merged 4 commits into
linuxdeepin:masterfrom
add-uos:ut-t12
Oct 24, 2026
Merged

deepin-bot[bot] merged 4 commits into
linuxdeepin:masterfrom
add-uos:ut-t12

Conversation

@add-uos

@add-uos add-uos commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Supplement unit tests for PageDriverInstallInfo (17 -> 30 cases),
    PageDriverBackupInfo (14 -> 24) and PageDriverRestoreInfo (8 -> 16);
    70 cases total covering all 34 testable public methods
  • Clean up malformed copyright header year format
    (2019-2026 ~ 2020 -> 2019-2026) in 30 unit test files
  • Rebased on latest upstream/master (9ae5b61)

Test results

  • Build: Qt6 Debug + coverage instrumentation, 0 errors
  • Tests: 70/70 passed
    (--gtest_filter='UT_PageDriverInstallInfo.:UT_PageDriverBackupInfo.:UT_PageDriverRestoreInfo.*', offscreen)
  • Coverage on the 3 target files: function 100% (35/35), line 100% (526/526)

Summary by Sourcery

Expand PageDriver unit-test coverage and standardize copyright headers across the test suite.

Enhancements:

  • Expand PageDriver install, backup, and restore unit-test coverage across public behavior, UI states, status transitions, signal forwarding, and boundary conditions.

Tests:

  • Increase the three PageDriver test suites to 70 cases covering all testable public methods and achieving complete function and line coverage for the target files.

Chores:

  • Normalize malformed copyright headers across the unit-test files.

Supplement ut_pagedriverinstallinfo.cpp from 17 to 30 GTest cases
covering all 14 public methods:
- addDriverInfoToTableView: cover 4 status branches (NOT_INSTALL/
  CAN_UPDATE/DRIVER_IS_NEW/unknown early-return) with per-column
  widget type and content assertions
- showTables: cover all-zero setNoUpdateDriverUI branch, install-only/
  update-only/both/new-only visibility and label counts, negative
  count boundary
- updateItemStatus/slotDownloadFinished: verify status sync on both
  views and error message forwarding via DriverStatusItem::setErrorMsg
- slotDownloadProgressChanged: verify 5-arg forwarding to head widget
  setDownloadUI with two driver types
- clearAllData/initTable: verify row reset and header rebuild for all
  three views
- setCheckedCBDisnable: verify disabled checkbox, ST_WAITING status
  and operation button via direct call and installAll signal path
- getCheckedDriverIndex: verify empty table and checked-state driven
  collection order
- declaration table + AAA comments per skill baseline; stubs follow
  project tests/src/stub.h convention (member Stub, auto-restore)
Supplement ut_pagedriverbackupinfo.cpp from 14 to 24 GTest cases
covering all 11 public methods:
- addDriverInfoToTableView: cover 3 backup-version branches (backable
  row with ST_DRIVER_NOT_BACKUP + BACKUP operation, backed-up-only
  3-column row, both-views dual insert) and the no-row negative case
- showTables: cover both-zero setNoBackupDriverUI, backable-only/
  backedup-only/both-present setBackableDriverUI branches and negative
  count boundary
- updateItemStatus: verify ST_DRIVER_BACKUP_FAILED triggers
  setErrorMsg("Backup Failed") while success status does not
- clearAllData/initTable: verify row reset and header rebuild on both
  views including column widths and header checkbox
- setCheckedCBDisnable: verify disabled checkbox and ST_WAITING status
  via direct call and backupAll signal path
- getCheckedDriverIndex/setHeaderCbEnable/initUI: structural and
  state-transition assertions
- declaration table + AAA comments per skill baseline; stubs follow
  project tests/src/stub.h convention (member Stub, auto-restore)
Supplement ut_pagedriverrestoreinfo.cpp from 8 to 16 GTest cases
covering all 9 public methods:
- addDriverInfoToTableView: cover backup-version present (4-column row
  with RESTORE operation) and empty backup-version early-return
- showTables: verify stack page switch at backedLength 0/non-zero and
  negative boundary, plus setRestoreDriverUI forwarding
- slotOperatorClicked: drive the real view signal path and verify the
  operation item is replaced by an ST_DRIVER_RESTORING status item at
  column 3 with 3-arg signal forwarding
- setItemOperationEnable: verify operation button enable/disable round
  trip via name-index lookup
- clearAllData/initTable: verify row reset and header rebuild with
  column widths and absent header checkbox
- initUI: verify two-page DStackedWidget assembly and gotoBackup button
  wiring; gotoBackup signal emission via button click
- declaration table + AAA comments per skill baseline; stubs follow
  project tests/src/stub.h convention (member Stub, auto-restore)
Remove the stray '~ 2020' / '~ 2026' suffix from the copyright line
in 30 unit test files, normalizing to:
  // Copyright (C) 2019-2026 UnionTech Software Technology Co.,Ltd

The malformed range was introduced by earlier header-restore tooling;
the year range 2019-2026 still covers the current year, so the SPDX
year range check keeps passing.
@sourcery-ai

sourcery-ai Bot commented Oct 24, 2026

Copy link
Copy Markdown

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

You can request another review in 4 days and 20 hours by commenting @sourcery-ai review. Upgrade to get a review now.

@sourcery-ai

sourcery-ai Bot commented Oct 24, 2026

Copy link
Copy Markdown

Reviewer's Guide

This PR substantially increases unit-test coverage for the PageDriver install, backup, and restore flows by adding isolated UI stubs, reusable fixtures, and explicit branch/state/signal assertions, while also standardizing malformed copyright headers across 30 test files; the reported Qt6 debug coverage is 100% for the three target files and all 70 focused tests pass.

File-Level Changes

Change Details Files
Expanded PageDriverInstallInfo tests from 17 to 30 cases with branch- and state-focused coverage of table population, UI visibility, status updates, download callbacks, selection handling, clearing, and signal forwarding.
  • Added fixtures and UI/device-manager stubs to isolate observable interactions.
  • Covered driver-status routing, unknown-status early return, count boundaries, row contents, widget state, and signal-driven behavior.
  • Added assertions for initialization, table configuration, repeated clearing, and error/status propagation.
deepin-devicemanager/tests/src/Page/ut_pagedriverinstallinfo.cpp
Expanded PageDriverBackupInfo tests from 14 to 24 cases to exercise backup table routing, UI-state selection, status updates, controls, clearing, and signal connections.
  • Added reusable driver/view helpers and stubs for UI setters and error reporting.
  • Covered backup-version equivalence classes, zero/nonzero/negative counts, row widgets and operations, checked-index collection, and disabled/waiting transitions.
  • Validated constructor-created UI, table headers and widths, repeated reset behavior, and backupAll signal forwarding.
deepin-devicemanager/tests/src/Page/ut_pagedriverbackupinfo.cpp
Expanded PageDriverRestoreInfo tests from 8 to 16 cases covering restoration eligibility, stacked-page selection, row operations, status transitions, initialization, and signals.
  • Added fixtures, helpers, and a UI stub for restore-count reporting.
  • Covered empty versus nonempty backup versions, zero/nonzero/negative counts, restore operation replacement, button enablement, repeated clearing, and gotoBackup/operatorClicked signals.
  • Asserted widget hierarchy, stack configuration, headers, column widths, and restored row contents.
deepin-devicemanager/tests/src/Page/ut_pagedriverrestoreinfo.cpp
Normalized malformed copyright header year ranges across the unit-test suite.
  • Removed the stray '~ 2020' suffix from copyright headers.
  • Corrected the affected Page test headers to use the standard copyright format.
deepin-devicemanager/tests/src/DeviceManager/ut_DeviceAudio.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicebios.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicebluetooth.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicecpu.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicegpu.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_deviceimage.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_deviceinfo.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput_bus.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput_extra.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_deviceinput_pure.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicemanager.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicememory.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicemonitor.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicenetwork.cpp
deepin-devicemanager/tests/src/DeviceManager/ut_devicestorage.cpp
deepin-devicemanager/tests/src/DriverControl/ut_dbusdriverinterface.cpp
deepin-devicemanager/tests/src/GenerateDevice/ut_cmdtool.cpp
deepin-devicemanager/tests/src/GenerateDevice/ut_devicegenerator.cpp
deepin-devicemanager/tests/src/GenerateDevice/ut_edidparser.cpp
deepin-devicemanager/tests/src/GenerateDevice/ut_hwgenerator.cpp
deepin-devicemanager/tests/src/Page/ut_pagedrivercontrol.cpp
deepin-devicemanager/tests/src/Page/ut_pagedriverinfo.cpp
deepin-devicemanager/tests/src/Page/ut_pagedrivermanager.cpp
deepin-devicemanager/tests/src/Page/ut_pagemultiinfo.cpp
deepin-devicemanager/tests/src/Widget/ut_detailtreeview.cpp
deepin-devicemanager/tests/src/Widget/ut_devicelistview.cpp
deepin-devicemanager/tests/src/Widget/ut_driverlistview.cpp
deepin-devicemanager/tests/src/Widget/ut_longtextlabel.cpp
deepin-devicemanager/tests/src/Widget/ut_textbrowser.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: add-uos, 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

@add-uos

add-uos commented Oct 24, 2026

Copy link
Copy Markdown
Contributor Author

/forcemerge

@deepin-bot

deepin-bot Bot commented Oct 24, 2026

Copy link
Copy Markdown
Contributor

This pr force merged! (status: unstable)

@deepin-bot
deepin-bot Bot merged commit f4d271c into linuxdeepin:master Oct 24, 2026
13 of 17 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