summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorDaeHyun Sung <sungdh86+git@gmail.com>2021-08-18 23:50:43 +0900
committerEike Rathke <erack@redhat.com>2021-08-19 19:10:24 +0200
commit9c13f1ad6384ee05a10ed688b93a46f6489a872a (patch)
tree053c62e26866e3571ce59321b3eb741cfbc15706 /i18npool
parent46f4069e914b82f8295b91b57a6c7429bc2da057 (diff)
tdf#143526 add Korean Numbering test case & fix Hanja number codepoint
add Korean Numbering test cases 1. koreanCounting 2. koreanLegal 3. koreanDigital 4. koreanDigital2 fix Korean Hanja number codepoint for Zero(0) Following MS Office's numFmt Strng example https://docs.microsoft.com/en-us/openspecs/office_standards/ms-docx/a1bb5809-e361-4e49-8e16-7f1a67da4121 Korean Hanja notation for Hanja is `零 U+96F6` on MS Word 2019 and that document. So, fix the Korean Hanja number code pointfor Zero(0) `零 U+96F6` Change-Id: I1a5b95640a93e7fbc3a0e724b154587877b198a0 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/120676 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/qa/cppunit/test_defaultnumberingprovider.cxx282
-rw-r--r--i18npool/source/nativenumber/data/numberchar.h4
2 files changed, 284 insertions, 2 deletions
diff --git a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx
index f7382ede1a9f..1bf0ab521079 100644
--- a/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx
+++ b/i18npool/qa/cppunit/test_defaultnumberingprovider.cxx
@@ -183,6 +183,288 @@ CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testArabicZero5)
CPPUNIT_ASSERT_EQUAL(OUString("10000"), aActual);
}
+CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanCounting)
+{
+ // 1 -> "일"
+ uno::Reference<text::XNumberingFormatter> xFormatter(
+ text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)),
+ };
+ lang::Locale aLocale;
+ OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ // Without the accompanying fix in place, this test would have failed with a
+ // lang.IllegalArgumentException, support for NUMBER_HANGUL_KO was missing.
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc77c"), aActual);
+
+ // 10 -> "십"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc2ed"), aActual);
+
+ // 100 -> "백"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_HANGUL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\ubc31"), aActual);
+}
+
+CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanLegal)
+{
+ // 1 -> "하나"
+ uno::Reference<text::XNumberingFormatter> xFormatter(
+ text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)),
+ };
+ lang::Locale aLocale;
+ OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ // Without the accompanying fix in place, this test would have failed with a
+ // lang.IllegalArgumentException, support for NUMBER_LEGAL_KO was missing.
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\ud558\ub098"), aActual);
+
+ // 2 -> "둘"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(2)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\ub458"), aActual);
+
+ // 3 -> "셋"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(3)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc14b"), aActual);
+
+ // 4 -> "넷"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(4)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\ub137"), aActual);
+
+ // 5 -> "다섯"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(5)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\ub2e4\uc12f"), aActual);
+ // 6 -> "여섯
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(6)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc5ec\uc12f"), aActual);
+ // 7 -> "일곱"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(7)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc77c\uacf1"), aActual);
+
+ // 8 -> "여덟"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(8)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc5ec\ub35f"), aActual);
+
+ // 9 -> "아홉"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(9)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc544\ud649"), aActual);
+
+ // 10 -> "열"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc5f4"), aActual);
+
+ // 21 -> "스물하나"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(21)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc2a4\ubb3c\ud558\ub098"), aActual);
+
+ // 32 -> "서른둘"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(32)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc11c\ub978\ub458"), aActual);
+
+ // 43 -> "마흔셋"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(43)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\ub9c8\ud754\uc14b"), aActual);
+
+ // 54 -> "쉰넷"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(54)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc270\ub137"), aActual);
+
+ // 65 -> "예순다섯"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(65)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc608\uc21c\ub2e4\uc12f"), aActual);
+
+ // 76 -> "일흔여섯"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(76)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc77c\ud754\uc5ec\uc12f"), aActual);
+
+ // 87 -> "여든일곱"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(87)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc5ec\ub4e0\uc77c\uacf1"), aActual);
+
+ // 98 -> "아흔여덟"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(98)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc544\ud754\uc5ec\ub35f"), aActual);
+
+ // 99 -> "아흔아홉"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_LEGAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(99)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc544\ud754\uc544\ud649"), aActual);
+}
+
+CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital)
+{
+ // 1 -> "일"
+ uno::Reference<text::XNumberingFormatter> xFormatter(
+ text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)),
+ };
+ lang::Locale aLocale;
+ OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ // Without the accompanying fix in place, this test would have failed with a
+ // lang.IllegalArgumentException, support for NUMBER_DIGITAL_KO was missing.
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc77c"), aActual);
+
+ // 10 -> "일영"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc77c\uc601"), aActual);
+
+ // 100 -> "일영영"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\uc77c\uc601\uc601"), aActual);
+}
+
+CPPUNIT_TEST_FIXTURE(I18npoolDefaultnumberingproviderTest, testKoreanDigital2)
+{
+ // 1 -> "一"
+ uno::Reference<text::XNumberingFormatter> xFormatter(
+ text::DefaultNumberingProvider::create(mxComponentContext), uno::UNO_QUERY);
+ uno::Sequence<beans::PropertyValue> aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(1)),
+ };
+ lang::Locale aLocale;
+ OUString aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ // Without the accompanying fix in place, this test would have failed with a
+ // lang.IllegalArgumentException, support for NUMBER_DIGITAL2_KO was missing.
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\u4e00"), aActual);
+
+ // 10 -> "一零"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(10)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\u4e00\u96f6"), aActual);
+
+ // 100 -> "一零零"
+ aProperties = {
+ comphelper::makePropertyValue(
+ "NumberingType", static_cast<sal_uInt16>(style::NumberingType::NUMBER_DIGITAL2_KO)),
+ comphelper::makePropertyValue("Value", static_cast<sal_Int32>(100)),
+ };
+ aActual = xFormatter->makeNumberingString(aProperties, aLocale);
+ CPPUNIT_ASSERT_EQUAL(OUString(u"\u4e00\u96f6\u96f6"), aActual);
+}
+
CPPUNIT_PLUGIN_IMPLEMENT();
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/i18npool/source/nativenumber/data/numberchar.h b/i18npool/source/nativenumber/data/numberchar.h
index b4f0c65d554b..8753d73d784d 100644
--- a/i18npool/source/nativenumber/data/numberchar.h
+++ b/i18npool/source/nativenumber/data/numberchar.h
@@ -65,8 +65,8 @@ const sal_Unicode NumberChar[][10] = {
{ 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x8086, 0x4F0D, 0x9678, 0x67D2, 0x634C, 0x7396 }, // T. Chinese Upper
{ 0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Japanese Modern
{ 0x96F6, 0x58F1, 0x5F10, 0x53C2, 0x56DB, 0x4F0D, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Japanese Trad.
- { 0x3007, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Lower
- { 0xF9B2, 0x58F9, 0x8CB3, 0x53C3, 0x56DB, 0x4F0D, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Upper
+ { 0x96F6, 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Lower
+ { 0x96F6, 0x58F9, 0x8CB3, 0x53C3, 0x56DB, 0x4F0D, 0x516D, 0x4E03, 0x516B, 0x4E5D }, // Korean Upper
{ 0xC601, 0xC77C, 0xC774, 0xC0BC, 0xC0AC, 0xC624, 0xC721, 0xCE60, 0xD314, 0xAD6C }, // Korean Hangul
{ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, 0x0668, 0x0669 }, // Arabic Indic
{ 0x06F0, 0x06F1, 0x06F2, 0x06F3, 0x06F4, 0x06F5, 0x06F6, 0x06F7, 0x06F8, 0x06F9 }, // Est. Arabic Indic