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/sheet/XSpreadsheetDocument.hpp>
16 #include <com/sun/star/sheet/XSpreadsheets.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_SpreadsheetsEnumeration
: public CalcUnoApiTest
,
27 public apitest::XEnumeration
30 ScIndexEnumeration_SpreadsheetsEnumeration();
32 virtual uno::Reference
<uno::XInterface
> init() override
;
33 virtual void setUp() override
;
34 virtual void tearDown() override
;
36 CPPUNIT_TEST_SUITE(ScIndexEnumeration_SpreadsheetsEnumeration
);
39 CPPUNIT_TEST(testHasMoreElements
);
40 CPPUNIT_TEST(testNextElement
);
42 CPPUNIT_TEST_SUITE_END();
45 uno::Reference
<lang::XComponent
> m_xComponent
;
48 ScIndexEnumeration_SpreadsheetsEnumeration::ScIndexEnumeration_SpreadsheetsEnumeration()
49 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
53 uno::Reference
<uno::XInterface
> ScIndexEnumeration_SpreadsheetsEnumeration::init()
55 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(m_xComponent
, uno::UNO_QUERY_THROW
);
56 CPPUNIT_ASSERT_MESSAGE("no calc document", xDoc
.is());
58 uno::Reference
<sheet::XSpreadsheets
> xSheets(xDoc
->getSheets(), uno::UNO_SET_THROW
);
59 uno::Reference
<container::XEnumerationAccess
> xEA(xSheets
, uno::UNO_QUERY_THROW
);
61 return xEA
->createEnumeration();
64 void ScIndexEnumeration_SpreadsheetsEnumeration::setUp()
66 CalcUnoApiTest::setUp();
67 m_xComponent
= loadFromDesktop("private:factory/scalc");
68 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent
.is());
71 void ScIndexEnumeration_SpreadsheetsEnumeration::tearDown()
73 closeDocument(m_xComponent
);
74 CalcUnoApiTest::tearDown();
77 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_SpreadsheetsEnumeration
);
79 } // namespace sc_apitest
81 CPPUNIT_PLUGIN_IMPLEMENT();
83 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */