1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 #ifndef INCLUDED_UNOTEST_BOOTSTRAPFIXTUREBASE_HXX
10 #define INCLUDED_UNOTEST_BOOTSTRAPFIXTUREBASE_HXX
12 #include <sal/config.h>
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>
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>
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.
32 // NB. this class is instantiated multiple times during a
33 // run of unit tests ...
34 class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase
: public CppUnit::TestFixture
37 OUString m_aSrcRootURL
;
38 OUString m_aSrcRootPath
;
39 OUString m_aWorkdirRootURL
;
40 OUString m_aWorkdirRootPath
;
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
;
47 BootstrapFixtureBase();
48 virtual ~BootstrapFixtureBase();
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 getMultiServiceFactory() { return m_xSFactory
; }
55 OUString
getSrcRootURL() { return m_aSrcRootURL
; }
56 OUString
getSrcRootPath() { return m_aSrcRootPath
; }
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
);
62 // return a Path to a given c-str path from the source directory
63 OUString
getPathFromSrc( const char *pPath
);
66 // return a URL to a given c-str path from the workdir directory
67 OUString
getURLFromWorkdir( const char *pPath
);
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
;
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */