LibreOffice Module test (master)  1
unoapi_test.cxx
Go to the documentation of this file.
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>
15 
16 using namespace css;
17 using namespace css::uno;
18 
19 UnoApiTest::UnoApiTest(const OUString& path)
20  : m_aBaseString(path)
21 {
22 }
23 
25 {
27 
28  mxDesktop
29  = css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory()));
30  CPPUNIT_ASSERT_MESSAGE("no desktop!", mxDesktop.is());
31 }
32 
33 void UnoApiTest::createFileURL(std::u16string_view aFileBase, OUString& rFilePath)
34 {
35  rFilePath = m_directories.getSrcRootURL() + m_aBaseString + "/" + aFileBase;
36 }
37 
38 void UnoApiTest::closeDocument(uno::Reference<lang::XComponent> const& xDocument)
39 {
40  uno::Reference<util::XCloseable> xCloseable(xDocument, UNO_QUERY_THROW);
41  xCloseable->close(false);
42 }
43 
44 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::frame::XDesktop2 > mxDesktop
OUString m_aBaseString
Definition: unoapi_test.hxx:37
UnoApiTest(const OUString &path)
Definition: unoapi_test.cxx:19
void closeDocument(css::uno::Reference< css::lang::XComponent > const &xDocument)
Definition: unoapi_test.cxx:38
const OUString & getSrcRootURL() const
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
virtual void setUp() override
Definition: unoapi_test.cxx:24
virtual void setUp() override
void createFileURL(std::u16string_view aFileBase, OUString &rFilePath)
Definition: unoapi_test.cxx:33
const css::uno::Reference< css::lang::XMultiServiceFactory > & getMultiServiceFactory() const