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_UNOTEST_BOOTSTRAPFIXTUREBASE_HXX
10 : #define INCLUDED_UNOTEST_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_aWorkdirRootURL;
40 : OUString m_aWorkdirRootPath;
41 :
42 : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext> m_xContext;
43 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> m_xSFactory;
44 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiComponentFactory> m_xFactory;
45 :
46 : public:
47 : BootstrapFixtureBase();
48 : virtual ~BootstrapFixtureBase();
49 :
50 : com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>
51 : getComponentContext() { return m_xContext; }
52 : com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>
53 0 : getMultiServiceFactory() { return m_xSFactory; }
54 :
55 0 : OUString getSrcRootURL() { return m_aSrcRootURL; }
56 0 : OUString getSrcRootPath() { return m_aSrcRootPath; }
57 :
58 : // return a URL to a given c-str path from the source directory
59 : OUString getURLFromSrc( const char *pPath );
60 : OUString getURLFromSrc( const OUString& rPath );
61 :
62 : // return a Path to a given c-str path from the source directory
63 : OUString getPathFromSrc( const char *pPath );
64 :
65 :
66 : // return a URL to a given c-str path from the workdir directory
67 : OUString getURLFromWorkdir( const char *pPath );
68 :
69 : // return a Path to a given c-str path from the workdir directory
70 : OUString getPathFromWorkdir( const char *pPath );
71 : virtual void setUp() SAL_OVERRIDE;
72 : virtual void tearDown() SAL_OVERRIDE;
73 :
74 : };
75 :
76 : }
77 :
78 : #endif
79 :
80 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|