Kaydet (Commit) 65b5d1a3 authored tarafından Isamu Mogi's avatar Isamu Mogi Kaydeden (comit) Caolán McNamara

related fdo#63230: Add unit test for fdo#44286

It fails if 6013fe19 is reverted.

Change-Id: Iabf13b15e3c26d7ebafdc9284642183f27723d8c
Reviewed-on: https://gerrit.libreoffice.org/9781Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0bf363bb
...@@ -25,6 +25,9 @@ $(eval $(call gb_CppunitTest_use_api,svl_qa_cppunit, \ ...@@ -25,6 +25,9 @@ $(eval $(call gb_CppunitTest_use_api,svl_qa_cppunit, \
$(eval $(call gb_CppunitTest_use_externals,svl_qa_cppunit, \ $(eval $(call gb_CppunitTest_use_externals,svl_qa_cppunit, \
boost_headers \ boost_headers \
icui18n \
icuuc \
icu_headers \
)) ))
$(eval $(call gb_CppunitTest_add_exception_objects,svl_qa_cppunit, \ $(eval $(call gb_CppunitTest_add_exception_objects,svl_qa_cppunit, \
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <unotools/syslocale.hxx> #include <unotools/syslocale.hxx>
#include <boost/scoped_ptr.hpp> #include <boost/scoped_ptr.hpp>
#include <unicode/calendar.h>
using namespace ::com::sun::star; using namespace ::com::sun::star;
using namespace svl; using namespace svl;
...@@ -55,6 +56,7 @@ public: ...@@ -55,6 +56,7 @@ public:
void testSharedString(); void testSharedString();
void testSharedStringPool(); void testSharedStringPool();
void testSharedStringPoolPurge(); void testSharedStringPoolPurge();
void testFdo44286();
void testFdo60915(); void testFdo60915();
void testI116701(); void testI116701();
...@@ -63,6 +65,7 @@ public: ...@@ -63,6 +65,7 @@ public:
CPPUNIT_TEST(testSharedString); CPPUNIT_TEST(testSharedString);
CPPUNIT_TEST(testSharedStringPool); CPPUNIT_TEST(testSharedStringPool);
CPPUNIT_TEST(testSharedStringPoolPurge); CPPUNIT_TEST(testSharedStringPoolPurge);
CPPUNIT_TEST(testFdo44286);
CPPUNIT_TEST(testFdo60915); CPPUNIT_TEST(testFdo60915);
CPPUNIT_TEST(testI116701); CPPUNIT_TEST(testI116701);
CPPUNIT_TEST_SUITE_END(); CPPUNIT_TEST_SUITE_END();
...@@ -74,6 +77,7 @@ private: ...@@ -74,6 +77,7 @@ private:
double fPreviewNumber, double fPreviewNumber,
LanguageType eLang, LanguageType eLang,
OUString& sExpected); OUString& sExpected);
boost::scoped_ptr<icu::TimeZone> m_pDefaultTimeZone;
}; };
Test::Test() Test::Test()
...@@ -87,6 +91,7 @@ Test::Test() ...@@ -87,6 +91,7 @@ Test::Test()
//getProcessServiceFactory. In general those should be removed in favour //getProcessServiceFactory. In general those should be removed in favour
//of retaining references to the root ServiceFactory as its passed around //of retaining references to the root ServiceFactory as its passed around
comphelper::setProcessServiceFactory(xSM); comphelper::setProcessServiceFactory(xSM);
m_pDefaultTimeZone.reset(icu::TimeZone::createDefault());
} }
void Test::setUp() void Test::setUp()
...@@ -95,6 +100,7 @@ void Test::setUp() ...@@ -95,6 +100,7 @@ void Test::setUp()
void Test::tearDown() void Test::tearDown()
{ {
icu::TimeZone::setDefault(*m_pDefaultTimeZone);
} }
Test::~Test() Test::~Test()
...@@ -397,6 +403,32 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter, ...@@ -397,6 +403,32 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter,
CPPUNIT_ASSERT_EQUAL(sExpected, sStr); 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() void Test::testFdo60915()
{ {
LanguageType eLang = LANGUAGE_THAI; LanguageType eLang = LANGUAGE_THAI;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment