[Libreoffice-commits] core.git: filter/CppunitTest_filter_psd_test.mk filter/Module_filter.mk filter/qa

Caolán McNamara caolanm at redhat.com
Thu Apr 17 08:20:21 PDT 2014


 filter/CppunitTest_filter_psd_test.mk               |   41 +++++++++++
 filter/Module_filter.mk                             |    1 
 filter/qa/cppunit/data/psd/fail/CVE-2007-3741-1.psd |binary
 filter/qa/cppunit/data/psd/indeterminate/.gitignore |    1 
 filter/qa/cppunit/data/psd/pass/rhbz899670-1.psd    |binary
 filter/qa/cppunit/filters-pcx-test.cxx              |   12 +--
 filter/qa/cppunit/filters-psd-test.cxx              |   71 ++++++++++++++++++++
 7 files changed, 120 insertions(+), 6 deletions(-)

New commits:
commit 3e28dff92cc25e7058e18545998088cad3ba6ccf
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Apr 17 16:18:49 2014 +0100

    add regression tests for psd filter
    
    Change-Id: Ia9b34bc3b77902f8edbc0e7040da5edd02e02879

diff --git a/filter/CppunitTest_filter_psd_test.mk b/filter/CppunitTest_filter_psd_test.mk
new file mode 100644
index 0000000..850cc32
--- /dev/null
+++ b/filter/CppunitTest_filter_psd_test.mk
@@ -0,0 +1,41 @@
+# -*- 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_psd_test))
+
+$(eval $(call gb_CppunitTest_use_external,filter_psd_test,boost_headers))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,filter_psd_test, \
+    filter/qa/cppunit/filters-psd-test \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,filter_psd_test, \
+    ipd \
+	sal \
+	test \
+	tl \
+	unotest \
+	vcl \
+	$(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,filter_psd_test,\
+    udkapi \
+    offapi \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,filter_psd_test))
+
+$(eval $(call gb_CppunitTest_use_components,filter_psd_test,\
+    configmgr/source/configmgr \
+))
+
+$(eval $(call gb_CppunitTest_use_configuration,filter_psd_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/filter/Module_filter.mk b/filter/Module_filter.mk
index d37d91b..eeab593 100644
--- a/filter/Module_filter.mk
+++ b/filter/Module_filter.mk
@@ -85,6 +85,7 @@ ifneq ($(DISABLE_CVE_TESTS),TRUE)
 $(eval $(call gb_Module_add_check_targets,filter,\
     CppunitTest_filter_pcx_test \
     CppunitTest_filter_pict_test \
+    CppunitTest_filter_psd_test \
     CppunitTest_filter_ras_test \
     CppunitTest_filter_tiff_test \
     CppunitTest_filter_tga_test \
diff --git a/filter/qa/cppunit/data/psd/fail/.gitignore b/filter/qa/cppunit/data/psd/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/filter/qa/cppunit/data/psd/fail/CVE-2007-3741-1.psd b/filter/qa/cppunit/data/psd/fail/CVE-2007-3741-1.psd
new file mode 100644
index 0000000..59b6900
Binary files /dev/null and b/filter/qa/cppunit/data/psd/fail/CVE-2007-3741-1.psd differ
diff --git a/filter/qa/cppunit/data/psd/indeterminate/.gitignore b/filter/qa/cppunit/data/psd/indeterminate/.gitignore
new file mode 100644
index 0000000..583b009c
--- /dev/null
+++ b/filter/qa/cppunit/data/psd/indeterminate/.gitignore
@@ -0,0 +1 @@
+*.wmf-*
diff --git a/filter/qa/cppunit/data/psd/pass/.gitignore b/filter/qa/cppunit/data/psd/pass/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/filter/qa/cppunit/data/psd/pass/rhbz899670-1.psd b/filter/qa/cppunit/data/psd/pass/rhbz899670-1.psd
new file mode 100644
index 0000000..ce8de84
Binary files /dev/null and b/filter/qa/cppunit/data/psd/pass/rhbz899670-1.psd differ
diff --git a/filter/qa/cppunit/filters-pcx-test.cxx b/filter/qa/cppunit/filters-pcx-test.cxx
index 678b267..013d96d 100644
--- a/filter/qa/cppunit/filters-pcx-test.cxx
+++ b/filter/qa/cppunit/filters-pcx-test.cxx
@@ -27,12 +27,12 @@ using namespace ::com::sun::star;
 
 /* Implementation of Filters test */
 
-class RasFilterTest
+class PcxFilterTest
     : public test::FiltersTest
     , public test::BootstrapFixture
 {
 public:
-    RasFilterTest() : BootstrapFixture(true, false) {}
+    PcxFilterTest() : BootstrapFixture(true, false) {}
 
     virtual bool load(const OUString &,
         const OUString &rURL, const OUString &,
@@ -43,12 +43,12 @@ public:
      */
     void testCVEs();
 
-    CPPUNIT_TEST_SUITE(RasFilterTest);
+    CPPUNIT_TEST_SUITE(PcxFilterTest);
     CPPUNIT_TEST(testCVEs);
     CPPUNIT_TEST_SUITE_END();
 };
 
-bool RasFilterTest::load(const OUString &,
+bool PcxFilterTest::load(const OUString &,
     const OUString &rURL, const OUString &,
     unsigned int, unsigned int, unsigned int)
 {
@@ -57,14 +57,14 @@ bool RasFilterTest::load(const OUString &,
     return GraphicImport(aFileStream, aGraphic, NULL);
 }
 
-void RasFilterTest::testCVEs()
+void PcxFilterTest::testCVEs()
 {
     testDir(OUString(),
         getURLFromSrc("/filter/qa/cppunit/data/pcx/"),
         OUString());
 }
 
-CPPUNIT_TEST_SUITE_REGISTRATION(RasFilterTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(PcxFilterTest);
 
 CPPUNIT_PLUGIN_IMPLEMENT();
 
diff --git a/filter/qa/cppunit/filters-psd-test.cxx b/filter/qa/cppunit/filters-psd-test.cxx
new file mode 100644
index 0000000..95ab882
--- /dev/null
+++ b/filter/qa/cppunit/filters-psd-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 PsdFilterTest
+    : public test::FiltersTest
+    , public test::BootstrapFixture
+{
+public:
+    PsdFilterTest() : 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(PsdFilterTest);
+    CPPUNIT_TEST(testCVEs);
+    CPPUNIT_TEST_SUITE_END();
+};
+
+bool PsdFilterTest::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 PsdFilterTest::testCVEs()
+{
+    testDir(OUString(),
+        getURLFromSrc("/filter/qa/cppunit/data/psd/"),
+        OUString());
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(PsdFilterTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list