fix build
[LibreOffice.git] / include / unotest / bootstrapfixturebase.hxx
blob1a25e25d4ca04fe860b94dbc0db34446f05e2443
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
9 #ifndef INCLUDED_UNOTEST_BOOTSTRAPFIXTUREBASE_HXX
10 #define INCLUDED_UNOTEST_BOOTSTRAPFIXTUREBASE_HXX
12 #include <sal/config.h>
14 #include <com/sun/star/uno/XComponentContext.hpp>
15 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
16 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
18 #include <cppunit/TestAssert.h>
19 #include <cppunit/TestFixture.h>
20 #include <cppunit/extensions/HelperMacros.h>
21 #include <cppunit/plugin/TestPlugIn.h>
22 #include <unotest/detail/unotestdllapi.hxx>
23 #include <unotest/directories.hxx>
25 // For cppunit < 1.15.0.
26 #ifndef CPPUNIT_TEST_FIXTURE
27 #define CPPUNIT_TEST_FIXTURE(TestClass, TestName) \
28 class TestName : public TestClass \
29 { \
30 public: \
31 void TestBody(); \
32 CPPUNIT_TEST_SUITE(TestName); \
33 CPPUNIT_TEST(TestBody); \
34 CPPUNIT_TEST_SUITE_END(); \
35 }; \
36 CPPUNIT_TEST_SUITE_REGISTRATION(TestName); \
37 void TestName::TestBody()
38 #endif
40 namespace test {
42 // Class to do lots of heavy-lifting UNO & environment
43 // bootstrapping for unit tests, such that we can use
44 // almost an entire LibreOffice during compile - so
45 // that we can get pieces of code alone to beat them up.
47 // NB. this class is instantiated multiple times during a
48 // run of unit tests ...
49 class OOO_DLLPUBLIC_UNOTEST BootstrapFixtureBase : public CppUnit::TestFixture
51 protected:
52 Directories m_directories;
53 css::uno::Reference<css::uno::XComponentContext> m_xContext;
54 css::uno::Reference<css::lang::XMultiServiceFactory> m_xSFactory;
55 css::uno::Reference<css::lang::XMultiComponentFactory> m_xFactory;
57 public:
58 BootstrapFixtureBase();
59 virtual ~BootstrapFixtureBase() override;
61 const css::uno::Reference<css::uno::XComponentContext>&
62 getComponentContext() const { return m_xContext; }
63 const css::uno::Reference<css::lang::XMultiServiceFactory>&
64 getMultiServiceFactory() const { return m_xSFactory; }
66 virtual void setUp() override;
67 virtual void tearDown() override;
72 #endif
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */