mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2025-01-08 09:53:20 +00:00
Search 适配Symbol 修改xts tdd问题
Signed-off-by: d00373225 <donglinbin1@huawei.com>
This commit is contained in:
parent
9871568c86
commit
6fed0763b1
@ -1527,20 +1527,17 @@ void SearchPattern::InitIconColorSize()
|
||||
void SearchPattern::CreateSearchIcon(const std::string& src)
|
||||
{
|
||||
CHECK_NULL_VOID(GetSearchNode());
|
||||
if (!GetSearchNode()->HasSearchIconNodeCreated()) {
|
||||
if (AceApplicationInfo::GetInstance().GreatOrEqualTargetAPIVersion(PlatformVersion::VERSION_TWELVE) &&
|
||||
src.empty()) {
|
||||
CreateOrUpdateSymbol(IMAGE_INDEX, true);
|
||||
} else {
|
||||
CreateOrUpdateImage(IMAGE_INDEX, src, true, "", "");
|
||||
}
|
||||
GetSearchNode()->UpdateHasSearchIconNodeCreated(true);
|
||||
if (AceApplicationInfo::GetInstance().GreatOrEqualTargetAPIVersion(PlatformVersion::VERSION_TWELVE) &&
|
||||
src.empty()) {
|
||||
CreateOrUpdateSymbol(IMAGE_INDEX, !GetSearchNode()->HasSearchIconNodeCreated());
|
||||
} else {
|
||||
if (src.empty()) {
|
||||
return;
|
||||
}
|
||||
UpdateIconNode(IMAGE_INDEX, src, "", "");
|
||||
CreateOrUpdateImage(IMAGE_INDEX, src, !GetSearchNode()->HasSearchIconNodeCreated(), "", "");
|
||||
}
|
||||
GetSearchNode()->UpdateHasSearchIconNodeCreated(true);
|
||||
if (src.empty()) {
|
||||
return;
|
||||
}
|
||||
UpdateIconNode(IMAGE_INDEX, src, "", "");
|
||||
}
|
||||
|
||||
void SearchPattern::CreateCancelIcon()
|
||||
@ -1568,9 +1565,8 @@ void SearchPattern::CreateOrUpdateSymbol(int32_t index, bool isCreateNode)
|
||||
auto layoutProperty = frameNode->GetLayoutProperty<TextLayoutProperty>();
|
||||
layoutProperty->UpdateSymbolSourceInfo(index == IMAGE_INDEX ? SymbolSourceInfo(searchTheme->GetSearchSymbolId())
|
||||
: SymbolSourceInfo(searchTheme->GetCancelSymbolId()));
|
||||
layoutProperty->UpdateFontSize(Dimension(index == IMAGE_INDEX ? GetSearchNode()->GetSearchIconSize().ConvertToFp()
|
||||
: GetSearchNode()->GetCancelIconSize().ConvertToFp(),
|
||||
DimensionUnit::FP));
|
||||
layoutProperty->UpdateFontSize(
|
||||
index == IMAGE_INDEX ? GetSearchNode()->GetSearchIconSize() : GetSearchNode()->GetCancelIconSize());
|
||||
layoutProperty->UpdateSymbolColorList(
|
||||
{ index == IMAGE_INDEX ? GetSearchNode()->GetSearchIconColor() : GetSearchNode()->GetCancelIconColor() });
|
||||
|
||||
@ -1816,7 +1812,7 @@ void SearchPattern::UpdateIconSize(int32_t index, const Dimension& value)
|
||||
if (iconFrameNode->GetTag() == V2::SYMBOL_ETS_TAG) {
|
||||
auto symbolLayoutProperty = iconFrameNode->GetLayoutProperty<TextLayoutProperty>();
|
||||
CHECK_NULL_VOID(symbolLayoutProperty);
|
||||
symbolLayoutProperty->UpdateFontSize(Dimension(value.ConvertToFp(), DimensionUnit::FP));
|
||||
symbolLayoutProperty->UpdateFontSize(value);
|
||||
} else {
|
||||
auto pipeline = PipelineBase::GetCurrentContext();
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
|
@ -1010,6 +1010,8 @@ HWTEST_F(SearchTestNg, SetTextColor001, TestSize.Level1)
|
||||
*/
|
||||
HWTEST_F(SearchTestNg, Create001, TestSize.Level1)
|
||||
{
|
||||
int32_t backupApiVersion = AceApplicationInfo::GetInstance().GetApiTargetVersion();
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(static_cast<int32_t>(PlatformVersion::VERSION_TWELVE));
|
||||
SearchModelNG searchModelInstance;
|
||||
|
||||
searchModelInstance.Create(EMPTY_VALUE, PLACEHOLDER, EMPTY_VALUE);
|
||||
@ -1027,14 +1029,15 @@ HWTEST_F(SearchTestNg, Create001, TestSize.Level1)
|
||||
ASSERT_NE(textFrameNode, nullptr);
|
||||
auto searchIconFrameNode = AceType::DynamicCast<FrameNode>(frameNode->GetChildAtIndex(IMAGE_INDEX));
|
||||
ASSERT_NE(searchIconFrameNode, nullptr);
|
||||
EXPECT_EQ(searchIconFrameNode.GetTag(), V2::IMAGE_ETS_TAG);
|
||||
EXPECT_EQ(searchIconFrameNode->GetTag(), V2::IMAGE_ETS_TAG);
|
||||
auto cancelIconFrameNode = AceType::DynamicCast<FrameNode>(frameNode->GetChildAtIndex(CANCEL_IMAGE_INDEX));
|
||||
ASSERT_NE(cancelIconFrameNode, nullptr);
|
||||
EXPECT_EQ(cancelIconFrameNode.GetTag(), V2::SYMBOL_ETS_TAG);
|
||||
EXPECT_EQ(cancelIconFrameNode->GetTag(), V2::SYMBOL_ETS_TAG);
|
||||
auto cancelButtonFrameNode = AceType::DynamicCast<FrameNode>(frameNode->GetChildAtIndex(CANCEL_BUTTON_INDEX));
|
||||
ASSERT_NE(cancelButtonFrameNode, nullptr);
|
||||
auto buttonFrameNode = AceType::DynamicCast<FrameNode>(frameNode->GetChildAtIndex(BUTTON_INDEX));
|
||||
EXPECT_NE(buttonFrameNode, nullptr);
|
||||
AceApplicationInfo::GetInstance().SetApiTargetVersion(static_cast<int32_t>(backupApiVersion));
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user