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/container/xenumeration.hxx>
13 #include <com/sun/star/container/XEnumerationAccess.hpp>
14 #include <com/sun/star/lang/XComponent.hpp>
15 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
16 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
17 #include <com/sun/star/uno/XInterface.hpp>
19 #include <com/sun/star/uno/Reference.hxx>
22 using namespace css::uno
;
26 class ScIndexEnumeration_FunctionDescriptionEnumeration
: public CalcUnoApiTest
,
27 public apitest::XEnumeration
30 ScIndexEnumeration_FunctionDescriptionEnumeration();
32 virtual uno::Reference
<uno::XInterface
> init() override
;
33 virtual void setUp() override
;
34 virtual void tearDown() override
;
36 CPPUNIT_TEST_SUITE(ScIndexEnumeration_FunctionDescriptionEnumeration
);
39 CPPUNIT_TEST(testHasMoreElements
);
40 CPPUNIT_TEST(testNextElement
);
42 CPPUNIT_TEST_SUITE_END();
45 uno::Reference
<lang::XComponent
> m_xComponent
;
48 ScIndexEnumeration_FunctionDescriptionEnumeration::
49 ScIndexEnumeration_FunctionDescriptionEnumeration()
50 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
54 uno::Reference
<uno::XInterface
> ScIndexEnumeration_FunctionDescriptionEnumeration::init()
56 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(m_xComponent
, uno::UNO_QUERY_THROW
);
57 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc
.is());
59 uno::Reference
<lang::XMultiServiceFactory
> xMSF(xDoc
, uno::UNO_QUERY_THROW
);
60 uno::Reference
<container::XEnumerationAccess
> xEA(
61 xMSF
->createInstance("com.sun.star.sheet.FunctionDescriptions"), uno::UNO_QUERY_THROW
);
63 return xEA
->createEnumeration();
66 void ScIndexEnumeration_FunctionDescriptionEnumeration::setUp()
68 CalcUnoApiTest::setUp();
69 m_xComponent
= loadFromDesktop("private:factory/scalc");
70 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent
.is());
73 void ScIndexEnumeration_FunctionDescriptionEnumeration::tearDown()
75 closeDocument(m_xComponent
);
76 CalcUnoApiTest::tearDown();
79 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_FunctionDescriptionEnumeration
);
81 } // namespace sc_apitest
83 CPPUNIT_PLUGIN_IMPLEMENT();
85 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */