summaryrefslogtreecommitdiff
path: root/svl
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-06-12 11:50:05 +0200
committerLászló Németh <nemeth@numbertext.org>2018-06-21 09:20:31 +0200
commit1d48e998ae038263b092e0de71da97fceee299f4 (patch)
treea3b455a2e571b6d15626824dd3e6a8456e339635 /svl
parentb86a8857e6488bac1224a9eed471bcf930994399 (diff)
NatNum12: fix and add capitalization prefixes, tdf#115007 follow-up
Limit NatNum12 conversion only for the selected parts of the date format (this bug – double calls of getNumberText – was hidden by the space prefix " " and empty return values at the first calls, resulting unchanged dates yet). New prefixes: "capitalize", "upper" and "title" to handle optional capitalization. (In Calc, it was not possible to format the result of NatNum formatting, but some languages often need capitalization or title case to format numbers and currencies.) Thanks code clean up using enum WhichCasing to Eike Rathke. Reviewed-on: https://gerrit.libreoffice.org/55681 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com> Conflicts: svl/qa/unit/svl.cxx Change-Id: I5fceb784930e6bc6d376116f5a42ad49cd248a54 Reviewed-on: https://gerrit.libreoffice.org/56202 Tested-by: Jenkins Reviewed-by: László Németh <nemeth@numbertext.org>
Diffstat (limited to 'svl')
-rw-r--r--svl/qa/unit/svl.cxx9
1 files changed, 9 insertions, 0 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 0ace5c7e1bb4..ffa66ae80b74 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1394,6 +1394,15 @@ void Test::testUserDefinedNumberFormats()
sCode = "[NatNum12 ordinal-number]0";
sExpected = "123rd";
checkPreviewString(aFormatter, sCode, 123, eLang, sExpected);
+ sCode = "[NatNum12 capitalize]0";
+ sExpected = "One hundred twenty-three";
+ checkPreviewString(aFormatter, sCode, 123, eLang, sExpected);
+ sCode = "[NatNum12 title ordinal]0";
+ sExpected = "One Thousand Two Hundred Thirty-Fourth";
+ checkPreviewString(aFormatter, sCode, 1234, eLang, sExpected);
+ sCode = "[NatNum12 upper ordinal-number]0";
+ sExpected = "12345TH";
+ checkPreviewString(aFormatter, sCode, 12345, eLang, sExpected);
#endif
}
{ // tdf#105968 engineering format with value rounded up to next magnitude