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 : ::rtl::OUString m_aWorkdirRootURL;
61 : ::rtl::OUString m_aWorkdirRootPath;
62 :
63 : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext;
64 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory;
65 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory;
66 :
67 : public:
68 : BootstrapFixtureBase();
69 : virtual ~BootstrapFixtureBase();
70 :
71 : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
72 3 : getComponentContext() { return m_xContext; }
73 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>
74 67 : getMultiServiceFactory() { return m_xSFactory; }
75 :
76 42 : ::rtl::OUString getSrcRootURL() { return m_aSrcRootURL; }
77 32 : ::rtl::OUString getSrcRootPath() { return m_aSrcRootPath; }
78 :
79 : // return a URL to a given c-str path from the source directory
80 : ::rtl::OUString getURLFromSrc( const char *pPath );
81 :
82 : // return a Path to a given c-str path from the source directory
83 : ::rtl::OUString getPathFromSrc( const char *pPath );
84 :
85 :
86 : // return a URL to a given c-str path from the workdir directory
87 : ::rtl::OUString getURLFromWorkdir( const char *pPath );
88 :
89 : // return a Path to a given c-str path from the workdir directory
90 : ::rtl::OUString getPathFromWorkdir( const char *pPath );
91 : virtual void setUp();
92 : virtual void tearDown();
93 :
94 : };
95 :
96 : }
97 :
98 : #endif
99 :
100 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|