summaryrefslogtreecommitdiff
path: root/svl/qa
diff options
context:
space:
mode:
authorLászló Németh <nemeth@numbertext.org>2018-06-12 11:50:05 +0200
committerEike Rathke <erack@redhat.com>2018-06-20 20:24:37 +0200
commit261ff0cdf0e89a80f5d2af7ba5a331bc237a0ceb (patch)
tree00aea88431dc91e8fcf9b5a966ef7ca140bd589a /svl/qa
parentec36da3788ffc7007dadc568d00f019c0ea831b4 (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. Change-Id: I5fceb784930e6bc6d376116f5a42ad49cd248a54 Reviewed-on: https://gerrit.libreoffice.org/55681 Tested-by: Jenkins Reviewed-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl/qa')
-rw-r--r--svl/qa/unit/svl.cxx13
1 files changed, 11 insertions, 2 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 26b2f6a41588..7f0c54a2547e 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -1394,14 +1394,23 @@ 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);
sCode = "[NatNum12 D=ordinal-number]D\" of \"MMMM";
sExpected = "2nd of January";
checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
sCode = "[NatNum12 D=ordinal-number,YYYY=year]D\" of \"MMMM\", \"YYYY";
sExpected = "2nd of January, nineteen hundred";
checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
- sCode = "[NatNum12 YYYY=year, D=ordinal]D\" of \"MMMM\", \"YYYY";
- sExpected = "second of January, nineteen hundred";
+ sCode = "[NatNum12 YYYY=title year, D=capitalize ordinal]D\" of \"MMMM\", \"YYYY";
+ sExpected = "Second of January, Nineteen Hundred";
checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected);
#endif
}