nss: upgrade to release 3.73
[LibreOffice.git] / sc / qa / extras / scfunctionlistobj.cxx
blob385ea7d8962a48c385eb345e7f12e3b463ad83f6
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/calc_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 CalcUnoApiTest,
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;
48 virtual void tearDown() override;
50 CPPUNIT_TEST_SUITE(ScFunctionListObj);
52 // XElementAccess
53 CPPUNIT_TEST(testGetElementType);
54 CPPUNIT_TEST(testHasElements);
56 // XEnumerationAccess
57 CPPUNIT_TEST(testCreateEnumeration);
59 // XFunctionDescriptions
60 CPPUNIT_TEST(testGetById);
62 // XIndexAccess
63 CPPUNIT_TEST(testGetByIndex);
64 CPPUNIT_TEST(testGetCount);
66 // XNameAccess
67 CPPUNIT_TEST(testGetByName);
68 CPPUNIT_TEST(testGetElementNames);
69 CPPUNIT_TEST(testHasByName);
71 // XServiceInfo
72 CPPUNIT_TEST(testGetImplementationName);
73 CPPUNIT_TEST(testGetSupportedServiceNames);
74 CPPUNIT_TEST(testSupportsService);
76 CPPUNIT_TEST_SUITE_END();
78 private:
79 uno::Reference<lang::XComponent> mxComponent;
82 ScFunctionListObj::ScFunctionListObj()
83 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
84 , XElementAccess(cppu::UnoType<uno::Sequence<beans::PropertyValue>>::get())
85 , XIndexAccess(395)
86 , XNameAccess("IF")
87 , XServiceInfo("stardiv.StarCalc.ScFunctionListObj", "com.sun.star.sheet.FunctionDescriptions")
91 uno::Reference<uno::XInterface> ScFunctionListObj::init()
93 uno::Reference<sheet::XSpreadsheetDocument> xDoc(mxComponent, UNO_QUERY_THROW);
94 uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, UNO_QUERY_THROW);
95 return xMSF->createInstance("com.sun.star.sheet.FunctionDescriptions");
98 void ScFunctionListObj::setUp()
100 CalcUnoApiTest::setUp();
101 // create a calc document
102 mxComponent = loadFromDesktop("private:factory/scalc");
105 void ScFunctionListObj::tearDown()
107 closeDocument(mxComponent);
108 CalcUnoApiTest::tearDown();
111 CPPUNIT_TEST_SUITE_REGISTRATION(ScFunctionListObj);
113 } // namespace sc_apitest
115 CPPUNIT_PLUGIN_IMPLEMENT();
117 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */