!388 NumberFormat百分数格式化问题

Merge pull request !388 from sunyaozu/bug1
This commit is contained in:
openharmony_ci 2023-04-04 09:31:56 +00:00 committed by Gitee
commit 5e7e2289ef
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 3 additions and 2 deletions

View File

@ -117,7 +117,8 @@ void NumberFormat::InitProperties()
}
}
if (!styleString.empty() && styleString == "percent") {
numberFormat = numberFormat.unit(icu::NoUnit::percent());
numberFormat = numberFormat.unit(icu::NoUnit::percent()).scale(icu::number::Scale::powerOfTen(2)).precision(
icu::number::Precision::fixedFraction(0));
}
if (!styleString.empty() && styleString == "unit") {
for (icu::MeasureUnit curUnit : unitArray) {

View File

@ -282,7 +282,7 @@ HWTEST_F(IntlTest, IntlFuncTest007, TestSize.Level1)
HWTEST_F(IntlTest, IntlFuncTest008, TestSize.Level1)
{
string locale = "en-CN";
string expects = "0,123,456.79%";
string expects = "12,345,678.9%";
vector<string> locales;
locales.push_back(locale);
string minimumIntegerDigits = "7";