[Libreoffice-commits] core.git: package/CppunitTest_package2_test.mk package/Module_package.mk package/qa

Caolán McNamara caolanm at redhat.com
Mon Dec 2 04:26:47 PST 2013


 package/CppunitTest_package2_test.mk         |   44 ++++++++++++++++++
 package/Module_package.mk                    |    4 +
 package/qa/cppunit/data/fail/EDB-29934-1.zip |binary
 package/qa/cppunit/test_package.cxx          |   65 +++++++++++++++++++++++++++
 4 files changed, 113 insertions(+)

New commits:
commit 827b44d38aa5c226a25b78108c2a19cf1caf694d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Mon Dec 2 12:25:55 2013 +0000

    Related: EDB-29934-1 add .zip cppunit tests
    
    Change-Id: Iaafdcc4e2c97e06bee245251316b18b3d9e87262

diff --git a/package/CppunitTest_package2_test.mk b/package/CppunitTest_package2_test.mk
new file mode 100644
index 0000000..bf4839a
--- /dev/null
+++ b/package/CppunitTest_package2_test.mk
@@ -0,0 +1,44 @@
+# -*- 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,package2_test))
+
+$(eval $(call gb_CppunitTest_add_exception_objects,package2_test, \
+    package/qa/cppunit/test_package \
+))
+
+$(eval $(call gb_CppunitTest_use_libraries,package2_test, \
+    comphelper \
+    cppu \
+    cppuhelper \
+    sal \
+    tl \
+    unotest \
+    $(gb_UWINAPI) \
+))
+
+$(eval $(call gb_CppunitTest_use_api,package2_test,\
+    offapi \
+    udkapi \
+))
+
+$(eval $(call gb_CppunitTest_use_components,package2_test,\
+    configmgr/source/configmgr \
+    package/util/package2 \
+    ucb/source/core/ucb1 \
+    ucb/source/ucp/file/ucpfile1 \
+))
+
+$(eval $(call gb_CppunitTest_use_ure,package2_test))
+
+$(eval $(call gb_CppunitTest_use_configuration,package2_test))
+
+# vim: set noet sw=4 ts=4:
diff --git a/package/Module_package.mk b/package/Module_package.mk
index 07e1c16..10971e6 100644
--- a/package/Module_package.mk
+++ b/package/Module_package.mk
@@ -15,4 +15,8 @@ $(eval $(call gb_Module_add_targets,package,\
 	Package_dtd \
 ))
 
+$(eval $(call gb_Module_add_check_targets,package,\
+    CppunitTest_package2_test \
+))
+
 # vim: set noet sw=4 ts=4:
diff --git a/package/qa/cppunit/data/fail/.gitignore b/package/qa/cppunit/data/fail/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/package/qa/cppunit/data/fail/EDB-29934-1.zip b/package/qa/cppunit/data/fail/EDB-29934-1.zip
new file mode 100644
index 0000000..510e75e
Binary files /dev/null and b/package/qa/cppunit/data/fail/EDB-29934-1.zip differ
diff --git a/package/qa/cppunit/data/indeterminate/.gitignore b/package/qa/cppunit/data/indeterminate/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/package/qa/cppunit/data/pass/.gitignore b/package/qa/cppunit/data/pass/.gitignore
new file mode 100644
index 0000000..e69de29
diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx
new file mode 100644
index 0000000..e10fc50
--- /dev/null
+++ b/package/qa/cppunit/test_package.cxx
@@ -0,0 +1,65 @@
+/* -*- 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 <comphelper/processfactory.hxx>
+#include <unotest/filters-test.hxx>
+#include <unotest/bootstrapfixturebase.hxx>
+#include "com/sun/star/packages/zip/ZipFileAccess.hpp"
+
+using namespace ::com::sun::star;
+
+namespace
+{
+    class PackageTest
+        : public test::FiltersTest
+        , public test::BootstrapFixtureBase
+    {
+    public:
+        PackageTest() {}
+
+        virtual bool load(const OUString &,
+            const OUString &rURL, const OUString &,
+            unsigned int, unsigned int, unsigned int);
+
+        void test();
+
+        CPPUNIT_TEST_SUITE(PackageTest);
+        CPPUNIT_TEST(test);
+        CPPUNIT_TEST_SUITE_END();
+    };
+
+    bool PackageTest::load(const OUString &,
+        const OUString &rURL, const OUString &,
+        unsigned int, unsigned int, unsigned int)
+    {
+        try
+        {
+            uno::Reference<css::packages::zip::XZipFileAccess2> xZip(
+                css::packages::zip::ZipFileAccess::createWithURL(comphelper::getProcessComponentContext(), rURL));
+            return xZip.is();
+        }
+        catch(...)
+        {
+            return false;
+        }
+    }
+
+    void PackageTest::test()
+    {
+        testDir(OUString(),
+            getURLFromSrc("/package/qa/cppunit/data/"),
+            OUString());
+    }
+
+    CPPUNIT_TEST_SUITE_REGISTRATION(PackageTest);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list