新增RichEditorPattern测试用例-用例编译失败修复

Signed-off-by: xqq879988 <xieqiqi2@huawei.com>
This commit is contained in:
xqq879988 2024-06-25 16:40:24 +08:00
parent 725232e25c
commit e1862aa0cb

View File

@ -1096,44 +1096,6 @@ HWTEST_F(RichEditorPatternTestNg, UpdateScrollBarOffset001, TestSize.Level1)
EXPECT_FALSE(tmpHost->isPropertyDiffMarked_);
}
/**
* @tc.name: OnSelectionMenuOptionsUpdate001
* @tc.desc: test OnSelectionMenuOptionsUpdate
* @tc.type: FUNC
*/
HWTEST_F(RichEditorPatternTestNg, OnSelectionMenuOptionsUpdate001, TestSize.Level1)
{
/**
* @tc.steps: step1. init and call function.
*/
ASSERT_NE(richEditorNode_, nullptr);
auto richEditorPattern = richEditorNode_->GetPattern<RichEditorPattern>();
ASSERT_NE(richEditorPattern, nullptr);
richEditorPattern->CreateNodePaintMethod();
EXPECT_NE(richEditorPattern->contentMod_, nullptr);
EXPECT_NE(richEditorPattern->overlayMod_, nullptr);
/**
* @tc.steps: step2. change parameter and call function.
*/
std::vector<MenuOptionsParam> menuOptionsItems;
MenuOptionsParam menuOptionItem1;
menuOptionItem1.content = "test1";
menuOptionItem1.actionRange = [](int32_t, int32_t) {};
menuOptionsItems.emplace_back(menuOptionItem1);
MenuOptionsParam menuOptionItem2;
menuOptionItem2.content = "test2";
menuOptionItem2.actionRange = [](int32_t, int32_t) {};
menuOptionsItems.emplace_back(menuOptionItem2);
richEditorPattern->OnSelectionMenuOptionsUpdate(std::move(menuOptionsItems));
for (auto& menuOption : richEditorPattern->menuOptionItems_) {
std::function<void(int32_t, int32_t)> actionRange = menuOption.actionRange;
auto weak = AceType::WeakClaim(&(*richEditorPattern));
std::string selectInfo = "test123";
menuOption.action(selectInfo);
}
EXPECT_NE(richEditorPattern->menuOptionItems_.size(), 0);
}
/**
* @tc.name: GetChangeSpanStyle002
* @tc.desc: test GetChangeSpanStyle