LibreOffice Module test (master)  1
Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | List of all members
XmlTestTools Class Reference

#include <xmltesttools.hxx>

Static Public Member Functions

static xmlDocUniquePtr parseXmlStream (SvStream *pStream)
 Return xmlDocPtr representation of the XML stream read from pStream. More...
 
static xmlDocUniquePtr dumpAndParse (MetafileXmlDump &rDumper, const GDIMetaFile &rGDIMetaFile)
 

Protected Member Functions

 XmlTestTools ()
 
virtual ~XmlTestTools ()
 
virtual void registerNamespaces (xmlXPathContextPtr &pXmlXpathCtx)
 
xmlXPathObjectPtr getXPathNode (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath)
 
OUString getXPath (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, const OString &rAttribute)
 Same as the assertXPath(), but don't assert: return the string instead. More...
 
OUString getXPathContent (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath)
 Same as the assertXPathContent(), but don't assert: return the string instead. More...
 
int getXPathPosition (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, const OString &rChildName)
 Get the position of the child named rName of the parent node specified by rXPath. More...
 
void assertXPath (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath)
 Assert that rXPath exists, and returns exactly one node. More...
 
void assertXPath (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, const OString &rAttribute, const OUString &rExpectedValue)
 Assert that rXPath exists, returns exactly one node, and the rXPath's attribute's value equals to the rExpected value. More...
 
void assertXPathAttrs (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, const std::vector< std::pair< OString, OUString >> &aPairVector)
 
void assertXPath (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, int nNumberOfNodes)
 Assert that rXPath exists, and returns exactly nNumberOfNodes nodes. More...
 
void assertXPathContent (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, const OUString &rContent)
 Assert that rXPath exists, and its content equals rContent. More...
 
void assertXPathNSDef (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, const OUString &rNSPrefix, const OUString &rNSHref)
 Assert that rXPath exists and it has an rNSPrefix=rNSHref namespace definition. More...
 
void assertXPathChildren (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, int nNumberOfChildNodes)
 Assert that rXPath exists, and has exactly nNumberOfChildNodes child nodes. More...
 
void assertXPathNoAttribute (const xmlDocUniquePtr &pXmlDoc, const OString &rXPath, const OString &rAttribute)
 Assert that rXPath exists, has exactly 1 result set nodes and does not have an attribute named rAttribute. More...
 

Static Protected Member Functions

static xmlDocUniquePtr parseXml (utl::TempFile const &aTempFile)
 

Detailed Description

Definition at line 32 of file xmltesttools.hxx.

Constructor & Destructor Documentation

XmlTestTools::XmlTestTools ( )
protected

Definition at line 39 of file xmltesttools.cxx.

XmlTestTools::~XmlTestTools ( )
protectedvirtual

Definition at line 42 of file xmltesttools.cxx.

Member Function Documentation

void XmlTestTools::assertXPath ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath 
)
protected

Assert that rXPath exists, and returns exactly one node.

Definition at line 162 of file xmltesttools.cxx.

References getXPath().

Referenced by assertXPathAttrs().

void XmlTestTools::assertXPath ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
const OString &  rAttribute,
const OUString &  rExpectedValue 
)
protected

Assert that rXPath exists, returns exactly one node, and the rXPath's attribute's value equals to the rExpected value.

Definition at line 167 of file xmltesttools.cxx.

References getXPath().

void XmlTestTools::assertXPath ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
int  nNumberOfNodes 
)
protected

Assert that rXPath exists, and returns exactly nNumberOfNodes nodes.

Useful for checking that we do not export some node (nNumberOfNodes == 0).

Definition at line 183 of file xmltesttools.cxx.

References getXPathNode().

void XmlTestTools::assertXPathAttrs ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
const std::vector< std::pair< OString, OUString >> &  aPairVector 
)
protected

Definition at line 174 of file xmltesttools.cxx.

References assertXPath().

void XmlTestTools::assertXPathChildren ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
int  nNumberOfChildNodes 
)
protected

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).

Definition at line 224 of file xmltesttools.cxx.

References getXPathNode(), and void().

void XmlTestTools::assertXPathContent ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
const OUString &  rContent 
)
protected

Assert that rXPath exists, and its content equals rContent.

Definition at line 192 of file xmltesttools.cxx.

References getXPathContent().

void XmlTestTools::assertXPathNoAttribute ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
const OString &  rAttribute 
)
protected

Assert that rXPath exists, has exactly 1 result set nodes and does not have an attribute named rAttribute.

Definition at line 242 of file xmltesttools.cxx.

References getXPathNode().

void XmlTestTools::assertXPathNSDef ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
const OUString &  rNSPrefix,
const OUString &  rNSHref 
)
protected

Assert that rXPath exists and it has an rNSPrefix=rNSHref namespace definition.

Definition at line 197 of file xmltesttools.cxx.

References getXPathNode().

xmlDocUniquePtr XmlTestTools::dumpAndParse ( MetafileXmlDump rDumper,
const GDIMetaFile rGDIMetaFile 
)
static
OUString XmlTestTools::getXPath ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
const OString &  rAttribute 
)
protected

Same as the assertXPath(), but don't assert: return the string instead.

Definition at line 83 of file xmltesttools.cxx.

References getXPathNode().

Referenced by assertXPath().

OUString XmlTestTools::getXPathContent ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath 
)
protected

Same as the assertXPathContent(), but don't assert: return the string instead.

Definition at line 106 of file xmltesttools.cxx.

References getXPathNode().

Referenced by assertXPathContent().

xmlXPathObjectPtr XmlTestTools::getXPathNode ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath 
)
protected
int XmlTestTools::getXPathPosition ( const xmlDocUniquePtr pXmlDoc,
const OString &  rXPath,
const OString &  rChildName 
)
protected

Get the position of the child named rName of the parent node specified by rXPath.

Useful for checking relative order of elements.

Definition at line 254 of file xmltesttools.cxx.

References getXPathNode().

xmlDocUniquePtr XmlTestTools::parseXml ( utl::TempFile const &  aTempFile)
staticprotected

Definition at line 45 of file xmltesttools.cxx.

References utl::TempFile::GetURL(), and parseXmlStream().

xmlDocUniquePtr XmlTestTools::parseXmlStream ( SvStream pStream)
static

Return xmlDocPtr representation of the XML stream read from pStream.

Definition at line 51 of file xmltesttools.cxx.

References SvStream::ReadBytes(), SvStream::remainingSize(), and SAL_INFO.

Referenced by dumpAndParse(), and parseXml().

void XmlTestTools::registerNamespaces ( xmlXPathContextPtr &  pXmlXpathCtx)
protectedvirtual

Definition at line 79 of file xmltesttools.cxx.

Referenced by getXPathNode().


The documentation for this class was generated from the following files: