diff options
author | Caolán McNamara <caolanm@redhat.com> | 2023-04-25 20:13:07 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2023-04-26 16:23:49 +0200 |
commit | 7d913c6ec16cab123bd261bca20c4aaeea6b0b38 (patch) | |
tree | c4e3703e7f8c4f0faa5d48d9f463476b0a9a8061 /svgio | |
parent | c163334ae8cdd202dd4060ef1f401a9e9b51ce3e (diff) |
expose parsing svgs for testing
Change-Id: I4d59aa9a684bd3e05fca473d6c7567cd8258b242
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151002
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'svgio')
-rw-r--r-- | svgio/CppunitTest_svgio.mk | 1 | ||||
-rw-r--r-- | svgio/CppunitTest_svgio_tools.mk | 1 | ||||
-rw-r--r-- | svgio/Library_svgio.mk | 1 | ||||
-rw-r--r-- | svgio/inc/svgdocumenthandler.hxx | 3 | ||||
-rw-r--r-- | svgio/source/svguno/xsvgparser.cxx | 10 |
5 files changed, 16 insertions, 0 deletions
diff --git a/svgio/CppunitTest_svgio.mk b/svgio/CppunitTest_svgio.mk index 3a828ad036e3..1bd6c3b0b5d0 100644 --- a/svgio/CppunitTest_svgio.mk +++ b/svgio/CppunitTest_svgio.mk @@ -42,6 +42,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svgio,\ unotest \ tk \ tl \ + utl \ vcl \ )) diff --git a/svgio/CppunitTest_svgio_tools.mk b/svgio/CppunitTest_svgio_tools.mk index cb48c5eda09d..abb6bb6e0fc7 100644 --- a/svgio/CppunitTest_svgio_tools.mk +++ b/svgio/CppunitTest_svgio_tools.mk @@ -39,6 +39,7 @@ $(eval $(call gb_CppunitTest_use_libraries,svgio_tools,\ svt \ tk \ tl \ + utl \ vcl \ )) diff --git a/svgio/Library_svgio.mk b/svgio/Library_svgio.mk index c5a35405323f..917f9ea4865e 100644 --- a/svgio/Library_svgio.mk +++ b/svgio/Library_svgio.mk @@ -45,6 +45,7 @@ $(eval $(call gb_Library_use_libraries,svgio,\ sax \ vcl \ svt \ + utl \ )) $(eval $(call gb_Library_add_exception_objects,svgio,\ diff --git a/svgio/inc/svgdocumenthandler.hxx b/svgio/inc/svgdocumenthandler.hxx index 197c9e8e83ee..a13284340a38 100644 --- a/svgio/inc/svgdocumenthandler.hxx +++ b/svgio/inc/svgdocumenthandler.hxx @@ -23,6 +23,7 @@ #include "svgdocument.hxx" #include <cppuhelper/implbase.hxx> +class SvStream; namespace svgio::svgreader { class SvgCharacterNode; } namespace svgio::svgreader @@ -60,4 +61,6 @@ namespace svgio::svgreader } // end of namespace svgio::svgreader +extern "C" SAL_DLLPUBLIC_EXPORT bool TestImportSVG(SvStream& rStream); + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx index 705f97a0487a..fd2f5d3ddff0 100644 --- a/svgio/source/svguno/xsvgparser.cxx +++ b/svgio/source/svguno/xsvgparser.cxx @@ -22,6 +22,7 @@ #include <com/sun/star/graphic/XSvgParser.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/lang/XInitialization.hpp> +#include <comphelper/processfactory.hxx> #include <cppuhelper/implbase2.hxx> #include <cppuhelper/supportsservice.hxx> #include <com/sun/star/xml/sax/XParser.hpp> @@ -30,6 +31,8 @@ #include <svgdocumenthandler.hxx> #include <comphelper/diagnose_ex.hxx> #include <rtl/ref.hxx> +#include <tools/stream.hxx> +#include <unotools/streamwrap.hxx> #include <svgvisitor.hxx> #include <utility> @@ -196,4 +199,11 @@ svgio_XSvgParser_get_implementation( return cppu::acquire(new svgio::svgreader::XSvgParser(context)); } +extern "C" bool TestImportSVG(SvStream& rStream) +{ + css::uno::Reference<css::io::XInputStream> xStream(new utl::OInputStreamWrapper(rStream)); + rtl::Reference<svgio::svgreader::XSvgParser> xSvgParser(new svgio::svgreader::XSvgParser(comphelper::getProcessComponentContext())); + return xSvgParser->getDecomposition(xStream, OUString()).getLength() != 0; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |