summaryrefslogtreecommitdiff
path: root/unotest
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2021-12-02 08:45:26 +0100
committerXisco Fauli <xiscofauli@libreoffice.org>2022-01-11 08:52:09 +0100
commitfedf5599d7aa80bd5b794a5ea85111f014b782f8 (patch)
treeb39ba01b3d60b0997a229f0a3b862fe672b56840 /unotest
parent3e224dc4e49b2a016bb7502031f002517237bea0 (diff)
test: move parseExportStream() from SdModelTestBaseXML up to MacrosTest
Move parseExportStream() from SdModelTestBaseXML up to MacrosTest, so oox/ test code can use it as well. Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126215 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins (cherry picked from commit f36767fde87191258ea21f3faac0be6ad79328e0) Change-Id: I8ba7d6f3b535456ddaa7cd0f0bb5d56fce7a7766 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128173 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Signed-off-by: Xisco Fauli <xiscofauli@libreoffice.org> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/128255 Tested-by: Jenkins
Diffstat (limited to 'unotest')
-rw-r--r--unotest/Library_unotest.mk1
-rw-r--r--unotest/source/cpp/macros_test.cxx17
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/");