summaryrefslogtreecommitdiff
path: root/svl/qa
diff options
context:
space:
mode:
authorIsamu Mogi <saturday6c@gmail.com>2014-06-13 20:42:42 +0900
committerCaolán McNamara <caolanm@redhat.com>2014-06-18 09:48:36 +0000
commit65b5d1a3f045faca462e7370a315cc729105df86 (patch)
treef91ef11e03af0bffb830f9a9b1cabee29c01105b /svl/qa
parent0bf363bb6aed583ea228cec88598144b2cbe0d73 (diff)
related fdo#63230: Add unit test for fdo#44286
It fails if 6013fe19a40dd16ce435a2428f7405b51930689e is reverted. Change-Id: Iabf13b15e3c26d7ebafdc9284642183f27723d8c Reviewed-on: https://gerrit.libreoffice.org/9781 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svl/qa')
-rw-r--r--svl/qa/unit/svl.cxx32
1 files changed, 32 insertions, 0 deletions
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 9090c563a256..673c8d2a77a7 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -37,6 +37,7 @@
#include <unotools/syslocale.hxx>
#include <boost/scoped_ptr.hpp>
+#include <unicode/calendar.h>
using namespace ::com::sun::star;
using namespace svl;
@@ -55,6 +56,7 @@ public:
void testSharedString();
void testSharedStringPool();
void testSharedStringPoolPurge();
+ void testFdo44286();
void testFdo60915();
void testI116701();
@@ -63,6 +65,7 @@ public:
CPPUNIT_TEST(testSharedString);
CPPUNIT_TEST(testSharedStringPool);
CPPUNIT_TEST(testSharedStringPoolPurge);
+ CPPUNIT_TEST(testFdo44286);
CPPUNIT_TEST(testFdo60915);
CPPUNIT_TEST(testI116701);
CPPUNIT_TEST_SUITE_END();
@@ -74,6 +77,7 @@ private:
double fPreviewNumber,
LanguageType eLang,
OUString& sExpected);
+ boost::scoped_ptr<icu::TimeZone> m_pDefaultTimeZone;
};
Test::Test()
@@ -87,6 +91,7 @@ Test::Test()
//getProcessServiceFactory. In general those should be removed in favour
//of retaining references to the root ServiceFactory as its passed around
comphelper::setProcessServiceFactory(xSM);
+ m_pDefaultTimeZone.reset(icu::TimeZone::createDefault());
}
void Test::setUp()
@@ -95,6 +100,7 @@ void Test::setUp()
void Test::tearDown()
{
+ icu::TimeZone::setDefault(*m_pDefaultTimeZone);
}
Test::~Test()
@@ -397,6 +403,32 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter,
CPPUNIT_ASSERT_EQUAL(sExpected, sStr);
}
+void Test::testFdo44286()
+{
+ LanguageType eLang = LANGUAGE_SYSTEM;
+ OUString sCode = "YYYY-MM-DD", sExpected;
+ double fPreviewNumber;
+ SvNumberFormatter aFormatter(m_xContext, eLang);
+ {
+ icu::TimeZone::adoptDefault(icu::TimeZone::createTimeZone("America/Sao_Paulo"));
+ sExpected = "1902-04-22";
+ fPreviewNumber = 843;
+ checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected);
+ }
+ {
+ icu::TimeZone::adoptDefault(icu::TimeZone::createTimeZone("Europe/Berlin"));
+ sExpected = "1790-07-27";
+ fPreviewNumber = -39967;
+ checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected);
+ }
+ {
+ icu::TimeZone::adoptDefault(icu::TimeZone::createTimeZone("US/Mountain"));
+ sExpected = "1790-07-26";
+ fPreviewNumber = -39968;
+ checkPreviewString(aFormatter, sCode, fPreviewNumber, eLang, sExpected);
+ }
+}
+
void Test::testFdo60915()
{
LanguageType eLang = LANGUAGE_THAI;