summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-04-25 20:13:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2023-04-26 16:23:49 +0200
commit7d913c6ec16cab123bd261bca20c4aaeea6b0b38 (patch)
treec4e3703e7f8c4f0faa5d48d9f463476b0a9a8061
parenttdf#151624 Fix Insert Formula tool in the Tabbed UI (diff)
downloadcore-7d913c6ec16cab123bd261bca20c4aaeea6b0b38.tar.gz
core-7d913c6ec16cab123bd261bca20c4aaeea6b0b38.zip
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>
-rw-r--r--svgio/CppunitTest_svgio.mk1
-rw-r--r--svgio/CppunitTest_svgio_tools.mk1
-rw-r--r--svgio/Library_svgio.mk1
-rw-r--r--svgio/inc/svgdocumenthandler.hxx3
-rw-r--r--svgio/source/svguno/xsvgparser.cxx10
-rw-r--r--vcl/workben/fftester.cxx10
6 files changed, 26 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: */
diff --git a/vcl/workben/fftester.cxx b/vcl/workben/fftester.cxx
index bc4a692b4f81..c396b28f1ede 100644
--- a/vcl/workben/fftester.cxx
+++ b/vcl/workben/fftester.cxx
@@ -542,6 +542,16 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv)
SvFileStream aFileStream(out, StreamMode::READ);
ret = static_cast<int>((*pfnImport)(aFileStream));
}
+ else if (strcmp(argv[2], "svg") == 0)
+ {
+ static FFilterCall pfnImport(nullptr);
+ if (!pfnImport)
+ {
+ pfnImport = load(u"libsvgiolo.so", "TestImportSVG");
+ }
+ SvFileStream aFileStream(out, StreamMode::READ);
+ ret = static_cast<int>((*pfnImport)(aFileStream));
+ }
#endif
}
catch (...)