!39355 【基础能力】Drag CAPI 修复Badge Number的问题

Merge pull request !39355 from Zhang Jinyu/FixNumberBadgeEnabled
This commit is contained in:
openharmony_ci 2024-08-02 15:03:26 +00:00 committed by Gitee
commit bd8e9b884a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 6 additions and 4 deletions

View File

@ -400,8 +400,8 @@ int32_t OH_ArkUI_DragPreviewOption_SetNumberBadgeEnabled(ArkUI_DragPreviewOption
return ARKUI_ERROR_CODE_PARAM_INVALID;
}
auto* options = reinterpret_cast<ArkUIDragPreViewAndInteractionOptions*>(option);
options->isNumberBadgeEnabled = enabled;
options->badgeNumber = static_cast<ArkUI_Int32>(enabled);
options->isNumberBadgeEnabled = false;
options->isShowBadge = enabled;
return ARKUI_ERROR_CODE_NO_ERROR;
}
@ -411,6 +411,7 @@ int32_t OH_ArkUI_DragPreviewOption_SetBadgeNumber(ArkUI_DragPreviewOption* optio
return ARKUI_ERROR_CODE_PARAM_INVALID;
}
auto* options = reinterpret_cast<ArkUIDragPreViewAndInteractionOptions*>(option);
options->isNumberBadgeEnabled = true;
options->badgeNumber = static_cast<ArkUI_Int32>(forcedNumber);
return ARKUI_ERROR_CODE_NO_ERROR;
}

View File

@ -386,8 +386,8 @@ HWTEST_F(DragAndDropTest, DragAndDropTest012, TestSize.Level1)
auto ret1 = OH_ArkUI_DragPreviewOption_SetNumberBadgeEnabled(dragPreviewOption, true);
EXPECT_EQ(ret1, ARKUI_ERROR_CODE_NO_ERROR);
auto* option = reinterpret_cast<ArkUIDragPreViewAndInteractionOptions*>(dragPreviewOption);
EXPECT_TRUE(option->isNumberBadgeEnabled);
EXPECT_EQ(option->badgeNumber, 1);
EXPECT_FALSE(option->isNumberBadgeEnabled);
EXPECT_TRUE(option->isShowBadge);
/**
* @tc.steps: step2.set preview option with nullptr.
@ -412,6 +412,7 @@ HWTEST_F(DragAndDropTest, DragAndDropTest013, TestSize.Level1)
auto ret1 = OH_ArkUI_DragPreviewOption_SetBadgeNumber(dragPreviewOption, 2);
EXPECT_EQ(ret1, ARKUI_ERROR_CODE_NO_ERROR);
auto* option = reinterpret_cast<ArkUIDragPreViewAndInteractionOptions*>(dragPreviewOption);
EXPECT_TRUE(option->isNumberBadgeEnabled);
EXPECT_EQ(option->badgeNumber, 2);
/**