summaryrefslogtreecommitdiff
path: root/package/source/zippackage
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-25 14:45:27 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-04-25 17:03:40 +0200
commitd41b436058def4497240c54afc38b319ce388430 (patch)
tree6cba42dcca2893d6a1b408fe0b9c5aa5a4a87785 /package/source/zippackage
parente7c30e6c1ee8fbea7d44ab00e2721ff13dfa4da5 (diff)
expose recovering zips for testing
Change-Id: I4709a2fb0bbb0fcc4c7d57dad53c899e7ba79cb4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/150971 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'package/source/zippackage')
-rw-r--r--package/source/zippackage/ZipPackage.cxx12
1 files changed, 12 insertions, 0 deletions
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index e03a17e8016a..eb7346236bb1 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -42,6 +42,7 @@
#include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
#include <com/sun/star/container/XNameContainer.hpp>
#include <comphelper/fileurl.hxx>
+#include <comphelper/processfactory.hxx>
#include <ucbhelper/content.hxx>
#include <cppuhelper/exc_hlp.hxx>
#include <com/sun/star/ucb/ContentCreationException.hpp>
@@ -61,6 +62,7 @@
#include <o3tl/string_view.hxx>
#include <osl/diagnose.h>
#include <sal/log.hxx>
+#include <unotools/streamwrap.hxx>
#include <unotools/tempfile.hxx>
#include <com/sun/star/io/XAsyncOutputMonitor.hpp>
@@ -1821,4 +1823,14 @@ package_ZipPackage_get_implementation(
return cppu::acquire(new ZipPackage(context));
}
+extern "C" bool TestImportZip(SvStream& rStream)
+{
+ // explicitly tests the "RepairPackage" recovery mode
+ rtl::Reference<ZipPackage> xPackage(new ZipPackage(comphelper::getProcessComponentContext()));
+ css::uno::Reference<css::io::XInputStream> xStream(new utl::OInputStreamWrapper(rStream));
+ css::uno::Sequence<Any> aArgs{ Any(xStream), Any(NamedValue("RepairPackage", Any(true))) };
+ xPackage->initialize(aArgs);
+ return true;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */