diff options
author | YogeshBharate <yogesh.bharate@synerzip.com> | 2014-02-04 19:34:09 +0530 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2014-02-14 12:53:13 +0100 |
commit | e3b03a028538e38337bcabbe5453b043920c23a8 (patch) | |
tree | 3eec9708918bf0877ee8bcbce195081348cb3e11 | |
parent | caedbd44ba3a5431e850e6c0bb3ebf808cb97839 (diff) |
Added unit test for fdo#73872:
- Issue related to footer reference.
- Added unit test to check footer1.xml.rels
is contains in doc after roundtrip.
- Also check Id = rId1 in footer1.xml.rels file.
Conflicts:
chart2/qa/extras/chart2export.cxx
Reviewed on:
https://gerrit.libreoffice.org/7851
Change-Id: I52fa8017abb7552c7752185873ff2bfb46689367
-rw-r--r-- | sw/CppunitTest_sw_ooxmlexport.mk | 2 | ||||
-rw-r--r-- | sw/qa/extras/ooxmlexport/data/chart-in-footer.docx | bin | 0 -> 29207 bytes | |||
-rw-r--r-- | sw/qa/extras/ooxmlexport/ooxmlexport.cxx | 27 | ||||
-rw-r--r-- | writerfilter/source/ooxml/OOXMLDocumentImpl.cxx | 1 |
4 files changed, 28 insertions, 2 deletions
diff --git a/sw/CppunitTest_sw_ooxmlexport.mk b/sw/CppunitTest_sw_ooxmlexport.mk index 4ebff325d6a2..6d09ca211495 100644 --- a/sw/CppunitTest_sw_ooxmlexport.mk +++ b/sw/CppunitTest_sw_ooxmlexport.mk @@ -51,6 +51,8 @@ $(eval $(call gb_CppunitTest_use_ure,sw_ooxmlexport)) $(eval $(call gb_CppunitTest_use_components,sw_ooxmlexport,\ basic/util/sb \ canvas/source/factory/canvasfactory \ + chart2/source/chartcore \ + chart2/source/controller/chartcontroller \ comphelper/util/comphelp \ configmgr/source/configmgr \ drawinglayer/drawinglayer \ diff --git a/sw/qa/extras/ooxmlexport/data/chart-in-footer.docx b/sw/qa/extras/ooxmlexport/data/chart-in-footer.docx Binary files differnew file mode 100644 index 000000000000..293ee076bc28 --- /dev/null +++ b/sw/qa/extras/ooxmlexport/data/chart-in-footer.docx diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx index 46d7adfe7ead..ab4e745affeb 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx @@ -155,6 +155,7 @@ xmlNodeSetPtr Test::getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath) xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("wp"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("a"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/main")); xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("pic"), BAD_CAST("http://schemas.openxmlformats.org/drawingml/2006/picture")); + xmlXPathRegisterNs(pXmlXpathCtx, BAD_CAST("rels"), BAD_CAST("http://schemas.openxmlformats.org/package/2006/relationships")); xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx); return pXmlXpathObj->nodesetval; } @@ -3198,8 +3199,6 @@ DECLARE_OOXMLEXPORT_TEST(testExtentValue, "fdo74605.docx") assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice[1]/w:drawing[1]/wp:anchor[1]/wp:extent","cx","0"); } -#endif - DECLARE_OOXMLEXPORT_TEST( testChildNodesOfCubicBezierTo, "FDO74774.docx") { /* Number of children required by cubicBexTo is 3 of type "pt". @@ -3215,6 +3214,30 @@ DECLARE_OOXMLEXPORT_TEST( testChildNodesOfCubicBezierTo, "FDO74774.docx") "/w:document/w:body/w:p[2]/w:r[1]/mc:AlternateContent[1]/mc:Choice/w:drawing[1]/wp:inline[1]/a:graphic[1]/a:graphicData[1]/wpg:wgp[1]/wps:wsp[3]/wps:spPr[1]/a:custGeom[1]/a:pathLst[1]/a:path[1]/a:cubicBezTo[2]/a:pt[3]"); } +DECLARE_OOXMLEXPORT_TEST(testChartInFooter, "chart-in-footer.docx") +{ + // fdo#73872: document contains chart in footer. + // The problem was that footer1.xml.rels files for footer1.xml + // files were missing from docx file after roundtrip. + xmlDocPtr pXmlDoc = parseExport("word/_rels/footer1.xml.rels"); + if(!pXmlDoc) + return; + + // Check footer1.xml.rels contains in doc after roundtrip. + // Check Id = rId1 in footer1.xml.rels + assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship","Id","rId1"); + + uno::Reference<drawing::XDrawPageSupplier> xDrawPageSupplier(mxComponent, uno::UNO_QUERY); + if (xDrawPageSupplier.is()) + { + // If xDrawPage->getCount()==1, then document conatins one shape. + uno::Reference<container::XIndexAccess> xDrawPage(xDrawPageSupplier->getDrawPage(), uno::UNO_QUERY); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), xDrawPage->getCount()); // One shape in the doc + } +} + +#endif + CPPUNIT_PLUGIN_IMPLEMENT(); diff --git a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx index 4b90d114b4ab..2981f9fe2e34 100644 --- a/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx +++ b/writerfilter/source/ooxml/OOXMLDocumentImpl.cxx @@ -178,6 +178,7 @@ void OOXMLDocumentImpl::importSubStreamRelations(OOXMLStream::Pointer_t pStream, { SAL_WARN("writerfilter", "importSubStreamRelations: exception while " "importing stream " << nType << " : " << e.Message); + return; } uno::Reference<io::XInputStream> xcpInputStream = |