svl/CppunitTest_svl_qa_cppunit.mk |    3 +++
 svl/qa/unit/svl.cxx               |   32 ++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)

New commits:
commit 65b5d1a3f045faca462e7370a315cc729105df86
Author: Isamu Mogi <saturda...@gmail.com>
Date:   Fri Jun 13 20:42:42 2014 +0900

    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 <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svl/CppunitTest_svl_qa_cppunit.mk 
b/svl/CppunitTest_svl_qa_cppunit.mk
index 7480d76..f5cd6f7 100644
--- a/svl/CppunitTest_svl_qa_cppunit.mk
+++ b/svl/CppunitTest_svl_qa_cppunit.mk
@@ -25,6 +25,9 @@ $(eval $(call gb_CppunitTest_use_api,svl_qa_cppunit, \
 
 $(eval $(call gb_CppunitTest_use_externals,svl_qa_cppunit, \
        boost_headers \
+       icui18n \
+       icuuc \
+       icu_headers \
 ))
 
 $(eval $(call gb_CppunitTest_add_exception_objects,svl_qa_cppunit, \
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 9090c56..673c8d2 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;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to