summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-29 15:07:54 +0200
committerTomaž Vajngerl <tomaz.vajngerl@collabora.com>2014-04-29 23:57:33 +0200
commitdde833575e29afecb6b053d3be28d9d028a72bef (patch)
treed63db949265ca1577dfbcb416299033ac3b92d6e /sd
parentde9ebbaddcb9633380e6614d7e70c1007d3be1c1 (diff)
tests: add XML and HTML test tools to test module
XML and HTML parsing and XPath asserts are used by many test in sw, sc and sd modules. This commit moves this functionallity to test module, where it is available to all modules. Change-Id: I53ad9c45b24f4c9bf106cb58ea619002968bfeda
Diffstat (limited to 'sd')
-rw-r--r--sd/qa/unit/HtmlExportTest.cxx42
1 files changed, 4 insertions, 38 deletions
diff --git a/sd/qa/unit/HtmlExportTest.cxx b/sd/qa/unit/HtmlExportTest.cxx
index a8aab8c909b4..4ce0a5d4d9dd 100644
--- a/sd/qa/unit/HtmlExportTest.cxx
+++ b/sd/qa/unit/HtmlExportTest.cxx
@@ -9,49 +9,15 @@
#include "sdmodeltestbase.hxx"
-#include <libxml/xmlwriter.h>
-#include <libxml/xpath.h>
-#include <libxml/xpathInternals.h>
-#include <libxml/parserInternals.h>
-#include <libxml/HTMLparser.h>
-#include <libxml/HTMLtree.h>
-
-#include <rtl/byteseq.hxx>
-#include <boost/scoped_array.hpp>
+#include <test/htmltesttools.hxx>
+#include <test/xmltesttools.hxx>
using namespace css;
using namespace rtl;
-class SdHTMLFilterTest : public SdModelTestBase
+class SdHTMLFilterTest : public SdModelTestBase, public XmlTestTools, public HtmlTestTools
{
- htmlDocPtr parseHtml(utl::TempFile& aTempFile)
- {
- SvFileStream aFileStream(aTempFile.GetURL(), STREAM_READ);
- sal_Size nSize = aFileStream.remainingSize();
-
- boost::scoped_array<sal_uInt8> pBuffer(new sal_uInt8[nSize + 1]);
-
- aFileStream.Read(pBuffer.get(), nSize);
-
- pBuffer[nSize] = 0;
- printf("Content: %s\n", reinterpret_cast<char*>(pBuffer.get()));
- return htmlParseDoc(reinterpret_cast<xmlChar*>(pBuffer.get()), NULL);
- }
-
- xmlNodeSetPtr getXPathNode(xmlDocPtr pXmlDoc, const OString& rXPath)
- {
- xmlXPathContextPtr pXmlXpathCtx = xmlXPathNewContext(pXmlDoc);
- xmlXPathObjectPtr pXmlXpathObj = xmlXPathEvalExpression(BAD_CAST(rXPath.getStr()), pXmlXpathCtx);
- return pXmlXpathObj->nodesetval;
- }
-
- void assertXPath(xmlDocPtr pXmlDoc, const OString& rXPath, int nNumberOfNodes)
- {
- xmlNodeSetPtr pXmlNodes = getXPathNode(pXmlDoc, rXPath);
- CPPUNIT_ASSERT_EQUAL_MESSAGE(OString("XPath '" + rXPath + "' number of nodes is incorrect").getStr(),
- nNumberOfNodes, xmlXPathNodeSetGetLength(pXmlNodes));
- }
-
+private:
htmlDocPtr exportAndparseHtml(sd::DrawDocShellRef& xDocShRef)
{
FileFormat* pFormat = getFormat(HTML);