[Libreoffice-commits] core.git: svl/qa

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Mon May 30 22:52:30 UTC 2016


 svl/qa/unit/svl.cxx |   26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

New commits:
commit 93874236610dd50a46b6db229e022ae364af582a
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sun May 29 08:07:41 2016 +0200

    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 <erack at redhat.com>
    Tested-by: Eike Rathke <erack at redhat.com>

diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 7f4c1e8..ece214b 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -31,6 +31,8 @@
 
 #include <i18nlangtag/lang.h>
 
+#include <math.h>
+
 #include <svl/zforlist.hxx>
 #include <svl/zformat.hxx>
 #include <svl/sharedstringpool.hxx>
@@ -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);
 
 }


More information about the Libreoffice-commits mailing list