summaryrefslogtreecommitdiff
path: root/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-05-05 19:10:16 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-05-07 09:52:27 +0200
commitec6eaa58addf0d8823f8c56d4ec168ff389da8c5 (patch)
treeadb44639fc6bdecad5f576aa5e1aa90f3c9d64b3 /sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
parentc437948f6c0d602bb200fc92e80cb73ae8ae5109 (diff)
fix memory leak of xmlDoc objects
in unit tests Change-Id: Id16731bbbe2f1b0e3642722d77aba04fc98db4cc Reviewed-on: https://gerrit.libreoffice.org/c/core/+/93508 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/qa/extras/ooxmlexport/ooxmlexport4.cxx')
-rw-r--r--sw/qa/extras/ooxmlexport/ooxmlexport4.cxx144
1 files changed, 72 insertions, 72 deletions
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
index a6352c767335..9e0e23b3c723 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport4.cxx
@@ -100,37 +100,37 @@ DECLARE_OOXMLEXPORT_TEST(testAutofit, "autofit.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesDeletedParagraphMark, "testTrackChangesDeletedParagraphMark.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:del");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesInsertedParagraphMark, "testTrackChangesInsertedParagraphMark.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:ins");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesDeletedTableRow, "testTrackChangesDeletedTableRow.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:trPr/w:del");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesInsertedTableRow, "testTrackChangesInsertedTableRow.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[2]/w:trPr/w:ins");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesDeletedTableCell, "testTrackChangesDeletedTableCell.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc/w:tcPr/w:cellDel");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesInsertedTableCell, "testTrackChangesInsertedTableCell.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[3]/w:tc/w:tcPr/w:cellIns");
}
@@ -151,19 +151,19 @@ DECLARE_OOXMLEXPORT_TEST(testTextBoxPictureFill, "textbox_picturefill.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO73034, "FDO73034.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:rPr/w:u", "val").match("single"));
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO71834, "fdo71834.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[2]/w:tc[1]/w:tcPr[1]/w:tcW[1]","type", "dxa");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTrackChangesParagraphProperties, "testTrackChangesParagraphProperties.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPathChildren(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange", 0);
}
@@ -184,7 +184,7 @@ DECLARE_OOXMLEXPORT_TEST(testMsoSpt180, "mso-spt180.docx")
DECLARE_OOXMLEXPORT_TEST(testFdo73550, "fdo73550.docx")
{
- xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
if (!pXmlDocument)
return;
// This was wrap="none".
@@ -234,7 +234,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73556,"fdo73556.docx")
* the table width was calculated as 2820 from cells instead
* of 3751 from the Grid.
*/
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 3);
sal_Int32 tableWidth = 0;
tableWidth += getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[1]", "w").toInt32();
@@ -246,7 +246,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73556,"fdo73556.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSegFaultWhileSave, "test_segfault_while_save.docx")
{
// fdo#74499
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
CPPUNIT_ASSERT_EQUAL(static_cast<sal_Int32>(6137), getXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol[2]", "w").toInt32());
// tdf#106572 - preventative test matching danger conditions, but imported OK anyway
@@ -263,7 +263,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(fdo69656, "Table_cell_auto_width_fdo69656.do
// After changes for fdo76741 the fixed width is exported as "dxa" for DOCX
// Check for the width type of table and its cells.
- xmlDocPtr pXmlDoc = parseExport();
+ xmlDocUniquePtr pXmlDoc = parseExport();
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblW","type","dxa");
}
@@ -274,7 +274,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo76741, "fdo76741.docx")
// - the table alignment in saved file is "left" instead of "center"
// - the table width type in properties is "auto" instead of "dxa"
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "//w:jc", "val", "center");
assertXPath(pXmlDoc, "//w:tblW", "w", "10081");
@@ -285,25 +285,25 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo73541,"fdo73541.docx")
{
// fdo#73541: The mirrored margins were not imported and mapped correctly in Page Layout
// Hence <w:mirrorMargins /> tag was not exported back in settings.xml
- xmlDocPtr pXmlDoc = parseExport("word/settings.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
assertXPath(pXmlDoc, "/w:settings/w:mirrorMargins");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo106029,"fdo106029.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/settings.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/settings.xml");
assertXPath(pXmlDoc, "/w:settings/w:compat/w:doNotExpandShiftReturn");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO74106, "FDO74106.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml");
assertXPath(pXmlDoc, "/w:numbering/w:abstractNum[1]/w:lvl[1]/w:numFmt", "val","hebrew1");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO74215, "FDO74215.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml");
// tdf#106849 NumPicBullet xShape should not be resized.
// This is dependent on the running system: see MSWordExportBase::BulletDefinitions
@@ -339,7 +339,7 @@ DECLARE_OOXMLEXPORT_TEST(testColumnBreak_ColumnCountIsZero,"fdo74153.docx")
/* fdo73545: Column Break with Column_count = 0 was not getting preserved.
* The <w:br w:type="column" /> was missing after roundtrip
*/
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
if (pXmlDoc)
assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r[1]/w:br","type","column");
@@ -368,7 +368,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testIndentation, "test_indentation.docx")
// fdo#74141 :There was a problem that in style.xml and document.xml in <w:ind> tag "right" & "left" margin
// attributes gets added(w:right=0 & w:left=0) if these attributes are not set in original document.
// This test is to verify <w:ind> does not contain w:right attribute.
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:ind", "end");
}
@@ -377,7 +377,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_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");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/footer1.xml.rels");
// Check footer1.xml.rels contains in doc after roundtrip.
// Check Id = rId1 in footer1.xml.rels
@@ -387,14 +387,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testChartInFooter, "chart-in-footer.docx")
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart");
- xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml");
+ xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
assertXPath(pXmlDocCT,
"/ContentType:Types/ContentType:Override[@PartName='/word/charts/chart1.xml']",
"ContentType",
"application/vnd.openxmlformats-officedocument.drawingml.chart+xml");
// check the content too
- xmlDocPtr pXmlDocFooter1 = parseExport("word/footer1.xml");
+ xmlDocUniquePtr pXmlDocFooter1 = parseExport("word/footer1.xml");
assertXPath(pXmlDocFooter1,
"/w:ftr/w:p[1]/w:r/w:drawing/wp:inline/a:graphic/a:graphicData",
"uri",
@@ -448,7 +448,7 @@ DECLARE_OOXMLEXPORT_TEST(testFloatingTablePosition, "floating-table-position.doc
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testAbi11739, "abi11739.docx")
{
// Validation test: order of elements were wrong.
- xmlDocPtr pXmlDoc = parseExport("word/styles.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/styles.xml");
// Order was: uiPriority, link, basedOn.
CPPUNIT_ASSERT(getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "basedOn") < getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "link"));
CPPUNIT_ASSERT(getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "link") < getXPathPosition(pXmlDoc, "/w:styles/w:style[3]", "uiPriority"));
@@ -466,7 +466,7 @@ DECLARE_OOXMLEXPORT_TEST(testEmbeddedXlsx, "embedded-xlsx.docx")
CPPUNIT_ASSERT_EQUAL(OUString("FrameShape"), getShape(2)->getShapeType());
// check the objects are present in the exported document.xml
- xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
if (!pXmlDocument)
return;
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/w:object", 2);
@@ -494,7 +494,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testNumberedLists_StartingWithZero, "FDO7410
* the Numbered list should start from 0.
* Problem was LO was writing <w:start> for all levels 0-8 with default value "1".
*/
- xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml");
// Check that we do _not_ export w:start for <w:lvl w:ilvl="0">.
assertXPath(pXmlDoc, "w:numbering/w:abstractNum[1]/w:lvl[1]/w:start", 0);
@@ -507,7 +507,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBreak,"fdo74566.docx")
* Now after fix , LO writes Page Break as the new paragraph and also
* preserves the xml tag <w:br>.
*/
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
uno::Reference<text::XTextRange> xParagraph2 = getParagraph(2);
uno::Reference<text::XTextRange> xParagraph4 = getParagraph(4);
@@ -519,7 +519,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBreak,"fdo74566.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOleObject, "test_ole_object.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/w:object/v:shape/v:imagedata",
"o:title");
@@ -530,13 +530,13 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOleObject, "test_ole_object.docx")
// TODO: ProgID="Package" - what is this? Zip with 10k extra header?
// check the rels too
- xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels");
+ xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels");
assertXPath(pXmlDocRels,
"/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.bin']",
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject");
// check the media type too
- xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml");
+ xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
assertXPath(pXmlDocCT,
"/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.bin']",
"ContentType",
@@ -551,7 +551,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo74792, "fdo74792.docx")
* were not preserved on exporting to DOCX format
* Added support to grabbag the rels, with associated images.
*/
- xmlDocPtr pXmlDoc = parseExport("word/diagrams/_rels/data1.xml.rels");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/diagrams/_rels/data1.xml.rels");
if(!pXmlDoc)
return;
assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship", 4);
@@ -570,11 +570,11 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx")
//repeated and thereby causing a data loss as the binary stream was
//getting over written. This test case ensures that unique names are
//given for images in different smart arts.
- xmlDocPtr pXmlDataRels1 = parseExport("word/diagrams/_rels/data1.xml.rels");
+ xmlDocUniquePtr pXmlDataRels1 = parseExport("word/diagrams/_rels/data1.xml.rels");
if( !pXmlDataRels1 )
return;
- xmlDocPtr pXmlDataRels2 = parseExport("word/diagrams/_rels/data2.xml.rels");
+ xmlDocUniquePtr pXmlDataRels2 = parseExport("word/diagrams/_rels/data2.xml.rels");
if( !pXmlDataRels2 )
return;
@@ -598,7 +598,7 @@ DECLARE_OOXMLEXPORT_TEST(testFdo77718, "fdo77718.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCurruption, "tableCurrupt.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/header2.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/header2.xml");
CPPUNIT_ASSERT(pXmlDoc) ;
assertXPath(pXmlDoc, "/w:hdr/w:tbl[1]/w:tr[1]/w:tc[1]",1);
@@ -611,7 +611,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableCurruption, "tableCurrupt.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDateControl, "date-control.docx")
{
// check XML
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date", "fullDate", "2014-03-05T00:00:00Z");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:dateFormat", "val", "dddd, dd' de 'MMMM' de 'yyyy");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:date/w:lid", "val", "es-ES");
@@ -620,7 +620,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDateControl, "date-control.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf115030, "tdf115030.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
sal_Unicode aDot = {0x02D9};
sal_Unicode aDobleDot = {0x00A8};
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:acc/m:accPr/m:chr", "val", OUString(aDot));
@@ -630,14 +630,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf115030, "tdf115030.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_OpeningBrace, "2120112713_OpenBrace.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// Checking for OpeningBrace tag
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[1]/m:dPr[1]/m:begChr[1]","val","");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf132305, "tdf132305.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:bar/m:barPr/m:pos","val","top");
}
@@ -678,7 +678,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_Tdf132305, "tdf132305.docx")
// See, tdf#38778
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf38778, "tdf38778_properties_in_run_for_field.doc")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
const OUString psz("20");
const OUString pszCs("20");
@@ -712,7 +712,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTdf38778, "tdf38778_properties_in_run_fo
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76312, "FDO76312.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr[1]/w:tc[1]");
}
@@ -720,7 +720,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO76312, "FDO76312.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testComboBoxControl, "combobox-control.docx")
{
// check XML
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[1]", "value", "manolo");
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtPr/w:dropDownList/w:listItem[2]", "value", "pepito");
assertXPathContent(pXmlDoc, "/w:document/w:body/w:p/w:sdt/w:sdtContent/w:r/w:t", "Manolo");
@@ -739,7 +739,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testComboBoxControl, "combobox-control.docx"
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCheckBoxControl, "checkbox-control.docx")
{
// check XML
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:checked", "val", "1");
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:checkedState", "val", "2612");
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w14:checkbox/w14:uncheckedState", "val", "2610");
@@ -753,8 +753,8 @@ DECLARE_OOXMLEXPORT_TEST(testParagraphWithComments, "paragraphWithComments.docx"
which was causing a mismatch in the relationship for comment id's
in document.xml and comment.xml
*/
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
- xmlDocPtr pXmlComm = parseExport("word/comments.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlComm = parseExport("word/comments.xml");
if(!pXmlDoc)
return;
@@ -783,11 +783,11 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOLEObjectinHeader, "2129393649.docx")
// Problem was relationship entry for oleobject from header was
// exported into document.xml.rels file because of this rels file
// for headers were missing from document/word/rels.
- xmlDocPtr pXmlDoc = parseExport("word/_rels/header1.xml.rels");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/_rels/header1.xml.rels");
assertXPath(pXmlDoc,"/rels:Relationships/rels:Relationship[1]","Id","rId1");
- xmlDocPtr pXmlDocCT = parseExport("[Content_Types].xml");
+ xmlDocUniquePtr pXmlDocCT = parseExport("[Content_Types].xml");
// check the media type too
assertXPath(pXmlDocCT,
@@ -796,12 +796,12 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOLEObjectinHeader, "2129393649.docx")
"application/vnd.openxmlformats-officedocument.oleObject");
// check the content too
- xmlDocPtr pXmlDocHeader1 = parseExport("word/header1.xml");
+ xmlDocUniquePtr pXmlDocHeader1 = parseExport("word/header1.xml");
assertXPath(pXmlDocHeader1,
"/w:hdr/w:tbl/w:tr[1]/w:tc[2]/w:p[1]/w:r/w:object/o:OLEObject",
"ProgID",
"Word.Picture.8");
- xmlDocPtr pXmlDocHeader2 = parseExport("word/header2.xml");
+ xmlDocUniquePtr pXmlDocHeader2 = parseExport("word/header2.xml");
assertXPath(pXmlDocHeader2,
"/w:hdr/w:tbl/w:tr[1]/w:tc[2]/w:p[1]/w:r/w:object/o:OLEObject",
"ProgID",
@@ -810,20 +810,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testOLEObjectinHeader, "2129393649.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test_ClosingBrace, "2120112713.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// Checking for ClosingBrace tag
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/m:oMath[1]/m:d[2]/m:dPr[1]/m:endChr[1]","val","");
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testlvlPicBulletId, "lvlPicBulletId.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/numbering.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/numbering.xml");
assertXPath(pXmlDoc, "/w:numbering[1]/w:abstractNum[1]/w:lvl[1]/w:lvlPicBulletId[1]", 0);
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtContent, "SdtContent.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/header1.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/header1.xml");
assertXPath(pXmlDoc, "/w:hdr[1]/w:sdt[1]/w:sdtContent[1]/w:p[1]/w:del[1]");
}
@@ -834,7 +834,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSdtContent, "SdtContent.docx")
DECLARE_OOXMLEXPORT_TEST(testFdo76016, "fdo76016.docx")
{
// check XML
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "//a:graphic/a:graphicData/wps:wsp/wps:spPr/a:prstGeom/a:avLst/a:gd[1]", "name", "adj1");
@@ -848,7 +848,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFileWithInvalidImageLink, "FileWithInval
invalid, then the RT file used to result in corruption
since the exported image would be an empty image.
*/
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPathNoAttribute(pXmlDoc,
"/w:document/w:body/w:p[2]/w:r[2]/w:drawing[1]/wp:inline[1]/"
@@ -858,20 +858,20 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFileWithInvalidImageLink, "FileWithInval
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeDOCX, "fdo80410.docx")
{
- xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml");
assertXPath(pXmlDoc,
"/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.docx']",
"ContentType",
"application/vnd.openxmlformats-officedocument.wordprocessingml.document");
// check the rels too
- xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels");
+ xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels");
assertXPath(pXmlDocRels,
"/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.docx']",
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
// check the content too
- xmlDocPtr pXmlDocContent = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml");
assertXPath(pXmlDocContent,
"/w:document/w:body/w:p[6]/w:r/w:object/o:OLEObject",
"ProgID",
@@ -880,18 +880,18 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeDOCX, "fdo80410.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeXLSM, "fdo76098.docx")
{
- xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml");
assertXPath(pXmlDoc, "/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/Microsoft_Excel_Macro-Enabled_Worksheet1.xlsm']", "ContentType", "application/vnd.ms-excel.sheet.macroEnabled.12");
// check the rels too
- xmlDocPtr pXmlDocRels = parseExport("word/charts/_rels/chart1.xml.rels");
+ xmlDocUniquePtr pXmlDocRels = parseExport("word/charts/_rels/chart1.xml.rels");
assertXPath(pXmlDocRels,
"/rels:Relationships/rels:Relationship[@Target='../embeddings/Microsoft_Excel_Macro-Enabled_Worksheet1.xlsm']",
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package");
// check the content too
- xmlDocPtr pXmlDocChart1 = parseExport("word/charts/chart1.xml");
+ xmlDocUniquePtr pXmlDocChart1 = parseExport("word/charts/chart1.xml");
assertXPath(pXmlDocChart1,
"/c:chartSpace/c:externalData",
"id",
@@ -900,7 +900,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testContentTypeXLSM, "fdo76098.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(test76108, "test76108.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
//docx file after RT is getting corrupted.
assertXPath(pXmlDoc, "/w:document[1]/w:body[1]/w:p[1]/w:r[1]/w:fldChar[1]", "fldCharType", "begin");
}
@@ -910,7 +910,7 @@ DECLARE_OOXMLEXPORT_TEST(testTCTagMisMatch, "TCTagMisMatch.docx")
// TCTagMisMatch.docx : This document contains an empty table with borders.
// there was a TC tag mismatch which resulted into a crash.
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
if(!pXmlDoc)
return;
assertXPath(pXmlDoc,"/w:document[1]/w:body[1]/w:tbl[1]/w:tr[1]/w:tc[1]/w:tbl[1]/w:tr[1]/w:tc[1]",0);
@@ -920,13 +920,13 @@ DECLARE_OOXMLEXPORT_TEST(testTCTagMisMatch, "TCTagMisMatch.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFDO78292, "FDO78292.docx")
{
//text node is a leaf node, it should not have any children
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc,"/w:document/w:body/w:p[14]/w:sdt[3]/w:sdtPr[1]/w:text/w14:checked",0);
}
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSimpleSdts, "simple-sdts.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:text", 1);
assertXPath(pXmlDoc, "/w:document/w:body/w:sdt/w:sdtPr/w:id", 3);
@@ -937,7 +937,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSimpleSdts, "simple-sdts.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEmbeddedExcelChart, "EmbeddedExcelChart.docx")
{
- xmlDocPtr pXmlDoc = parseExport("[Content_Types].xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("[Content_Types].xml");
assertXPath(pXmlDoc,
"/ContentType:Types/ContentType:Override[@PartName='/word/embeddings/oleObject1.xls']",
@@ -945,14 +945,14 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testEmbeddedExcelChart, "EmbeddedExcelChart.
"application/vnd.ms-excel");
// check the rels too
- xmlDocPtr pXmlDocRels = parseExport("word/_rels/document.xml.rels");
+ xmlDocUniquePtr pXmlDocRels = parseExport("word/_rels/document.xml.rels");
assertXPath(pXmlDocRels,
"/rels:Relationships/rels:Relationship[@Target='embeddings/oleObject1.xls']",
"Type",
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject");
// check the content too
- xmlDocPtr pXmlDocContent = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDocContent = parseExport("word/document.xml");
assertXPath(pXmlDocContent,
"/w:document/w:body/w:p/w:r/w:object/o:OLEObject",
"ProgID",
@@ -986,7 +986,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf103001, "tdf103001.docx")
DECLARE_OOXMLEXPORT_TEST(testTdf92521, "tdf92521.odt")
{
- if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+ if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
// There should be a section break that's in the middle of the document: right after the table.
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:sectPr", 1);
}
@@ -996,7 +996,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx")
// the problem was: file is truncated: the first page is missing.
// More precisely, the table in the first page was clipped.
{
- xmlDocPtr pXmlDoc = parseLayoutDump();
+ xmlDocUniquePtr pXmlDoc = parseLayoutDump();
sal_Int32 nFlyPrtHeight = getXPath(pXmlDoc, "(/root/page[1]//fly)[1]/infos/prtBounds", "height").toInt32();
sal_Int32 nTableHeight = getXPath(pXmlDoc, "(/root/page[1]//fly)[1]/tab/infos/bounds", "height").toInt32();
CPPUNIT_ASSERT_MESSAGE("The table is clipped in a fly frame.", nFlyPrtHeight >= nTableHeight);
@@ -1032,7 +1032,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf102466, "tdf102466.docx")
DECLARE_OOXMLEXPORT_TEST(testTdf99090_pgbrkAfterTable, "tdf99090_pgbrkAfterTable.docx")
{
- if (xmlDocPtr pXmlDoc = parseExport("word/document.xml"))
+ if (xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml"))
// There should be a regular page break that's in the middle of the document: right after the table.
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:r/w:br", 1);
}
@@ -1137,7 +1137,7 @@ DECLARE_OOXMLEXPORT_TEST(testTdf81345_045Original,"tdf81345.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDocxTablePosition, "floating-table-position.docx")
{
- xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
// the exported positions were wrong due to some missing shifting in the export code
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblPr/w:tblpPr", "tblpX", "3494");
@@ -1147,7 +1147,7 @@ DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testDocxTablePosition, "floating-table-posit
DECLARE_OOXMLEXPORT_TEST(testUnderlineGroupShapeText, "tdf123351_UnderlineGroupSapeText.docx")
{
// tdf#123351: Check if correct underline is used.
- xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
if (!pXmlDocument)
return;
@@ -1201,7 +1201,7 @@ DECLARE_OOXMLEXPORT_TEST(testUnderlineGroupShapeText, "tdf123351_UnderlineGroupS
DECLARE_OOXMLEXPORT_TEST(testUnderlineColorGroupedShapes, "tdf132491_UnderlineColorGroupedShapes.docx")
{
// tdf#132491 : Check if correct color is used for underline.
- xmlDocPtr pXmlDocument = parseExport("word/document.xml");
+ xmlDocUniquePtr pXmlDocument = parseExport("word/document.xml");
if (!pXmlDocument)
return;
assertXPath(pXmlDocument, "/w:document/w:body/w:p/w:r/mc:AlternateContent/mc:Choice/w:drawing/wp:anchor"