summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-20 09:33:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-20 10:57:20 +0100
commit069485673730ec003f53e2fc9697ee29732f8ba6 (patch)
treea626eebb54fa0c74aed466a62f98c14b83663d4d /filter
parent9e8a88b6dace33f6e07ba308f99320124166b971 (diff)
add eps import regression test
Change-Id: Iba88c7e54ba83132a859124d51f88be72cb3e3e1
Diffstat (limited to 'filter')
-rw-r--r--filter/CppunitTest_filter_eps_test.mk45
-rw-r--r--filter/Module_filter.mk1
-rw-r--r--filter/qa/cppunit/data/eps/fail/.gitignore0
-rw-r--r--filter/qa/cppunit/data/eps/fail/CVE-2009-4195-1.epsbin0 -> 45336 bytes
-rw-r--r--filter/qa/cppunit/data/eps/indeterminate/.gitignore1
-rw-r--r--filter/qa/cppunit/data/eps/pass/.gitignore0
-rw-r--r--filter/qa/cppunit/data/eps/pass/fdo13433-4.eps667
-rw-r--r--filter/qa/cppunit/filters-eps-test.cxx71
8 files changed, 785 insertions, 0 deletions
diff --git a/filter/CppunitTest_filter_eps_test.mk b/filter/CppunitTest_filter_eps_test.mk
new file mode 100644
index 000000000000..89d1102f5a30
--- /dev/null
+++ b/filter/CppunitTest_filter_eps_test.mk
@@ -0,0 +1,45 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_CppunitTest_CppunitTest,filter_eps_test))
+
+$(eval $(call gb_CppunitTest_use_external,filter_eps_test,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,filter_eps_test, \
+ filter/qa/cppunit/filters-eps-test \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,filter_eps_test, \
+ ips \
+ sal \
+ test \
+ tl \
+ unotest \
+ vcl \
+ $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,filter_eps_test,\
+ udkapi \
+ offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,filter_eps_test))
+$(eval $(call gb_CppunitTest_use_vcl,filter_eps_test))
+
+$(eval $(call gb_CppunitTest_use_components,filter_eps_test,\
+ configmgr/source/configmgr \
+ i18npool/util/i18npool \
+ ucb/source/core/ucb1 \
+ ucb/source/ucp/file/ucpfile1 \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,filter_eps_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index a3bddf45cbba..7c7575ac34ac 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -86,6 +86,7 @@ $(eval $(call gb_Module_add_check_targets,filter,\
ifneq ($(DISABLE_CVE_TESTS),TRUE)
$(eval $(call gb_Module_add_check_targets,filter,\
CppunitTest_filter_dxf_test \
+ CppunitTest_filter_eps_test \
CppunitTest_filter_met_test \
CppunitTest_filter_pcx_test \
CppunitTest_filter_pict_test \
diff --git a/filter/qa/cppunit/data/eps/fail/.gitignore b/filter/qa/cppunit/data/eps/fail/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/filter/qa/cppunit/data/eps/fail/.gitignore
diff --git a/filter/qa/cppunit/data/eps/fail/CVE-2009-4195-1.eps b/filter/qa/cppunit/data/eps/fail/CVE-2009-4195-1.eps
new file mode 100644
index 000000000000..5ae189f15105
--- /dev/null
+++ b/filter/qa/cppunit/data/eps/fail/CVE-2009-4195-1.eps
Binary files differ
diff --git a/filter/qa/cppunit/data/eps/indeterminate/.gitignore b/filter/qa/cppunit/data/eps/indeterminate/.gitignore
new file mode 100644
index 000000000000..583b009c7c60
--- /dev/null
+++ b/filter/qa/cppunit/data/eps/indeterminate/.gitignore
@@ -0,0 +1 @@
+*.wmf-*
diff --git a/filter/qa/cppunit/data/eps/pass/.gitignore b/filter/qa/cppunit/data/eps/pass/.gitignore
new file mode 100644
index 000000000000..e69de29bb2d1
--- /dev/null
+++ b/filter/qa/cppunit/data/eps/pass/.gitignore
diff --git a/filter/qa/cppunit/data/eps/pass/fdo13433-4.eps b/filter/qa/cppunit/data/eps/pass/fdo13433-4.eps
new file mode 100644
index 000000000000..6ca427f86f4f
--- /dev/null
+++ b/filter/qa/cppunit/data/eps/pass/fdo13433-4.eps
@@ -0,0 +1,667 @@
+%!PS-Adobe-3.0 EPSF-3.0
+%%Title: /home/amg/newtest05.eps
+%%Creator: matplotlib version 0.98.0, http://matplotlib.sourceforge.net/
+%%CreationDate: Sat Jul 19 09:49:37 2008
+%%Orientation: portrait
+%%BoundingBox: 13 175 598 616
+%%EndComments
+%%BeginProlog
+/mpldict 7 dict def
+mpldict begin
+/m { moveto } bind def
+/l { lineto } bind def
+/r { rlineto } bind def
+/c { curveto } bind def
+/cl { closepath } bind def
+/box {
+m
+1 index 0 r
+0 exch r
+neg 0 r
+cl
+} bind def
+/clipbox {
+box
+clip
+newpath
+} bind def
+end
+%%EndProlog
+mpldict begin
+13.5 175.5 translate
+585 441 0 0 clipbox
+1.000 setlinewidth
+0 setlinejoin
+2 setlinecap
+[] 0 setdash
+1.000 setgray
+gsave
+0 0 m
+585 0 l
+585 441 l
+0 441 l
+0 0 l
+gsave
+fill
+grestore
+stroke
+grestore
+0.000 setgray
+gsave
+73.125 44.1 m
+526.5 44.1 l
+526.5 396.9 l
+73.125 396.9 l
+73.125 44.1 l
+gsave
+1.000 setgray
+fill
+grestore
+stroke
+grestore
+0.500 setlinewidth
+0 setlinecap
+gsave
+453.4 352.8 73.12 44.1 clipbox
+/o {
+gsave
+newpath
+translate
+0 -3 m
+0.795609 -3 1.55874 -2.6839 2.12132 -2.12132 c
+2.6839 -1.55874 3 -0.795609 3 0 c
+3 0.795609 2.6839 1.55874 2.12132 2.12132 c
+1.55874 2.6839 0.795609 3 0 3 c
+-0.795609 3 -1.55874 2.6839 -2.12132 2.12132 c
+-2.6839 1.55874 -3 0.795609 -3 0 c
+-3 -0.795609 -2.6839 -1.55874 -2.12132 -2.12132 c
+-1.55874 -2.6839 -0.795609 -3 0 -3 c
+cl
+gsave
+1.000 0.000 0.000 setrgbcolor
+fill
+grestore
+stroke
+grestore
+} bind def
+73.1 92.5 o
+77.7 206 o
+82.2 204 o
+86.7 293 o
+91.3 189 o
+95.8 276 o
+100 250 o
+105 226 o
+109 240 o
+114 329 o
+118 250 o
+123 226 o
+128 99 o
+132 195 o
+137 241 o
+141 168 o
+146 166 o
+150 301 o
+155 294 o
+159 223 o
+164 220 o
+168 184 o
+173 205 o
+177 242 o
+182 320 o
+186 239 o
+191 306 o
+196 272 o
+200 96.1 o
+205 293 o
+209 265 o
+214 233 o
+218 231 o
+223 138 o
+227 204 o
+232 278 o
+236 271 o
+241 165 o
+245 199 o
+250 239 o
+254 234 o
+259 306 o
+264 304 o
+268 246 o
+273 172 o
+277 180 o
+282 246 o
+286 146 o
+291 97.8 o
+295 241 o
+300 141 o
+304 242 o
+309 177 o
+313 189 o
+318 142 o
+322 216 o
+327 273 o
+332 261 o
+336 173 o
+341 223 o
+345 282 o
+350 285 o
+354 90.1 o
+359 241 o
+363 344 o
+368 187 o
+372 172 o
+377 224 o
+381 300 o
+386 237 o
+390 107 o
+395 249 o
+400 263 o
+404 146 o
+409 162 o
+413 228 o
+418 252 o
+422 166 o
+427 255 o
+431 92.7 o
+436 277 o
+440 204 o
+445 226 o
+449 356 o
+454 277 o
+458 247 o
+463 244 o
+468 272 o
+472 286 o
+477 259 o
+481 332 o
+486 138 o
+490 212 o
+495 203 o
+499 163 o
+504 374 o
+508 371 o
+513 223 o
+517 126 o
+522 205 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 4 l
+stroke
+grestore
+} bind def
+73.1 44.1 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 -4 l
+stroke
+grestore
+} bind def
+73.1 397 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+70.389000 31.664000 translate
+0.000000 rotate
+0.000000 0.000000 m /zero glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 4 l
+stroke
+grestore
+} bind def
+164 44.1 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 -4 l
+stroke
+grestore
+} bind def
+164 397 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+158.328000 31.436000 translate
+0.000000 rotate
+0.000000 0.000000 m /two glyphshow
+5.472000 0.000000 m /zero glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 4 l
+stroke
+grestore
+} bind def
+254 44.1 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 -4 l
+stroke
+grestore
+} bind def
+254 397 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+249.003000 31.436000 translate
+0.000000 rotate
+0.000000 0.000000 m /four glyphshow
+5.472000 0.000000 m /zero glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 4 l
+stroke
+grestore
+} bind def
+345 44.1 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 -4 l
+stroke
+grestore
+} bind def
+345 397 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+339.678000 31.664000 translate
+0.000000 rotate
+0.000000 0.000000 m /six glyphshow
+5.472000 0.000000 m /zero glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 4 l
+stroke
+grestore
+} bind def
+436 44.1 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 -4 l
+stroke
+grestore
+} bind def
+436 397 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+430.353000 31.664000 translate
+0.000000 rotate
+0.000000 0.000000 m /eight glyphshow
+5.472000 0.000000 m /zero glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 4 l
+stroke
+grestore
+} bind def
+526 44.1 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+0 -4 l
+stroke
+grestore
+} bind def
+526 397 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+518.292000 31.436000 translate
+0.000000 rotate
+0.000000 0.000000 m /one glyphshow
+5.472000 0.000000 m /zero glyphshow
+10.944000 0.000000 m /zero glyphshow
+grestore
+ 1.000 setlinewidth
+gsave
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+296.531 17.82 moveto
+0.0 rotate
+(X)
+0.000 0.000 0.000 setrgbcolor
+show
+grestore
+stroke
+grestore
+0.500 setlinewidth
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+73.1 44.1 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+526 44.1 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+57.905000 39.882000 translate
+0.000000 rotate
+0.000000 0.000000 m /minus glyphshow
+5.748000 0.000000 m /three glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+73.1 103 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+526 103 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+57.905000 98.682000 translate
+0.000000 rotate
+0.000000 0.000000 m /minus glyphshow
+5.748000 0.000000 m /two glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+73.1 162 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+526 162 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+57.905000 157.482000 translate
+0.000000 rotate
+0.000000 0.000000 m /minus glyphshow
+5.748000 0.000000 m /one glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+73.1 221 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+526 221 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+63.653000 216.282000 translate
+0.000000 rotate
+0.000000 0.000000 m /zero glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+73.1 279 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+526 279 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+63.653000 275.082000 translate
+0.000000 rotate
+0.000000 0.000000 m /one glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+73.1 338 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+526 338 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+63.653000 333.882000 translate
+0.000000 rotate
+0.000000 0.000000 m /two glyphshow
+grestore
+ gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+4 0 l
+stroke
+grestore
+} bind def
+73.1 397 o
+grestore
+gsave
+/o {
+gsave
+newpath
+translate
+0 0 m
+-4 0 l
+stroke
+grestore
+} bind def
+526 397 o
+grestore
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+63.653000 392.682000 translate
+0.000000 rotate
+0.000000 0.000000 m /three glyphshow
+grestore
+ 1.000 setlinewidth
+gsave
+gsave
+/Helvetica-Narrow findfont
+12.0 scalefont
+setfont
+52.905 217.218 moveto
+90.0 rotate
+(Y)
+0.000 0.000 0.000 setrgbcolor
+show
+grestore
+stroke
+grestore
+2 setlinecap
+gsave
+73.125 44.1 m
+526.5 44.1 l
+526.5 396.9 l
+73.125 396.9 l
+73.125 44.1 l
+stroke
+grestore
+0 setlinecap
+gsave
+gsave
+/Helvetica-Narrow findfont
+14.0 scalefont
+setfont
+277.798 404.798 moveto
+0.0 rotate
+(Test plot)
+0.000 0.000 0.000 setrgbcolor
+show
+grestore
+stroke
+grestore
+
+end
+showpage
diff --git a/filter/qa/cppunit/filters-eps-test.cxx b/filter/qa/cppunit/filters-eps-test.cxx
new file mode 100644
index 000000000000..f291d113c315
--- /dev/null
+++ b/filter/qa/cppunit/filters-eps-test.cxx
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <unotest/filters-test.hxx>
+#include <test/bootstrapfixture.hxx>
+#include <vcl/FilterConfigItem.hxx>
+#include <tools/stream.hxx>
+#include <vcl/graph.hxx>
+
+#include <osl/file.hxx>
+#include <osl/process.h>
+
+extern "C"
+{
+ SAL_DLLPUBLIC_EXPORT bool SAL_CALL
+ GraphicImport(SvStream & rStream, Graphic & rGraphic,
+ FilterConfigItem*);
+}
+
+using namespace ::com::sun::star;
+
+/* Implementation of Filters test */
+
+class EpsFilterTest
+ : public test::FiltersTest
+ , public test::BootstrapFixture
+{
+public:
+ EpsFilterTest() : BootstrapFixture(true, false) {}
+
+ virtual bool load(const OUString &,
+ const OUString &rURL, const OUString &,
+ unsigned int, unsigned int, unsigned int) SAL_OVERRIDE;
+
+ /**
+ * Ensure CVEs remain unbroken
+ */
+ void testCVEs();
+
+ CPPUNIT_TEST_SUITE(EpsFilterTest);
+ CPPUNIT_TEST(testCVEs);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+bool EpsFilterTest::load(const OUString &,
+ const OUString &rURL, const OUString &,
+ unsigned int, unsigned int, unsigned int)
+{
+ SvFileStream aFileStream(rURL, STREAM_READ);
+ Graphic aGraphic;
+ return GraphicImport(aFileStream, aGraphic, NULL);
+}
+
+void EpsFilterTest::testCVEs()
+{
+ testDir(OUString(),
+ getURLFromSrc("/filter/qa/cppunit/data/eps/"),
+ OUString());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(EpsFilterTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */