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

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Jan 27 12:29:31 PST 2016


 sc/qa/unit/data/xlsx/preserve_space.xlsx |binary
 sc/qa/unit/subsequent_export-test.cxx    |   16 ++++++++++++++++
 sc/source/filter/excel/xestring.cxx      |    2 +-
 3 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 4c61179b747e6309b9693cc1e2e79b2589aa807d
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jan 27 16:27:06 2016 +0100

    add test for tdf#96912
    
    Change-Id: I6d3f7f86cffef8e91cf108c3aecdf5278e4b8658

diff --git a/sc/qa/unit/data/xlsx/preserve_space.xlsx b/sc/qa/unit/data/xlsx/preserve_space.xlsx
new file mode 100644
index 0000000..401a908
Binary files /dev/null and b/sc/qa/unit/data/xlsx/preserve_space.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 761a34a..e1f89b4 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -155,6 +155,7 @@ public:
     void testMoveCellAnchoredShapes();
     void testMatrixMultiplication();
     void testPreserveTextWhitespaceXLSX();
+    void testPreserveTextWhitespace2XLSX();
     void testTextDirection();
 
     void testRefStringXLSX();
@@ -211,6 +212,7 @@ public:
     CPPUNIT_TEST(testLinkedGraphicRT);
     CPPUNIT_TEST(testImageWithSpecialID);
     CPPUNIT_TEST(testPreserveTextWhitespaceXLSX);
+    CPPUNIT_TEST(testPreserveTextWhitespace2XLSX);
     CPPUNIT_TEST(testSheetLocalRangeNameXLS);
     CPPUNIT_TEST(testSheetTextBoxHyperlink);
     CPPUNIT_TEST(testFontSize);
@@ -2782,6 +2784,20 @@ void ScExportTest::testPreserveTextWhitespaceXLSX()
     xDocSh->DoClose();
 }
 
+void ScExportTest::testPreserveTextWhitespace2XLSX()
+{
+    ScDocShellRef xShell = loadDoc("preserve_space.", FORMAT_XLSX);
+    ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_XLSX);
+    CPPUNIT_ASSERT(xDocSh.Is());
+
+    xmlDocPtr pDoc = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, "xl/sharedStrings.xml", FORMAT_XLSX);
+    CPPUNIT_ASSERT(pDoc);
+    assertXPath(pDoc, "/x:sst/x:si[1]/x:t", "space", "preserve");
+    assertXPath(pDoc, "/x:sst/x:si[2]/x:r[1]/x:t", "space", "preserve");
+    assertXPath(pDoc, "/x:sst/x:si[2]/x:r[2]/x:t", "space", "preserve");
+    xDocSh->DoClose();
+}
+
 void ScExportTest::testHiddenShape()
 {
     ScDocShellRef xDocSh = loadDoc("hiddenShape.", FORMAT_XLSX);
commit 8aa853b2365430558693a32aa23825e199543cf9
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Jan 27 16:25:50 2016 +0100

    we need the space="preserve" also for formatted strings, tdf#96912
    
    Change-Id: I6e245de697c1c42acd916beb75d4d157b2962a9a

diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx
index 58d1acef..d30b2f7 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -401,7 +401,7 @@ static sal_uInt16 lcl_WriteRun( XclExpXmlStream& rStrm, const ScfUInt16Vec& rBuf
         rWorksheet->endElement( XML_rPr );
     }
     rWorksheet->startElement( XML_t,
-            FSEND );
+                FSNS(XML_xml, XML_space), "preserve", FSEND );
     rWorksheet->writeEscaped( XclXmlUtils::ToOUString( rBuffer, nStart, nLength ) );
     rWorksheet->endElement( XML_t );
     rWorksheet->endElement( XML_r );


More information about the Libreoffice-commits mailing list