Add unit-test for 'track changes - paragraph properties changed' preservation
This is a unit-test added to complement the patch that added support for the preservation of 'Track Changes - Paragraph Properties Changed' from a DOCX file. Conflicts: sw/qa/extras/ooxmlexport/ooxmlexport.cxx Reviewed on: https://gerrit.libreoffice.org/7401 Change-Id: Ic81a5ac9ee369ae0f1d2f8d1a1fe54ea5e6b7402
This commit is contained in:
Binary file not shown.
@@ -83,6 +83,12 @@ protected:
|
||||
*/
|
||||
void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfNodes);
|
||||
|
||||
/**
|
||||
* Assert that rXPath exists, and has exactly nNumberOfChildNodes child nodes.
|
||||
* Useful for checking that we do have a no child nodes to a specific node (nNumberOfChildNodes == 0).
|
||||
*/
|
||||
void assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfChildNodes);
|
||||
|
||||
/**
|
||||
* Same as the assertXPath(), but don't assert: return the string instead.
|
||||
*/
|
||||
@@ -160,6 +166,18 @@ void Test::assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfNo
|
||||
nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes));
|
||||
}
|
||||
|
||||
void Test::assertXPathChildren(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfChildNodes)
|
||||
{
|
||||
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
||||
OString("XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
|
||||
1, xmlXPathNodeSetGetLength(pXmlNodes));
|
||||
xmlNodePtr pXmlNode = pXmlNodes->nodeTab[0];
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE(
|
||||
OString("XPath '" + rXPath + "' number of child-nodes is incorrect").getStr(),
|
||||
nNumberOfChildNodes, (int)xmlChildElementCount(pXmlNode));
|
||||
}
|
||||
|
||||
OUString Test::getXPath(xmlDocPtr pXmlDoc, const OString& rXPath, const OString& rAttribute)
|
||||
{
|
||||
xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
|
||||
@@ -2422,6 +2440,14 @@ DECLARE_OOXMLEXPORT_TEST(testFdo70942, "fdo70942.docx")
|
||||
"prst", "ellipse");
|
||||
}
|
||||
|
||||
DECLARE_OOXMLEXPORT_TEST(testTrackChangesParagraphProperties, "testTrackChangesParagraphProperties.docx")
|
||||
{
|
||||
xmlDocPtr pXmlDoc = parseExport("word/document.xml");
|
||||
if (!pXmlDoc)
|
||||
return;
|
||||
assertXPathChildren(pXmlDoc, "/w:document/w:body/w:p[1]/w:pPr/w:pPrChange", 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
CPPUNIT_PLUGIN_IMPLEMENT();
|
||||
|
Reference in New Issue
Block a user