Branch data 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 or as specified alternatively below. You may obtain a copy of
8 : : * the License at 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 : : * Major Contributor(s):
16 : : * Copyright (C) 2011 Michael Meeks <michael.meeks@suse.com>
17 : : *
18 : : * All Rights Reserved.
19 : : *
20 : : * For minor contributions see the git repository.
21 : : *
22 : : * Alternatively, the contents of this file may be used under the terms of
23 : : * either the GNU General Public License Version 3 or later (the "GPLv3+"), or
24 : : * the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
25 : : * in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
26 : : * instead of those above.
27 : : */
28 : : #ifndef INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
29 : : #define INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
30 : :
31 : : #include <sal/config.h>
32 : :
33 : : #include <rtl/string.hxx>
34 : : #include <com/sun/star/uno/XComponentContext.hpp>
35 : : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
36 : : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
37 : :
38 : : #include "cppunit/TestAssert.h"
39 : : #include "cppunit/TestFixture.h"
40 : : #include "cppunit/extensions/HelperMacros.h"
41 : : #include "cppunit/plugin/TestPlugIn.h"
42 : : #include "unotest/detail/unotestdllapi.hxx"
43 : :
44 : : namespace test {
45 : :
46 : : // Class to do lots of heavy-lifting UNO & environment
47 : : // bootstrapping for unit tests, such that we can use
48 : : // almost an entire LibreOffice during compile - so
49 : : // that we can get pieces of code alone to beat them up.
50 : :
51 : : // NB. this class is instantiated multiple times during a
52 : : // run of unit tests ...
53 : : class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture
54 : : {
55 : : protected:
56 : : ::rtl::OUString m_aSrcRootURL;
57 : : ::rtl::OUString m_aSrcRootPath;
58 : : ::rtl::OUString m_aSolverRootURL;
59 : : ::rtl::OUString m_aSolverRootPath;
60 : :
61 : : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext;
62 : : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory;
63 : : com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory;
64 : :
65 : : public:
66 : : BootstrapFixtureBase();
67 : : virtual ~BootstrapFixtureBase();
68 : :
69 : : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
70 : 9 : getComponentContext() { return m_xContext; }
71 : : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>
72 : 879 : getMultiServiceFactory() { return m_xSFactory; }
73 : :
74 : 271 : ::rtl::OUString getSrcRootURL() { return m_aSrcRootURL; }
75 : 87 : ::rtl::OUString getSrcRootPath() { return m_aSrcRootPath; }
76 : :
77 : : // return a URL to a given c-str path from the source directory
78 : : ::rtl::OUString getURLFromSrc( const char *pPath );
79 : :
80 : : // return a Path to a given c-str path from the source directory
81 : : ::rtl::OUString getPathFromSrc( const char *pPath );
82 : :
83 : : // return a URL to a given c-str path from the solver directory
84 : : ::rtl::OUString getURLFromSolver( const char *pPath );
85 : :
86 : : // return a Path to a given c-str path from the solver directory
87 : : ::rtl::OUString getPathFromSolver( const char *pPath );
88 : :
89 : : virtual void setUp();
90 : : virtual void tearDown();
91 : :
92 : : };
93 : :
94 : : }
95 : :
96 : : #endif
97 : :
98 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|