!35529 Fix:Toggle button 组件更新后FontSize不一致

Merge pull request !35529 from yangziyong/toggle_button
This commit is contained in:
openharmony_ci 2024-06-14 15:05:16 +00:00 committed by Gitee
commit 0617607abd
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 2 additions and 4 deletions

View File

@ -572,9 +572,7 @@ void ToggleButtonPattern::InitButtonAndText()
CHECK_NULL_VOID(textNode);
auto textLayoutProperty = textNode->GetLayoutProperty<TextLayoutProperty>();
CHECK_NULL_VOID(textLayoutProperty);
if (!textLayoutProperty->HasFontSize()) {
textLayoutProperty->UpdateFontSize(textFontSize_);
} else {
if (textLayoutProperty->HasFontSize()) {
layoutProperty->UpdateFontSize(textLayoutProperty->GetFontSizeValue(textFontSize_));
}
layoutProperty->UpdateLabel(textLayoutProperty->GetContentValue(""));

View File

@ -355,7 +355,7 @@ HWTEST_F(ToggleButtonTestNg, ToggleButtonPatternTest007, TestSize.Level1)
ASSERT_NE(textNode, nullptr);
auto textLayoutProperty = textNode->GetLayoutProperty<TextLayoutProperty>();
ASSERT_NE(textLayoutProperty, nullptr);
EXPECT_EQ(textLayoutProperty->GetFontSizeValue(childFontSize).Value(), dimensionValue);
EXPECT_EQ(textLayoutProperty->GetFontSizeValue(childFontSize).Value(), childDimensionValue);
/**
* @tc.steps: step4. Creat child node and set font size.