diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-11-06 14:19:28 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-11-06 14:48:03 +0000 |
commit | 31bfb20c81b0d293a5531c381885791540f477b0 (patch) | |
tree | 848f394204c206c2825658f3d985e263644fbbe2 /filter/qa | |
parent | coverity#1000834 Use of untrusted string value (diff) | |
download | core-31bfb20c81b0d293a5531c381885791540f477b0.tar.gz core-31bfb20c81b0d293a5531c381885791540f477b0.zip |
add a build-time regression test for pcd file format
Change-Id: Ie413372ab1cfc7e38570fdf65c6daca8c2cc426b
Diffstat (limited to 'filter/qa')
-rw-r--r-- | filter/qa/cppunit/data/pcd/fail/.gitignore | 0 | ||||
-rw-r--r-- | filter/qa/cppunit/data/pcd/indeterminate/.gitignore | 1 | ||||
-rw-r--r-- | filter/qa/cppunit/data/pcd/pass/.gitignore | 0 | ||||
-rw-r--r-- | filter/qa/cppunit/data/pcd/pass/blank-square.pcd | bin | 0 -> 788480 bytes | |||
-rw-r--r-- | filter/qa/cppunit/data/psd/pass/blank-square.psd | bin | 0 -> 23846 bytes | |||
-rw-r--r-- | filter/qa/cppunit/filters-pcd-test.cxx | 71 |
6 files changed, 72 insertions, 0 deletions
diff --git a/filter/qa/cppunit/data/pcd/fail/.gitignore b/filter/qa/cppunit/data/pcd/fail/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/filter/qa/cppunit/data/pcd/fail/.gitignore diff --git a/filter/qa/cppunit/data/pcd/indeterminate/.gitignore b/filter/qa/cppunit/data/pcd/indeterminate/.gitignore new file mode 100644 index 000000000000..583b009c7c60 --- /dev/null +++ b/filter/qa/cppunit/data/pcd/indeterminate/.gitignore @@ -0,0 +1 @@ +*.wmf-* diff --git a/filter/qa/cppunit/data/pcd/pass/.gitignore b/filter/qa/cppunit/data/pcd/pass/.gitignore new file mode 100644 index 000000000000..e69de29bb2d1 --- /dev/null +++ b/filter/qa/cppunit/data/pcd/pass/.gitignore diff --git a/filter/qa/cppunit/data/pcd/pass/blank-square.pcd b/filter/qa/cppunit/data/pcd/pass/blank-square.pcd Binary files differnew file mode 100644 index 000000000000..a626b5f2309b --- /dev/null +++ b/filter/qa/cppunit/data/pcd/pass/blank-square.pcd diff --git a/filter/qa/cppunit/data/psd/pass/blank-square.psd b/filter/qa/cppunit/data/psd/pass/blank-square.psd Binary files differnew file mode 100644 index 000000000000..fc811da006e7 --- /dev/null +++ b/filter/qa/cppunit/data/psd/pass/blank-square.psd diff --git a/filter/qa/cppunit/filters-pcd-test.cxx b/filter/qa/cppunit/filters-pcd-test.cxx new file mode 100644 index 000000000000..681dc7de641c --- /dev/null +++ b/filter/qa/cppunit/filters-pcd-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 PcdFilterTest + : public test::FiltersTest + , public test::BootstrapFixture +{ +public: + PcdFilterTest() : 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(PcdFilterTest); + CPPUNIT_TEST(testCVEs); + CPPUNIT_TEST_SUITE_END(); +}; + +bool PcdFilterTest::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 PcdFilterTest::testCVEs() +{ + testDir(OUString(), + getURLFromSrc("/filter/qa/cppunit/data/pcd/"), + OUString()); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(PcdFilterTest); + +CPPUNIT_PLUGIN_IMPLEMENT(); + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |