fix: App operator!= uses OR of both fields - #3443
MyLeeJiEun wants to merge 1 commit into
Conversation
1. Change App::operator!= from && to || so it negates operator== 2. Apps differing in one field were wrongly reported as equal 3. Add ut_category.cpp with four inequality test scenarios 4. Register ut_category in tests/CMakeLists.txt with Qt::Test link Influence: 1. Verify operator!= returns true for Apps differing in one field 2. Verify operator!= returns false for identical Apps 3. Run ut_category unit tests, expect 15/15 passing fix: 修正 App operator!= 为两字段的逻辑或 1. 将 App::operator!= 的 && 改为 ||,使其为 operator== 的逻辑否定 2. 仅一个字段不同的两个 App 此前被误判为相等 3. 新增 ut_category.cpp,覆盖修复后四种不等比较场景 4. 在 tests/CMakeLists.txt 注册 ut_category 并链接 Qt::Test Influence: 1. 验证仅一个字段不同的 App 的 operator!= 返回 true 2. 验证完全相同的 App 的 operator!= 返回 false 3. 运行 ut_category 单元测试,预期 15/15 通过
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: MyLeeJiEun 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 |
Reviewer's GuideFixes Flow diagram for App inequality comparisonflowchart TD
A[Compare App fields] --> B{Id differs?}
B -->|Yes| D[operator!= returns true]
B -->|No| C{isUser differs?}
C -->|Yes| D
C -->|No| E[operator!= returns false]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Hi @MyLeeJiEun. Thanks for your PR. I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
TAG Bot New tag: 6.1.106 |
|
TAG Bot New tag: 6.1.107 |
修复内容
App::operator!=(src/plugin-defaultapp/operation/category.h)误用&&而非||——operator!=本应为operator==的逻辑否定,却要求两个字段同时不同才返回true,导致仅在一个字段(Id或isUser)上不同的两个 App 被误判为「相等」。改动
src/plugin-defaultapp/operation/category.h:App::operator!=中&&改为||,使其与operator==严格互为逻辑否定。tests/ut_category.cpp(新增):覆盖修复后四种不等比较场景——仅Id不同 / 仅isUser不同 / 两字段都不同 / 完全相同。关键用例App.InequalityUsesOrOfBothFields。tests/CMakeLists.txt:新增ut_category.cpp+category.cpp编译目标、plugin-defaultapp/operationinclude 路径、Qt::Test链接。验证
category.cpp行覆盖率 100%。operator!=直接调用方,为潜伏态缺陷的纯修正,零运行时影响。关联
f24e9fc3-639a-4fc0-beb1-6eb2c0c4c86c)Summary by Sourcery
Fix App inequality comparisons and add comprehensive category unit-test coverage.
Bug Fixes:
App::operator!=so apps differing in eitherIdorisUserare recognized as unequal.Build:
Tests:
Appequality and inequality semantics andCategorystate changes, list management, deduplication, and signals.