From 1d48e998ae038263b092e0de71da97fceee299f4 Mon Sep 17 00:00:00 2001 From: László Németh Date: Tue, 12 Jun 2018 11:50:05 +0200 Subject: NatNum12: fix and add capitalization prefixes, tdf#115007 follow-up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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 --- svl/qa/unit/svl.cxx | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'svl') 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 -- cgit