diff options
author | Takeshi Abe <tabe@fixedpoint.jp> | 2016-10-21 11:46:47 +0900 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2016-10-24 11:04:26 +0000 |
commit | 1bd2f008130c717f8f2acd6edad64e00faa2e98d (patch) | |
tree | df21376902d26887ad60e5ade2ecec2b37fb1c62 /svl | |
parent | d129099624d2b646d975c9567541ed9c18adb7ef (diff) |
tdf#103060 Format "GGG" as the era name of a locale-dependent calendar
by default, as Excel does.
This change applies to "GG" and "G" as well. Note that nothing changes
for Italian locale, in which "GGG" stays as a placeholder for day of week.
Change-Id: Iad68f6a9548b7229930c0e0c518fdb29bfaa026f
Reviewed-on: https://gerrit.libreoffice.org/29724
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>
Diffstat (limited to 'svl')
-rw-r--r-- | svl/qa/unit/svl.cxx | 21 | ||||
-rw-r--r-- | svl/source/numbers/zformat.cxx | 3 |
2 files changed, 24 insertions, 0 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 9ae468f00c83..48b5b4433a58 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -60,6 +60,7 @@ public: void testSharedStringPoolPurge(); void testFdo60915(); void testI116701(); + void testTdf103060(); void testDateInput(); void testIsNumberFormat(); void testUserDefinedNumberFormats(); @@ -71,6 +72,7 @@ public: CPPUNIT_TEST(testSharedStringPoolPurge); CPPUNIT_TEST(testFdo60915); CPPUNIT_TEST(testI116701); + CPPUNIT_TEST(testTdf103060); CPPUNIT_TEST(testDateInput); CPPUNIT_TEST(testIsNumberFormat); CPPUNIT_TEST(testUserDefinedNumberFormats); @@ -484,6 +486,25 @@ void Test::testI116701() checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected); } +void Test::testTdf103060() +{ + LanguageType eLang = LANGUAGE_JAPANESE; + OUString sCode, sExpected; + double fPreviewNumber = 42655; // equals 2016-10-12 + SvNumberFormatter aFormatter(m_xContext, eLang); + sCode = "G"; + sExpected = "H"; // Heisei era + checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected); + sCode = "GG"; + const sal_Unicode EXPECTED_G2[] = {0x5E73}; + sExpected = OUString(EXPECTED_G2, SAL_N_ELEMENTS(EXPECTED_G2)); + checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected); + sCode = "GGG"; + const sal_Unicode EXPECTED_G3[] = {0x5E73, 0x6210}; + sExpected = OUString(EXPECTED_G3, SAL_N_ELEMENTS(EXPECTED_G3)); + checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected); +} + void Test::testDateInput() { const char* aData[][2] = { diff --git a/svl/source/numbers/zformat.cxx b/svl/source/numbers/zformat.cxx index a37987ebdbcc..8178b7e4e385 100644 --- a/svl/source/numbers/zformat.cxx +++ b/svl/source/numbers/zformat.cxx @@ -3264,6 +3264,9 @@ bool SvNumberformat::ImpIsOtherCalendar( const ImpSvNumFor& rNumFor ) const case NF_KEY_RR : case NF_KEY_AAA : case NF_KEY_AAAA : + case NF_KEY_G : + case NF_KEY_GG : + case NF_KEY_GGG : return true; } } |