1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/.
10 #include <test/calc_unoapi_test.hxx>
11 #include <test/sheet/functiondescription.hxx>
13 #include <com/sun/star/beans/PropertyValue.hpp>
14 #include <com/sun/star/container/XNameAccess.hpp>
15 #include <com/sun/star/lang/XComponent.hpp>
16 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
17 #include <com/sun/star/sheet/XFunctionDescriptions.hpp>
18 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
20 #include <com/sun/star/uno/Sequence.hxx>
21 #include <com/sun/star/uno/Reference.hxx>
24 using namespace css::uno
;
25 using namespace com::sun::star
;
29 class ScFunctionDescriptionObj
: public CalcUnoApiTest
, public apitest::FunctionDescription
32 ScFunctionDescriptionObj();
34 virtual uno::Sequence
<beans::PropertyValue
> init() override
;
36 virtual void setUp() override
;
37 virtual void tearDown() override
;
39 CPPUNIT_TEST_SUITE(ScFunctionDescriptionObj
);
41 // FunctionDescription
42 CPPUNIT_TEST(testFunctionDescriptionProperties
);
44 CPPUNIT_TEST_SUITE_END();
47 uno::Reference
<lang::XComponent
> mxComponent
;
50 ScFunctionDescriptionObj::ScFunctionDescriptionObj()
51 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
55 uno::Sequence
<beans::PropertyValue
> ScFunctionDescriptionObj::init()
57 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, UNO_QUERY_THROW
);
59 uno::Reference
<lang::XMultiServiceFactory
> xMSF(xDoc
, UNO_QUERY_THROW
);
60 uno::Reference
<sheet::XFunctionDescriptions
> xFDs(
61 xMSF
->createInstance("com.sun.star.sheet.FunctionDescriptions"), UNO_QUERY_THROW
);
63 uno::Reference
<container::XNameAccess
> xNA(xFDs
, UNO_QUERY_THROW
);
64 uno::Sequence
<OUString
> names
= xNA
->getElementNames();
66 uno::Sequence
<beans::PropertyValue
> sPropertyValues
;
67 CPPUNIT_ASSERT(xNA
->getByName(names
[0]) >>= sPropertyValues
);
68 return sPropertyValues
;
71 void ScFunctionDescriptionObj::setUp()
73 CalcUnoApiTest::setUp();
74 // create a calc document
75 mxComponent
= loadFromDesktop("private:factory/scalc");
78 void ScFunctionDescriptionObj::tearDown()
80 closeDocument(mxComponent
);
81 CalcUnoApiTest::tearDown();
84 CPPUNIT_TEST_SUITE_REGISTRATION(ScFunctionDescriptionObj
);
88 CPPUNIT_PLUGIN_IMPLEMENT();
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */