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_TableAutoFormatEnumeration
: public CalcUnoApiTest
,
27 public apitest::XEnumeration
30 ScIndexEnumeration_TableAutoFormatEnumeration();
32 virtual uno::Reference
<uno::XInterface
> init() override
;
33 virtual void setUp() override
;
34 virtual void tearDown() override
;
36 CPPUNIT_TEST_SUITE(ScIndexEnumeration_TableAutoFormatEnumeration
);
39 CPPUNIT_TEST(testHasMoreElements
);
40 CPPUNIT_TEST(testNextElement
);
42 CPPUNIT_TEST_SUITE_END();
45 uno::Reference
<lang::XComponent
> m_xComponent
;
48 ScIndexEnumeration_TableAutoFormatEnumeration::ScIndexEnumeration_TableAutoFormatEnumeration()
49 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
53 uno::Reference
<uno::XInterface
> ScIndexEnumeration_TableAutoFormatEnumeration::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
<lang::XMultiServiceFactory
> xMSF(xDoc
, uno::UNO_QUERY_THROW
);
59 uno::Reference
<container::XEnumerationAccess
> xEA(
60 xMSF
->createInstance("com.sun.star.sheet.TableAutoFormats"), uno::UNO_QUERY_THROW
);
62 return xEA
->createEnumeration();
65 void ScIndexEnumeration_TableAutoFormatEnumeration::setUp()
67 CalcUnoApiTest::setUp();
68 m_xComponent
= loadFromDesktop("private:factory/scalc");
69 CPPUNIT_ASSERT_MESSAGE("no component", m_xComponent
.is());
72 void ScIndexEnumeration_TableAutoFormatEnumeration::tearDown()
74 closeDocument(m_xComponent
);
75 CalcUnoApiTest::tearDown();
78 CPPUNIT_TEST_SUITE_REGISTRATION(ScIndexEnumeration_TableAutoFormatEnumeration
);
80 } // namespace sc_apitest
82 CPPUNIT_PLUGIN_IMPLEMENT();
84 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */