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 :
10 : #include "test/unoapi_test.hxx"
11 :
12 : #include <com/sun/star/util/XCloseable.hpp>
13 : #include <com/sun/star/frame/Desktop.hpp>
14 : #include <comphelper/processfactory.hxx>
15 :
16 : using namespace css;
17 : using namespace css::uno;
18 :
19 102 : UnoApiTest::UnoApiTest(const OUString& path)
20 102 : : m_aBaseString(path)
21 : {
22 102 : }
23 :
24 102 : void UnoApiTest::setUp()
25 : {
26 102 : test::BootstrapFixture::setUp();
27 :
28 : // This is a bit of a fudge, we do this to ensure that ScGlobals::ensure,
29 : // which is a private symbol to us, gets called
30 204 : m_xCalcComponent =
31 306 : getMultiServiceFactory()->createInstance("com.sun.star.comp.Calc.SpreadsheetDocument");
32 102 : CPPUNIT_ASSERT_MESSAGE("no calc component!", m_xCalcComponent.is());
33 102 : mxDesktop = com::sun::star::frame::Desktop::create( comphelper::getComponentContext(getMultiServiceFactory()) );
34 102 : }
35 :
36 102 : void UnoApiTest::tearDown()
37 : {
38 102 : uno::Reference< lang::XComponent >( m_xCalcComponent, UNO_QUERY_THROW )->dispose();
39 102 : test::BootstrapFixture::tearDown();
40 102 : }
41 :
42 116 : void UnoApiTest::createFileURL(const OUString& aFileBase, OUString& rFilePath)
43 : {
44 116 : rFilePath = getSrcRootURL() + m_aBaseString + "/" + aFileBase;
45 116 : }
46 :
47 13 : void UnoApiTest::closeDocument( uno::Reference< lang::XComponent > xDocument )
48 : {
49 13 : uno::Reference< util::XCloseable > xCloseable(xDocument, UNO_QUERY_THROW);
50 13 : xCloseable->close(false);
51 58 : }
52 :
53 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|