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

yogesh.bharate001 yogesh.bharate at synerzip.com
Mon May 11 12:03:07 PDT 2015


 sc/qa/unit/data/xlsx/TextColor.xlsx   |binary
 sc/qa/unit/subsequent_export-test.cxx |   20 +++++++++++++++++++-
 sc/source/filter/excel/xestring.cxx   |    3 ++-
 3 files changed, 21 insertions(+), 2 deletions(-)

New commits:
commit 8865ed2efecd03722d10e522265f31c99b13b2bb
Author: yogesh.bharate001 <yogesh.bharate at synerzip.com>
Date:   Mon Apr 27 15:08:16 2015 +0530

    tdf#90812: rPr is not exported after roundtrip.
    
    Problem Description:
    XML Difference: In sharedStrings.xml
    Original file :
    <r>
      <rPr>
          <sz val="11"/>
          <color rgb="FFFF0000"/>
          <rFont val="Calibri"/>
          <family val="2"/>
          <scheme val="minor"/>
      </rPr>
       <t>Red</t>
    </r>
    
    Roundtrip file:
    <r>
      <t>Red</t>
    </r>
    
    rPr is missing in roundtrip file.
    
    Conflicts:
    	sc/qa/unit/subsequent_export-test.cxx
    
    Change-Id: I79efd0f8f1a735ef7e4ebd3fda220b3e339ea91c
    Reviewed-on: https://gerrit.libreoffice.org/15548
    Reviewed-by: Joren De Cuyper <jorendc at libreoffice.org>
    Tested-by: Joren De Cuyper <jorendc at libreoffice.org>

diff --git a/sc/qa/unit/data/xlsx/TextColor.xlsx b/sc/qa/unit/data/xlsx/TextColor.xlsx
new file mode 100644
index 0000000..4de9387
Binary files /dev/null and b/sc/qa/unit/data/xlsx/TextColor.xlsx differ
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 42d8b42..d42e29e 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -142,6 +142,7 @@ public:
     void testSheetCharacterKerningSpace();
     void testSheetCondensedCharacterSpace();
     void testTextUnderlineColor();
+    void testSheetRunParagraphProperty();
 
     CPPUNIT_TEST_SUITE(ScExportTest);
     CPPUNIT_TEST(test);
@@ -194,6 +195,7 @@ public:
     CPPUNIT_TEST(testSheetCharacterKerningSpace);
     CPPUNIT_TEST(testSheetCondensedCharacterSpace);
     CPPUNIT_TEST(testTextUnderlineColor);
+    CPPUNIT_TEST(testSheetRunParagraphProperty);
 
     CPPUNIT_TEST_SUITE_END();
 
@@ -220,7 +222,8 @@ void ScExportTest::registerNamespaces(xmlXPathContextPtr& pXmlXPathCtx)
         { BAD_CAST("table"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:table:1.0") },
         { BAD_CAST("text"), BAD_CAST("urn:oasis:names:tc:opendocument:xmlns:text:1.0") },
         { BAD_CAST("xlink"), BAD_CAST("http://www.w3c.org/1999/xlink") },
-        { BAD_CAST("xdr"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing") }
+        { BAD_CAST("xdr"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing") },
+        { BAD_CAST("x"), BAD_CAST("http://schemas.openxmlformats.org/spreadsheetml/2006/main") }
     };
     for(size_t i = 0; i < SAL_N_ELEMENTS(aNamespaces); ++i)
     {
@@ -2611,6 +2614,21 @@ void ScExportTest::testTextUnderlineColor()
     CPPUNIT_ASSERT_EQUAL(OUString("ff0000"), color);
 }
 
+void ScExportTest::testSheetRunParagraphProperty()
+{
+    ScDocShellRef xShell = loadDoc("TextColor.", XLSX);
+    CPPUNIT_ASSERT(xShell.Is());
+
+    ScDocShellRef xDocSh = saveAndReload(&(*xShell), XLSX);
+    CPPUNIT_ASSERT(xDocSh.Is());
+
+    xmlDocPtr pDoc = XPathHelper::parseExport(&(*xDocSh), m_xSFactory, "xl/sharedStrings.xml", XLSX);
+    CPPUNIT_ASSERT(pDoc);
+
+    assertXPath(pDoc, "/x:sst/x:si/x:r[1]/x:rPr[1]", 1);
+
+    xDocSh->DoClose();
+}
 
 CPPUNIT_TEST_SUITE_REGISTRATION(ScExportTest);
 
diff --git a/sc/source/filter/excel/xestring.cxx b/sc/source/filter/excel/xestring.cxx
index 2e716b0..0e1a127 100644
--- a/sc/source/filter/excel/xestring.cxx
+++ b/sc/source/filter/excel/xestring.cxx
@@ -427,9 +427,10 @@ void XclExpString::WriteXml( XclExpXmlStream& rStrm ) const
         const XclExpFont* pFont = NULL;
         for ( ; aIt != aEnd; ++aIt )
         {
+            // pFont getting first then pass it to run otherwise pFont is NULL.
+            pFont = rFonts.GetFont( aIt->mnFontIdx );
             nStart = lcl_WriteRun( rStrm, GetUnicodeBuffer(),
                     nStart, aIt->mnChar-nStart, pFont );
-            pFont = rFonts.GetFont( aIt->mnFontIdx );
         }
         lcl_WriteRun( rStrm, GetUnicodeBuffer(),
                 nStart, GetUnicodeBuffer().size() - nStart, pFont );


More information about the Libreoffice-commits mailing list