diff options
author | Michael Stahl <mstahl@redhat.com> | 2016-07-25 11:47:25 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2016-07-25 12:13:36 +0200 |
commit | 2f758cdd01a998292a93091f951ad96668139a5b (patch) | |
tree | 55e7e51e8ebdbd3d86169840f04dea45cc2b457f /sd/qa/unit/sdmodeltestbase.hxx | |
parent | 5206929f3a125a739adb860709586a0f50cb9611 (diff) |
move parseExport to SdExportTest base class
Change-Id: I20cc59e21aa1b99d8cee5a9f60c0703e9c457187
Diffstat (limited to 'sd/qa/unit/sdmodeltestbase.hxx')
-rw-r--r-- | sd/qa/unit/sdmodeltestbase.hxx | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/sd/qa/unit/sdmodeltestbase.hxx b/sd/qa/unit/sdmodeltestbase.hxx index c4dcc80feb9b..33b63ebf5557 100644 --- a/sd/qa/unit/sdmodeltestbase.hxx +++ b/sd/qa/unit/sdmodeltestbase.hxx @@ -12,14 +12,17 @@ #include <test/bootstrapfixture.hxx> #include <test/xmldiff.hxx> +#include <test/xmltesttools.hxx> #include <unotest/filters-test.hxx> #include <unotest/macros_test.hxx> #include "drawdoc.hxx" #include "../source/ui/inc/DrawDocShell.hxx" -#include "unotools/tempfile.hxx" +#include <unotools/tempfile.hxx> +#include <unotools/ucbstreamhelper.hxx> #include <tools/color.hxx> +#include <comphelper/processfactory.hxx> #include <rtl/strbuf.hxx> #include <sfx2/docfile.hxx> @@ -27,6 +30,7 @@ #include <svl/itemset.hxx> #include <com/sun/star/drawing/XDrawPagesSupplier.hpp> +#include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <drawinglayer/XShapeDumper.hxx> #include <com/sun/star/text/XTextField.hpp> @@ -358,6 +362,30 @@ protected: xPropSet->getPropertyValue("TextField") >>= xField; return xField; } + +}; + +class SdModelTestBaseXML + : public SdModelTestBase, public XmlTestTools +{ + +public: + xmlDocPtr parseExport(utl::TempFile & rTempFile, OUString const& rStreamName) + { + OUString const url(rTempFile.GetURL()); + uno::Reference<packages::zip::XZipFileAccess2> const xZipNames( + packages::zip::ZipFileAccess::createWithURL( + comphelper::getComponentContext(m_xSFactory), url)); + uno::Reference<io::XInputStream> const xInputStream( + xZipNames->getByName(rStreamName), uno::UNO_QUERY); + std::unique_ptr<SvStream> const pStream( + utl::UcbStreamHelper::CreateStream(xInputStream, true)); + xmlDocPtr const pXmlDoc = parseXmlStream(pStream.get()); + pXmlDoc->name = reinterpret_cast<char *>(xmlStrdup( + reinterpret_cast<xmlChar const *>(OUStringToOString(url, RTL_TEXTENCODING_UTF8).getStr()))); + return pXmlDoc; + } + }; CPPUNIT_NS_BEGIN |