Version 7.5.1.1, tag libreoffice-7.5.1.1
[LibreOffice.git] / sc / qa / extras / scfunctionlistobj.cxx
blob940aba8c39839e5a965359e9ff6095e25709c4f7
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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 */
10 #include <test/unoapi_test.hxx>
11 #include <test/container/xelementaccess.hxx>
12 #include <test/container/xenumerationaccess.hxx>
13 #include <test/container/xindexaccess.hxx>
14 #include <test/container/xnameaccess.hxx>
15 #include <test/lang/xserviceinfo.hxx>
16 #include <test/sheet/xfunctiondescriptions.hxx>
18 #include <com/sun/star/beans/PropertyValue.hpp>
19 #include <com/sun/star/lang/XComponent.hpp>
20 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
21 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
22 #include <com/sun/star/uno/XInterface.hpp>
24 #include <com/sun/star/uno/Reference.hxx>
25 #include <com/sun/star/uno/Sequence.hxx>
27 #include <cppu/unotype.hxx>
29 using namespace css;
30 using namespace css::uno;
31 using namespace com::sun::star;
33 namespace sc_apitest
35 class ScFunctionListObj : public UnoApiTest,
36 public apitest::XElementAccess,
37 public apitest::XEnumerationAccess,
38 public apitest::XFunctionDescriptions,
39 public apitest::XIndexAccess,
40 public apitest::XNameAccess,
41 public apitest::XServiceInfo
43 public:
44 ScFunctionListObj();
46 virtual uno::Reference<uno::XInterface> init() override;
47 virtual void setUp() override;
49 CPPUNIT_TEST_SUITE(ScFunctionListObj);
51 // XElementAccess
52 CPPUNIT_TEST(testGetElementType);
53 CPPUNIT_TEST(testHasElements);
55 // XEnumerationAccess
56 CPPUNIT_TEST(testCreateEnumeration);
58 // XFunctionDescriptions
59 CPPUNIT_TEST(testGetById);
61 // XIndexAccess
62 CPPUNIT_TEST(testGetByIndex);
63 CPPUNIT_TEST(testGetCount);
65 // XNameAccess
66 CPPUNIT_TEST(testGetByName);
67 CPPUNIT_TEST(testGetElementNames);
68 CPPUNIT_TEST(testHasByName);
70 // XServiceInfo
71 CPPUNIT_TEST(testGetImplementationName);
72 CPPUNIT_TEST(testGetSupportedServiceNames);
73 CPPUNIT_TEST(testSupportsService);
75 CPPUNIT_TEST_SUITE_END();
78 ScFunctionListObj::ScFunctionListObj()
79 : UnoApiTest("/sc/qa/extras/testdocuments")
80 , XElementAccess(cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get())
81 , XIndexAccess(395)
82 , XNameAccess("IF")
83 , XServiceInfo("stardiv.StarCalc.ScFunctionListObj", "com.sun.star.sheet.FunctionDescriptions")
87 uno::Reference<uno::XInterface> ScFunctionListObj::init()
89 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
90 uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, UNO_QUERY_THROW);
91 return xMSF->createInstance("com.sun.star.sheet.FunctionDescriptions");
94 void ScFunctionListObj::setUp()
96 UnoApiTest::setUp();
97 // create a calc document
98 mxComponent = loadFromDesktop("private:factory/scalc");
101 CPPUNIT_TEST_SUITE_REGISTRATION(ScFunctionListObj);
103 } // namespace sc_apitest
105 CPPUNIT_PLUGIN_IMPLEMENT();
107 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */