diff options
Diffstat (limited to 'unotest')
-rw-r--r-- | unotest/Library_unotest.mk | 1 | ||||
-rw-r--r-- | unotest/source/cpp/macros_test.cxx | 17 |
2 files changed, 18 insertions, 0 deletions
diff --git a/unotest/Library_unotest.mk b/unotest/Library_unotest.mk index ea697699ee82..3acfe2f69ed9 100644 --- a/unotest/Library_unotest.mk +++ b/unotest/Library_unotest.mk @@ -22,6 +22,7 @@ $(eval $(call gb_Library_use_libraries,unotest,\ cppuhelper \ sal \ sb \ + utl \ )) $(eval $(call gb_Library_use_externals,unotest,\ diff --git a/unotest/source/cpp/macros_test.cxx b/unotest/source/cpp/macros_test.cxx index ab15518e4c9c..718c0b1b8954 100644 --- a/unotest/source/cpp/macros_test.cxx +++ b/unotest/source/cpp/macros_test.cxx @@ -14,6 +14,7 @@ #include <com/sun/star/document/MacroExecMode.hpp> #include <com/sun/star/uno/XComponentContext.hpp> #include <com/sun/star/frame/DispatchHelper.hpp> +#include <com/sun/star/packages/zip/ZipFileAccess.hpp> #include <basic/basrdll.hxx> #include <cppunit/TestAssert.h> @@ -23,6 +24,8 @@ #include <osl/file.hxx> #include <osl/process.h> #include <osl/thread.h> +#include <unotools/tempfile.hxx> +#include <unotools/ucbstreamhelper.hxx> using namespace css; @@ -85,6 +88,20 @@ void MacrosTest::dispatchCommand(const uno::Reference<lang::XComponent>& xCompon xDispatchHelper->executeDispatch(xFrame, rCommand, OUString(), 0, rPropertyValues); } +std::unique_ptr<SvStream> MacrosTest::parseExportStream(const utl::TempFile& rTempFile, + const OUString& rStreamName) +{ + const OUString aUrl = rTempFile.GetURL(); + uno::Reference<uno::XComponentContext> xComponentContext + = comphelper::getProcessComponentContext(); + uno::Reference<packages::zip::XZipFileAccess2> const xZipNames( + packages::zip::ZipFileAccess::createWithURL(xComponentContext, aUrl)); + uno::Reference<io::XInputStream> const xInputStream(xZipNames->getByName(rStreamName), + uno::UNO_QUERY); + std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(xInputStream, true)); + return pStream; +} + void MacrosTest::setUpNssGpg(const test::Directories& rDirectories, const OUString& rTestName) { OUString aSourceDir = rDirectories.getURLFromSrc(u"/test/signing-keys/"); |