From 5aec14e653f792e014567ad5089b8b81b849ba0f Mon Sep 17 00:00:00 2001 From: zhangdd_ewan Date: Fri, 22 Nov 2024 17:19:52 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangdd_ewan --- frameworks/intl/include/utils.h | 1 - frameworks/intl/test/unittest/intl_test_extent.cpp | 5 +++++ frameworks/intl/test/unittest/locale_config_test.cpp | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/frameworks/intl/include/utils.h b/frameworks/intl/include/utils.h index 3658c02d..d60b4d38 100644 --- a/frameworks/intl/include/utils.h +++ b/frameworks/intl/include/utils.h @@ -49,7 +49,6 @@ bool GetPseudoLocalizationEnforce(); std::string PseudoLocalizationProcessor(const std::string &input); std::string PseudoLocalizationProcessor(const std::string &input, bool ifEnforce); bool CheckSystemPermission(); -size_t ConvertBytesToSizeT(const char *byteArray); std::set GetTimeZoneAvailableIDs(I18nErrorCode &errorCode); bool RegexSearchNoExcept(const std::string& str, std::smatch& match, const std::regex& regex); std::string LocaleEncode(const std::string& locale); diff --git a/frameworks/intl/test/unittest/intl_test_extent.cpp b/frameworks/intl/test/unittest/intl_test_extent.cpp index c5b0900e..6dbb3689 100644 --- a/frameworks/intl/test/unittest/intl_test_extent.cpp +++ b/frameworks/intl/test/unittest/intl_test_extent.cpp @@ -541,6 +541,11 @@ HWTEST_F(IntlTest, IntlFuncTest0062, TestSize.Level1) std::string localeCode = LocaleEncode(localeTag); std::string targetCode = "58400008334651000314"; EXPECT_EQ(localeCode, targetCode); + std::vector resultVec; + const std::string separator = ","; + std::string source = "zh,en,fr,de,zh-Hant,fil"; + Merge(resultVec, separator, source); + EXPECT_EQ(resultVec.size(), 6); std::string localeRule = "zh-Hans"; DateTimeRule* dateTimeRule = new DateTimeRule(localeRule); diff --git a/frameworks/intl/test/unittest/locale_config_test.cpp b/frameworks/intl/test/unittest/locale_config_test.cpp index e7c20e46..1c9929a9 100644 --- a/frameworks/intl/test/unittest/locale_config_test.cpp +++ b/frameworks/intl/test/unittest/locale_config_test.cpp @@ -445,6 +445,12 @@ HWTEST_F(LocaleConfigTest, LocaleConfigFuncTest021, TestSize.Level1) flag = LocaleConfig::IsValidTag(fakeTag); EXPECT_TRUE(!flag); EXPECT_FALSE(LocaleConfig::IsValidTag("")); + std::string langaugeKey = LocaleConfig::GetLanguageKey(); + EXPECT_EQ(langaugeKey, "persist.global.language"); + std::string localeKey = LocaleConfig::GetLocaleKey(); + EXPECT_EQ(localeKey, "persist.global.locale"); + std::string hourKey = LocaleConfig::GetHourKey(); + EXPECT_EQ(hourKey, "persist.global.is24Hour"); } } // namespace I18n } // namespace Global From 4da3b6665c7a9f294c3f34f4749302f42f63b36a Mon Sep 17 00:00:00 2001 From: zhangdd_ewan Date: Fri, 22 Nov 2024 18:12:48 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=A1=A5=E5=85=85=E6=8E=A5=E5=8F=A3?= =?UTF-8?q?=E8=A6=86=E7=9B=96=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhangdd_ewan --- frameworks/intl/test/unittest/intl_test_extent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frameworks/intl/test/unittest/intl_test_extent.cpp b/frameworks/intl/test/unittest/intl_test_extent.cpp index 6dbb3689..e6c2a977 100644 --- a/frameworks/intl/test/unittest/intl_test_extent.cpp +++ b/frameworks/intl/test/unittest/intl_test_extent.cpp @@ -541,11 +541,11 @@ HWTEST_F(IntlTest, IntlFuncTest0062, TestSize.Level1) std::string localeCode = LocaleEncode(localeTag); std::string targetCode = "58400008334651000314"; EXPECT_EQ(localeCode, targetCode); - std::vector resultVec; + std::vector resultVec = {"zh", "en", "fr", "de", "zh-Hant", "fil"}; const std::string separator = ","; - std::string source = "zh,en,fr,de,zh-Hant,fil"; + std::string source; Merge(resultVec, separator, source); - EXPECT_EQ(resultVec.size(), 6); + EXPECT_EQ(source, "zh,en,fr,de,zh-Hant,fil"); std::string localeRule = "zh-Hans"; DateTimeRule* dateTimeRule = new DateTimeRule(localeRule);