Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : */
9 : #ifndef INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
10 : #define INCLUDED_UNOUNOTEST_BOOTSTRAPFIXTUREBASE_HXX
11 :
12 : #include <sal/config.h>
13 :
14 : #include <rtl/string.hxx>
15 : #include <com/sun/star/uno/XComponentContext.hpp>
16 : #include <com/sun/star/lang/XMultiServiceFactory.hpp>
17 : #include <com/sun/star/lang/XMultiComponentFactory.hpp>
18 :
19 : #include "cppunit/TestAssert.h"
20 : #include "cppunit/TestFixture.h"
21 : #include "cppunit/extensions/HelperMacros.h"
22 : #include "cppunit/plugin/TestPlugIn.h"
23 : #include "unotest/detail/unotestdllapi.hxx"
24 :
25 : namespace test {
26 :
27 : // Class to do lots of heavy-lifting UNO & environment
28 : // bootstrapping for unit tests, such that we can use
29 : // almost an entire LibreOffice during compile - so
30 : // that we can get pieces of code alone to beat them up.
31 :
32 : // NB. this class is instantiated multiple times during a
33 : // run of unit tests ...
34 : class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture
35 : {
36 : protected:
37 : OUString m_aSrcRootURL;
38 : OUString m_aSrcRootPath;
39 : OUString m_aSolverRootURL;
40 : OUString m_aSolverRootPath;
41 : OUString m_aWorkdirRootURL;
42 : OUString m_aWorkdirRootPath;
43 :
44 : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext;
45 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory;
46 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory;
47 :
48 : public:
49 : BootstrapFixtureBase();
50 : virtual ~BootstrapFixtureBase();
51 :
52 : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
53 3 : getComponentContext() { return m_xContext; }
54 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>
55 295 : getMultiServiceFactory() { return m_xSFactory; }
56 :
57 184 : OUString getSrcRootURL() { return m_aSrcRootURL; }
58 33 : OUString getSrcRootPath() { return m_aSrcRootPath; }
59 :
60 : // return a URL to a given c-str path from the source directory
61 : OUString getURLFromSrc( const char *pPath );
62 :
63 : // return a Path to a given c-str path from the source directory
64 : OUString getPathFromSrc( const char *pPath );
65 :
66 :
67 : // return a URL to a given c-str path from the workdir directory
68 : OUString getURLFromWorkdir( const char *pPath );
69 :
70 : // return a Path to a given c-str path from the workdir directory
71 : OUString getPathFromWorkdir( const char *pPath );
72 : virtual void setUp();
73 : virtual void tearDown();
74 :
75 : };
76 :
77 : }
78 :
79 : #endif
80 :
81 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|