summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2018-05-13 03:09:43 +0300
committerEike Rathke <erack@redhat.com>2018-05-15 11:42:36 +0200
commit56a7f308cf57f87d9e2cdeb77f48b570f81de85e (patch)
tree2beac75305f078c6d038ad17eb3b0f96ae9db82f /svl
parent5193d7fc00bd9d2ac2f77989e861c819d994c19c (diff)
tdf#115007: add NatNum codes for cardinal/ordinal number names/indicators
... based on libnumbertext integrated since commit f1579d3d6c5f5f3a651825e035b93bee7a4f43c6. [NatNum12] gives cardinal number names (one, two, three, ...) [NatNum13] gives ordinal number names (first, second, third, ...) [NatNum14] gives ordinal indicators (1st, 2nd, 3rd, ...) Change-Id: Ie2afdeeb82da1b36e9755c02d7b2276c77be9c72 Reviewed-on: https://gerrit.libreoffice.org/54186 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r--svl/CppunitTest_svl_qa_cppunit.mk14
-rw-r--r--svl/qa/unit/svl.cxx12
2 files changed, 26 insertions, 0 deletions
diff --git a/svl/CppunitTest_svl_qa_cppunit.mk b/svl/CppunitTest_svl_qa_cppunit.mk
index 65be44e40b6f..a067efe8794f 100644
--- a/svl/CppunitTest_svl_qa_cppunit.mk
+++ b/svl/CppunitTest_svl_qa_cppunit.mk
@@ -27,6 +27,16 @@ $(eval $(call gb_CppunitTest_use_externals,svl_qa_cppunit, \
icu_headers \
))
+ifeq ($(ENABLE_LIBNUMBERTEXT),TRUE)
+$(eval $(call gb_CppunitTest_use_package,svl_qa_cppunit, \
+ libnumbertext_numbertext \
+))
+endif
+
+$(eval $(call gb_CppunitTest_add_defs,svl_qa_cppunit, \
+ -DENABLE_LIBNUMBERTEXT=$(if $(filter TRUE,$(ENABLE_LIBNUMBERTEXT)),1,0) \
+))
+
$(eval $(call gb_CppunitTest_add_exception_objects,svl_qa_cppunit, \
svl/qa/unit/svl \
))
@@ -52,6 +62,10 @@ $(eval $(call gb_CppunitTest_set_include,svl_qa_cppunit,\
$(eval $(call gb_CppunitTest_use_components,svl_qa_cppunit,\
i18npool/util/i18npool \
configmgr/source/configmgr \
+ $(if $(filter TRUE,$(ENABLE_LIBNUMBERTEXT)), \
+ framework/util/fwk \
+ lingucomponent/source/numbertext/numbertext \
+ ) \
))
$(eval $(call gb_CppunitTest_use_ure,svl_qa_cppunit))
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 633e82b75eb2..b744e5a3bfbb 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1383,6 +1383,18 @@ void Test::testUserDefinedNumberFormats()
checkPreviewString(aFormatter, sCode, 120, eLang, sExpected);
sCode = "[DBNum2][$-0404]General\\ ";
checkPreviewString(aFormatter, sCode, 120, eLang, sExpected);
+#if ENABLE_LIBNUMBERTEXT
+ // tdf#115007 - cardinal/ordinal number names/indicators
+ sCode = "[NatNum12]0";
+ sExpected = "one hundred twenty-three";
+ checkPreviewString(aFormatter, sCode, 123, eLang, sExpected);
+ sCode = "[NatNum13]0";
+ sExpected = "one hundred twenty-third";
+ checkPreviewString(aFormatter, sCode, 123, eLang, sExpected);
+ sCode = "[NatNum14]0";
+ sExpected = "123rd";
+ checkPreviewString(aFormatter, sCode, 123, eLang, sExpected);
+#endif
}
{ // tdf#105968 engineering format with value rounded up to next magnitude
sCode = "##0.00E+00";