Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * Version: MPL 1.1 / GPLv3+ / LGPLv3+
4 : *
5 : * The contents of this file are subject to the Mozilla Public License Version
6 : * 1.1 (the "License"); you may not use this file except in compliance with
7 : * the License. You may obtain a copy of the License at
8 : * http://www.mozilla.org/MPL/
9 : *
10 : * Software distributed under the License is distributed on an "AS IS" basis,
11 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 : * for the specific language governing rights and limitations under the
13 : * License.
14 : *
15 : * The Initial Developer of the Original Code is
16 : * Caolán McNamara <caolanm@redhat.com>
17 : * Portions created by the Initial Developer are Copyright (C) 2011 the
18 : * Initial Developer. All Rights Reserved.
19 : *
20 : * Contributor(s):
21 : * Caolán McNamara <caolanm@redhat.com>
22 : *
23 : * Alternatively, the contents of this file may be used under the terms of
24 : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
25 : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
26 : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
27 : * instead of those above.
28 : */
29 :
30 : #include <unotest/filters-test.hxx>
31 : #include <test/bootstrapfixture.hxx>
32 :
33 : #include <osl/file.hxx>
34 : #include <osl/process.h>
35 :
36 : #include <svtools/filter.hxx>
37 :
38 : using namespace ::com::sun::star;
39 :
40 : /* Implementation of Filters test */
41 :
42 2 : class SvtoolsFiltersTest
43 : : public test::FiltersTest
44 : , public test::BootstrapFixture
45 : {
46 : public:
47 1 : SvtoolsFiltersTest() : BootstrapFixture(true, false) {}
48 :
49 : virtual bool load(const rtl::OUString &,
50 : const rtl::OUString &rURL, const rtl::OUString &,
51 : unsigned int, unsigned int, unsigned int);
52 :
53 : /**
54 : * Ensure CVEs remain unbroken
55 : */
56 : void testCVEs();
57 :
58 2 : CPPUNIT_TEST_SUITE(SvtoolsFiltersTest);
59 1 : CPPUNIT_TEST(testCVEs);
60 2 : CPPUNIT_TEST_SUITE_END();
61 : };
62 :
63 43 : bool SvtoolsFiltersTest::load(const rtl::OUString &,
64 : const rtl::OUString &rURL, const rtl::OUString &,
65 : unsigned int, unsigned int, unsigned int)
66 : {
67 43 : GraphicFilter aGraphicFilter(false);
68 43 : SvFileStream aFileStream(rURL, STREAM_READ);
69 43 : Graphic aGraphic;
70 43 : return aGraphicFilter.ImportGraphic(aGraphic, rURL, aFileStream) == 0;
71 : }
72 :
73 1 : void SvtoolsFiltersTest::testCVEs()
74 : {
75 : testDir(rtl::OUString(),
76 : getURLFromSrc("/svtools/qa/cppunit/data/wmf/"),
77 1 : rtl::OUString());
78 :
79 : testDir(rtl::OUString(),
80 : getURLFromSrc("/svtools/qa/cppunit/data/emf/"),
81 1 : rtl::OUString());
82 :
83 : testDir(rtl::OUString(),
84 : getURLFromSrc("/svtools/qa/cppunit/data/sgv/"),
85 1 : rtl::OUString());
86 :
87 : testDir(rtl::OUString(),
88 : getURLFromSrc("/svtools/qa/cppunit/data/png/"),
89 1 : rtl::OUString());
90 :
91 : testDir(rtl::OUString(),
92 : getURLFromSrc("/svtools/qa/cppunit/data/jpg/"),
93 1 : rtl::OUString());
94 :
95 : testDir(rtl::OUString(),
96 : getURLFromSrc("/svtools/qa/cppunit/data/gif/"),
97 1 : rtl::OUString());
98 :
99 : testDir(rtl::OUString(),
100 : getURLFromSrc("/svtools/qa/cppunit/data/bmp/"),
101 1 : rtl::OUString());
102 1 : }
103 :
104 1 : CPPUNIT_TEST_SUITE_REGISTRATION(SvtoolsFiltersTest);
105 :
106 4 : CPPUNIT_PLUGIN_IMPLEMENT();
107 :
108 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|