From 93874236610dd50a46b6db229e022ae364af582a Mon Sep 17 00:00:00 2001 From: Laurent Balland-Poirier Date: Sun, 29 May 2016 08:07:41 +0200 Subject: tdf#97835 tdf#61996 tdf#95339 Add qa unit test tdf#97835: suppress decimal separator tdf#61996: skip quoted text tdf#95339: detect SSMM as seconds minutes Change-Id: Iee3ff723b0c5d2a298d8c7ef03112d5e30d4e4df Reviewed-on: https://gerrit.libreoffice.org/25597 Reviewed-by: Eike Rathke Tested-by: Eike Rathke --- svl/qa/unit/svl.cxx | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'svl') diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx index 7f4c1e875381..ece214b3eb55 100644 --- a/svl/qa/unit/svl.cxx +++ b/svl/qa/unit/svl.cxx @@ -31,6 +31,8 @@ #include +#include + #include #include #include @@ -60,6 +62,7 @@ public: void testI116701(); void testDateInput(); void testIsNumberFormat(); + void testUserDefinedNumberFormats(); CPPUNIT_TEST_SUITE(Test); CPPUNIT_TEST(testNumberFormat); @@ -70,6 +73,7 @@ public: CPPUNIT_TEST(testI116701); CPPUNIT_TEST(testDateInput); CPPUNIT_TEST(testIsNumberFormat); + CPPUNIT_TEST(testUserDefinedNumberFormats); CPPUNIT_TEST_SUITE_END(); private: @@ -1080,6 +1084,28 @@ void Test::testIsNumberFormat() } } +void Test::testUserDefinedNumberFormats() +{ + LanguageType eLang = LANGUAGE_ENGLISH_US; + OUString sCode, sExpected; + SvNumberFormatter aFormatter(m_xContext, eLang); + { // tdf#97835: suppress decimal separator + sCode = "0.##\" m\""; + sExpected = "12 m"; + checkPreviewString(aFormatter, sCode, 12.0, eLang, sExpected); + } + { // tdf#61996: skip quoted text + sCode = "0.00\" ;\""; + sExpected = "-12.00 ;"; + checkPreviewString(aFormatter, sCode, -12.0, eLang, sExpected); + } + { // tdf#995339: detect SSMM as second minute + sCode = "SS:MM:HH DD/MM/YY"; + sExpected = "54:23:03 02/01/00"; + checkPreviewString(aFormatter, sCode, M_PI, eLang, sExpected); + } +} + CPPUNIT_TEST_SUITE_REGISTRATION(Test); } -- cgit