summaryrefslogtreecommitdiff
path: root/unotest/inc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-10-12 15:19:21 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-10-15 12:18:44 +0100
commitdb5a5ffa82f835c81cf9a411d24f4cb0b1bb8fa5 (patch)
tree0e320d48ea2ce24a87f33095d2959919333c0b5c /unotest/inc
parent528a225ddb1d429eeb048626d5e9e045118bad2e (diff)
split bootstrapfixture and move test-filters class for sot test
sot is below vcl, but is a filters test, we can split bootstrapfixture into a vcl needing bit and and non-vcl bit and filters test api can be standalone and combined with whichever bit in order to form pre and post vcl filters test
Diffstat (limited to 'unotest/inc')
-rw-r--r--unotest/inc/unotest/bootstrapfixturebase.hxx88
-rw-r--r--unotest/inc/unotest/filters-test.hxx75
2 files changed, 163 insertions, 0 deletions
diff --git a/unotest/inc/unotest/bootstrapfixturebase.hxx b/unotest/inc/unotest/bootstrapfixturebase.hxx
new file mode 100644
index 000000000000..6edd3f5b5643
--- /dev/null
+++ b/unotest/inc/unotest/bootstrapfixturebase.hxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License or as specified alternatively below. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * Major Contributor(s):
+ * Copyright (C) 2011 Michael Meeks <michael.meeks@suse.com>
+ *
+ * All Rights Reserved.
+ *
+ * For minor contributions see the git repository.
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+#ifndef INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
+#define INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
+
+#include <sal/config.h>
+
+#include <rtl/string.hxx>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/lang/XMultiComponentFactory.hpp>
+
+#include "sal/precppunit.hxx"
+#include "cppunit/TestAssert.h"
+#include "cppunit/TestFixture.h"
+#include "cppunit/extensions/HelperMacros.h"
+#include "cppunit/plugin/TestPlugIn.h"
+#include "unotest/detail/unotestdllapi.hxx"
+
+namespace test {
+
+// Class to do lots of heavy-lifting UNO & environment
+// bootstrapping for unit tests, such that we can use
+// almost an entire LibreOffice during compile - so
+// that we can get pieces of code alone to beat them up.
+
+// NB. this class is instantiated multiple times during a
+// run of unit tests ...
+class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture
+{
+protected:
+ ::rtl::OUString m_aSrcRootURL;
+ ::rtl::OUString m_aSrcRootPath;
+
+ com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext;
+ com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory;
+ com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory;
+
+public:
+ BootstrapFixtureBase();
+ virtual ~BootstrapFixtureBase();
+
+ com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
+ getComponentContext() { return m_xContext; }
+ com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>
+ getMultiServiceFactory() { return m_xSFactory; }
+
+ ::rtl::OUString getSrcRootURL() { return m_aSrcRootURL; }
+ ::rtl::OUString getSrcRootPath() { return m_aSrcRootPath; }
+
+ // return a URL to a given c-str path from the source directory
+ ::rtl::OUString getURLFromSrc( const char *pPath );
+
+ virtual void setUp();
+ virtual void tearDown();
+
+};
+
+}
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/unotest/inc/unotest/filters-test.hxx b/unotest/inc/unotest/filters-test.hxx
new file mode 100644
index 000000000000..974c1fa34ecc
--- /dev/null
+++ b/unotest/inc/unotest/filters-test.hxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * Version: MPL 1.1 / GPLv3+ / LGPLv3+
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Initial Developer of the Original Code is
+ * Caolán McNamara <caolanm@redhat.com>
+ * Portions created by the Initial Developer are Copyright (C) 2011 the
+ * Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ * Caolán McNamara <caolanm@redhat.com>
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+ * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+ * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+ * instead of those above.
+ */
+
+#include <rtl/ustring.hxx>
+#include "unotest/detail/unotestdllapi.hxx"
+
+namespace test {
+
+enum filterStatus
+{
+ fail = 0,
+ pass = 1,
+ indeterminate = 2
+};
+
+/*
+ * NOTE, any files beginning with CVE- will be assumed to be encrypted using
+ * arcfour with key 0x435645, this is to silence panicky virus/malware-checkers
+ *
+ * e.g. m[de]crypt --bare -a arcfour -o hex -k 435645 -s 3
+ */
+/* Implementation of Filters test */
+class OOO_DLLPUBLIC_UNOTEST FiltersTest
+{
+public:
+ void testDir(
+ //filter name
+ const rtl::OUString &rFilter,
+ //root dir of test files, must contain pass, fail, indeterminate
+ const rtl::OUString &rURL,
+ //additional filter data for SfxFilter
+ const rtl::OUString &rUserData);
+
+ virtual bool load(
+ const rtl::OUString &rFilter,
+ const rtl::OUString &rURL,
+ const rtl::OUString &rUserData) = 0;
+
+protected:
+ void recursiveScan(
+ const rtl::OUString &rFilter,
+ const rtl::OUString &rURL,
+ const rtl::OUString &rUserData,
+ filterStatus nExpected);
+};
+
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */