tdf#129423: Make export tests export-only where applicable
Change-Id: I71d7e23dfdccd508ab0c12776296886c4bd028a6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/85880
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
index 7ccadb2..b34b125 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx
@@ -519,7 +519,7 @@
CPPUNIT_ASSERT_EQUAL(sal_Int32(318), getProperty<sal_Int32>(xFrame, "RightMargin"));
}
DECLARE_OOXMLEXPORT_TEST(testCellBtlr, "cell-btlr.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCellBtlr, "cell-btlr.docx")
{
/*
* The problem was that the exporter didn't mirror the workaround of the
@@ -528,8 +528,6 @@
*/
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:tcPr/w:textDirection", "val", "btLr");
}
@@ -867,7 +865,7 @@
}
}
DECLARE_OOXMLEXPORT_TEST(testPageBorderSpacingExportCase2, "page-borders-export-case-2.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPageBorderSpacingExportCase2, "page-borders-export-case-2.docx")
{
// The problem was that the exporter didn't mirror the workaround of the
// importer, regarding the page border's spacing : the <w:pgBorders w:offsetFrom="page">
@@ -877,8 +875,6 @@
// for Word to handle (larger than 31 points)
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
// Assert the XPath expression - page borders
assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgBorders", "offsetFrom", "page");
@@ -903,12 +899,10 @@
parseDump("/root/page[3]/header/txt/text()"));
}
DECLARE_OOXMLEXPORT_TEST(testGrabBag, "grabbag.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGrabBag, "grabbag.docx")
{
// w:mirrorIndents was lost on roundtrip, now should be handled as a grab bag property
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p/w:pPr/w:mirrorIndents");
}
@@ -1090,12 +1084,10 @@
CPPUNIT_ASSERT_EQUAL(sal_Int16(50), nShadowTransparence);
}
DECLARE_OOXMLEXPORT_TEST(NoFillAttrInImagedata, "NoFillAttrInImagedata.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(NoFillAttrInImagedata, "NoFillAttrInImagedata.docx")
{
//problem was that type and color2 which are v:fill attributes were written in 'v:imagedata'
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect/v:imagedata", "type");
assertXPathNoAttribute(pXmlDoc, "/w:document/w:body/w:p/w:r/mc:AlternateContent[2]/mc:Fallback/w:pict/v:rect/v:imagedata", "color2");
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
index 478ee10..6a31591 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport3.cxx
@@ -491,12 +491,10 @@
xmlXPathFreeObject(pXmlObj);
}
DECLARE_OOXMLEXPORT_TEST(testMultiColumnLineSeparator, "multi-column-line-separator-SAVED.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testMultiColumnLineSeparator, "multi-column-line-separator-SAVED.docx")
{
// Check for the Column Separator value.It should be FALSE as the document does not contain separator line.
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:pPr/w:sectPr/w:cols","sep","false");
}
@@ -529,25 +527,21 @@
CPPUNIT_ASSERT(CustomXml); // Grab Bag has all the expected elements
}
DECLARE_OOXMLEXPORT_TEST(testCustomXmlRelationships, "customxml.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCustomXmlRelationships, "customxml.docx")
{
xmlDocPtr pXmlDoc = parseExport("customXml/_rels/item1.xml.rels");
if(!pXmlDoc)
return;
// Check there is a relation to itemProps1.xml.
assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship", 1);
assertXPath(pXmlDoc, "/rels:Relationships/rels:Relationship[@Id='rId1']", "Target", "itemProps1.xml");
}
DECLARE_OOXMLEXPORT_TEST(testFdo69644, "fdo69644.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFdo69644, "fdo69644.docx")
{
// The problem was that the exporter exported the table definition
// with only 3 columns, instead of 5 columns.
// Check that the table grid is exported with 5 columns
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tblGrid/w:gridCol", 5);
}
@@ -557,11 +551,9 @@
getParagraph(1, "Sample pages document.");
}
DECLARE_OOXMLEXPORT_TEST(testPgMargin, "testPgMargin.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testPgMargin, "testPgMargin.docx")
{
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:sectPr/w:pgMar", "left", "1440");
}
@@ -673,14 +665,12 @@
CPPUNIT_ASSERT_EQUAL(sal_Int16( 45 * 10), aGradient8.Angle);
}
DECLARE_OOXMLEXPORT_TEST(testCellGridSpan, "cell-grid-span.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCellGridSpan, "cell-grid-span.docx")
{
// The problem was during export gridSpan value for 1st & 2nd cells for test document
// used to get set wrongly to 5 and 65532 respectively which was the reason for crash during save operation
// Verifying gridSpan element is not present in RoundTripped Document (As it's Default value is 1).
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[1]/w:tcPr/w:gridSpan",0);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc[2]/w:tcPr/w:gridSpan",0);
}
@@ -697,11 +687,9 @@
CPPUNIT_ASSERT_EQUAL(text::WritingMode2::LR_TB, nLRDir);
}
DECLARE_OOXMLEXPORT_TEST(testParaAutoSpacing, "para-auto-spacing.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testParaAutoSpacing, "para-auto-spacing.docx")
{
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "beforeAutospacing","1");
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:spacing", "afterAutospacing","1");
@@ -784,19 +772,15 @@
assertXPath(pXmlFootnotes, "/w:footnotes/w:footnote[3]/w:p/w:r/w:footnoteRef", 1);
}
DECLARE_OOXMLEXPORT_TEST(testSpacingLineRule,"table_lineRule.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testSpacingLineRule,"table_lineRule.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr[1]/w:tc[1]/w:p/w:pPr/w:spacing", "lineRule", "auto");
}
DECLARE_OOXMLEXPORT_TEST(testTableLineSpacing, "table_atleast.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testTableLineSpacing, "table_atleast.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl/w:tr/w:tc/w:p/w:pPr/w:spacing", "line", "320");
}
@@ -925,14 +909,12 @@
}
DECLARE_OOXMLEXPORT_TEST(testcantSplit, "2_table_doc.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testcantSplit, "2_table_doc.docx")
{
// if Split table value is true for a table then during export do not write <w:cantSplit w:val="false"/>
// in table row property,As default row prop is allow row to break across page.
// writing <w:cantSplit w:val="false"/> during export was causing problem that all the cell data used to come on same page
xmlDocPtr pXmlDoc = parseExport();
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[1]/w:tr/w:trPr/w:cantSplit",0);
assertXPath(pXmlDoc, "/w:document/w:body/w:tbl[2]/w:tr/w:trPr/w:cantSplit","val","true");
}
@@ -968,20 +950,16 @@
CPPUNIT_ASSERT_EQUAL( OUString("Heading Base"), xStyle->getParentStyle() );
}
DECLARE_OOXMLEXPORT_TEST(testcolumnbreak, "columnbreak.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testcolumnbreak, "columnbreak.docx")
{
CPPUNIT_ASSERT_EQUAL(style::BreakType_COLUMN_BEFORE, getProperty<style::BreakType>(getParagraph(5, "This is first line after col brk."), "BreakType"));
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r[1]/w:br", "type", "column");
}
DECLARE_OOXMLEXPORT_TEST(testGlossary, "testGlossary.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testGlossary, "testGlossary.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/glossary/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:glossaryDocument", "Ignorable", "w14 wp14");
}
@@ -990,20 +968,16 @@
// crashtest
}
DECLARE_OOXMLEXPORT_TEST(testCrashWhileSave, "testCrashWhileSave.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testCrashWhileSave, "testCrashWhileSave.docx")
{
xmlDocPtr pXmlDoc = parseExport("word/footer1.xml");
if (!pXmlDoc)
return;
CPPUNIT_ASSERT(getXPath(pXmlDoc, "/w:ftr/w:tbl/w:tr/w:tc[1]/w:p[1]/w:pPr/w:pStyle", "val").match("Normal"));
}
DECLARE_OOXMLEXPORT_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.docx")
DECLARE_OOXMLEXPORT_EXPORTONLY_TEST(testFileOpenInputOutputError,"floatingtbl_with_formula.docx")
{
// Docx containing Floating table with formula was giving "General input/output error" while opening in LibreOffice
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
if (!pXmlDoc)
return;
assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pStyle", "val", "Normal");
// let's also assert that the formula was exported properly