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

Laurent Balland-Poirier laurent.balland-poirier at laposte.net
Wed Nov 9 14:51:46 UTC 2016


 sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods |binary
 sc/qa/unit/subsequent_export-test.cxx                 |   27 +++++++++++++++++-
 2 files changed, 26 insertions(+), 1 deletion(-)

New commits:
commit b0901f9f0843c2d85da6742780d9aef296f62c60
Author: Laurent Balland-Poirier <laurent.balland-poirier at laposte.net>
Date:   Sat Oct 22 23:51:14 2016 +0200

    tdf#102370 QA test exponent without sign during export to Excel
    
    Change-Id: I0adf7d97f297a8fe1003c8e4cb9a08c9070ed92e
    Reviewed-on: https://gerrit.libreoffice.org/30170
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Eike Rathke <erack at redhat.com>

diff --git a/sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods b/sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods
new file mode 100644
index 0000000..ab3fbd7
Binary files /dev/null and b/sc/qa/unit/data/ods/tdf102370_ExponentWithoutSign.ods differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 9a47f47..b9bbc30 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -61,6 +61,7 @@
 #include <formula/grammar.hxx>
 #include <unotools/useroptions.hxx>
 #include <tools/datetime.hxx>
+#include <svl/zformat.hxx>
 
 #include <test/xmltesttools.hxx>
 #include <comphelper/processfactory.hxx>
@@ -179,6 +180,7 @@ public:
     void testTdf88657();
     void testEscapeCharInNumberFormatXLSX();
     void testNatNumInNumberFormatXLSX();
+    void testExponentWithoutSignFormatXLSX();
 
     void testHiddenRepeatedRowsODS();
     void testHyperlinkTargetFrameODS();
@@ -264,6 +266,7 @@ public:
     CPPUNIT_TEST(testTdf88657);
     CPPUNIT_TEST(testEscapeCharInNumberFormatXLSX);
     CPPUNIT_TEST(testNatNumInNumberFormatXLSX);
+    CPPUNIT_TEST(testExponentWithoutSignFormatXLSX);
 
     CPPUNIT_TEST(testHiddenRepeatedRowsODS);
     CPPUNIT_TEST(testHyperlinkTargetFrameODS);
@@ -3698,6 +3701,28 @@ void ScExportTest::testNatNumInNumberFormatXLSX()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testExponentWithoutSignFormatXLSX()
+{
+    ScDocShellRef xDocSh = loadDoc("tdf102370_ExponentWithoutSign.", FORMAT_ODS);
+    CPPUNIT_ASSERT( xDocSh.Is() );
+    xDocSh = saveAndReload( &(*xDocSh), FORMAT_XLSX);
+    CPPUNIT_ASSERT( xDocSh.Is() );
+
+    xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
+    CPPUNIT_ASSERT(xDocSh.Is());
+
+    ScDocument& rDoc = xDocSh->GetDocument();
+    sal_uInt32 nNumberFormat;
+    rDoc.GetNumberFormat(0, 0, 0, nNumberFormat);
+    const SvNumberformat* pNumberFormat = rDoc.GetFormatTable()->GetEntry(nNumberFormat);
+    const OUString& rFormatStr = pNumberFormat->GetFormatstring();
+    const OUString aExpectedFormatStr = "0.00E0";
+
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format lost exponent without sign during Excel export", aExpectedFormatStr, rFormatStr);
+
+    xDocSh->DoClose();
+}
+
 void ScExportTest::testHiddenRepeatedRowsODS()
 {
     ScDocShellRef xDocSh = loadDoc("empty.", FORMAT_ODS);
@@ -3708,7 +3733,7 @@ void ScExportTest::testHiddenRepeatedRowsODS()
         rDoc.SetRowHidden(0, 20, 0, true);
     }
 
-    xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);  // Convert [NatNum5] to [DBNum2] in Chinese
+    xDocSh = saveAndReload( &(*xDocSh), FORMAT_ODS);
     ScDocument& rDoc = xDocSh->GetDocument();
     SCROW nFirstRow = 0;
     SCROW nLastRow = 0;


More information about the Libreoffice-commits mailing list