summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorYogeshBharate <yogesh.bharate@synerzip.com>2014-02-04 19:34:09 +0530
committerMiklos Vajna <vmiklos@collabora.co.uk>2014-02-14 12:53:13 +0100
commite3b03a028538e38337bcabbe5453b043920c23a8 (patch)
tree3eec9708918bf0877ee8bcbce195081348cb3e11 /sw
parentcaedbd44ba3a5431e850e6c0bb3ebf808cb97839 (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
Diffstat (limited to 'sw')
-rw-r--r--sw/CppunitTest_sw_ooxmlexport.mk2
-rw-r--r--sw/qa/extras/ooxmlexport/data/chart-in-footer.docxbin0 -> 29207 bytes
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport.cxx27
3 files changed, 27 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
new file mode 100644
index 000000000000..293ee076bc28
--- /dev/null
+++ b/sw/qa/extras/ooxmlexport/data/chart-in-footer.docx
Binary files differ
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();